state.c revision 1043a6498a7f94922be5f4b5deac89fd05cfa670
11043a6498a7f94922be5f4b5deac89fd05cfa670Brian Paul/* $Id: state.c,v 1.86 2002/06/16 01:14:22 brianp Exp $ */
2d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul
3d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul/*
4d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul * Mesa 3-D graphics library
55b7dab2e4c7df1fde0a7fcf28b8b54745b9fcd2eBrian Paul * Version:  4.1
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#ifdef PC_HEADER
35d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul#include "all.h"
36d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul#else
37d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul#include "glheader.h"
38d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul#include "accum.h"
39ad2ac216fa0cbebc36530bf9e5256e902710b892Keith Whitwell#include "api_loopback.h"
40d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul#include "attrib.h"
41d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul#include "blend.h"
42d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul#include "buffers.h"
43d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul#include "clip.h"
44d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul#include "colortab.h"
45d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul#include "context.h"
46cf8eebee075e3f69c3daa4ea88994e07527055e4Brian Paul#include "convolve.h"
47d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul#include "depth.h"
48d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul#include "dlist.h"
49d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul#include "drawpix.h"
50d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul#include "enable.h"
51d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul#include "eval.h"
52d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul#include "get.h"
53d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul#include "feedback.h"
54d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul#include "fog.h"
55d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul#include "hint.h"
568a9507442a9811e2c4a4bac6a993e8a900c50d4dBrian Paul#include "histogram.h"
57d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul#include "light.h"
58d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul#include "lines.h"
59d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul#include "matrix.h"
60d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul#include "mmath.h"
61d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul#include "pixel.h"
62d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul#include "points.h"
63d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul#include "polygon.h"
64d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul#include "rastpos.h"
65d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul#include "state.h"
66d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul#include "stencil.h"
67d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul#include "teximage.h"
68d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul#include "texobj.h"
69d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul#include "texstate.h"
705e3bc0c2a2bcdf59949410f94c9b705fc1281ce8Jouk Jansen#include "mtypes.h"
71d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul#include "varray.h"
7286b842790b720cd6b1499ce8edca8a4e9c8dc029Brian Paul#include "vpstate.h"
7323caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell
7423caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell#include "math/m_matrix.h"
7523caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell#include "math/m_xform.h"
76d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul#endif
77d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul
78d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul
79d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paulstatic int
80d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paulgeneric_noop(void)
81d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul{
82d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul#ifdef DEBUG
8308836341788a9f9d638d9dc8328510ccd18ddeb5Brian Paul   _mesa_problem(NULL, "undefined function dispatch");
84d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul#endif
85d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   return 0;
86d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul}
87d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul
88d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul
895fb84d263b8068467a2429942ecf113a0a4c8a60Brian Paul/*
905fb84d263b8068467a2429942ecf113a0a4c8a60Brian Paul * Set all pointers in the given dispatch table to point to a
915fb84d263b8068467a2429942ecf113a0a4c8a60Brian Paul * generic no-op function.
925fb84d263b8068467a2429942ecf113a0a4c8a60Brian Paul */
93d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paulvoid
945fb84d263b8068467a2429942ecf113a0a4c8a60Brian Paul_mesa_init_no_op_table(struct _glapi_table *table, GLuint tableSize)
95d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul{
965fb84d263b8068467a2429942ecf113a0a4c8a60Brian Paul   GLuint i;
975fb84d263b8068467a2429942ecf113a0a4c8a60Brian Paul   void **dispatch = (void **) table;
985fb84d263b8068467a2429942ecf113a0a4c8a60Brian Paul   for (i = 0; i < tableSize; i++) {
995fb84d263b8068467a2429942ecf113a0a4c8a60Brian Paul      dispatch[i] = (void *) generic_noop;
100d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   }
101d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul}
102d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul
103d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul
104cab974cf6c2dbfbf5dd5d291e1aae0f8eeb34290Keith Whitwell
105d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul/*
106d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul * Initialize the given dispatch table with pointers to Mesa's
107d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul * immediate-mode commands.
108ad2ac216fa0cbebc36530bf9e5256e902710b892Keith Whitwell *
109ad2ac216fa0cbebc36530bf9e5256e902710b892Keith Whitwell * Pointers to begin/end object commands and a few others
110ad2ac216fa0cbebc36530bf9e5256e902710b892Keith Whitwell * are provided via the vtxfmt interface elsewhere.
111d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul */
112d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paulvoid
1135fb84d263b8068467a2429942ecf113a0a4c8a60Brian Paul_mesa_init_exec_table(struct _glapi_table *exec, GLuint tableSize)
114d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul{
115d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   /* first initialize all dispatch slots to no-op */
1165fb84d263b8068467a2429942ecf113a0a4c8a60Brian Paul   _mesa_init_no_op_table(exec, tableSize);
117d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul
1188b6a91a93f1b3f79796f398884aaca77a8a09198Keith Whitwell   _mesa_loopback_init_api_table( exec, GL_TRUE );
119ad2ac216fa0cbebc36530bf9e5256e902710b892Keith Whitwell
120d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   /* load the dispatch slots we understand */
121d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->Accum = _mesa_Accum;
122d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->AlphaFunc = _mesa_AlphaFunc;
123d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->Bitmap = _mesa_Bitmap;
124d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->BlendFunc = _mesa_BlendFunc;
125d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->CallList = _mesa_CallList;
126d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->CallLists = _mesa_CallLists;
127d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->Clear = _mesa_Clear;
128d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->ClearAccum = _mesa_ClearAccum;
129d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->ClearColor = _mesa_ClearColor;
130d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->ClearDepth = _mesa_ClearDepth;
131d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->ClearIndex = _mesa_ClearIndex;
132d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->ClearStencil = _mesa_ClearStencil;
133d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->ClipPlane = _mesa_ClipPlane;
134d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->ColorMask = _mesa_ColorMask;
135d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->ColorMaterial = _mesa_ColorMaterial;
136d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->CopyPixels = _mesa_CopyPixels;
137d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->CullFace = _mesa_CullFace;
138d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->DeleteLists = _mesa_DeleteLists;
139d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->DepthFunc = _mesa_DepthFunc;
140d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->DepthMask = _mesa_DepthMask;
141d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->DepthRange = _mesa_DepthRange;
142d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->Disable = _mesa_Disable;
143d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->DrawBuffer = _mesa_DrawBuffer;
144d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->DrawPixels = _mesa_DrawPixels;
145d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->Enable = _mesa_Enable;
146d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->EndList = _mesa_EndList;
147d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->FeedbackBuffer = _mesa_FeedbackBuffer;
148d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->Finish = _mesa_Finish;
149d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->Flush = _mesa_Flush;
150fe5d67d95f3a5fc84c5421d409a6464642aaf2cbKeith Whitwell   exec->FogCoordPointerEXT = _mesa_FogCoordPointerEXT;
151d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->Fogf = _mesa_Fogf;
152d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->Fogfv = _mesa_Fogfv;
153d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->Fogi = _mesa_Fogi;
154d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->Fogiv = _mesa_Fogiv;
155d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->FrontFace = _mesa_FrontFace;
156d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->Frustum = _mesa_Frustum;
157d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->GenLists = _mesa_GenLists;
158d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->GetBooleanv = _mesa_GetBooleanv;
159d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->GetClipPlane = _mesa_GetClipPlane;
160d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->GetDoublev = _mesa_GetDoublev;
161d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->GetError = _mesa_GetError;
162d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->GetFloatv = _mesa_GetFloatv;
163d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->GetIntegerv = _mesa_GetIntegerv;
164d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->GetLightfv = _mesa_GetLightfv;
165d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->GetLightiv = _mesa_GetLightiv;
166d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->GetMapdv = _mesa_GetMapdv;
167d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->GetMapfv = _mesa_GetMapfv;
168d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->GetMapiv = _mesa_GetMapiv;
169d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->GetMaterialfv = _mesa_GetMaterialfv;
170d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->GetMaterialiv = _mesa_GetMaterialiv;
171d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->GetPixelMapfv = _mesa_GetPixelMapfv;
172d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->GetPixelMapuiv = _mesa_GetPixelMapuiv;
173d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->GetPixelMapusv = _mesa_GetPixelMapusv;
174d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->GetPolygonStipple = _mesa_GetPolygonStipple;
175d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->GetString = _mesa_GetString;
176d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->GetTexEnvfv = _mesa_GetTexEnvfv;
177d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->GetTexEnviv = _mesa_GetTexEnviv;
178d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->GetTexGendv = _mesa_GetTexGendv;
179d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->GetTexGenfv = _mesa_GetTexGenfv;
180d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->GetTexGeniv = _mesa_GetTexGeniv;
181d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->GetTexImage = _mesa_GetTexImage;
182d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->GetTexLevelParameterfv = _mesa_GetTexLevelParameterfv;
183d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->GetTexLevelParameteriv = _mesa_GetTexLevelParameteriv;
184d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->GetTexParameterfv = _mesa_GetTexParameterfv;
185d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->GetTexParameteriv = _mesa_GetTexParameteriv;
186d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->Hint = _mesa_Hint;
187d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->IndexMask = _mesa_IndexMask;
188d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->InitNames = _mesa_InitNames;
189d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->IsEnabled = _mesa_IsEnabled;
190d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->IsList = _mesa_IsList;
191d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->LightModelf = _mesa_LightModelf;
192d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->LightModelfv = _mesa_LightModelfv;
193d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->LightModeli = _mesa_LightModeli;
194d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->LightModeliv = _mesa_LightModeliv;
195d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->Lightf = _mesa_Lightf;
196d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->Lightfv = _mesa_Lightfv;
197d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->Lighti = _mesa_Lighti;
198d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->Lightiv = _mesa_Lightiv;
199d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->LineStipple = _mesa_LineStipple;
200d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->LineWidth = _mesa_LineWidth;
201d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->ListBase = _mesa_ListBase;
202d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->LoadIdentity = _mesa_LoadIdentity;
203d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->LoadMatrixd = _mesa_LoadMatrixd;
204d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->LoadMatrixf = _mesa_LoadMatrixf;
205d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->LoadName = _mesa_LoadName;
206d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->LogicOp = _mesa_LogicOp;
207d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->Map1d = _mesa_Map1d;
208d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->Map1f = _mesa_Map1f;
209d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->Map2d = _mesa_Map2d;
210d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->Map2f = _mesa_Map2f;
211d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->MapGrid1d = _mesa_MapGrid1d;
212d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->MapGrid1f = _mesa_MapGrid1f;
213d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->MapGrid2d = _mesa_MapGrid2d;
214d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->MapGrid2f = _mesa_MapGrid2f;
215d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->MatrixMode = _mesa_MatrixMode;
216d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->MultMatrixd = _mesa_MultMatrixd;
217d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->MultMatrixf = _mesa_MultMatrixf;
218d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->NewList = _mesa_NewList;
219d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->Ortho = _mesa_Ortho;
220d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->PassThrough = _mesa_PassThrough;
221d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->PixelMapfv = _mesa_PixelMapfv;
222d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->PixelMapuiv = _mesa_PixelMapuiv;
223d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->PixelMapusv = _mesa_PixelMapusv;
224d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->PixelStoref = _mesa_PixelStoref;
225d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->PixelStorei = _mesa_PixelStorei;
226d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->PixelTransferf = _mesa_PixelTransferf;
227d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->PixelTransferi = _mesa_PixelTransferi;
228d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->PixelZoom = _mesa_PixelZoom;
229d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->PointSize = _mesa_PointSize;
230d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->PolygonMode = _mesa_PolygonMode;
231d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->PolygonOffset = _mesa_PolygonOffset;
232d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->PolygonStipple = _mesa_PolygonStipple;
233d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->PopAttrib = _mesa_PopAttrib;
234d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->PopMatrix = _mesa_PopMatrix;
235d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->PopName = _mesa_PopName;
236d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->PushAttrib = _mesa_PushAttrib;
237d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->PushMatrix = _mesa_PushMatrix;
238d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->PushName = _mesa_PushName;
239d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->RasterPos2d = _mesa_RasterPos2d;
240d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->RasterPos2dv = _mesa_RasterPos2dv;
241d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->RasterPos2f = _mesa_RasterPos2f;
242d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->RasterPos2fv = _mesa_RasterPos2fv;
243d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->RasterPos2i = _mesa_RasterPos2i;
244d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->RasterPos2iv = _mesa_RasterPos2iv;
245d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->RasterPos2s = _mesa_RasterPos2s;
246d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->RasterPos2sv = _mesa_RasterPos2sv;
247d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->RasterPos3d = _mesa_RasterPos3d;
248d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->RasterPos3dv = _mesa_RasterPos3dv;
249d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->RasterPos3f = _mesa_RasterPos3f;
250d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->RasterPos3fv = _mesa_RasterPos3fv;
251d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->RasterPos3i = _mesa_RasterPos3i;
252d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->RasterPos3iv = _mesa_RasterPos3iv;
253d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->RasterPos3s = _mesa_RasterPos3s;
254d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->RasterPos3sv = _mesa_RasterPos3sv;
255d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->RasterPos4d = _mesa_RasterPos4d;
256d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->RasterPos4dv = _mesa_RasterPos4dv;
257d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->RasterPos4f = _mesa_RasterPos4f;
258d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->RasterPos4fv = _mesa_RasterPos4fv;
259d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->RasterPos4i = _mesa_RasterPos4i;
260d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->RasterPos4iv = _mesa_RasterPos4iv;
261d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->RasterPos4s = _mesa_RasterPos4s;
262d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->RasterPos4sv = _mesa_RasterPos4sv;
263d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->ReadBuffer = _mesa_ReadBuffer;
264d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->ReadPixels = _mesa_ReadPixels;
265d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->RenderMode = _mesa_RenderMode;
266d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->Rotated = _mesa_Rotated;
267d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->Rotatef = _mesa_Rotatef;
268d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->Scaled = _mesa_Scaled;
269d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->Scalef = _mesa_Scalef;
270d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->Scissor = _mesa_Scissor;
271fe5d67d95f3a5fc84c5421d409a6464642aaf2cbKeith Whitwell   exec->SecondaryColorPointerEXT = _mesa_SecondaryColorPointerEXT;
272d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->SelectBuffer = _mesa_SelectBuffer;
273d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->ShadeModel = _mesa_ShadeModel;
274d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->StencilFunc = _mesa_StencilFunc;
275d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->StencilMask = _mesa_StencilMask;
276d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->StencilOp = _mesa_StencilOp;
277d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->TexEnvf = _mesa_TexEnvf;
278d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->TexEnvfv = _mesa_TexEnvfv;
279d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->TexEnvi = _mesa_TexEnvi;
280d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->TexEnviv = _mesa_TexEnviv;
281d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->TexGend = _mesa_TexGend;
282d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->TexGendv = _mesa_TexGendv;
283d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->TexGenf = _mesa_TexGenf;
284d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->TexGenfv = _mesa_TexGenfv;
285d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->TexGeni = _mesa_TexGeni;
286d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->TexGeniv = _mesa_TexGeniv;
287d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->TexImage1D = _mesa_TexImage1D;
288d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->TexImage2D = _mesa_TexImage2D;
289d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->TexParameterf = _mesa_TexParameterf;
290d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->TexParameterfv = _mesa_TexParameterfv;
291d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->TexParameteri = _mesa_TexParameteri;
292d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->TexParameteriv = _mesa_TexParameteriv;
293d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->Translated = _mesa_Translated;
294d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->Translatef = _mesa_Translatef;
295d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->Viewport = _mesa_Viewport;
296d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul
297d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   /* 1.1 */
298d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->AreTexturesResident = _mesa_AreTexturesResident;
299d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->BindTexture = _mesa_BindTexture;
300d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->ColorPointer = _mesa_ColorPointer;
301d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->CopyTexImage1D = _mesa_CopyTexImage1D;
302d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->CopyTexImage2D = _mesa_CopyTexImage2D;
303d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->CopyTexSubImage1D = _mesa_CopyTexSubImage1D;
304d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->CopyTexSubImage2D = _mesa_CopyTexSubImage2D;
305d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->DeleteTextures = _mesa_DeleteTextures;
306d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->DisableClientState = _mesa_DisableClientState;
307d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->EdgeFlagPointer = _mesa_EdgeFlagPointer;
308d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->EnableClientState = _mesa_EnableClientState;
309d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->GenTextures = _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;
314d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->NormalPointer = _mesa_NormalPointer;
315d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->PopClientAttrib = _mesa_PopClientAttrib;
316d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->PrioritizeTextures = _mesa_PrioritizeTextures;
317d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->PushClientAttrib = _mesa_PushClientAttrib;
318d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->TexCoordPointer = _mesa_TexCoordPointer;
319d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->TexSubImage1D = _mesa_TexSubImage1D;
320d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->TexSubImage2D = _mesa_TexSubImage2D;
321d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->VertexPointer = _mesa_VertexPointer;
322d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul
323d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   /* 1.2 */
324d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->CopyTexSubImage3D = _mesa_CopyTexSubImage3D;
325d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->TexImage3D = _mesa_TexImage3D;
326d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->TexSubImage3D = _mesa_TexSubImage3D;
327d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul
328d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   /* OpenGL 1.2  GL_ARB_imaging */
329d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->BlendColor = _mesa_BlendColor;
330d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->BlendEquation = _mesa_BlendEquation;
331d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->ColorSubTable = _mesa_ColorSubTable;
332d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->ColorTable = _mesa_ColorTable;
333d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->ColorTableParameterfv = _mesa_ColorTableParameterfv;
334d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->ColorTableParameteriv = _mesa_ColorTableParameteriv;
335d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->ConvolutionFilter1D = _mesa_ConvolutionFilter1D;
336d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->ConvolutionFilter2D = _mesa_ConvolutionFilter2D;
337d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->ConvolutionParameterf = _mesa_ConvolutionParameterf;
338d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->ConvolutionParameterfv = _mesa_ConvolutionParameterfv;
339d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->ConvolutionParameteri = _mesa_ConvolutionParameteri;
340d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->ConvolutionParameteriv = _mesa_ConvolutionParameteriv;
341d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->CopyColorSubTable = _mesa_CopyColorSubTable;
342d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->CopyColorTable = _mesa_CopyColorTable;
343d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->CopyConvolutionFilter1D = _mesa_CopyConvolutionFilter1D;
344d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->CopyConvolutionFilter2D = _mesa_CopyConvolutionFilter2D;
345d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->GetColorTable = _mesa_GetColorTable;
346d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->GetColorTableParameterfv = _mesa_GetColorTableParameterfv;
347d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->GetColorTableParameteriv = _mesa_GetColorTableParameteriv;
348d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->GetConvolutionFilter = _mesa_GetConvolutionFilter;
349d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->GetConvolutionParameterfv = _mesa_GetConvolutionParameterfv;
350d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->GetConvolutionParameteriv = _mesa_GetConvolutionParameteriv;
351d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->GetHistogram = _mesa_GetHistogram;
352d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->GetHistogramParameterfv = _mesa_GetHistogramParameterfv;
353d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->GetHistogramParameteriv = _mesa_GetHistogramParameteriv;
354d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->GetMinmax = _mesa_GetMinmax;
355d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->GetMinmaxParameterfv = _mesa_GetMinmaxParameterfv;
356d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->GetMinmaxParameteriv = _mesa_GetMinmaxParameteriv;
357d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->GetSeparableFilter = _mesa_GetSeparableFilter;
358d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->Histogram = _mesa_Histogram;
359d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->Minmax = _mesa_Minmax;
360d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->ResetHistogram = _mesa_ResetHistogram;
361d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->ResetMinmax = _mesa_ResetMinmax;
362d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->SeparableFilter2D = _mesa_SeparableFilter2D;
363d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul
3641a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul   /* 2. GL_EXT_blend_color */
3651a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul#if 0
3661a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul   exec->BlendColorEXT = _mesa_BlendColorEXT;
3671a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul#endif
3681a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul
3691a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul   /* 3. GL_EXT_polygon_offset */
3701a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul   exec->PolygonOffsetEXT = _mesa_PolygonOffsetEXT;
3711a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul
3721a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul   /* 6. GL_EXT_texture3d */
373ead285a9266bb5f80e68de122490a6afb88df6f3Brian Paul#if 0
374d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->CopyTexSubImage3DEXT = _mesa_CopyTexSubImage3D;
375d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->TexImage3DEXT = _mesa_TexImage3DEXT;
376d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   exec->TexSubImage3DEXT = _mesa_TexSubImage3D;
377ead285a9266bb5f80e68de122490a6afb88df6f3Brian Paul#endif
378d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul
3791a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul   /* 11. GL_EXT_histogram */
3801a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul   exec->GetHistogramEXT = _mesa_GetHistogram;
3811a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul   exec->GetHistogramParameterfvEXT = _mesa_GetHistogramParameterfv;
3821a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul   exec->GetHistogramParameterivEXT = _mesa_GetHistogramParameteriv;
3831a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul   exec->GetMinmaxEXT = _mesa_GetMinmax;
3841a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul   exec->GetMinmaxParameterfvEXT = _mesa_GetMinmaxParameterfv;
3851a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul   exec->GetMinmaxParameterivEXT = _mesa_GetMinmaxParameteriv;
386d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul
3871a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul   /* ?. GL_SGIX_pixel_texture */
3882b2e925ea4a5652b0ab73b1efbce345a42663842Brian Paul   exec->PixelTexGenSGIX = _mesa_PixelTexGenSGIX;
3892b2e925ea4a5652b0ab73b1efbce345a42663842Brian Paul
3901a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul   /* 15. GL_SGIS_pixel_texture */
3912b2e925ea4a5652b0ab73b1efbce345a42663842Brian Paul   exec->PixelTexGenParameteriSGIS = _mesa_PixelTexGenParameteriSGIS;
3922b2e925ea4a5652b0ab73b1efbce345a42663842Brian Paul   exec->PixelTexGenParameterivSGIS = _mesa_PixelTexGenParameterivSGIS;
3932b2e925ea4a5652b0ab73b1efbce345a42663842Brian Paul   exec->PixelTexGenParameterfSGIS = _mesa_PixelTexGenParameterfSGIS;
3942b2e925ea4a5652b0ab73b1efbce345a42663842Brian Paul   exec->PixelTexGenParameterfvSGIS = _mesa_PixelTexGenParameterfvSGIS;
3952b2e925ea4a5652b0ab73b1efbce345a42663842Brian Paul   exec->GetPixelTexGenParameterivSGIS = _mesa_GetPixelTexGenParameterivSGIS;
3962b2e925ea4a5652b0ab73b1efbce345a42663842Brian Paul   exec->GetPixelTexGenParameterfvSGIS = _mesa_GetPixelTexGenParameterfvSGIS;
3972b2e925ea4a5652b0ab73b1efbce345a42663842Brian Paul
3981f0e213bf88500e9c2f7ca92e57392efae5e4459Brian Paul   /* 30. GL_EXT_vertex_array */
3991f0e213bf88500e9c2f7ca92e57392efae5e4459Brian Paul   exec->ColorPointerEXT = _mesa_ColorPointerEXT;
4001f0e213bf88500e9c2f7ca92e57392efae5e4459Brian Paul   exec->EdgeFlagPointerEXT = _mesa_EdgeFlagPointerEXT;
4011f0e213bf88500e9c2f7ca92e57392efae5e4459Brian Paul   exec->IndexPointerEXT = _mesa_IndexPointerEXT;
4021f0e213bf88500e9c2f7ca92e57392efae5e4459Brian Paul   exec->NormalPointerEXT = _mesa_NormalPointerEXT;
4031f0e213bf88500e9c2f7ca92e57392efae5e4459Brian Paul   exec->TexCoordPointerEXT = _mesa_TexCoordPointerEXT;
4041f0e213bf88500e9c2f7ca92e57392efae5e4459Brian Paul   exec->VertexPointerEXT = _mesa_VertexPointerEXT;
4051f0e213bf88500e9c2f7ca92e57392efae5e4459Brian Paul
4061a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul   /* 37. GL_EXT_blend_minmax */
4071a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul#if 0
4081a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul   exec->BlendEquationEXT = _mesa_BlendEquationEXT;
4091a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul#endif
410d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul
4111a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul   /* 54. GL_EXT_point_parameters */
412471a774f433c23b263828aa591415741e78a35daBrian Paul   exec->PointParameterfEXT = _mesa_PointParameterfEXT;
413471a774f433c23b263828aa591415741e78a35daBrian Paul   exec->PointParameterfvEXT = _mesa_PointParameterfvEXT;
414d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul
4151a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul   /* 78. GL_EXT_paletted_texture */
416ead285a9266bb5f80e68de122490a6afb88df6f3Brian Paul#if 0
4171a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul   exec->ColorTableEXT = _mesa_ColorTableEXT;
4181a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul   exec->ColorSubTableEXT = _mesa_ColorSubTableEXT;
419ead285a9266bb5f80e68de122490a6afb88df6f3Brian Paul#endif
4201a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul   exec->GetColorTableEXT = _mesa_GetColorTable;
4211a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul   exec->GetColorTableParameterfvEXT = _mesa_GetColorTableParameterfv;
4221a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul   exec->GetColorTableParameterivEXT = _mesa_GetColorTableParameteriv;
423d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul
4241a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul   /* 97. GL_EXT_compiled_vertex_array */
4251a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul   exec->LockArraysEXT = _mesa_LockArraysEXT;
4261a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul   exec->UnlockArraysEXT = _mesa_UnlockArraysEXT;
4271a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul
4281a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul   /* 173. GL_INGR_blend_func_separate */
4291a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul   exec->BlendFuncSeparateEXT = _mesa_BlendFuncSeparateEXT;
4301a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul
4311a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul   /* 196. GL_MESA_resize_buffers */
4321a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul   exec->ResizeBuffersMESA = _mesa_ResizeBuffersMESA;
4331a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul
4341a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul   /* 197. GL_MESA_window_pos */
4351a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul   exec->WindowPos2dMESA = _mesa_WindowPos2dMESA;
4361a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul   exec->WindowPos2dvMESA = _mesa_WindowPos2dvMESA;
4371a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul   exec->WindowPos2fMESA = _mesa_WindowPos2fMESA;
4381a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul   exec->WindowPos2fvMESA = _mesa_WindowPos2fvMESA;
4391a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul   exec->WindowPos2iMESA = _mesa_WindowPos2iMESA;
4401a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul   exec->WindowPos2ivMESA = _mesa_WindowPos2ivMESA;
4411a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul   exec->WindowPos2sMESA = _mesa_WindowPos2sMESA;
4421a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul   exec->WindowPos2svMESA = _mesa_WindowPos2svMESA;
4431a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul   exec->WindowPos3dMESA = _mesa_WindowPos3dMESA;
4441a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul   exec->WindowPos3dvMESA = _mesa_WindowPos3dvMESA;
4451a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul   exec->WindowPos3fMESA = _mesa_WindowPos3fMESA;
4461a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul   exec->WindowPos3fvMESA = _mesa_WindowPos3fvMESA;
4471a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul   exec->WindowPos3iMESA = _mesa_WindowPos3iMESA;
4481a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul   exec->WindowPos3ivMESA = _mesa_WindowPos3ivMESA;
4491a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul   exec->WindowPos3sMESA = _mesa_WindowPos3sMESA;
4501a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul   exec->WindowPos3svMESA = _mesa_WindowPos3svMESA;
4511a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul   exec->WindowPos4dMESA = _mesa_WindowPos4dMESA;
4521a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul   exec->WindowPos4dvMESA = _mesa_WindowPos4dvMESA;
4531a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul   exec->WindowPos4fMESA = _mesa_WindowPos4fMESA;
4541a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul   exec->WindowPos4fvMESA = _mesa_WindowPos4fvMESA;
4551a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul   exec->WindowPos4iMESA = _mesa_WindowPos4iMESA;
4561a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul   exec->WindowPos4ivMESA = _mesa_WindowPos4ivMESA;
4571a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul   exec->WindowPos4sMESA = _mesa_WindowPos4sMESA;
4581a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul   exec->WindowPos4svMESA = _mesa_WindowPos4svMESA;
459d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul
460b638c34381004aa2a778227bad51d259d05a9b53Brian Paul   /* 233. GL_NV_vertex_program */
46186b842790b720cd6b1499ce8edca8a4e9c8dc029Brian Paul   exec->BindProgramNV = _mesa_BindProgramNV;
46286b842790b720cd6b1499ce8edca8a4e9c8dc029Brian Paul   exec->DeleteProgramsNV = _mesa_DeleteProgramsNV;
46386b842790b720cd6b1499ce8edca8a4e9c8dc029Brian Paul   exec->ExecuteProgramNV = _mesa_ExecuteProgramNV;
46486b842790b720cd6b1499ce8edca8a4e9c8dc029Brian Paul   exec->GenProgramsNV = _mesa_GenProgramsNV;
46586b842790b720cd6b1499ce8edca8a4e9c8dc029Brian Paul   exec->AreProgramsResidentNV = _mesa_AreProgramsResidentNV;
46686b842790b720cd6b1499ce8edca8a4e9c8dc029Brian Paul   exec->RequestResidentProgramsNV = _mesa_RequestResidentProgramsNV;
46786b842790b720cd6b1499ce8edca8a4e9c8dc029Brian Paul   exec->GetProgramParameterfvNV = _mesa_GetProgramParameterfvNV;
46886b842790b720cd6b1499ce8edca8a4e9c8dc029Brian Paul   exec->GetProgramParameterdvNV = _mesa_GetProgramParameterdvNV;
46986b842790b720cd6b1499ce8edca8a4e9c8dc029Brian Paul   exec->GetProgramivNV = _mesa_GetProgramivNV;
47086b842790b720cd6b1499ce8edca8a4e9c8dc029Brian Paul   exec->GetProgramStringNV = _mesa_GetProgramStringNV;
47186b842790b720cd6b1499ce8edca8a4e9c8dc029Brian Paul   exec->GetTrackMatrixivNV = _mesa_GetTrackMatrixivNV;
47286b842790b720cd6b1499ce8edca8a4e9c8dc029Brian Paul   exec->GetVertexAttribdvNV = _mesa_GetVertexAttribdvNV;
47386b842790b720cd6b1499ce8edca8a4e9c8dc029Brian Paul   exec->GetVertexAttribfvNV = _mesa_GetVertexAttribfvNV;
47486b842790b720cd6b1499ce8edca8a4e9c8dc029Brian Paul   exec->GetVertexAttribivNV = _mesa_GetVertexAttribivNV;
47586b842790b720cd6b1499ce8edca8a4e9c8dc029Brian Paul   exec->GetVertexAttribPointervNV = _mesa_GetVertexAttribPointervNV;
47686b842790b720cd6b1499ce8edca8a4e9c8dc029Brian Paul   exec->IsProgramNV = _mesa_IsProgramNV;
47786b842790b720cd6b1499ce8edca8a4e9c8dc029Brian Paul   exec->LoadProgramNV = _mesa_LoadProgramNV;
47886b842790b720cd6b1499ce8edca8a4e9c8dc029Brian Paul   exec->ProgramParameter4dNV = _mesa_ProgramParameter4dNV;
47986b842790b720cd6b1499ce8edca8a4e9c8dc029Brian Paul   exec->ProgramParameter4dvNV = _mesa_ProgramParameter4dvNV;
48086b842790b720cd6b1499ce8edca8a4e9c8dc029Brian Paul   exec->ProgramParameter4fNV = _mesa_ProgramParameter4fNV;
48186b842790b720cd6b1499ce8edca8a4e9c8dc029Brian Paul   exec->ProgramParameter4fvNV = _mesa_ProgramParameter4fvNV;
48286b842790b720cd6b1499ce8edca8a4e9c8dc029Brian Paul   exec->ProgramParameters4dvNV = _mesa_ProgramParameters4dvNV;
48386b842790b720cd6b1499ce8edca8a4e9c8dc029Brian Paul   exec->ProgramParameters4fvNV = _mesa_ProgramParameters4fvNV;
48486b842790b720cd6b1499ce8edca8a4e9c8dc029Brian Paul   exec->TrackMatrixNV = _mesa_TrackMatrixNV;
48586b842790b720cd6b1499ce8edca8a4e9c8dc029Brian Paul   exec->VertexAttribPointerNV = _mesa_VertexAttribPointerNV;
48686b842790b720cd6b1499ce8edca8a4e9c8dc029Brian Paul
48723d8ef3937b3b66684f7feb62446abca8e91d307Brian Paul   /* 262. GL_NV_point_sprite */
48823d8ef3937b3b66684f7feb62446abca8e91d307Brian Paul   exec->PointParameteriNV = _mesa_PointParameteriNV;
48923d8ef3937b3b66684f7feb62446abca8e91d307Brian Paul   exec->PointParameterivNV = _mesa_PointParameterivNV;
49023d8ef3937b3b66684f7feb62446abca8e91d307Brian Paul
4911a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul   /* ARB 1. GL_ARB_multitexture */
492471a774f433c23b263828aa591415741e78a35daBrian Paul   exec->ActiveTextureARB = _mesa_ActiveTextureARB;
493471a774f433c23b263828aa591415741e78a35daBrian Paul   exec->ClientActiveTextureARB = _mesa_ClientActiveTextureARB;
494d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul
4951a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul   /* ARB 3. GL_ARB_transpose_matrix */
496471a774f433c23b263828aa591415741e78a35daBrian Paul   exec->LoadTransposeMatrixdARB = _mesa_LoadTransposeMatrixdARB;
497471a774f433c23b263828aa591415741e78a35daBrian Paul   exec->LoadTransposeMatrixfARB = _mesa_LoadTransposeMatrixfARB;
498471a774f433c23b263828aa591415741e78a35daBrian Paul   exec->MultTransposeMatrixdARB = _mesa_MultTransposeMatrixdARB;
499471a774f433c23b263828aa591415741e78a35daBrian Paul   exec->MultTransposeMatrixfARB = _mesa_MultTransposeMatrixfARB;
5001207bf057aeea3376e5e0f03f789a5d67ed4d29dBrian Paul
501736fcbec4732830e7976fb5eb309b13e03be132cBrian Paul   /* ARB 5. GL_ARB_multisample */
502471a774f433c23b263828aa591415741e78a35daBrian Paul   exec->SampleCoverageARB = _mesa_SampleCoverageARB;
503736fcbec4732830e7976fb5eb309b13e03be132cBrian Paul
5041207bf057aeea3376e5e0f03f789a5d67ed4d29dBrian Paul   /* ARB 12. GL_ARB_texture_compression */
505471a774f433c23b263828aa591415741e78a35daBrian Paul   exec->CompressedTexImage3DARB = _mesa_CompressedTexImage3DARB;
506471a774f433c23b263828aa591415741e78a35daBrian Paul   exec->CompressedTexImage2DARB = _mesa_CompressedTexImage2DARB;
507471a774f433c23b263828aa591415741e78a35daBrian Paul   exec->CompressedTexImage1DARB = _mesa_CompressedTexImage1DARB;
508471a774f433c23b263828aa591415741e78a35daBrian Paul   exec->CompressedTexSubImage3DARB = _mesa_CompressedTexSubImage3DARB;
509471a774f433c23b263828aa591415741e78a35daBrian Paul   exec->CompressedTexSubImage2DARB = _mesa_CompressedTexSubImage2DARB;
510471a774f433c23b263828aa591415741e78a35daBrian Paul   exec->CompressedTexSubImage1DARB = _mesa_CompressedTexSubImage1DARB;
511471a774f433c23b263828aa591415741e78a35daBrian Paul   exec->GetCompressedTexImageARB = _mesa_GetCompressedTexImageARB;
5121207bf057aeea3376e5e0f03f789a5d67ed4d29dBrian Paul
5131537b63fce36f87b3606d0e7cdca2d10bbdffd56Brian Paul   /* ARB 14. GL_ARB_point_parameters */
5141537b63fce36f87b3606d0e7cdca2d10bbdffd56Brian Paul   /* reuse EXT_point_parameters functions */
5151537b63fce36f87b3606d0e7cdca2d10bbdffd56Brian Paul
516d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul}
517d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul
518d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul
5191207bf057aeea3376e5e0f03f789a5d67ed4d29dBrian Paul
520d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul/**********************************************************************/
521d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul/*****                   State update logic                       *****/
522d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul/**********************************************************************/
523d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul
524d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul
5251e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwellstatic void
526a852378a6289d154364dde440f89a39bbfc33e2dBrian Paulupdate_polygon( GLcontext *ctx )
5271e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell{
528cab974cf6c2dbfbf5dd5d291e1aae0f8eeb34290Keith Whitwell   ctx->_TriangleCaps &= ~(DD_TRI_CULL_FRONT_BACK | DD_TRI_OFFSET);
529cab974cf6c2dbfbf5dd5d291e1aae0f8eeb34290Keith Whitwell
530bfa023921c9d1aa872237e0ac6085160f7c2cbc5Keith Whitwell   if (ctx->Polygon.CullFlag && ctx->Polygon.CullFaceMode == GL_FRONT_AND_BACK)
531bfa023921c9d1aa872237e0ac6085160f7c2cbc5Keith Whitwell      ctx->_TriangleCaps |= DD_TRI_CULL_FRONT_BACK;
532d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul
5331e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell   /* Any Polygon offsets enabled? */
534f1d6b384415a083c358d3824e77f3d434f08bfccBrian Paul   ctx->Polygon._OffsetAny = GL_FALSE;
5351e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell   ctx->_TriangleCaps &= ~DD_TRI_OFFSET;
536d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul
5371e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell   if (ctx->Polygon.OffsetPoint ||
5381e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell       ctx->Polygon.OffsetLine ||
539f1d6b384415a083c358d3824e77f3d434f08bfccBrian Paul       ctx->Polygon.OffsetFill) {
5401e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell      ctx->_TriangleCaps |= DD_TRI_OFFSET;
541f1d6b384415a083c358d3824e77f3d434f08bfccBrian Paul      ctx->Polygon._OffsetAny = GL_TRUE;
542f1d6b384415a083c358d3824e77f3d434f08bfccBrian Paul   }
5431e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell}
544d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul
5455e3bc0c2a2bcdf59949410f94c9b705fc1281ce8Jouk Jansenstatic void
546a852378a6289d154364dde440f89a39bbfc33e2dBrian Paulcalculate_model_project_matrix( GLcontext *ctx )
5471e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell{
54823caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell      _math_matrix_mul_matrix( &ctx->_ModelProjectMatrix,
54930f51ae067379c2b3573c06b707d25a9704df7beBrian Paul			       ctx->ProjectionMatrixStack.Top,
55030f51ae067379c2b3573c06b707d25a9704df7beBrian Paul			       ctx->ModelviewMatrixStack.Top );
5511e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell
552ad2ac216fa0cbebc36530bf9e5256e902710b892Keith Whitwell      _math_matrix_analyse( &ctx->_ModelProjectMatrix );
5531e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell}
554d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul
5551e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwellstatic void
556a852378a6289d154364dde440f89a39bbfc33e2dBrian Paulupdate_modelview_scale( GLcontext *ctx )
5571e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell{
5581e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell   ctx->_ModelViewInvScale = 1.0F;
55930f51ae067379c2b3573c06b707d25a9704df7beBrian Paul   if (ctx->ModelviewMatrixStack.Top->flags & (MAT_FLAG_UNIFORM_SCALE |
5601e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell			       MAT_FLAG_GENERAL_SCALE |
5611e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell			       MAT_FLAG_GENERAL_3D |
5621e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell			       MAT_FLAG_GENERAL) ) {
56330f51ae067379c2b3573c06b707d25a9704df7beBrian Paul      const GLfloat *m = ctx->ModelviewMatrixStack.Top->inv;
5641e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell      GLfloat f = m[2] * m[2] + m[6] * m[6] + m[10] * m[10];
5651e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell      if (f < 1e-12) f = 1.0;
5661e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell      if (ctx->_NeedEyeCoords)
5677b9fe820a3fba3849864682fbb1cb512362934abKarl Schultz	 ctx->_ModelViewInvScale = (GLfloat) (1.0/GL_SQRT(f));
5681e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell      else
5697b9fe820a3fba3849864682fbb1cb512362934abKarl Schultz	 ctx->_ModelViewInvScale = (GLfloat) GL_SQRT(f);
5701e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell   }
5711e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell}
572d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul
5731e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell
5745e3bc0c2a2bcdf59949410f94c9b705fc1281ce8Jouk Jansen/* Bring uptodate any state that relies on _NeedEyeCoords.
5751e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell */
5761e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwellstatic void
577a852378a6289d154364dde440f89a39bbfc33e2dBrian Paulupdate_tnl_spaces( GLcontext *ctx, GLuint oldneedeyecoords )
5785e3bc0c2a2bcdf59949410f94c9b705fc1281ce8Jouk Jansen{
5791e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell   /* Check if the truth-value interpretations of the bitfields have
5805e3bc0c2a2bcdf59949410f94c9b705fc1281ce8Jouk Jansen    * changed:
5811e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell    */
582a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul   if ((oldneedeyecoords == 0) != (ctx->_NeedEyeCoords == 0)) {
5831e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell      /* Recalculate all state that depends on _NeedEyeCoords.
584d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul       */
585a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul      update_modelview_scale(ctx);
58608836341788a9f9d638d9dc8328510ccd18ddeb5Brian Paul      _mesa_compute_light_positions( ctx );
5871e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell
5881e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell      if (ctx->Driver.LightingSpaceChange)
5891e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell	 ctx->Driver.LightingSpaceChange( ctx );
590d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   }
591a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul   else {
5921e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell      GLuint new_state = ctx->NewState;
593d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul
594cab974cf6c2dbfbf5dd5d291e1aae0f8eeb34290Keith Whitwell      /* Recalculate that same state only if it has been invalidated
59522144ab7552f0799bcfca506bf4ffa7f70a06649Gareth Hughes       * by other statechanges.
5961e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell       */
5975e3bc0c2a2bcdf59949410f94c9b705fc1281ce8Jouk Jansen      if (new_state & _NEW_MODELVIEW)
598a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul	 update_modelview_scale(ctx);
5991e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell
6001e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell      if (new_state & (_NEW_LIGHT|_NEW_MODELVIEW))
60108836341788a9f9d638d9dc8328510ccd18ddeb5Brian Paul	 _mesa_compute_light_positions( ctx );
6021e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell   }
6031e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell}
6041e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell
6051e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell
6061e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwellstatic void
607a852378a6289d154364dde440f89a39bbfc33e2dBrian Paulupdate_drawbuffer( GLcontext *ctx )
6081e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell{
6091e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell   ctx->DrawBuffer->_Xmin = 0;
6101e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell   ctx->DrawBuffer->_Ymin = 0;
6111e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell   ctx->DrawBuffer->_Xmax = ctx->DrawBuffer->Width;
6121e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell   ctx->DrawBuffer->_Ymax = ctx->DrawBuffer->Height;
6131e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell   if (ctx->Scissor.Enabled) {
6141e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell      if (ctx->Scissor.X > ctx->DrawBuffer->_Xmin) {
6151e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell	 ctx->DrawBuffer->_Xmin = ctx->Scissor.X;
6161e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell      }
6171e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell      if (ctx->Scissor.Y > ctx->DrawBuffer->_Ymin) {
6181e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell	 ctx->DrawBuffer->_Ymin = ctx->Scissor.Y;
6191e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell      }
6201e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell      if (ctx->Scissor.X + ctx->Scissor.Width < ctx->DrawBuffer->_Xmax) {
6211e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell	 ctx->DrawBuffer->_Xmax = ctx->Scissor.X + ctx->Scissor.Width;
622d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul      }
6231e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell      if (ctx->Scissor.Y + ctx->Scissor.Height < ctx->DrawBuffer->_Ymax) {
6241e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell	 ctx->DrawBuffer->_Ymax = ctx->Scissor.Y + ctx->Scissor.Height;
6251e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell      }
6261e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell   }
6271e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell}
628d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul
629d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul
6301e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell/* NOTE: This routine references Tranform attribute values to compute
6311e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell * userclip positions in clip space, but is only called on
6321e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell * _NEW_PROJECTION.  The _mesa_ClipPlane() function keeps these values
6331043a6498a7f94922be5f4b5deac89fd05cfa670Brian Paul * up to date across changes to the Transform attributes.
6341e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell */
6351e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwellstatic void
636a852378a6289d154364dde440f89a39bbfc33e2dBrian Paulupdate_projection( GLcontext *ctx )
6371e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell{
63830f51ae067379c2b3573c06b707d25a9704df7beBrian Paul   _math_matrix_analyse( ctx->ProjectionMatrixStack.Top );
63922144ab7552f0799bcfca506bf4ffa7f70a06649Gareth Hughes
6401e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell   /* Recompute clip plane positions in clipspace.  This is also done
6411e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell    * in _mesa_ClipPlane().
6421e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell    */
643103bc0f75c00dfcf671dc50d8d9666f88a42a59dBrian Paul   if (ctx->Transform.ClipPlanesEnabled) {
6441e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell      GLuint p;
645a864432fb4333dfbbe669554de7485d8426e1c38Brian Paul      for (p = 0; p < ctx->Const.MaxClipPlanes; p++) {
646103bc0f75c00dfcf671dc50d8d9666f88a42a59dBrian Paul	 if (ctx->Transform.ClipPlanesEnabled & (1 << p)) {
64708836341788a9f9d638d9dc8328510ccd18ddeb5Brian Paul	    _mesa_transform_vector( ctx->Transform._ClipUserPlane[p],
6481e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell				 ctx->Transform.EyeUserPlane[p],
64930f51ae067379c2b3573c06b707d25a9704df7beBrian Paul				 ctx->ProjectionMatrixStack.Top->inv );
650d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul	 }
651d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul      }
652d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   }
6531e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell}
6541e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell
6551e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell
656a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul/*
657a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul * Return a bitmask of IMAGE_*_BIT flags which to indicate which
658a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul * pixel transfer operations are enabled.
659a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul */
660a852378a6289d154364dde440f89a39bbfc33e2dBrian Paulstatic void
661a852378a6289d154364dde440f89a39bbfc33e2dBrian Paulupdate_image_transfer_state(GLcontext *ctx)
662a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul{
663a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul   GLuint mask = 0;
664a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul
665a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul   if (ctx->Pixel.RedScale   != 1.0F || ctx->Pixel.RedBias   != 0.0F ||
666a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul       ctx->Pixel.GreenScale != 1.0F || ctx->Pixel.GreenBias != 0.0F ||
667a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul       ctx->Pixel.BlueScale  != 1.0F || ctx->Pixel.BlueBias  != 0.0F ||
668a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul       ctx->Pixel.AlphaScale != 1.0F || ctx->Pixel.AlphaBias != 0.0F)
669a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul      mask |= IMAGE_SCALE_BIAS_BIT;
670a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul
671a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul   if (ctx->Pixel.IndexShift || ctx->Pixel.IndexOffset)
672a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul      mask |= IMAGE_SHIFT_OFFSET_BIT;
6735e3bc0c2a2bcdf59949410f94c9b705fc1281ce8Jouk Jansen
674a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul   if (ctx->Pixel.MapColorFlag)
675a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul      mask |= IMAGE_MAP_COLOR_BIT;
676a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul
677a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul   if (ctx->Pixel.ColorTableEnabled)
678a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul      mask |= IMAGE_COLOR_TABLE_BIT;
679a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul
680a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul   if (ctx->Pixel.Convolution1DEnabled ||
681a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul       ctx->Pixel.Convolution2DEnabled ||
68245015e4d79d63183f6d9c4e4fad655921e07b0abBrian Paul       ctx->Pixel.Separable2DEnabled) {
683a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul      mask |= IMAGE_CONVOLUTION_BIT;
68445015e4d79d63183f6d9c4e4fad655921e07b0abBrian Paul      if (ctx->Pixel.PostConvolutionScale[0] != 1.0F ||
68545015e4d79d63183f6d9c4e4fad655921e07b0abBrian Paul          ctx->Pixel.PostConvolutionScale[1] != 1.0F ||
68645015e4d79d63183f6d9c4e4fad655921e07b0abBrian Paul          ctx->Pixel.PostConvolutionScale[2] != 1.0F ||
68745015e4d79d63183f6d9c4e4fad655921e07b0abBrian Paul          ctx->Pixel.PostConvolutionScale[3] != 1.0F ||
68845015e4d79d63183f6d9c4e4fad655921e07b0abBrian Paul          ctx->Pixel.PostConvolutionBias[0] != 0.0F ||
68945015e4d79d63183f6d9c4e4fad655921e07b0abBrian Paul          ctx->Pixel.PostConvolutionBias[1] != 0.0F ||
69045015e4d79d63183f6d9c4e4fad655921e07b0abBrian Paul          ctx->Pixel.PostConvolutionBias[2] != 0.0F ||
69145015e4d79d63183f6d9c4e4fad655921e07b0abBrian Paul          ctx->Pixel.PostConvolutionBias[3] != 0.0F) {
69245015e4d79d63183f6d9c4e4fad655921e07b0abBrian Paul         mask |= IMAGE_POST_CONVOLUTION_SCALE_BIAS;
69345015e4d79d63183f6d9c4e4fad655921e07b0abBrian Paul      }
69445015e4d79d63183f6d9c4e4fad655921e07b0abBrian Paul   }
695a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul
696a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul   if (ctx->Pixel.PostConvolutionColorTableEnabled)
697a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul      mask |= IMAGE_POST_CONVOLUTION_COLOR_TABLE_BIT;
698a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul
69930f51ae067379c2b3573c06b707d25a9704df7beBrian Paul   if (ctx->ColorMatrixStack.Top->type != MATRIX_IDENTITY ||
700a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul       ctx->Pixel.PostColorMatrixScale[0] != 1.0F ||
701a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul       ctx->Pixel.PostColorMatrixBias[0]  != 0.0F ||
702a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul       ctx->Pixel.PostColorMatrixScale[1] != 1.0F ||
703a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul       ctx->Pixel.PostColorMatrixBias[1]  != 0.0F ||
704a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul       ctx->Pixel.PostColorMatrixScale[2] != 1.0F ||
705a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul       ctx->Pixel.PostColorMatrixBias[2]  != 0.0F ||
706a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul       ctx->Pixel.PostColorMatrixScale[3] != 1.0F ||
707a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul       ctx->Pixel.PostColorMatrixBias[3]  != 0.0F)
708a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul      mask |= IMAGE_COLOR_MATRIX_BIT;
709a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul
710a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul   if (ctx->Pixel.PostColorMatrixColorTableEnabled)
711a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul      mask |= IMAGE_POST_COLOR_MATRIX_COLOR_TABLE_BIT;
712a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul
713a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul   if (ctx->Pixel.HistogramEnabled)
714a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul      mask |= IMAGE_HISTOGRAM_BIT;
715a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul
716a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul   if (ctx->Pixel.MinMaxEnabled)
717a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul      mask |= IMAGE_MIN_MAX_BIT;
718a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul
719a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul   ctx->_ImageTransferState = mask;
720a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul}
721a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul
7221e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell
7238e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul
7248e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul
7258e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul/* Note: This routine refers to derived texture attribute values to
7268e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul * compute the ENABLE_TEXMAT flags, but is only called on
7278e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul * _NEW_TEXTURE_MATRIX.  On changes to _NEW_TEXTURE, the ENABLE_TEXMAT
7288e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul * flags are updated by _mesa_update_textures(), below.
7298e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul *
7308e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul * If both TEXTURE and TEXTURE_MATRIX change at once, these values
7318e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul * will be computed twice.
7328e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul */
7338e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paulstatic void
7348e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paulupdate_texture_matrices( GLcontext *ctx )
7358e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul{
7368e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul   GLuint i;
7378e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul
738ed39a43b8cb2e1cf69b097fc89365cde470ebf51Keith Whitwell   ctx->Texture._TexMatEnabled = 0;
7398e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul
7408e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul   for (i=0; i < ctx->Const.MaxTextureUnits; i++) {
74130f51ae067379c2b3573c06b707d25a9704df7beBrian Paul      if (ctx->TextureMatrixStack[i].Top->flags & MAT_DIRTY) {
74230f51ae067379c2b3573c06b707d25a9704df7beBrian Paul	 _math_matrix_analyse( ctx->TextureMatrixStack[i].Top );
7438e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul
7448e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul	 if (ctx->Texture.Unit[i]._ReallyEnabled &&
74530f51ae067379c2b3573c06b707d25a9704df7beBrian Paul	     ctx->TextureMatrixStack[i].Top->type != MATRIX_IDENTITY)
746ed39a43b8cb2e1cf69b097fc89365cde470ebf51Keith Whitwell	    ctx->Texture._TexMatEnabled |= ENABLE_TEXMAT(i);
7470cb28418d06c30e431bdff515c1d36a812d5950dKeith Whitwell
7480cb28418d06c30e431bdff515c1d36a812d5950dKeith Whitwell	 if (ctx->Driver.TextureMatrix)
7490cb28418d06c30e431bdff515c1d36a812d5950dKeith Whitwell	    ctx->Driver.TextureMatrix( ctx, i, ctx->TextureMatrixStack[i].Top);
7508e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul      }
7518e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul   }
7528e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul}
7538e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul
7548e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul
7558e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul/* Note: This routine refers to derived texture matrix values to
7568e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul * compute the ENABLE_TEXMAT flags, but is only called on
7578e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul * _NEW_TEXTURE.  On changes to _NEW_TEXTURE_MATRIX, the ENABLE_TEXMAT
7588e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul * flags are updated by _mesa_update_texture_matrices, above.
7598e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul *
7608e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul * If both TEXTURE and TEXTURE_MATRIX change at once, these values
7618e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul * will be computed twice.
7628e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul */
7638e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paulstatic void
7648e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paulupdate_texture_state( GLcontext *ctx )
7658e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul{
7668afe7de8deaf3c9613fd68b344de8c52b02b1879Brian Paul   GLuint unit;
7678e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul
7688afe7de8deaf3c9613fd68b344de8c52b02b1879Brian Paul   ctx->Texture._ReallyEnabled = 0;  /* XXX obsolete */
7698afe7de8deaf3c9613fd68b344de8c52b02b1879Brian Paul   ctx->Texture._EnabledUnits = 0;
7708e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul   ctx->Texture._GenFlags = 0;
7718e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul   ctx->_NeedNormals &= ~NEED_NORMALS_TEXGEN;
7728e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul   ctx->_NeedEyeCoords &= ~NEED_EYE_TEXGEN;
773ed39a43b8cb2e1cf69b097fc89365cde470ebf51Keith Whitwell   ctx->Texture._TexMatEnabled = 0;
774ed39a43b8cb2e1cf69b097fc89365cde470ebf51Keith Whitwell   ctx->Texture._TexGenEnabled = 0;
7758e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul
7768e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul   /* Update texture unit state.
7778e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul    */
7788afe7de8deaf3c9613fd68b344de8c52b02b1879Brian Paul   for (unit = 0; unit < ctx->Const.MaxTextureUnits; unit++) {
7798afe7de8deaf3c9613fd68b344de8c52b02b1879Brian Paul      struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
7808e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul
7818e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul      texUnit->_ReallyEnabled = 0;
7828e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul      texUnit->_GenFlags = 0;
7838e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul
7848e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul      if (!texUnit->Enabled)
7858e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul	 continue;
7868e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul
7878afe7de8deaf3c9613fd68b344de8c52b02b1879Brian Paul      /* Look for the highest-priority texture target that's enabled and
7888afe7de8deaf3c9613fd68b344de8c52b02b1879Brian Paul       * complete.  That's the one we'll use for texturing.
7898e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul       */
7908afe7de8deaf3c9613fd68b344de8c52b02b1879Brian Paul      if (texUnit->Enabled & TEXTURE_CUBE_BIT) {
7918e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul         struct gl_texture_object *texObj = texUnit->CurrentCubeMap;
7928e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul         if (!texObj->Complete) {
7938e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul            _mesa_test_texobj_completeness(ctx, texObj);
7948e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul         }
7958e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul         if (texObj->Complete) {
7968afe7de8deaf3c9613fd68b344de8c52b02b1879Brian Paul            texUnit->_ReallyEnabled = TEXTURE_CUBE_BIT;
7978e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul            texUnit->_Current = texObj;
7988e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul         }
7998e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul      }
8008e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul
8018afe7de8deaf3c9613fd68b344de8c52b02b1879Brian Paul      if (!texUnit->_ReallyEnabled && (texUnit->Enabled & TEXTURE_3D_BIT)) {
8028e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul         struct gl_texture_object *texObj = texUnit->Current3D;
8038e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul         if (!texObj->Complete) {
8048e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul            _mesa_test_texobj_completeness(ctx, texObj);
8058e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul         }
8068e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul         if (texObj->Complete) {
8078afe7de8deaf3c9613fd68b344de8c52b02b1879Brian Paul            texUnit->_ReallyEnabled = TEXTURE_3D_BIT;
8088e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul            texUnit->_Current = texObj;
8098e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul         }
8108e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul      }
8118e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul
8128afe7de8deaf3c9613fd68b344de8c52b02b1879Brian Paul      if (!texUnit->_ReallyEnabled && (texUnit->Enabled & TEXTURE_RECT_BIT)) {
8138afe7de8deaf3c9613fd68b344de8c52b02b1879Brian Paul         struct gl_texture_object *texObj = texUnit->CurrentRect;
8148afe7de8deaf3c9613fd68b344de8c52b02b1879Brian Paul         if (!texObj->Complete) {
8158afe7de8deaf3c9613fd68b344de8c52b02b1879Brian Paul            _mesa_test_texobj_completeness(ctx, texObj);
8168afe7de8deaf3c9613fd68b344de8c52b02b1879Brian Paul         }
8178afe7de8deaf3c9613fd68b344de8c52b02b1879Brian Paul         if (texObj->Complete) {
8188afe7de8deaf3c9613fd68b344de8c52b02b1879Brian Paul            texUnit->_ReallyEnabled = TEXTURE_RECT_BIT;
8198afe7de8deaf3c9613fd68b344de8c52b02b1879Brian Paul            texUnit->_Current = texObj;
8208afe7de8deaf3c9613fd68b344de8c52b02b1879Brian Paul         }
8218afe7de8deaf3c9613fd68b344de8c52b02b1879Brian Paul      }
8228afe7de8deaf3c9613fd68b344de8c52b02b1879Brian Paul
8238afe7de8deaf3c9613fd68b344de8c52b02b1879Brian Paul      if (!texUnit->_ReallyEnabled && (texUnit->Enabled & TEXTURE_2D_BIT)) {
8248e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul         struct gl_texture_object *texObj = texUnit->Current2D;
8258e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul         if (!texObj->Complete) {
8268e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul            _mesa_test_texobj_completeness(ctx, texObj);
8278e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul         }
8288e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul         if (texObj->Complete) {
8298afe7de8deaf3c9613fd68b344de8c52b02b1879Brian Paul            texUnit->_ReallyEnabled = TEXTURE_2D_BIT;
8308e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul            texUnit->_Current = texObj;
8318e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul         }
8328e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul      }
8338e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul
8348afe7de8deaf3c9613fd68b344de8c52b02b1879Brian Paul      if (!texUnit->_ReallyEnabled && (texUnit->Enabled & TEXTURE_1D_BIT)) {
8358e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul         struct gl_texture_object *texObj = texUnit->Current1D;
8368e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul         if (!texObj->Complete) {
8378e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul            _mesa_test_texobj_completeness(ctx, texObj);
8388e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul         }
8398e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul         if (texObj->Complete) {
8408afe7de8deaf3c9613fd68b344de8c52b02b1879Brian Paul            texUnit->_ReallyEnabled = TEXTURE_1D_BIT;
8418e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul            texUnit->_Current = texObj;
8428e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul         }
8438e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul      }
8448e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul
8458e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul      if (!texUnit->_ReallyEnabled) {
8468e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul	 texUnit->_Current = NULL;
8478e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul	 continue;
8488e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul      }
8498e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul
8508afe7de8deaf3c9613fd68b344de8c52b02b1879Brian Paul      /* Texture._ReallyEnabled records the enable state for all units in
8518afe7de8deaf3c9613fd68b344de8c52b02b1879Brian Paul       * one word.
8528afe7de8deaf3c9613fd68b344de8c52b02b1879Brian Paul       */
8538e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul      {
8548afe7de8deaf3c9613fd68b344de8c52b02b1879Brian Paul         GLuint flag = texUnit->_ReallyEnabled << (unit * NUM_TEXTURE_TARGETS);
8558afe7de8deaf3c9613fd68b344de8c52b02b1879Brian Paul	 ctx->Texture._ReallyEnabled |= flag;  /* XXX obsolete field! */
8568afe7de8deaf3c9613fd68b344de8c52b02b1879Brian Paul         if (texUnit->_ReallyEnabled)
8578afe7de8deaf3c9613fd68b344de8c52b02b1879Brian Paul            ctx->Texture._EnabledUnits |= (1 << unit);
8588e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul      }
8598e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul
8608e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul      if (texUnit->TexGenEnabled) {
8618e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul	 if (texUnit->TexGenEnabled & S_BIT) {
8628e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul	    texUnit->_GenFlags |= texUnit->_GenBitS;
8638e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul	 }
8648e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul	 if (texUnit->TexGenEnabled & T_BIT) {
8658e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul	    texUnit->_GenFlags |= texUnit->_GenBitT;
8668e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul	 }
8678e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul	 if (texUnit->TexGenEnabled & Q_BIT) {
8688e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul	    texUnit->_GenFlags |= texUnit->_GenBitQ;
8698e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul	 }
8708e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul	 if (texUnit->TexGenEnabled & R_BIT) {
8718e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul	    texUnit->_GenFlags |= texUnit->_GenBitR;
8728e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul	 }
8738e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul
8748afe7de8deaf3c9613fd68b344de8c52b02b1879Brian Paul	 ctx->Texture._TexGenEnabled |= ENABLE_TEXGEN(unit);
8758e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul	 ctx->Texture._GenFlags |= texUnit->_GenFlags;
8768e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul      }
8778e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul
8788afe7de8deaf3c9613fd68b344de8c52b02b1879Brian Paul      if (ctx->TextureMatrixStack[unit].Top->type != MATRIX_IDENTITY)
8798afe7de8deaf3c9613fd68b344de8c52b02b1879Brian Paul	 ctx->Texture._TexMatEnabled |= ENABLE_TEXMAT(unit);
8808e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul   }
8818e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul
8828e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul   if (ctx->Texture._GenFlags & TEXGEN_NEED_NORMALS) {
8838e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul      ctx->_NeedNormals |= NEED_NORMALS_TEXGEN;
8848e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul      ctx->_NeedEyeCoords |= NEED_EYE_TEXGEN;
8858e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul   }
8868e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul
8878e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul   if (ctx->Texture._GenFlags & TEXGEN_NEED_EYE_COORD) {
8888e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul      ctx->_NeedEyeCoords |= NEED_EYE_TEXGEN;
8898e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul   }
8908e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul}
8918e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul
8928e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul
8930cb28418d06c30e431bdff515c1d36a812d5950dKeith Whitwell
8941e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell/*
8951e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell * If ctx->NewState is non-zero then this function MUST be called before
8961e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell * rendering any primitive.  Basically, function pointers and miscellaneous
8971e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell * flags are updated to reflect the current state of the state machine.
8981e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell *
899cab974cf6c2dbfbf5dd5d291e1aae0f8eeb34290Keith Whitwell * The above constraint is now maintained largely by the two Exec
900cab974cf6c2dbfbf5dd5d291e1aae0f8eeb34290Keith Whitwell * dispatch tables, which trigger the appropriate flush on transition
901cab974cf6c2dbfbf5dd5d291e1aae0f8eeb34290Keith Whitwell * between State and Geometry modes.
902cab974cf6c2dbfbf5dd5d291e1aae0f8eeb34290Keith Whitwell *
903cab974cf6c2dbfbf5dd5d291e1aae0f8eeb34290Keith Whitwell * Special care is taken with the derived value _NeedEyeCoords.  This
9041e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell * is a bitflag which is updated with information from a number of
9051e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell * attribute groups (MODELVIEW, LIGHT, TEXTURE).  A lot of derived
9061e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell * state references this value, and must be treated with care to
9071e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell * ensure that updates are done correctly.  All state dependent on
9081e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell * _NeedEyeCoords is calculated from within _mesa_update_tnl_spaces(),
90922144ab7552f0799bcfca506bf4ffa7f70a06649Gareth Hughes * and from nowhere else.
9101e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell */
91108836341788a9f9d638d9dc8328510ccd18ddeb5Brian Paulvoid _mesa_update_state( GLcontext *ctx )
9121e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell{
913479fa1db1dc7cb8e48219ac28edfb2f2a9c971b2Brian Paul   const GLuint new_state = ctx->NewState;
914479fa1db1dc7cb8e48219ac28edfb2f2a9c971b2Brian Paul   const GLuint oldneedeyecoords = ctx->_NeedEyeCoords;
9151e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell
9161e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell   if (MESA_VERBOSE & VERBOSE_STATE)
917306d3fcdbad523428501833405e47e9897896defKeith Whitwell      _mesa_print_state("_mesa_update_state", new_state);
9181e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell
9195e3bc0c2a2bcdf59949410f94c9b705fc1281ce8Jouk Jansen   if (new_state & _NEW_MODELVIEW)
92030f51ae067379c2b3573c06b707d25a9704df7beBrian Paul      _math_matrix_analyse( ctx->ModelviewMatrixStack.Top );
9211e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell
9225e3bc0c2a2bcdf59949410f94c9b705fc1281ce8Jouk Jansen   if (new_state & _NEW_PROJECTION)
923a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul      update_projection( ctx );
924d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul
9255e3bc0c2a2bcdf59949410f94c9b705fc1281ce8Jouk Jansen   if (new_state & _NEW_TEXTURE_MATRIX)
9268e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul      update_texture_matrices( ctx );
9271e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell
9285e3bc0c2a2bcdf59949410f94c9b705fc1281ce8Jouk Jansen   if (new_state & _NEW_COLOR_MATRIX)
92930f51ae067379c2b3573c06b707d25a9704df7beBrian Paul      _math_matrix_analyse( ctx->ColorMatrixStack.Top );
9305e3bc0c2a2bcdf59949410f94c9b705fc1281ce8Jouk Jansen
9311e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell   /* References ColorMatrix.type (derived above).
9321e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell    */
933cab974cf6c2dbfbf5dd5d291e1aae0f8eeb34290Keith Whitwell   if (new_state & _IMAGE_NEW_TRANSFER_STATE)
934a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul      update_image_transfer_state(ctx);
9351e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell
9361e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell   /* Contributes to NeedEyeCoords, NeedNormals.
937d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul    */
9385e3bc0c2a2bcdf59949410f94c9b705fc1281ce8Jouk Jansen   if (new_state & _NEW_TEXTURE)
9398e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul      update_texture_state( ctx );
940d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul
9415e3bc0c2a2bcdf59949410f94c9b705fc1281ce8Jouk Jansen   if (new_state & (_NEW_BUFFERS|_NEW_SCISSOR))
942a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul      update_drawbuffer( ctx );
943d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul
9445e3bc0c2a2bcdf59949410f94c9b705fc1281ce8Jouk Jansen   if (new_state & _NEW_POLYGON)
945a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul      update_polygon( ctx );
946d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul
9471e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell   /* Contributes to NeedEyeCoords, NeedNormals.
9481e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell    */
9495e3bc0c2a2bcdf59949410f94c9b705fc1281ce8Jouk Jansen   if (new_state & _NEW_LIGHT)
95008836341788a9f9d638d9dc8328510ccd18ddeb5Brian Paul      _mesa_update_lighting( ctx );
951d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul
9521e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell   /* We can light in object space if the modelview matrix preserves
9531e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell    * lengths and relative angles.
9541e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell    */
9551e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell   if (new_state & (_NEW_MODELVIEW|_NEW_LIGHT)) {
9561e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell      ctx->_NeedEyeCoords &= ~NEED_EYE_LIGHT_MODELVIEW;
9571e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell      if (ctx->Light.Enabled &&
95830f51ae067379c2b3573c06b707d25a9704df7beBrian Paul	  !TEST_MAT_FLAGS( ctx->ModelviewMatrixStack.Top, MAT_FLAGS_LENGTH_PRESERVING))
9591e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell	    ctx->_NeedEyeCoords |= NEED_EYE_LIGHT_MODELVIEW;
9601e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell   }
961d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul
9620cb28418d06c30e431bdff515c1d36a812d5950dKeith Whitwell
9630cb28418d06c30e431bdff515c1d36a812d5950dKeith Whitwell#if 0
964c6755aa6d55493a000644ba74233387d408d070fBrian Paul   /* XXX this is a bit of a hack.  We should be checking elsewhere if
965c6755aa6d55493a000644ba74233387d408d070fBrian Paul    * vertex program mode is enabled.  We set _NeedEyeCoords to zero to
966c6755aa6d55493a000644ba74233387d408d070fBrian Paul    * ensure that the combined modelview/projection matrix is computed
967c6755aa6d55493a000644ba74233387d408d070fBrian Paul    * in calculate_model_project_matrix().
968c6755aa6d55493a000644ba74233387d408d070fBrian Paul    */
969c6755aa6d55493a000644ba74233387d408d070fBrian Paul   if (ctx->VertexProgram.Enabled)
970c6755aa6d55493a000644ba74233387d408d070fBrian Paul      ctx->_NeedEyeCoords = 0;
9710cb28418d06c30e431bdff515c1d36a812d5950dKeith Whitwell   /* KW: it's now always computed.
9720cb28418d06c30e431bdff515c1d36a812d5950dKeith Whitwell    */
9730cb28418d06c30e431bdff515c1d36a812d5950dKeith Whitwell#endif
9740cb28418d06c30e431bdff515c1d36a812d5950dKeith Whitwell
9750cb28418d06c30e431bdff515c1d36a812d5950dKeith Whitwell   /* Keep ModelviewProject uptodate always to allow tnl
9760cb28418d06c30e431bdff515c1d36a812d5950dKeith Whitwell    * implementations that go model->clip even when eye is required.
9770cb28418d06c30e431bdff515c1d36a812d5950dKeith Whitwell    */
9780cb28418d06c30e431bdff515c1d36a812d5950dKeith Whitwell   if (new_state & (_NEW_MODELVIEW|_NEW_PROJECTION))
9790cb28418d06c30e431bdff515c1d36a812d5950dKeith Whitwell      calculate_model_project_matrix(ctx);
98006d05afdd687fcd1d59d46c6a86c2e5707e1859bBrian Paul
981cab974cf6c2dbfbf5dd5d291e1aae0f8eeb34290Keith Whitwell   /* ctx->_NeedEyeCoords is now uptodate.
9821e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell    *
983cab974cf6c2dbfbf5dd5d291e1aae0f8eeb34290Keith Whitwell    * If the truth value of this variable has changed, update for the
984cab974cf6c2dbfbf5dd5d291e1aae0f8eeb34290Keith Whitwell    * new lighting space and recompute the positions of lights and the
9851e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell    * normal transform.
9865e3bc0c2a2bcdf59949410f94c9b705fc1281ce8Jouk Jansen    *
9871e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell    * If the lighting space hasn't changed, may still need to recompute
98822144ab7552f0799bcfca506bf4ffa7f70a06649Gareth Hughes    * light positions & normal transforms for other reasons.
9891e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell    */
9901e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell   if (new_state & (_NEW_MODELVIEW |
9911e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell		    _NEW_LIGHT |
992cab974cf6c2dbfbf5dd5d291e1aae0f8eeb34290Keith Whitwell		    _MESA_NEW_NEED_EYE_COORDS))
993a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul      update_tnl_spaces( ctx, oldneedeyecoords );
9941e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell
99523caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   /*
99623caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell    * Here the driver sets up all the ctx->Driver function pointers
99723caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell    * to it's specific, private functions, and performs any
99823caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell    * internal state management necessary, including invalidating
99923caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell    * state of active modules.
1000cab974cf6c2dbfbf5dd5d291e1aae0f8eeb34290Keith Whitwell    *
1001cab974cf6c2dbfbf5dd5d291e1aae0f8eeb34290Keith Whitwell    * Set ctx->NewState to zero to avoid recursion if
1002cab974cf6c2dbfbf5dd5d291e1aae0f8eeb34290Keith Whitwell    * Driver.UpdateState() has to call FLUSH_VERTICES().  (fixed?)
100323caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell    */
1004d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   ctx->NewState = 0;
1005cab974cf6c2dbfbf5dd5d291e1aae0f8eeb34290Keith Whitwell   ctx->Driver.UpdateState(ctx, new_state);
10062448fc7deeaa870d879de17158f243f239c05b15Keith Whitwell   ctx->Array.NewState = 0;
1007479fa1db1dc7cb8e48219ac28edfb2f2a9c971b2Brian Paul
10082448fc7deeaa870d879de17158f243f239c05b15Keith Whitwell   /* At this point we can do some assertions to be sure the required
100922144ab7552f0799bcfca506bf4ffa7f70a06649Gareth Hughes    * device driver function pointers are all initialized.
1010479fa1db1dc7cb8e48219ac28edfb2f2a9c971b2Brian Paul    */
10112448fc7deeaa870d879de17158f243f239c05b15Keith Whitwell   ASSERT(ctx->Driver.GetString);
10122448fc7deeaa870d879de17158f243f239c05b15Keith Whitwell   ASSERT(ctx->Driver.UpdateState);
10132448fc7deeaa870d879de17158f243f239c05b15Keith Whitwell   ASSERT(ctx->Driver.Clear);
10142448fc7deeaa870d879de17158f243f239c05b15Keith Whitwell   ASSERT(ctx->Driver.SetDrawBuffer);
10152448fc7deeaa870d879de17158f243f239c05b15Keith Whitwell   ASSERT(ctx->Driver.GetBufferSize);
1016479fa1db1dc7cb8e48219ac28edfb2f2a9c971b2Brian Paul   if (ctx->Visual.accumRedBits > 0) {
10172448fc7deeaa870d879de17158f243f239c05b15Keith Whitwell      ASSERT(ctx->Driver.Accum);
1018479fa1db1dc7cb8e48219ac28edfb2f2a9c971b2Brian Paul   }
10192448fc7deeaa870d879de17158f243f239c05b15Keith Whitwell   ASSERT(ctx->Driver.DrawPixels);
10202448fc7deeaa870d879de17158f243f239c05b15Keith Whitwell   ASSERT(ctx->Driver.ReadPixels);
10212448fc7deeaa870d879de17158f243f239c05b15Keith Whitwell   ASSERT(ctx->Driver.CopyPixels);
10222448fc7deeaa870d879de17158f243f239c05b15Keith Whitwell   ASSERT(ctx->Driver.Bitmap);
1023f7c830e35ca243c391bde1bfd0ae059c292ac649Brian Paul   ASSERT(ctx->Driver.ResizeBuffers);
10242448fc7deeaa870d879de17158f243f239c05b15Keith Whitwell   ASSERT(ctx->Driver.TexImage1D);
10252448fc7deeaa870d879de17158f243f239c05b15Keith Whitwell   ASSERT(ctx->Driver.TexImage2D);
10262448fc7deeaa870d879de17158f243f239c05b15Keith Whitwell   ASSERT(ctx->Driver.TexImage3D);
10272448fc7deeaa870d879de17158f243f239c05b15Keith Whitwell   ASSERT(ctx->Driver.TexSubImage1D);
10282448fc7deeaa870d879de17158f243f239c05b15Keith Whitwell   ASSERT(ctx->Driver.TexSubImage2D);
10292448fc7deeaa870d879de17158f243f239c05b15Keith Whitwell   ASSERT(ctx->Driver.TexSubImage3D);
1030c499ce31baf820e84d133c2189f88e15a1a36672Brian Paul   ASSERT(ctx->Driver.CopyTexImage1D);
1031c499ce31baf820e84d133c2189f88e15a1a36672Brian Paul   ASSERT(ctx->Driver.CopyTexImage2D);
1032c499ce31baf820e84d133c2189f88e15a1a36672Brian Paul   ASSERT(ctx->Driver.CopyTexSubImage1D);
1033c499ce31baf820e84d133c2189f88e15a1a36672Brian Paul   ASSERT(ctx->Driver.CopyTexSubImage2D);
1034c499ce31baf820e84d133c2189f88e15a1a36672Brian Paul   ASSERT(ctx->Driver.CopyTexSubImage3D);
1035479fa1db1dc7cb8e48219ac28edfb2f2a9c971b2Brian Paul   if (ctx->Extensions.ARB_texture_compression) {
1036e4276667dafc8de0c6e64af8300fc7598437de6eBrian Paul      ASSERT(ctx->Driver.BaseCompressedTexFormat);
1037e4276667dafc8de0c6e64af8300fc7598437de6eBrian Paul      ASSERT(ctx->Driver.CompressedTextureSize);
1038e4276667dafc8de0c6e64af8300fc7598437de6eBrian Paul      ASSERT(ctx->Driver.GetCompressedTexImage);
1039e4276667dafc8de0c6e64af8300fc7598437de6eBrian Paul#if 0  /* HW drivers need these, but not SW rasterizers */
10402448fc7deeaa870d879de17158f243f239c05b15Keith Whitwell      ASSERT(ctx->Driver.CompressedTexImage1D);
10412448fc7deeaa870d879de17158f243f239c05b15Keith Whitwell      ASSERT(ctx->Driver.CompressedTexImage2D);
10422448fc7deeaa870d879de17158f243f239c05b15Keith Whitwell      ASSERT(ctx->Driver.CompressedTexImage3D);
10432448fc7deeaa870d879de17158f243f239c05b15Keith Whitwell      ASSERT(ctx->Driver.CompressedTexSubImage1D);
10442448fc7deeaa870d879de17158f243f239c05b15Keith Whitwell      ASSERT(ctx->Driver.CompressedTexSubImage2D);
10452448fc7deeaa870d879de17158f243f239c05b15Keith Whitwell      ASSERT(ctx->Driver.CompressedTexSubImage3D);
1046e4276667dafc8de0c6e64af8300fc7598437de6eBrian Paul#endif
1047479fa1db1dc7cb8e48219ac28edfb2f2a9c971b2Brian Paul   }
1048d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul}
10490cb28418d06c30e431bdff515c1d36a812d5950dKeith Whitwell
10500cb28418d06c30e431bdff515c1d36a812d5950dKeith Whitwell/* Is this helpful?
10510cb28418d06c30e431bdff515c1d36a812d5950dKeith Whitwell */
10520cb28418d06c30e431bdff515c1d36a812d5950dKeith Whitwellvoid
10530cb28418d06c30e431bdff515c1d36a812d5950dKeith Whitwell_mesa_allow_light_in_model( GLcontext *ctx, GLboolean flag )
10540cb28418d06c30e431bdff515c1d36a812d5950dKeith Whitwell{
10550cb28418d06c30e431bdff515c1d36a812d5950dKeith Whitwell   if (flag)
10560cb28418d06c30e431bdff515c1d36a812d5950dKeith Whitwell      ctx->_NeedEyeCoords &= ~NEED_EYE_DRIVER;
10570cb28418d06c30e431bdff515c1d36a812d5950dKeith Whitwell   else
10580cb28418d06c30e431bdff515c1d36a812d5950dKeith Whitwell      ctx->_NeedEyeCoords |= NEED_EYE_DRIVER;
10590cb28418d06c30e431bdff515c1d36a812d5950dKeith Whitwell
10600cb28418d06c30e431bdff515c1d36a812d5950dKeith Whitwell   ctx->NewState |= _NEW_POINT;	/* one of the bits from
10610cb28418d06c30e431bdff515c1d36a812d5950dKeith Whitwell				 * _MESA_NEW_NEED_EYE_COORDS.
10620cb28418d06c30e431bdff515c1d36a812d5950dKeith Whitwell				 */
10630cb28418d06c30e431bdff515c1d36a812d5950dKeith Whitwell}
1064