state.c revision f48216ad0f75dc2eecc34ab6978986f564c90334
1f48216ad0f75dc2eecc34ab6978986f564c90334Brian Paul/* $Id: state.c,v 1.97 2002/11/06 15:16:23 brianp Exp $ */
2d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul
3d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul/*
4d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul * Mesa 3-D graphics library
5f48216ad0f75dc2eecc34ab6978986f564c90334Brian Paul * Version:  5.0
6d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul *
7f7c830e35ca243c391bde1bfd0ae059c292ac649Brian Paul * Copyright (C) 1999-2002  Brian Paul   All Rights Reserved.
8d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul *
9d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul * Permission is hereby granted, free of charge, to any person obtaining a
10d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul * copy of this software and associated documentation files (the "Software"),
11d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul * to deal in the Software without restriction, including without limitation
12d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul * the rights to use, copy, modify, merge, publish, distribute, sublicense,
13d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul * and/or sell copies of the Software, and to permit persons to whom the
14d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul * Software is furnished to do so, subject to the following conditions:
15d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul *
16d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul * The above copyright notice and this permission notice shall be included
17d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul * in all copies or substantial portions of the Software.
18d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul *
19d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
20d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
22d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
23d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
24d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul */
26d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul
27d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul
28a02fb6afc865a30077ae4d802a7020371c141e73Brian Paul/*
292448fc7deeaa870d879de17158f243f239c05b15Keith Whitwell * This file manages recalculation of derived values in the
302448fc7deeaa870d879de17158f243f239c05b15Keith Whitwell * __GLcontext.
31a02fb6afc865a30077ae4d802a7020371c141e73Brian Paul */
32a02fb6afc865a30077ae4d802a7020371c141e73Brian Paul
33d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul
34d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul#include "glheader.h"
35d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul#include "accum.h"
36ad2ac216fa0cbebc36530bf9e5256e902710b892Keith Whitwell#include "api_loopback.h"
37d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul#include "attrib.h"
38d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul#include "blend.h"
39d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul#include "buffers.h"
40d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul#include "clip.h"
41d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul#include "colortab.h"
42d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul#include "context.h"
43cf8eebee075e3f69c3daa4ea88994e07527055e4Brian Paul#include "convolve.h"
44d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul#include "depth.h"
45d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul#include "dlist.h"
46d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul#include "drawpix.h"
47d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul#include "enable.h"
48d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul#include "eval.h"
49d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul#include "get.h"
50d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul#include "feedback.h"
51d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul#include "fog.h"
52d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul#include "hint.h"
538a9507442a9811e2c4a4bac6a993e8a900c50d4dBrian Paul#include "histogram.h"
54d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul#include "light.h"
55d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul#include "lines.h"
56d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul#include "matrix.h"
57d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul#include "mmath.h"
58d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul#include "pixel.h"
59d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul#include "points.h"
60d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul#include "polygon.h"
61d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul#include "rastpos.h"
62d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul#include "state.h"
63d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul#include "stencil.h"
64d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul#include "teximage.h"
65d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul#include "texobj.h"
66d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul#include "texstate.h"
675e3bc0c2a2bcdf59949410f94c9b705fc1281ce8Jouk Jansen#include "mtypes.h"
68d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul#include "varray.h"
698dfc5b9863f08a713177fd92847573e17febbac9Brian Paul#if FEATURE_NV_vertex_program
7086b842790b720cd6b1499ce8edca8a4e9c8dc029Brian Paul#include "vpstate.h"
718dfc5b9863f08a713177fd92847573e17febbac9Brian Paul#endif
7223caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell
7323caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell#include "math/m_matrix.h"
7423caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell#include "math/m_xform.h"
75d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul
76d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul
77d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paulstatic int
78d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paulgeneric_noop(void)
79d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul{
80d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul#ifdef DEBUG
81641b2307ec77e70a5b1db75934438d2fbb75613cBrian Paul   _mesa_problem(NULL, "User called no-op dispatch function");
82d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul#endif
83d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   return 0;
84d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul}
85d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul
86d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul
875fb84d263b8068467a2429942ecf113a0a4c8a60Brian Paul/*
885fb84d263b8068467a2429942ecf113a0a4c8a60Brian Paul * Set all pointers in the given dispatch table to point to a
895fb84d263b8068467a2429942ecf113a0a4c8a60Brian Paul * generic no-op function.
905fb84d263b8068467a2429942ecf113a0a4c8a60Brian Paul */
91d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paulvoid
925fb84d263b8068467a2429942ecf113a0a4c8a60Brian Paul_mesa_init_no_op_table(struct _glapi_table *table, GLuint tableSize)
93d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul{
945fb84d263b8068467a2429942ecf113a0a4c8a60Brian Paul   GLuint i;
955fb84d263b8068467a2429942ecf113a0a4c8a60Brian Paul   void **dispatch = (void **) table;
965fb84d263b8068467a2429942ecf113a0a4c8a60Brian Paul   for (i = 0; i < tableSize; i++) {
975fb84d263b8068467a2429942ecf113a0a4c8a60Brian Paul      dispatch[i] = (void *) generic_noop;
98d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   }
99d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul}
100d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul
101d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul
102cab974cf6c2dbfbf5dd5d291e1aae0f8eeb34290Keith Whitwell
103d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul/*
104d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul * Initialize the given dispatch table with pointers to Mesa's
105d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul * immediate-mode commands.
106ad2ac216fa0cbebc36530bf9e5256e902710b892Keith Whitwell *
107ad2ac216fa0cbebc36530bf9e5256e902710b892Keith Whitwell * Pointers to begin/end object commands and a few others
108ad2ac216fa0cbebc36530bf9e5256e902710b892Keith Whitwell * are provided via the vtxfmt interface elsewhere.
109d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul */
110d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paulvoid
1115fb84d263b8068467a2429942ecf113a0a4c8a60Brian Paul_mesa_init_exec_table(struct _glapi_table *exec, GLuint tableSize)
112d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul{
113d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   /* first initialize all dispatch slots to no-op */
1145fb84d263b8068467a2429942ecf113a0a4c8a60Brian Paul   _mesa_init_no_op_table(exec, tableSize);
115d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul
1168b6a91a93f1b3f79796f398884aaca77a8a09198Keith Whitwell   _mesa_loopback_init_api_table( exec, GL_TRUE );
117ad2ac216fa0cbebc36530bf9e5256e902710b892Keith Whitwell
118d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   /* load the dispatch slots we understand */
119d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->Accum = _mesa_Accum;
120d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->AlphaFunc = _mesa_AlphaFunc;
121d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->Bitmap = _mesa_Bitmap;
122d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->BlendFunc = _mesa_BlendFunc;
123d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->CallList = _mesa_CallList;
124d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->CallLists = _mesa_CallLists;
125d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->Clear = _mesa_Clear;
126d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->ClearAccum = _mesa_ClearAccum;
127d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->ClearColor = _mesa_ClearColor;
128d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->ClearDepth = _mesa_ClearDepth;
129d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->ClearIndex = _mesa_ClearIndex;
130d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->ClearStencil = _mesa_ClearStencil;
131d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->ClipPlane = _mesa_ClipPlane;
132d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->ColorMask = _mesa_ColorMask;
133d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->ColorMaterial = _mesa_ColorMaterial;
134d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->CopyPixels = _mesa_CopyPixels;
135d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->CullFace = _mesa_CullFace;
136d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->DeleteLists = _mesa_DeleteLists;
137d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->DepthFunc = _mesa_DepthFunc;
138d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->DepthMask = _mesa_DepthMask;
139d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->DepthRange = _mesa_DepthRange;
140d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->Disable = _mesa_Disable;
141d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->DrawBuffer = _mesa_DrawBuffer;
142d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->DrawPixels = _mesa_DrawPixels;
143d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->Enable = _mesa_Enable;
144d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->EndList = _mesa_EndList;
145d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->FeedbackBuffer = _mesa_FeedbackBuffer;
146d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->Finish = _mesa_Finish;
147d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->Flush = _mesa_Flush;
148fe5d67d95f3a5fc84c5421d409a6464642aaf2cbKeith Whitwell   exec->FogCoordPointerEXT = _mesa_FogCoordPointerEXT;
149d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->Fogf = _mesa_Fogf;
150d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->Fogfv = _mesa_Fogfv;
151d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->Fogi = _mesa_Fogi;
152d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->Fogiv = _mesa_Fogiv;
153d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->FrontFace = _mesa_FrontFace;
154d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->Frustum = _mesa_Frustum;
155d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->GenLists = _mesa_GenLists;
156d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->GetBooleanv = _mesa_GetBooleanv;
157d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->GetClipPlane = _mesa_GetClipPlane;
158d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->GetDoublev = _mesa_GetDoublev;
159d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->GetError = _mesa_GetError;
160d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->GetFloatv = _mesa_GetFloatv;
161d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->GetIntegerv = _mesa_GetIntegerv;
162d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->GetLightfv = _mesa_GetLightfv;
163d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->GetLightiv = _mesa_GetLightiv;
164d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->GetMapdv = _mesa_GetMapdv;
165d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->GetMapfv = _mesa_GetMapfv;
166d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->GetMapiv = _mesa_GetMapiv;
167d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->GetMaterialfv = _mesa_GetMaterialfv;
168d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->GetMaterialiv = _mesa_GetMaterialiv;
169d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->GetPixelMapfv = _mesa_GetPixelMapfv;
170d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->GetPixelMapuiv = _mesa_GetPixelMapuiv;
171d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->GetPixelMapusv = _mesa_GetPixelMapusv;
172d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->GetPolygonStipple = _mesa_GetPolygonStipple;
173d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->GetString = _mesa_GetString;
174d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->GetTexEnvfv = _mesa_GetTexEnvfv;
175d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->GetTexEnviv = _mesa_GetTexEnviv;
176d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->GetTexGendv = _mesa_GetTexGendv;
177d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->GetTexGenfv = _mesa_GetTexGenfv;
178d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->GetTexGeniv = _mesa_GetTexGeniv;
179d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->GetTexImage = _mesa_GetTexImage;
180d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->GetTexLevelParameterfv = _mesa_GetTexLevelParameterfv;
181d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->GetTexLevelParameteriv = _mesa_GetTexLevelParameteriv;
182d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->GetTexParameterfv = _mesa_GetTexParameterfv;
183d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->GetTexParameteriv = _mesa_GetTexParameteriv;
184d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->Hint = _mesa_Hint;
185d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->IndexMask = _mesa_IndexMask;
186d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->InitNames = _mesa_InitNames;
187d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->IsEnabled = _mesa_IsEnabled;
188d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->IsList = _mesa_IsList;
189d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->LightModelf = _mesa_LightModelf;
190d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->LightModelfv = _mesa_LightModelfv;
191d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->LightModeli = _mesa_LightModeli;
192d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->LightModeliv = _mesa_LightModeliv;
193d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->Lightf = _mesa_Lightf;
194d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->Lightfv = _mesa_Lightfv;
195d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->Lighti = _mesa_Lighti;
196d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->Lightiv = _mesa_Lightiv;
197d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->LineStipple = _mesa_LineStipple;
198d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->LineWidth = _mesa_LineWidth;
199d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->ListBase = _mesa_ListBase;
200d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->LoadIdentity = _mesa_LoadIdentity;
201d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->LoadMatrixd = _mesa_LoadMatrixd;
202d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->LoadMatrixf = _mesa_LoadMatrixf;
203d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->LoadName = _mesa_LoadName;
204d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->LogicOp = _mesa_LogicOp;
205d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->Map1d = _mesa_Map1d;
206d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->Map1f = _mesa_Map1f;
207d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->Map2d = _mesa_Map2d;
208d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->Map2f = _mesa_Map2f;
209d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->MapGrid1d = _mesa_MapGrid1d;
210d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->MapGrid1f = _mesa_MapGrid1f;
211d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->MapGrid2d = _mesa_MapGrid2d;
212d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->MapGrid2f = _mesa_MapGrid2f;
213d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->MatrixMode = _mesa_MatrixMode;
214d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->MultMatrixd = _mesa_MultMatrixd;
215d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->MultMatrixf = _mesa_MultMatrixf;
216d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->NewList = _mesa_NewList;
217d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->Ortho = _mesa_Ortho;
218d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->PassThrough = _mesa_PassThrough;
219d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->PixelMapfv = _mesa_PixelMapfv;
220d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->PixelMapuiv = _mesa_PixelMapuiv;
221d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->PixelMapusv = _mesa_PixelMapusv;
222d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->PixelStoref = _mesa_PixelStoref;
223d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->PixelStorei = _mesa_PixelStorei;
224d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->PixelTransferf = _mesa_PixelTransferf;
225d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->PixelTransferi = _mesa_PixelTransferi;
226d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->PixelZoom = _mesa_PixelZoom;
227d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->PointSize = _mesa_PointSize;
228d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->PolygonMode = _mesa_PolygonMode;
229d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->PolygonOffset = _mesa_PolygonOffset;
230d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->PolygonStipple = _mesa_PolygonStipple;
231d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->PopAttrib = _mesa_PopAttrib;
232d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->PopMatrix = _mesa_PopMatrix;
233d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->PopName = _mesa_PopName;
234d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->PushAttrib = _mesa_PushAttrib;
235d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->PushMatrix = _mesa_PushMatrix;
236d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->PushName = _mesa_PushName;
237d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->RasterPos2d = _mesa_RasterPos2d;
238d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->RasterPos2dv = _mesa_RasterPos2dv;
239d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->RasterPos2f = _mesa_RasterPos2f;
240d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->RasterPos2fv = _mesa_RasterPos2fv;
241d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->RasterPos2i = _mesa_RasterPos2i;
242d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->RasterPos2iv = _mesa_RasterPos2iv;
243d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->RasterPos2s = _mesa_RasterPos2s;
244d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->RasterPos2sv = _mesa_RasterPos2sv;
245d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->RasterPos3d = _mesa_RasterPos3d;
246d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->RasterPos3dv = _mesa_RasterPos3dv;
247d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->RasterPos3f = _mesa_RasterPos3f;
248d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->RasterPos3fv = _mesa_RasterPos3fv;
249d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->RasterPos3i = _mesa_RasterPos3i;
250d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->RasterPos3iv = _mesa_RasterPos3iv;
251d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->RasterPos3s = _mesa_RasterPos3s;
252d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->RasterPos3sv = _mesa_RasterPos3sv;
253d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->RasterPos4d = _mesa_RasterPos4d;
254d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->RasterPos4dv = _mesa_RasterPos4dv;
255d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->RasterPos4f = _mesa_RasterPos4f;
256d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->RasterPos4fv = _mesa_RasterPos4fv;
257d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->RasterPos4i = _mesa_RasterPos4i;
258d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->RasterPos4iv = _mesa_RasterPos4iv;
259d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->RasterPos4s = _mesa_RasterPos4s;
260d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->RasterPos4sv = _mesa_RasterPos4sv;
261d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->ReadBuffer = _mesa_ReadBuffer;
262d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->ReadPixels = _mesa_ReadPixels;
263d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->RenderMode = _mesa_RenderMode;
264d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->Rotated = _mesa_Rotated;
265d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->Rotatef = _mesa_Rotatef;
266d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->Scaled = _mesa_Scaled;
267d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->Scalef = _mesa_Scalef;
268d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->Scissor = _mesa_Scissor;
269fe5d67d95f3a5fc84c5421d409a6464642aaf2cbKeith Whitwell   exec->SecondaryColorPointerEXT = _mesa_SecondaryColorPointerEXT;
270d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->SelectBuffer = _mesa_SelectBuffer;
271d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->ShadeModel = _mesa_ShadeModel;
272d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->StencilFunc = _mesa_StencilFunc;
273d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->StencilMask = _mesa_StencilMask;
274d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->StencilOp = _mesa_StencilOp;
275d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->TexEnvf = _mesa_TexEnvf;
276d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->TexEnvfv = _mesa_TexEnvfv;
277d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->TexEnvi = _mesa_TexEnvi;
278d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->TexEnviv = _mesa_TexEnviv;
279d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->TexGend = _mesa_TexGend;
280d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->TexGendv = _mesa_TexGendv;
281d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->TexGenf = _mesa_TexGenf;
282d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->TexGenfv = _mesa_TexGenfv;
283d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->TexGeni = _mesa_TexGeni;
284d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->TexGeniv = _mesa_TexGeniv;
285d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->TexImage1D = _mesa_TexImage1D;
286d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->TexImage2D = _mesa_TexImage2D;
287d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->TexParameterf = _mesa_TexParameterf;
288d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->TexParameterfv = _mesa_TexParameterfv;
289d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->TexParameteri = _mesa_TexParameteri;
290d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->TexParameteriv = _mesa_TexParameteriv;
291d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->Translated = _mesa_Translated;
292d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->Translatef = _mesa_Translatef;
293d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->Viewport = _mesa_Viewport;
294d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul
295d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   /* 1.1 */
296d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->AreTexturesResident = _mesa_AreTexturesResident;
297f48216ad0f75dc2eecc34ab6978986f564c90334Brian Paul   exec->AreTexturesResidentEXT = _mesa_AreTexturesResident;
298d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->BindTexture = _mesa_BindTexture;
299d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->ColorPointer = _mesa_ColorPointer;
300d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->CopyTexImage1D = _mesa_CopyTexImage1D;
301d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->CopyTexImage2D = _mesa_CopyTexImage2D;
302d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->CopyTexSubImage1D = _mesa_CopyTexSubImage1D;
303d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->CopyTexSubImage2D = _mesa_CopyTexSubImage2D;
304d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->DeleteTextures = _mesa_DeleteTextures;
305d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->DisableClientState = _mesa_DisableClientState;
306d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->EdgeFlagPointer = _mesa_EdgeFlagPointer;
307d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->EnableClientState = _mesa_EnableClientState;
308d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->GenTextures = _mesa_GenTextures;
309f48216ad0f75dc2eecc34ab6978986f564c90334Brian Paul   exec->GenTexturesEXT = _mesa_GenTextures;
310d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->GetPointerv = _mesa_GetPointerv;
311d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->IndexPointer = _mesa_IndexPointer;
312d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->InterleavedArrays = _mesa_InterleavedArrays;
313d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->IsTexture = _mesa_IsTexture;
314f48216ad0f75dc2eecc34ab6978986f564c90334Brian Paul   exec->IsTextureEXT = _mesa_IsTexture;
315d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->NormalPointer = _mesa_NormalPointer;
316d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->PopClientAttrib = _mesa_PopClientAttrib;
317d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->PrioritizeTextures = _mesa_PrioritizeTextures;
318d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->PushClientAttrib = _mesa_PushClientAttrib;
319d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->TexCoordPointer = _mesa_TexCoordPointer;
320d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->TexSubImage1D = _mesa_TexSubImage1D;
321d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->TexSubImage2D = _mesa_TexSubImage2D;
322d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->VertexPointer = _mesa_VertexPointer;
323d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul
324d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   /* 1.2 */
325d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->CopyTexSubImage3D = _mesa_CopyTexSubImage3D;
326d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->TexImage3D = _mesa_TexImage3D;
327d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->TexSubImage3D = _mesa_TexSubImage3D;
328d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul
329d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   /* OpenGL 1.2  GL_ARB_imaging */
330d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->BlendColor = _mesa_BlendColor;
331d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->BlendEquation = _mesa_BlendEquation;
332d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->ColorSubTable = _mesa_ColorSubTable;
333d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->ColorTable = _mesa_ColorTable;
334d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->ColorTableParameterfv = _mesa_ColorTableParameterfv;
335d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->ColorTableParameteriv = _mesa_ColorTableParameteriv;
336d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->ConvolutionFilter1D = _mesa_ConvolutionFilter1D;
337d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->ConvolutionFilter2D = _mesa_ConvolutionFilter2D;
338d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->ConvolutionParameterf = _mesa_ConvolutionParameterf;
339d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->ConvolutionParameterfv = _mesa_ConvolutionParameterfv;
340d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->ConvolutionParameteri = _mesa_ConvolutionParameteri;
341d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->ConvolutionParameteriv = _mesa_ConvolutionParameteriv;
342d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->CopyColorSubTable = _mesa_CopyColorSubTable;
343d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->CopyColorTable = _mesa_CopyColorTable;
344d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->CopyConvolutionFilter1D = _mesa_CopyConvolutionFilter1D;
345d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->CopyConvolutionFilter2D = _mesa_CopyConvolutionFilter2D;
346d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->GetColorTable = _mesa_GetColorTable;
347f48216ad0f75dc2eecc34ab6978986f564c90334Brian Paul   exec->GetColorTableEXT = _mesa_GetColorTable;
348d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->GetColorTableParameterfv = _mesa_GetColorTableParameterfv;
349f48216ad0f75dc2eecc34ab6978986f564c90334Brian Paul   exec->GetColorTableParameterfvEXT = _mesa_GetColorTableParameterfv;
350d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->GetColorTableParameteriv = _mesa_GetColorTableParameteriv;
351f48216ad0f75dc2eecc34ab6978986f564c90334Brian Paul   exec->GetColorTableParameterivEXT = _mesa_GetColorTableParameteriv;
352d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->GetConvolutionFilter = _mesa_GetConvolutionFilter;
353f48216ad0f75dc2eecc34ab6978986f564c90334Brian Paul   exec->GetConvolutionFilterEXT = _mesa_GetConvolutionFilter;
354d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->GetConvolutionParameterfv = _mesa_GetConvolutionParameterfv;
355f48216ad0f75dc2eecc34ab6978986f564c90334Brian Paul   exec->GetConvolutionParameterfvEXT = _mesa_GetConvolutionParameterfv;
356d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->GetConvolutionParameteriv = _mesa_GetConvolutionParameteriv;
357f48216ad0f75dc2eecc34ab6978986f564c90334Brian Paul   exec->GetConvolutionParameterivEXT = _mesa_GetConvolutionParameteriv;
358d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->GetHistogram = _mesa_GetHistogram;
359f48216ad0f75dc2eecc34ab6978986f564c90334Brian Paul   exec->GetHistogramEXT = _mesa_GetHistogram;
360d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->GetHistogramParameterfv = _mesa_GetHistogramParameterfv;
361f48216ad0f75dc2eecc34ab6978986f564c90334Brian Paul   exec->GetHistogramParameterfvEXT = _mesa_GetHistogramParameterfv;
362d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->GetHistogramParameteriv = _mesa_GetHistogramParameteriv;
363f48216ad0f75dc2eecc34ab6978986f564c90334Brian Paul   exec->GetHistogramParameterivEXT = _mesa_GetHistogramParameteriv;
364d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->GetMinmax = _mesa_GetMinmax;
365f48216ad0f75dc2eecc34ab6978986f564c90334Brian Paul   exec->GetMinmaxEXT = _mesa_GetMinmax;
366d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->GetMinmaxParameterfv = _mesa_GetMinmaxParameterfv;
367f48216ad0f75dc2eecc34ab6978986f564c90334Brian Paul   exec->GetMinmaxParameterfvEXT = _mesa_GetMinmaxParameterfv;
368d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->GetMinmaxParameteriv = _mesa_GetMinmaxParameteriv;
369f48216ad0f75dc2eecc34ab6978986f564c90334Brian Paul   exec->GetMinmaxParameterivEXT = _mesa_GetMinmaxParameteriv;
370d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->GetSeparableFilter = _mesa_GetSeparableFilter;
371f48216ad0f75dc2eecc34ab6978986f564c90334Brian Paul   exec->GetSeparableFilterEXT = _mesa_GetSeparableFilter;
372d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->Histogram = _mesa_Histogram;
373d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->Minmax = _mesa_Minmax;
374d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->ResetHistogram = _mesa_ResetHistogram;
375d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->ResetMinmax = _mesa_ResetMinmax;
376d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->SeparableFilter2D = _mesa_SeparableFilter2D;
377d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul
3781a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul   /* 2. GL_EXT_blend_color */
3791a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul#if 0
3801a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul   exec->BlendColorEXT = _mesa_BlendColorEXT;
3811a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul#endif
3821a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul
3831a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul   /* 3. GL_EXT_polygon_offset */
3841a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul   exec->PolygonOffsetEXT = _mesa_PolygonOffsetEXT;
3851a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul
3861a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul   /* 6. GL_EXT_texture3d */
387ead285a9266bb5f80e68de122490a6afb88df6f3Brian Paul#if 0
388d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->CopyTexSubImage3DEXT = _mesa_CopyTexSubImage3D;
389d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->TexImage3DEXT = _mesa_TexImage3DEXT;
390d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->TexSubImage3DEXT = _mesa_TexSubImage3D;
391ead285a9266bb5f80e68de122490a6afb88df6f3Brian Paul#endif
392d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul
3931a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul   /* 11. GL_EXT_histogram */
3941a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul   exec->GetHistogramEXT = _mesa_GetHistogram;
3951a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul   exec->GetHistogramParameterfvEXT = _mesa_GetHistogramParameterfv;
3961a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul   exec->GetHistogramParameterivEXT = _mesa_GetHistogramParameteriv;
3971a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul   exec->GetMinmaxEXT = _mesa_GetMinmax;
3981a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul   exec->GetMinmaxParameterfvEXT = _mesa_GetMinmaxParameterfv;
3991a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul   exec->GetMinmaxParameterivEXT = _mesa_GetMinmaxParameteriv;
400d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul
4011a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul   /* ?. GL_SGIX_pixel_texture */
4022b2e925ea4a5652b0ab73b1efbce345a42663842Brian Paul   exec->PixelTexGenSGIX = _mesa_PixelTexGenSGIX;
4032b2e925ea4a5652b0ab73b1efbce345a42663842Brian Paul
4041a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul   /* 15. GL_SGIS_pixel_texture */
4052b2e925ea4a5652b0ab73b1efbce345a42663842Brian Paul   exec->PixelTexGenParameteriSGIS = _mesa_PixelTexGenParameteriSGIS;
4062b2e925ea4a5652b0ab73b1efbce345a42663842Brian Paul   exec->PixelTexGenParameterivSGIS = _mesa_PixelTexGenParameterivSGIS;
4072b2e925ea4a5652b0ab73b1efbce345a42663842Brian Paul   exec->PixelTexGenParameterfSGIS = _mesa_PixelTexGenParameterfSGIS;
4082b2e925ea4a5652b0ab73b1efbce345a42663842Brian Paul   exec->PixelTexGenParameterfvSGIS = _mesa_PixelTexGenParameterfvSGIS;
4092b2e925ea4a5652b0ab73b1efbce345a42663842Brian Paul   exec->GetPixelTexGenParameterivSGIS = _mesa_GetPixelTexGenParameterivSGIS;
4102b2e925ea4a5652b0ab73b1efbce345a42663842Brian Paul   exec->GetPixelTexGenParameterfvSGIS = _mesa_GetPixelTexGenParameterfvSGIS;
4112b2e925ea4a5652b0ab73b1efbce345a42663842Brian Paul
4121f0e213bf88500e9c2f7ca92e57392efae5e4459Brian Paul   /* 30. GL_EXT_vertex_array */
4131f0e213bf88500e9c2f7ca92e57392efae5e4459Brian Paul   exec->ColorPointerEXT = _mesa_ColorPointerEXT;
4141f0e213bf88500e9c2f7ca92e57392efae5e4459Brian Paul   exec->EdgeFlagPointerEXT = _mesa_EdgeFlagPointerEXT;
4151f0e213bf88500e9c2f7ca92e57392efae5e4459Brian Paul   exec->IndexPointerEXT = _mesa_IndexPointerEXT;
4161f0e213bf88500e9c2f7ca92e57392efae5e4459Brian Paul   exec->NormalPointerEXT = _mesa_NormalPointerEXT;
4171f0e213bf88500e9c2f7ca92e57392efae5e4459Brian Paul   exec->TexCoordPointerEXT = _mesa_TexCoordPointerEXT;
4181f0e213bf88500e9c2f7ca92e57392efae5e4459Brian Paul   exec->VertexPointerEXT = _mesa_VertexPointerEXT;
4191f0e213bf88500e9c2f7ca92e57392efae5e4459Brian Paul
4201a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul   /* 37. GL_EXT_blend_minmax */
4211a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul#if 0
4221a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul   exec->BlendEquationEXT = _mesa_BlendEquationEXT;
4231a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul#endif
424d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul
4251a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul   /* 54. GL_EXT_point_parameters */
426471a774f433c23b263828aa591415741e78a35daBrian Paul   exec->PointParameterfEXT = _mesa_PointParameterfEXT;
427471a774f433c23b263828aa591415741e78a35daBrian Paul   exec->PointParameterfvEXT = _mesa_PointParameterfvEXT;
428d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul
4291a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul   /* 78. GL_EXT_paletted_texture */
430ead285a9266bb5f80e68de122490a6afb88df6f3Brian Paul#if 0
4311a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul   exec->ColorTableEXT = _mesa_ColorTableEXT;
4321a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul   exec->ColorSubTableEXT = _mesa_ColorSubTableEXT;
433ead285a9266bb5f80e68de122490a6afb88df6f3Brian Paul#endif
4341a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul   exec->GetColorTableEXT = _mesa_GetColorTable;
4351a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul   exec->GetColorTableParameterfvEXT = _mesa_GetColorTableParameterfv;
4361a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul   exec->GetColorTableParameterivEXT = _mesa_GetColorTableParameteriv;
437d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul
4381a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul   /* 97. GL_EXT_compiled_vertex_array */
4391a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul   exec->LockArraysEXT = _mesa_LockArraysEXT;
4401a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul   exec->UnlockArraysEXT = _mesa_UnlockArraysEXT;
4411a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul
4422525bc7d305f6dcab3beb75535da25a488c969b0Brian Paul   /* 148. GL_EXT_multi_draw_arrays */
4432525bc7d305f6dcab3beb75535da25a488c969b0Brian Paul   exec->MultiDrawArraysEXT = _mesa_MultiDrawArraysEXT;
4442525bc7d305f6dcab3beb75535da25a488c969b0Brian Paul   exec->MultiDrawElementsEXT = _mesa_MultiDrawElementsEXT;
4452525bc7d305f6dcab3beb75535da25a488c969b0Brian Paul
4461a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul   /* 173. GL_INGR_blend_func_separate */
4471a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul   exec->BlendFuncSeparateEXT = _mesa_BlendFuncSeparateEXT;
4481a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul
4491a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul   /* 196. GL_MESA_resize_buffers */
4501a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul   exec->ResizeBuffersMESA = _mesa_ResizeBuffersMESA;
4511a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul
4521a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul   /* 197. GL_MESA_window_pos */
4531a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul   exec->WindowPos2dMESA = _mesa_WindowPos2dMESA;
4541a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul   exec->WindowPos2dvMESA = _mesa_WindowPos2dvMESA;
4551a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul   exec->WindowPos2fMESA = _mesa_WindowPos2fMESA;
4561a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul   exec->WindowPos2fvMESA = _mesa_WindowPos2fvMESA;
4571a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul   exec->WindowPos2iMESA = _mesa_WindowPos2iMESA;
4581a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul   exec->WindowPos2ivMESA = _mesa_WindowPos2ivMESA;
4591a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul   exec->WindowPos2sMESA = _mesa_WindowPos2sMESA;
4601a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul   exec->WindowPos2svMESA = _mesa_WindowPos2svMESA;
4611a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul   exec->WindowPos3dMESA = _mesa_WindowPos3dMESA;
4621a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul   exec->WindowPos3dvMESA = _mesa_WindowPos3dvMESA;
4631a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul   exec->WindowPos3fMESA = _mesa_WindowPos3fMESA;
4641a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul   exec->WindowPos3fvMESA = _mesa_WindowPos3fvMESA;
4651a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul   exec->WindowPos3iMESA = _mesa_WindowPos3iMESA;
4661a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul   exec->WindowPos3ivMESA = _mesa_WindowPos3ivMESA;
4671a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul   exec->WindowPos3sMESA = _mesa_WindowPos3sMESA;
4681a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul   exec->WindowPos3svMESA = _mesa_WindowPos3svMESA;
4691a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul   exec->WindowPos4dMESA = _mesa_WindowPos4dMESA;
4701a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul   exec->WindowPos4dvMESA = _mesa_WindowPos4dvMESA;
4711a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul   exec->WindowPos4fMESA = _mesa_WindowPos4fMESA;
4721a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul   exec->WindowPos4fvMESA = _mesa_WindowPos4fvMESA;
4731a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul   exec->WindowPos4iMESA = _mesa_WindowPos4iMESA;
4741a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul   exec->WindowPos4ivMESA = _mesa_WindowPos4ivMESA;
4751a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul   exec->WindowPos4sMESA = _mesa_WindowPos4sMESA;
4761a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul   exec->WindowPos4svMESA = _mesa_WindowPos4svMESA;
477d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul
478b638c34381004aa2a778227bad51d259d05a9b53Brian Paul   /* 233. GL_NV_vertex_program */
4798dfc5b9863f08a713177fd92847573e17febbac9Brian Paul#if FEATURE_NV_vertex_program
48086b842790b720cd6b1499ce8edca8a4e9c8dc029Brian Paul   exec->BindProgramNV = _mesa_BindProgramNV;
48186b842790b720cd6b1499ce8edca8a4e9c8dc029Brian Paul   exec->DeleteProgramsNV = _mesa_DeleteProgramsNV;
48286b842790b720cd6b1499ce8edca8a4e9c8dc029Brian Paul   exec->ExecuteProgramNV = _mesa_ExecuteProgramNV;
48386b842790b720cd6b1499ce8edca8a4e9c8dc029Brian Paul   exec->GenProgramsNV = _mesa_GenProgramsNV;
48486b842790b720cd6b1499ce8edca8a4e9c8dc029Brian Paul   exec->AreProgramsResidentNV = _mesa_AreProgramsResidentNV;
48586b842790b720cd6b1499ce8edca8a4e9c8dc029Brian Paul   exec->RequestResidentProgramsNV = _mesa_RequestResidentProgramsNV;
48686b842790b720cd6b1499ce8edca8a4e9c8dc029Brian Paul   exec->GetProgramParameterfvNV = _mesa_GetProgramParameterfvNV;
48786b842790b720cd6b1499ce8edca8a4e9c8dc029Brian Paul   exec->GetProgramParameterdvNV = _mesa_GetProgramParameterdvNV;
48886b842790b720cd6b1499ce8edca8a4e9c8dc029Brian Paul   exec->GetProgramivNV = _mesa_GetProgramivNV;
48986b842790b720cd6b1499ce8edca8a4e9c8dc029Brian Paul   exec->GetProgramStringNV = _mesa_GetProgramStringNV;
49086b842790b720cd6b1499ce8edca8a4e9c8dc029Brian Paul   exec->GetTrackMatrixivNV = _mesa_GetTrackMatrixivNV;
49186b842790b720cd6b1499ce8edca8a4e9c8dc029Brian Paul   exec->GetVertexAttribdvNV = _mesa_GetVertexAttribdvNV;
49286b842790b720cd6b1499ce8edca8a4e9c8dc029Brian Paul   exec->GetVertexAttribfvNV = _mesa_GetVertexAttribfvNV;
49386b842790b720cd6b1499ce8edca8a4e9c8dc029Brian Paul   exec->GetVertexAttribivNV = _mesa_GetVertexAttribivNV;
49486b842790b720cd6b1499ce8edca8a4e9c8dc029Brian Paul   exec->GetVertexAttribPointervNV = _mesa_GetVertexAttribPointervNV;
49586b842790b720cd6b1499ce8edca8a4e9c8dc029Brian Paul   exec->IsProgramNV = _mesa_IsProgramNV;
49686b842790b720cd6b1499ce8edca8a4e9c8dc029Brian Paul   exec->LoadProgramNV = _mesa_LoadProgramNV;
49786b842790b720cd6b1499ce8edca8a4e9c8dc029Brian Paul   exec->ProgramParameter4dNV = _mesa_ProgramParameter4dNV;
49886b842790b720cd6b1499ce8edca8a4e9c8dc029Brian Paul   exec->ProgramParameter4dvNV = _mesa_ProgramParameter4dvNV;
49986b842790b720cd6b1499ce8edca8a4e9c8dc029Brian Paul   exec->ProgramParameter4fNV = _mesa_ProgramParameter4fNV;
50086b842790b720cd6b1499ce8edca8a4e9c8dc029Brian Paul   exec->ProgramParameter4fvNV = _mesa_ProgramParameter4fvNV;
50186b842790b720cd6b1499ce8edca8a4e9c8dc029Brian Paul   exec->ProgramParameters4dvNV = _mesa_ProgramParameters4dvNV;
50286b842790b720cd6b1499ce8edca8a4e9c8dc029Brian Paul   exec->ProgramParameters4fvNV = _mesa_ProgramParameters4fvNV;
50386b842790b720cd6b1499ce8edca8a4e9c8dc029Brian Paul   exec->TrackMatrixNV = _mesa_TrackMatrixNV;
50486b842790b720cd6b1499ce8edca8a4e9c8dc029Brian Paul   exec->VertexAttribPointerNV = _mesa_VertexAttribPointerNV;
5058dfc5b9863f08a713177fd92847573e17febbac9Brian Paul#endif
50686b842790b720cd6b1499ce8edca8a4e9c8dc029Brian Paul
50723d8ef3937b3b66684f7feb62446abca8e91d307Brian Paul   /* 262. GL_NV_point_sprite */
50823d8ef3937b3b66684f7feb62446abca8e91d307Brian Paul   exec->PointParameteriNV = _mesa_PointParameteriNV;
50923d8ef3937b3b66684f7feb62446abca8e91d307Brian Paul   exec->PointParameterivNV = _mesa_PointParameterivNV;
51023d8ef3937b3b66684f7feb62446abca8e91d307Brian Paul
5115f60a0b50ada1865d4fc6a724366e8ea0cc9a72fBrian Paul   /* 268. GL_EXT_stencil_two_side */
5125f60a0b50ada1865d4fc6a724366e8ea0cc9a72fBrian Paul   exec->ActiveStencilFaceEXT = _mesa_ActiveStencilFaceEXT;
5135f60a0b50ada1865d4fc6a724366e8ea0cc9a72fBrian Paul
5141a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul   /* ARB 1. GL_ARB_multitexture */
515471a774f433c23b263828aa591415741e78a35daBrian Paul   exec->ActiveTextureARB = _mesa_ActiveTextureARB;
516471a774f433c23b263828aa591415741e78a35daBrian Paul   exec->ClientActiveTextureARB = _mesa_ClientActiveTextureARB;
517d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul
5181a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul   /* ARB 3. GL_ARB_transpose_matrix */
519471a774f433c23b263828aa591415741e78a35daBrian Paul   exec->LoadTransposeMatrixdARB = _mesa_LoadTransposeMatrixdARB;
520471a774f433c23b263828aa591415741e78a35daBrian Paul   exec->LoadTransposeMatrixfARB = _mesa_LoadTransposeMatrixfARB;
521471a774f433c23b263828aa591415741e78a35daBrian Paul   exec->MultTransposeMatrixdARB = _mesa_MultTransposeMatrixdARB;
522471a774f433c23b263828aa591415741e78a35daBrian Paul   exec->MultTransposeMatrixfARB = _mesa_MultTransposeMatrixfARB;
5231207bf057aeea3376e5e0f03f789a5d67ed4d29dBrian Paul
524736fcbec4732830e7976fb5eb309b13e03be132cBrian Paul   /* ARB 5. GL_ARB_multisample */
525471a774f433c23b263828aa591415741e78a35daBrian Paul   exec->SampleCoverageARB = _mesa_SampleCoverageARB;
526736fcbec4732830e7976fb5eb309b13e03be132cBrian Paul
5271207bf057aeea3376e5e0f03f789a5d67ed4d29dBrian Paul   /* ARB 12. GL_ARB_texture_compression */
528471a774f433c23b263828aa591415741e78a35daBrian Paul   exec->CompressedTexImage3DARB = _mesa_CompressedTexImage3DARB;
529471a774f433c23b263828aa591415741e78a35daBrian Paul   exec->CompressedTexImage2DARB = _mesa_CompressedTexImage2DARB;
530471a774f433c23b263828aa591415741e78a35daBrian Paul   exec->CompressedTexImage1DARB = _mesa_CompressedTexImage1DARB;
531471a774f433c23b263828aa591415741e78a35daBrian Paul   exec->CompressedTexSubImage3DARB = _mesa_CompressedTexSubImage3DARB;
532471a774f433c23b263828aa591415741e78a35daBrian Paul   exec->CompressedTexSubImage2DARB = _mesa_CompressedTexSubImage2DARB;
533471a774f433c23b263828aa591415741e78a35daBrian Paul   exec->CompressedTexSubImage1DARB = _mesa_CompressedTexSubImage1DARB;
534471a774f433c23b263828aa591415741e78a35daBrian Paul   exec->GetCompressedTexImageARB = _mesa_GetCompressedTexImageARB;
5351207bf057aeea3376e5e0f03f789a5d67ed4d29dBrian Paul
5361537b63fce36f87b3606d0e7cdca2d10bbdffd56Brian Paul   /* ARB 14. GL_ARB_point_parameters */
5371537b63fce36f87b3606d0e7cdca2d10bbdffd56Brian Paul   /* reuse EXT_point_parameters functions */
538d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul}
539d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul
540d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul
5411207bf057aeea3376e5e0f03f789a5d67ed4d29dBrian Paul
542d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul/**********************************************************************/
543d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul/*****                   State update logic                       *****/
544d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul/**********************************************************************/
545d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul
546d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul
5470c3f820bf069785723510f4ad2bf4b69ba7f72e0Brian Paul/*
5480c3f820bf069785723510f4ad2bf4b69ba7f72e0Brian Paul * Check polygon state and set DD_TRI_CULL_FRONT_BACK and/or DD_TRI_OFFSET
5490c3f820bf069785723510f4ad2bf4b69ba7f72e0Brian Paul * in ctx->_TriangleCaps if needed.
5500c3f820bf069785723510f4ad2bf4b69ba7f72e0Brian Paul */
5511e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwellstatic void
552a852378a6289d154364dde440f89a39bbfc33e2dBrian Paulupdate_polygon( GLcontext *ctx )
5531e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell{
554cab974cf6c2dbfbf5dd5d291e1aae0f8eeb34290Keith Whitwell   ctx->_TriangleCaps &= ~(DD_TRI_CULL_FRONT_BACK | DD_TRI_OFFSET);
555cab974cf6c2dbfbf5dd5d291e1aae0f8eeb34290Keith Whitwell
556bfa023921c9d1aa872237e0ac6085160f7c2cbc5Keith Whitwell   if (ctx->Polygon.CullFlag && ctx->Polygon.CullFaceMode == GL_FRONT_AND_BACK)
557bfa023921c9d1aa872237e0ac6085160f7c2cbc5Keith Whitwell      ctx->_TriangleCaps |= DD_TRI_CULL_FRONT_BACK;
558d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul
5591e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell   /* Any Polygon offsets enabled? */
5601e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell   if (ctx->Polygon.OffsetPoint ||
5611e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell       ctx->Polygon.OffsetLine ||
562f1d6b384415a083c358d3824e77f3d434f08bfccBrian Paul       ctx->Polygon.OffsetFill) {
5631e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell      ctx->_TriangleCaps |= DD_TRI_OFFSET;
564f1d6b384415a083c358d3824e77f3d434f08bfccBrian Paul   }
5651e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell}
566d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul
5675e3bc0c2a2bcdf59949410f94c9b705fc1281ce8Jouk Jansenstatic void
568a852378a6289d154364dde440f89a39bbfc33e2dBrian Paulcalculate_model_project_matrix( GLcontext *ctx )
5691e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell{
570641b2307ec77e70a5b1db75934438d2fbb75613cBrian Paul   _math_matrix_mul_matrix( &ctx->_ModelProjectMatrix,
571641b2307ec77e70a5b1db75934438d2fbb75613cBrian Paul                            ctx->ProjectionMatrixStack.Top,
572641b2307ec77e70a5b1db75934438d2fbb75613cBrian Paul                            ctx->ModelviewMatrixStack.Top );
5731e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell
574641b2307ec77e70a5b1db75934438d2fbb75613cBrian Paul   _math_matrix_analyse( &ctx->_ModelProjectMatrix );
5751e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell}
576d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul
5771e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwellstatic void
578a852378a6289d154364dde440f89a39bbfc33e2dBrian Paulupdate_modelview_scale( GLcontext *ctx )
5791e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell{
5801e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell   ctx->_ModelViewInvScale = 1.0F;
58130f51ae067379c2b3573c06b707d25a9704df7beBrian Paul   if (ctx->ModelviewMatrixStack.Top->flags & (MAT_FLAG_UNIFORM_SCALE |
5821e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell			       MAT_FLAG_GENERAL_SCALE |
5831e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell			       MAT_FLAG_GENERAL_3D |
5841e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell			       MAT_FLAG_GENERAL) ) {
58530f51ae067379c2b3573c06b707d25a9704df7beBrian Paul      const GLfloat *m = ctx->ModelviewMatrixStack.Top->inv;
5861e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell      GLfloat f = m[2] * m[2] + m[6] * m[6] + m[10] * m[10];
5871e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell      if (f < 1e-12) f = 1.0;
5881e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell      if (ctx->_NeedEyeCoords)
5897b9fe820a3fba3849864682fbb1cb512362934abKarl Schultz	 ctx->_ModelViewInvScale = (GLfloat) (1.0/GL_SQRT(f));
5901e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell      else
5917b9fe820a3fba3849864682fbb1cb512362934abKarl Schultz	 ctx->_ModelViewInvScale = (GLfloat) GL_SQRT(f);
5921e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell   }
5931e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell}
594d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul
5951e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell
5965e3bc0c2a2bcdf59949410f94c9b705fc1281ce8Jouk Jansen/* Bring uptodate any state that relies on _NeedEyeCoords.
5971e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell */
5981e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwellstatic void
599a852378a6289d154364dde440f89a39bbfc33e2dBrian Paulupdate_tnl_spaces( GLcontext *ctx, GLuint oldneedeyecoords )
6005e3bc0c2a2bcdf59949410f94c9b705fc1281ce8Jouk Jansen{
6011e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell   /* Check if the truth-value interpretations of the bitfields have
6025e3bc0c2a2bcdf59949410f94c9b705fc1281ce8Jouk Jansen    * changed:
6031e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell    */
604a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul   if ((oldneedeyecoords == 0) != (ctx->_NeedEyeCoords == 0)) {
6051e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell      /* Recalculate all state that depends on _NeedEyeCoords.
606d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul       */
607a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul      update_modelview_scale(ctx);
60808836341788a9f9d638d9dc8328510ccd18ddeb5Brian Paul      _mesa_compute_light_positions( ctx );
6091e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell
6101e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell      if (ctx->Driver.LightingSpaceChange)
6111e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell	 ctx->Driver.LightingSpaceChange( ctx );
612d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   }
613a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul   else {
6141e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell      GLuint new_state = ctx->NewState;
615d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul
616cab974cf6c2dbfbf5dd5d291e1aae0f8eeb34290Keith Whitwell      /* Recalculate that same state only if it has been invalidated
61722144ab7552f0799bcfca506bf4ffa7f70a06649Gareth Hughes       * by other statechanges.
6181e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell       */
6195e3bc0c2a2bcdf59949410f94c9b705fc1281ce8Jouk Jansen      if (new_state & _NEW_MODELVIEW)
620a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul	 update_modelview_scale(ctx);
6211e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell
6221e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell      if (new_state & (_NEW_LIGHT|_NEW_MODELVIEW))
62308836341788a9f9d638d9dc8328510ccd18ddeb5Brian Paul	 _mesa_compute_light_positions( ctx );
6241e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell   }
6251e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell}
6261e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell
6271e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell
6281e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwellstatic void
629a852378a6289d154364dde440f89a39bbfc33e2dBrian Paulupdate_drawbuffer( GLcontext *ctx )
6301e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell{
6311e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell   ctx->DrawBuffer->_Xmin = 0;
6321e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell   ctx->DrawBuffer->_Ymin = 0;
6331e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell   ctx->DrawBuffer->_Xmax = ctx->DrawBuffer->Width;
6341e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell   ctx->DrawBuffer->_Ymax = ctx->DrawBuffer->Height;
6351e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell   if (ctx->Scissor.Enabled) {
6361e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell      if (ctx->Scissor.X > ctx->DrawBuffer->_Xmin) {
6371e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell	 ctx->DrawBuffer->_Xmin = ctx->Scissor.X;
6381e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell      }
6391e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell      if (ctx->Scissor.Y > ctx->DrawBuffer->_Ymin) {
6401e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell	 ctx->DrawBuffer->_Ymin = ctx->Scissor.Y;
6411e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell      }
6421e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell      if (ctx->Scissor.X + ctx->Scissor.Width < ctx->DrawBuffer->_Xmax) {
6431e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell	 ctx->DrawBuffer->_Xmax = ctx->Scissor.X + ctx->Scissor.Width;
644d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul      }
6451e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell      if (ctx->Scissor.Y + ctx->Scissor.Height < ctx->DrawBuffer->_Ymax) {
6461e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell	 ctx->DrawBuffer->_Ymax = ctx->Scissor.Y + ctx->Scissor.Height;
6471e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell      }
6481e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell   }
6491e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell}
650d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul
651d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul
6521e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell/* NOTE: This routine references Tranform attribute values to compute
6531e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell * userclip positions in clip space, but is only called on
6541e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell * _NEW_PROJECTION.  The _mesa_ClipPlane() function keeps these values
6551043a6498a7f94922be5f4b5deac89fd05cfa670Brian Paul * up to date across changes to the Transform attributes.
6561e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell */
6571e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwellstatic void
658a852378a6289d154364dde440f89a39bbfc33e2dBrian Paulupdate_projection( GLcontext *ctx )
6591e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell{
66030f51ae067379c2b3573c06b707d25a9704df7beBrian Paul   _math_matrix_analyse( ctx->ProjectionMatrixStack.Top );
66122144ab7552f0799bcfca506bf4ffa7f70a06649Gareth Hughes
6621e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell   /* Recompute clip plane positions in clipspace.  This is also done
6631e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell    * in _mesa_ClipPlane().
6641e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell    */
665103bc0f75c00dfcf671dc50d8d9666f88a42a59dBrian Paul   if (ctx->Transform.ClipPlanesEnabled) {
6661e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell      GLuint p;
667a864432fb4333dfbbe669554de7485d8426e1c38Brian Paul      for (p = 0; p < ctx->Const.MaxClipPlanes; p++) {
668103bc0f75c00dfcf671dc50d8d9666f88a42a59dBrian Paul	 if (ctx->Transform.ClipPlanesEnabled & (1 << p)) {
66908836341788a9f9d638d9dc8328510ccd18ddeb5Brian Paul	    _mesa_transform_vector( ctx->Transform._ClipUserPlane[p],
6701e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell				 ctx->Transform.EyeUserPlane[p],
67130f51ae067379c2b3573c06b707d25a9704df7beBrian Paul				 ctx->ProjectionMatrixStack.Top->inv );
672d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul	 }
673d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul      }
674d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   }
6751e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell}
6761e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell
6771e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell
678a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul/*
679a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul * Return a bitmask of IMAGE_*_BIT flags which to indicate which
680a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul * pixel transfer operations are enabled.
681a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul */
682a852378a6289d154364dde440f89a39bbfc33e2dBrian Paulstatic void
683a852378a6289d154364dde440f89a39bbfc33e2dBrian Paulupdate_image_transfer_state(GLcontext *ctx)
684a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul{
685a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul   GLuint mask = 0;
686a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul
687a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul   if (ctx->Pixel.RedScale   != 1.0F || ctx->Pixel.RedBias   != 0.0F ||
688a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul       ctx->Pixel.GreenScale != 1.0F || ctx->Pixel.GreenBias != 0.0F ||
689a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul       ctx->Pixel.BlueScale  != 1.0F || ctx->Pixel.BlueBias  != 0.0F ||
690a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul       ctx->Pixel.AlphaScale != 1.0F || ctx->Pixel.AlphaBias != 0.0F)
691a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul      mask |= IMAGE_SCALE_BIAS_BIT;
692a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul
693a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul   if (ctx->Pixel.IndexShift || ctx->Pixel.IndexOffset)
694a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul      mask |= IMAGE_SHIFT_OFFSET_BIT;
6955e3bc0c2a2bcdf59949410f94c9b705fc1281ce8Jouk Jansen
696a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul   if (ctx->Pixel.MapColorFlag)
697a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul      mask |= IMAGE_MAP_COLOR_BIT;
698a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul
699a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul   if (ctx->Pixel.ColorTableEnabled)
700a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul      mask |= IMAGE_COLOR_TABLE_BIT;
701a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul
702a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul   if (ctx->Pixel.Convolution1DEnabled ||
703a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul       ctx->Pixel.Convolution2DEnabled ||
70445015e4d79d63183f6d9c4e4fad655921e07b0abBrian Paul       ctx->Pixel.Separable2DEnabled) {
705a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul      mask |= IMAGE_CONVOLUTION_BIT;
70645015e4d79d63183f6d9c4e4fad655921e07b0abBrian Paul      if (ctx->Pixel.PostConvolutionScale[0] != 1.0F ||
70745015e4d79d63183f6d9c4e4fad655921e07b0abBrian Paul          ctx->Pixel.PostConvolutionScale[1] != 1.0F ||
70845015e4d79d63183f6d9c4e4fad655921e07b0abBrian Paul          ctx->Pixel.PostConvolutionScale[2] != 1.0F ||
70945015e4d79d63183f6d9c4e4fad655921e07b0abBrian Paul          ctx->Pixel.PostConvolutionScale[3] != 1.0F ||
71045015e4d79d63183f6d9c4e4fad655921e07b0abBrian Paul          ctx->Pixel.PostConvolutionBias[0] != 0.0F ||
71145015e4d79d63183f6d9c4e4fad655921e07b0abBrian Paul          ctx->Pixel.PostConvolutionBias[1] != 0.0F ||
71245015e4d79d63183f6d9c4e4fad655921e07b0abBrian Paul          ctx->Pixel.PostConvolutionBias[2] != 0.0F ||
71345015e4d79d63183f6d9c4e4fad655921e07b0abBrian Paul          ctx->Pixel.PostConvolutionBias[3] != 0.0F) {
71445015e4d79d63183f6d9c4e4fad655921e07b0abBrian Paul         mask |= IMAGE_POST_CONVOLUTION_SCALE_BIAS;
71545015e4d79d63183f6d9c4e4fad655921e07b0abBrian Paul      }
71645015e4d79d63183f6d9c4e4fad655921e07b0abBrian Paul   }
717a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul
718a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul   if (ctx->Pixel.PostConvolutionColorTableEnabled)
719a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul      mask |= IMAGE_POST_CONVOLUTION_COLOR_TABLE_BIT;
720a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul
72130f51ae067379c2b3573c06b707d25a9704df7beBrian Paul   if (ctx->ColorMatrixStack.Top->type != MATRIX_IDENTITY ||
722a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul       ctx->Pixel.PostColorMatrixScale[0] != 1.0F ||
723a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul       ctx->Pixel.PostColorMatrixBias[0]  != 0.0F ||
724a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul       ctx->Pixel.PostColorMatrixScale[1] != 1.0F ||
725a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul       ctx->Pixel.PostColorMatrixBias[1]  != 0.0F ||
726a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul       ctx->Pixel.PostColorMatrixScale[2] != 1.0F ||
727a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul       ctx->Pixel.PostColorMatrixBias[2]  != 0.0F ||
728a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul       ctx->Pixel.PostColorMatrixScale[3] != 1.0F ||
729a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul       ctx->Pixel.PostColorMatrixBias[3]  != 0.0F)
730a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul      mask |= IMAGE_COLOR_MATRIX_BIT;
731a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul
732a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul   if (ctx->Pixel.PostColorMatrixColorTableEnabled)
733a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul      mask |= IMAGE_POST_COLOR_MATRIX_COLOR_TABLE_BIT;
734a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul
735a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul   if (ctx->Pixel.HistogramEnabled)
736a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul      mask |= IMAGE_HISTOGRAM_BIT;
737a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul
738a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul   if (ctx->Pixel.MinMaxEnabled)
739a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul      mask |= IMAGE_MIN_MAX_BIT;
740a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul
741a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul   ctx->_ImageTransferState = mask;
742a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul}
743a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul
7441e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell
7458e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul
7468e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul
7478e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul/* Note: This routine refers to derived texture attribute values to
7488e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul * compute the ENABLE_TEXMAT flags, but is only called on
7498e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul * _NEW_TEXTURE_MATRIX.  On changes to _NEW_TEXTURE, the ENABLE_TEXMAT
7508e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul * flags are updated by _mesa_update_textures(), below.
7518e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul *
7528e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul * If both TEXTURE and TEXTURE_MATRIX change at once, these values
7538e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul * will be computed twice.
7548e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul */
7558e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paulstatic void
7568e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paulupdate_texture_matrices( GLcontext *ctx )
7578e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul{
7588e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul   GLuint i;
7598e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul
760ed39a43b8cb2e1cf69b097fc89365cde470ebf51Keith Whitwell   ctx->Texture._TexMatEnabled = 0;
7618e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul
7628e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul   for (i=0; i < ctx->Const.MaxTextureUnits; i++) {
76330f51ae067379c2b3573c06b707d25a9704df7beBrian Paul      if (ctx->TextureMatrixStack[i].Top->flags & MAT_DIRTY) {
76430f51ae067379c2b3573c06b707d25a9704df7beBrian Paul	 _math_matrix_analyse( ctx->TextureMatrixStack[i].Top );
7658e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul
7668e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul	 if (ctx->Texture.Unit[i]._ReallyEnabled &&
76730f51ae067379c2b3573c06b707d25a9704df7beBrian Paul	     ctx->TextureMatrixStack[i].Top->type != MATRIX_IDENTITY)
768ed39a43b8cb2e1cf69b097fc89365cde470ebf51Keith Whitwell	    ctx->Texture._TexMatEnabled |= ENABLE_TEXMAT(i);
7690cb28418d06c30e431bdff515c1d36a812d5950dKeith Whitwell
7700cb28418d06c30e431bdff515c1d36a812d5950dKeith Whitwell	 if (ctx->Driver.TextureMatrix)
7710cb28418d06c30e431bdff515c1d36a812d5950dKeith Whitwell	    ctx->Driver.TextureMatrix( ctx, i, ctx->TextureMatrixStack[i].Top);
7728e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul      }
7738e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul   }
7748e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul}
7758e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul
7768e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul
7778e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul/* Note: This routine refers to derived texture matrix values to
7788e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul * compute the ENABLE_TEXMAT flags, but is only called on
7798e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul * _NEW_TEXTURE.  On changes to _NEW_TEXTURE_MATRIX, the ENABLE_TEXMAT
7808e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul * flags are updated by _mesa_update_texture_matrices, above.
7818e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul *
7828e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul * If both TEXTURE and TEXTURE_MATRIX change at once, these values
7838e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul * will be computed twice.
7848e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul */
7858e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paulstatic void
7868e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paulupdate_texture_state( GLcontext *ctx )
7878e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul{
7888afe7de8deaf3c9613fd68b344de8c52b02b1879Brian Paul   GLuint unit;
7898e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul
7908afe7de8deaf3c9613fd68b344de8c52b02b1879Brian Paul   ctx->Texture._EnabledUnits = 0;
7918e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul   ctx->Texture._GenFlags = 0;
7928e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul   ctx->_NeedNormals &= ~NEED_NORMALS_TEXGEN;
7938e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul   ctx->_NeedEyeCoords &= ~NEED_EYE_TEXGEN;
794ed39a43b8cb2e1cf69b097fc89365cde470ebf51Keith Whitwell   ctx->Texture._TexMatEnabled = 0;
795ed39a43b8cb2e1cf69b097fc89365cde470ebf51Keith Whitwell   ctx->Texture._TexGenEnabled = 0;
7968e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul
7978e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul   /* Update texture unit state.
7988e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul    */
7998afe7de8deaf3c9613fd68b344de8c52b02b1879Brian Paul   for (unit = 0; unit < ctx->Const.MaxTextureUnits; unit++) {
8008afe7de8deaf3c9613fd68b344de8c52b02b1879Brian Paul      struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
8018e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul
8028e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul      texUnit->_ReallyEnabled = 0;
8038e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul      texUnit->_GenFlags = 0;
8048e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul
8058e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul      if (!texUnit->Enabled)
8068e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul	 continue;
8078e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul
8088afe7de8deaf3c9613fd68b344de8c52b02b1879Brian Paul      /* Look for the highest-priority texture target that's enabled and
8098afe7de8deaf3c9613fd68b344de8c52b02b1879Brian Paul       * complete.  That's the one we'll use for texturing.
8108e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul       */
8118afe7de8deaf3c9613fd68b344de8c52b02b1879Brian Paul      if (texUnit->Enabled & TEXTURE_CUBE_BIT) {
8128e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul         struct gl_texture_object *texObj = texUnit->CurrentCubeMap;
8138e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul         if (!texObj->Complete) {
8148e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul            _mesa_test_texobj_completeness(ctx, texObj);
8158e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul         }
8168e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul         if (texObj->Complete) {
8178afe7de8deaf3c9613fd68b344de8c52b02b1879Brian Paul            texUnit->_ReallyEnabled = TEXTURE_CUBE_BIT;
8188e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul            texUnit->_Current = texObj;
8198e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul         }
8208e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul      }
8218e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul
8228afe7de8deaf3c9613fd68b344de8c52b02b1879Brian Paul      if (!texUnit->_ReallyEnabled && (texUnit->Enabled & TEXTURE_3D_BIT)) {
8238e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul         struct gl_texture_object *texObj = texUnit->Current3D;
8248e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul         if (!texObj->Complete) {
8258e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul            _mesa_test_texobj_completeness(ctx, texObj);
8268e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul         }
8278e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul         if (texObj->Complete) {
8288afe7de8deaf3c9613fd68b344de8c52b02b1879Brian Paul            texUnit->_ReallyEnabled = TEXTURE_3D_BIT;
8298e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul            texUnit->_Current = texObj;
8308e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul         }
8318e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul      }
8328e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul
8338afe7de8deaf3c9613fd68b344de8c52b02b1879Brian Paul      if (!texUnit->_ReallyEnabled && (texUnit->Enabled & TEXTURE_RECT_BIT)) {
8348afe7de8deaf3c9613fd68b344de8c52b02b1879Brian Paul         struct gl_texture_object *texObj = texUnit->CurrentRect;
8358afe7de8deaf3c9613fd68b344de8c52b02b1879Brian Paul         if (!texObj->Complete) {
8368afe7de8deaf3c9613fd68b344de8c52b02b1879Brian Paul            _mesa_test_texobj_completeness(ctx, texObj);
8378afe7de8deaf3c9613fd68b344de8c52b02b1879Brian Paul         }
8388afe7de8deaf3c9613fd68b344de8c52b02b1879Brian Paul         if (texObj->Complete) {
8398afe7de8deaf3c9613fd68b344de8c52b02b1879Brian Paul            texUnit->_ReallyEnabled = TEXTURE_RECT_BIT;
8408afe7de8deaf3c9613fd68b344de8c52b02b1879Brian Paul            texUnit->_Current = texObj;
8418afe7de8deaf3c9613fd68b344de8c52b02b1879Brian Paul         }
8428afe7de8deaf3c9613fd68b344de8c52b02b1879Brian Paul      }
8438afe7de8deaf3c9613fd68b344de8c52b02b1879Brian Paul
8448afe7de8deaf3c9613fd68b344de8c52b02b1879Brian Paul      if (!texUnit->_ReallyEnabled && (texUnit->Enabled & TEXTURE_2D_BIT)) {
8458e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul         struct gl_texture_object *texObj = texUnit->Current2D;
8468e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul         if (!texObj->Complete) {
8478e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul            _mesa_test_texobj_completeness(ctx, texObj);
8488e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul         }
8498e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul         if (texObj->Complete) {
8508afe7de8deaf3c9613fd68b344de8c52b02b1879Brian Paul            texUnit->_ReallyEnabled = TEXTURE_2D_BIT;
8518e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul            texUnit->_Current = texObj;
8528e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul         }
8538e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul      }
8548e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul
8558afe7de8deaf3c9613fd68b344de8c52b02b1879Brian Paul      if (!texUnit->_ReallyEnabled && (texUnit->Enabled & TEXTURE_1D_BIT)) {
8568e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul         struct gl_texture_object *texObj = texUnit->Current1D;
8578e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul         if (!texObj->Complete) {
8588e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul            _mesa_test_texobj_completeness(ctx, texObj);
8598e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul         }
8608e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul         if (texObj->Complete) {
8618afe7de8deaf3c9613fd68b344de8c52b02b1879Brian Paul            texUnit->_ReallyEnabled = TEXTURE_1D_BIT;
8628e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul            texUnit->_Current = texObj;
8638e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul         }
8648e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul      }
8658e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul
8668e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul      if (!texUnit->_ReallyEnabled) {
8678e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul	 texUnit->_Current = NULL;
8688e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul	 continue;
8698e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul      }
8708e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul
87159c5cf35c92e969f66eefd27809e72089b731701Brian Paul      if (texUnit->_ReallyEnabled)
87259c5cf35c92e969f66eefd27809e72089b731701Brian Paul         ctx->Texture._EnabledUnits |= (1 << unit);
8738e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul
8748e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul      if (texUnit->TexGenEnabled) {
8758e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul	 if (texUnit->TexGenEnabled & S_BIT) {
8768e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul	    texUnit->_GenFlags |= texUnit->_GenBitS;
8778e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul	 }
8788e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul	 if (texUnit->TexGenEnabled & T_BIT) {
8798e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul	    texUnit->_GenFlags |= texUnit->_GenBitT;
8808e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul	 }
8818e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul	 if (texUnit->TexGenEnabled & Q_BIT) {
8828e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul	    texUnit->_GenFlags |= texUnit->_GenBitQ;
8838e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul	 }
8848e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul	 if (texUnit->TexGenEnabled & R_BIT) {
8858e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul	    texUnit->_GenFlags |= texUnit->_GenBitR;
8868e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul	 }
8878e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul
8888afe7de8deaf3c9613fd68b344de8c52b02b1879Brian Paul	 ctx->Texture._TexGenEnabled |= ENABLE_TEXGEN(unit);
8898e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul	 ctx->Texture._GenFlags |= texUnit->_GenFlags;
8908e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul      }
8918e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul
8928afe7de8deaf3c9613fd68b344de8c52b02b1879Brian Paul      if (ctx->TextureMatrixStack[unit].Top->type != MATRIX_IDENTITY)
8938afe7de8deaf3c9613fd68b344de8c52b02b1879Brian Paul	 ctx->Texture._TexMatEnabled |= ENABLE_TEXMAT(unit);
8948e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul   }
8958e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul
8968e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul   if (ctx->Texture._GenFlags & TEXGEN_NEED_NORMALS) {
8978e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul      ctx->_NeedNormals |= NEED_NORMALS_TEXGEN;
8988e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul      ctx->_NeedEyeCoords |= NEED_EYE_TEXGEN;
8998e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul   }
9008e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul
9018e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul   if (ctx->Texture._GenFlags & TEXGEN_NEED_EYE_COORD) {
9028e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul      ctx->_NeedEyeCoords |= NEED_EYE_TEXGEN;
9038e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul   }
9048e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul}
9058e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul
9068e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul
9070cb28418d06c30e431bdff515c1d36a812d5950dKeith Whitwell
9081e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell/*
9091e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell * If ctx->NewState is non-zero then this function MUST be called before
9101e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell * rendering any primitive.  Basically, function pointers and miscellaneous
9111e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell * flags are updated to reflect the current state of the state machine.
9121e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell *
913cab974cf6c2dbfbf5dd5d291e1aae0f8eeb34290Keith Whitwell * The above constraint is now maintained largely by the two Exec
914cab974cf6c2dbfbf5dd5d291e1aae0f8eeb34290Keith Whitwell * dispatch tables, which trigger the appropriate flush on transition
915cab974cf6c2dbfbf5dd5d291e1aae0f8eeb34290Keith Whitwell * between State and Geometry modes.
916cab974cf6c2dbfbf5dd5d291e1aae0f8eeb34290Keith Whitwell *
917cab974cf6c2dbfbf5dd5d291e1aae0f8eeb34290Keith Whitwell * Special care is taken with the derived value _NeedEyeCoords.  This
9181e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell * is a bitflag which is updated with information from a number of
9191e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell * attribute groups (MODELVIEW, LIGHT, TEXTURE).  A lot of derived
9201e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell * state references this value, and must be treated with care to
9211e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell * ensure that updates are done correctly.  All state dependent on
9221e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell * _NeedEyeCoords is calculated from within _mesa_update_tnl_spaces(),
92322144ab7552f0799bcfca506bf4ffa7f70a06649Gareth Hughes * and from nowhere else.
9241e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell */
92508836341788a9f9d638d9dc8328510ccd18ddeb5Brian Paulvoid _mesa_update_state( GLcontext *ctx )
9261e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell{
927479fa1db1dc7cb8e48219ac28edfb2f2a9c971b2Brian Paul   const GLuint new_state = ctx->NewState;
928479fa1db1dc7cb8e48219ac28edfb2f2a9c971b2Brian Paul   const GLuint oldneedeyecoords = ctx->_NeedEyeCoords;
9291e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell
9301e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell   if (MESA_VERBOSE & VERBOSE_STATE)
931306d3fcdbad523428501833405e47e9897896defKeith Whitwell      _mesa_print_state("_mesa_update_state", new_state);
9321e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell
9335e3bc0c2a2bcdf59949410f94c9b705fc1281ce8Jouk Jansen   if (new_state & _NEW_MODELVIEW)
93430f51ae067379c2b3573c06b707d25a9704df7beBrian Paul      _math_matrix_analyse( ctx->ModelviewMatrixStack.Top );
9351e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell
9365e3bc0c2a2bcdf59949410f94c9b705fc1281ce8Jouk Jansen   if (new_state & _NEW_PROJECTION)
937a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul      update_projection( ctx );
938d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul
9395e3bc0c2a2bcdf59949410f94c9b705fc1281ce8Jouk Jansen   if (new_state & _NEW_TEXTURE_MATRIX)
9408e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul      update_texture_matrices( ctx );
9411e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell
9425e3bc0c2a2bcdf59949410f94c9b705fc1281ce8Jouk Jansen   if (new_state & _NEW_COLOR_MATRIX)
94330f51ae067379c2b3573c06b707d25a9704df7beBrian Paul      _math_matrix_analyse( ctx->ColorMatrixStack.Top );
9445e3bc0c2a2bcdf59949410f94c9b705fc1281ce8Jouk Jansen
9451e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell   /* References ColorMatrix.type (derived above).
9461e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell    */
947cab974cf6c2dbfbf5dd5d291e1aae0f8eeb34290Keith Whitwell   if (new_state & _IMAGE_NEW_TRANSFER_STATE)
948a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul      update_image_transfer_state(ctx);
9491e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell
9501e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell   /* Contributes to NeedEyeCoords, NeedNormals.
951d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul    */
9525e3bc0c2a2bcdf59949410f94c9b705fc1281ce8Jouk Jansen   if (new_state & _NEW_TEXTURE)
9538e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul      update_texture_state( ctx );
954d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul
9555e3bc0c2a2bcdf59949410f94c9b705fc1281ce8Jouk Jansen   if (new_state & (_NEW_BUFFERS|_NEW_SCISSOR))
956a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul      update_drawbuffer( ctx );
957d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul
9585e3bc0c2a2bcdf59949410f94c9b705fc1281ce8Jouk Jansen   if (new_state & _NEW_POLYGON)
959a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul      update_polygon( ctx );
960d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul
9611e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell   /* Contributes to NeedEyeCoords, NeedNormals.
9621e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell    */
9635e3bc0c2a2bcdf59949410f94c9b705fc1281ce8Jouk Jansen   if (new_state & _NEW_LIGHT)
96408836341788a9f9d638d9dc8328510ccd18ddeb5Brian Paul      _mesa_update_lighting( ctx );
965d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul
9661e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell   /* We can light in object space if the modelview matrix preserves
9671e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell    * lengths and relative angles.
9681e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell    */
9691e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell   if (new_state & (_NEW_MODELVIEW|_NEW_LIGHT)) {
9701e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell      ctx->_NeedEyeCoords &= ~NEED_EYE_LIGHT_MODELVIEW;
9711e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell      if (ctx->Light.Enabled &&
97230f51ae067379c2b3573c06b707d25a9704df7beBrian Paul	  !TEST_MAT_FLAGS( ctx->ModelviewMatrixStack.Top, MAT_FLAGS_LENGTH_PRESERVING))
9731e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell	    ctx->_NeedEyeCoords |= NEED_EYE_LIGHT_MODELVIEW;
9741e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell   }
975d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul
9760cb28418d06c30e431bdff515c1d36a812d5950dKeith Whitwell
9770cb28418d06c30e431bdff515c1d36a812d5950dKeith Whitwell#if 0
978c6755aa6d55493a000644ba74233387d408d070fBrian Paul   /* XXX this is a bit of a hack.  We should be checking elsewhere if
979c6755aa6d55493a000644ba74233387d408d070fBrian Paul    * vertex program mode is enabled.  We set _NeedEyeCoords to zero to
980c6755aa6d55493a000644ba74233387d408d070fBrian Paul    * ensure that the combined modelview/projection matrix is computed
981c6755aa6d55493a000644ba74233387d408d070fBrian Paul    * in calculate_model_project_matrix().
982c6755aa6d55493a000644ba74233387d408d070fBrian Paul    */
983c6755aa6d55493a000644ba74233387d408d070fBrian Paul   if (ctx->VertexProgram.Enabled)
984c6755aa6d55493a000644ba74233387d408d070fBrian Paul      ctx->_NeedEyeCoords = 0;
9850cb28418d06c30e431bdff515c1d36a812d5950dKeith Whitwell   /* KW: it's now always computed.
9860cb28418d06c30e431bdff515c1d36a812d5950dKeith Whitwell    */
9870cb28418d06c30e431bdff515c1d36a812d5950dKeith Whitwell#endif
9880cb28418d06c30e431bdff515c1d36a812d5950dKeith Whitwell
9890cb28418d06c30e431bdff515c1d36a812d5950dKeith Whitwell   /* Keep ModelviewProject uptodate always to allow tnl
9900cb28418d06c30e431bdff515c1d36a812d5950dKeith Whitwell    * implementations that go model->clip even when eye is required.
9910cb28418d06c30e431bdff515c1d36a812d5950dKeith Whitwell    */
9920cb28418d06c30e431bdff515c1d36a812d5950dKeith Whitwell   if (new_state & (_NEW_MODELVIEW|_NEW_PROJECTION))
9930cb28418d06c30e431bdff515c1d36a812d5950dKeith Whitwell      calculate_model_project_matrix(ctx);
99406d05afdd687fcd1d59d46c6a86c2e5707e1859bBrian Paul
995cab974cf6c2dbfbf5dd5d291e1aae0f8eeb34290Keith Whitwell   /* ctx->_NeedEyeCoords is now uptodate.
9961e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell    *
997cab974cf6c2dbfbf5dd5d291e1aae0f8eeb34290Keith Whitwell    * If the truth value of this variable has changed, update for the
998cab974cf6c2dbfbf5dd5d291e1aae0f8eeb34290Keith Whitwell    * new lighting space and recompute the positions of lights and the
9991e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell    * normal transform.
10005e3bc0c2a2bcdf59949410f94c9b705fc1281ce8Jouk Jansen    *
10011e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell    * If the lighting space hasn't changed, may still need to recompute
100222144ab7552f0799bcfca506bf4ffa7f70a06649Gareth Hughes    * light positions & normal transforms for other reasons.
10031e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell    */
10041e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell   if (new_state & (_NEW_MODELVIEW |
10051e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell		    _NEW_LIGHT |
1006cab974cf6c2dbfbf5dd5d291e1aae0f8eeb34290Keith Whitwell		    _MESA_NEW_NEED_EYE_COORDS))
1007a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul      update_tnl_spaces( ctx, oldneedeyecoords );
10081e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell
100923caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   /*
101023caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell    * Here the driver sets up all the ctx->Driver function pointers
101123caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell    * to it's specific, private functions, and performs any
101223caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell    * internal state management necessary, including invalidating
101323caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell    * state of active modules.
1014cab974cf6c2dbfbf5dd5d291e1aae0f8eeb34290Keith Whitwell    *
1015cab974cf6c2dbfbf5dd5d291e1aae0f8eeb34290Keith Whitwell    * Set ctx->NewState to zero to avoid recursion if
1016cab974cf6c2dbfbf5dd5d291e1aae0f8eeb34290Keith Whitwell    * Driver.UpdateState() has to call FLUSH_VERTICES().  (fixed?)
101723caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell    */
1018d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   ctx->NewState = 0;
1019cab974cf6c2dbfbf5dd5d291e1aae0f8eeb34290Keith Whitwell   ctx->Driver.UpdateState(ctx, new_state);
10202448fc7deeaa870d879de17158f243f239c05b15Keith Whitwell   ctx->Array.NewState = 0;
1021479fa1db1dc7cb8e48219ac28edfb2f2a9c971b2Brian Paul
10222448fc7deeaa870d879de17158f243f239c05b15Keith Whitwell   /* At this point we can do some assertions to be sure the required
102322144ab7552f0799bcfca506bf4ffa7f70a06649Gareth Hughes    * device driver function pointers are all initialized.
1024479fa1db1dc7cb8e48219ac28edfb2f2a9c971b2Brian Paul    */
10252448fc7deeaa870d879de17158f243f239c05b15Keith Whitwell   ASSERT(ctx->Driver.GetString);
10262448fc7deeaa870d879de17158f243f239c05b15Keith Whitwell   ASSERT(ctx->Driver.UpdateState);
10272448fc7deeaa870d879de17158f243f239c05b15Keith Whitwell   ASSERT(ctx->Driver.Clear);
10282448fc7deeaa870d879de17158f243f239c05b15Keith Whitwell   ASSERT(ctx->Driver.GetBufferSize);
1029479fa1db1dc7cb8e48219ac28edfb2f2a9c971b2Brian Paul   if (ctx->Visual.accumRedBits > 0) {
10302448fc7deeaa870d879de17158f243f239c05b15Keith Whitwell      ASSERT(ctx->Driver.Accum);
1031479fa1db1dc7cb8e48219ac28edfb2f2a9c971b2Brian Paul   }
10322448fc7deeaa870d879de17158f243f239c05b15Keith Whitwell   ASSERT(ctx->Driver.DrawPixels);
10332448fc7deeaa870d879de17158f243f239c05b15Keith Whitwell   ASSERT(ctx->Driver.ReadPixels);
10342448fc7deeaa870d879de17158f243f239c05b15Keith Whitwell   ASSERT(ctx->Driver.CopyPixels);
10352448fc7deeaa870d879de17158f243f239c05b15Keith Whitwell   ASSERT(ctx->Driver.Bitmap);
1036f7c830e35ca243c391bde1bfd0ae059c292ac649Brian Paul   ASSERT(ctx->Driver.ResizeBuffers);
10372448fc7deeaa870d879de17158f243f239c05b15Keith Whitwell   ASSERT(ctx->Driver.TexImage1D);
10382448fc7deeaa870d879de17158f243f239c05b15Keith Whitwell   ASSERT(ctx->Driver.TexImage2D);
10392448fc7deeaa870d879de17158f243f239c05b15Keith Whitwell   ASSERT(ctx->Driver.TexImage3D);
10402448fc7deeaa870d879de17158f243f239c05b15Keith Whitwell   ASSERT(ctx->Driver.TexSubImage1D);
10412448fc7deeaa870d879de17158f243f239c05b15Keith Whitwell   ASSERT(ctx->Driver.TexSubImage2D);
10422448fc7deeaa870d879de17158f243f239c05b15Keith Whitwell   ASSERT(ctx->Driver.TexSubImage3D);
1043c499ce31baf820e84d133c2189f88e15a1a36672Brian Paul   ASSERT(ctx->Driver.CopyTexImage1D);
1044c499ce31baf820e84d133c2189f88e15a1a36672Brian Paul   ASSERT(ctx->Driver.CopyTexImage2D);
1045c499ce31baf820e84d133c2189f88e15a1a36672Brian Paul   ASSERT(ctx->Driver.CopyTexSubImage1D);
1046c499ce31baf820e84d133c2189f88e15a1a36672Brian Paul   ASSERT(ctx->Driver.CopyTexSubImage2D);
1047c499ce31baf820e84d133c2189f88e15a1a36672Brian Paul   ASSERT(ctx->Driver.CopyTexSubImage3D);
1048479fa1db1dc7cb8e48219ac28edfb2f2a9c971b2Brian Paul   if (ctx->Extensions.ARB_texture_compression) {
1049e4276667dafc8de0c6e64af8300fc7598437de6eBrian Paul#if 0  /* HW drivers need these, but not SW rasterizers */
10502448fc7deeaa870d879de17158f243f239c05b15Keith Whitwell      ASSERT(ctx->Driver.CompressedTexImage1D);
10512448fc7deeaa870d879de17158f243f239c05b15Keith Whitwell      ASSERT(ctx->Driver.CompressedTexImage2D);
10522448fc7deeaa870d879de17158f243f239c05b15Keith Whitwell      ASSERT(ctx->Driver.CompressedTexImage3D);
10532448fc7deeaa870d879de17158f243f239c05b15Keith Whitwell      ASSERT(ctx->Driver.CompressedTexSubImage1D);
10542448fc7deeaa870d879de17158f243f239c05b15Keith Whitwell      ASSERT(ctx->Driver.CompressedTexSubImage2D);
10552448fc7deeaa870d879de17158f243f239c05b15Keith Whitwell      ASSERT(ctx->Driver.CompressedTexSubImage3D);
1056e4276667dafc8de0c6e64af8300fc7598437de6eBrian Paul#endif
1057479fa1db1dc7cb8e48219ac28edfb2f2a9c971b2Brian Paul   }
1058d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul}
10590cb28418d06c30e431bdff515c1d36a812d5950dKeith Whitwell
10600cb28418d06c30e431bdff515c1d36a812d5950dKeith Whitwell/* Is this helpful?
10610cb28418d06c30e431bdff515c1d36a812d5950dKeith Whitwell */
10620cb28418d06c30e431bdff515c1d36a812d5950dKeith Whitwellvoid
10630cb28418d06c30e431bdff515c1d36a812d5950dKeith Whitwell_mesa_allow_light_in_model( GLcontext *ctx, GLboolean flag )
10640cb28418d06c30e431bdff515c1d36a812d5950dKeith Whitwell{
10650cb28418d06c30e431bdff515c1d36a812d5950dKeith Whitwell   if (flag)
10660cb28418d06c30e431bdff515c1d36a812d5950dKeith Whitwell      ctx->_NeedEyeCoords &= ~NEED_EYE_DRIVER;
10670cb28418d06c30e431bdff515c1d36a812d5950dKeith Whitwell   else
10680cb28418d06c30e431bdff515c1d36a812d5950dKeith Whitwell      ctx->_NeedEyeCoords |= NEED_EYE_DRIVER;
10690cb28418d06c30e431bdff515c1d36a812d5950dKeith Whitwell
10700cb28418d06c30e431bdff515c1d36a812d5950dKeith Whitwell   ctx->NewState |= _NEW_POINT;	/* one of the bits from
10710cb28418d06c30e431bdff515c1d36a812d5950dKeith Whitwell				 * _MESA_NEW_NEED_EYE_COORDS.
10720cb28418d06c30e431bdff515c1d36a812d5950dKeith Whitwell				 */
10730cb28418d06c30e431bdff515c1d36a812d5950dKeith Whitwell}
1074