state.c revision 2525bc7d305f6dcab3beb75535da25a488c969b0
12525bc7d305f6dcab3beb75535da25a488c969b0Brian Paul/* $Id: state.c,v 1.88 2002/06/30 15:47:01 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
4282525bc7d305f6dcab3beb75535da25a488c969b0Brian Paul   /* 148. GL_EXT_multi_draw_arrays */
4292525bc7d305f6dcab3beb75535da25a488c969b0Brian Paul   exec->MultiDrawArraysEXT = _mesa_MultiDrawArraysEXT;
4302525bc7d305f6dcab3beb75535da25a488c969b0Brian Paul   exec->MultiDrawElementsEXT = _mesa_MultiDrawElementsEXT;
4312525bc7d305f6dcab3beb75535da25a488c969b0Brian Paul
4321a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul   /* 173. GL_INGR_blend_func_separate */
4331a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul   exec->BlendFuncSeparateEXT = _mesa_BlendFuncSeparateEXT;
4341a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul
4351a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul   /* 196. GL_MESA_resize_buffers */
4361a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul   exec->ResizeBuffersMESA = _mesa_ResizeBuffersMESA;
4371a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul
4381a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul   /* 197. GL_MESA_window_pos */
4391a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul   exec->WindowPos2dMESA = _mesa_WindowPos2dMESA;
4401a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul   exec->WindowPos2dvMESA = _mesa_WindowPos2dvMESA;
4411a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul   exec->WindowPos2fMESA = _mesa_WindowPos2fMESA;
4421a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul   exec->WindowPos2fvMESA = _mesa_WindowPos2fvMESA;
4431a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul   exec->WindowPos2iMESA = _mesa_WindowPos2iMESA;
4441a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul   exec->WindowPos2ivMESA = _mesa_WindowPos2ivMESA;
4451a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul   exec->WindowPos2sMESA = _mesa_WindowPos2sMESA;
4461a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul   exec->WindowPos2svMESA = _mesa_WindowPos2svMESA;
4471a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul   exec->WindowPos3dMESA = _mesa_WindowPos3dMESA;
4481a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul   exec->WindowPos3dvMESA = _mesa_WindowPos3dvMESA;
4491a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul   exec->WindowPos3fMESA = _mesa_WindowPos3fMESA;
4501a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul   exec->WindowPos3fvMESA = _mesa_WindowPos3fvMESA;
4511a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul   exec->WindowPos3iMESA = _mesa_WindowPos3iMESA;
4521a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul   exec->WindowPos3ivMESA = _mesa_WindowPos3ivMESA;
4531a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul   exec->WindowPos3sMESA = _mesa_WindowPos3sMESA;
4541a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul   exec->WindowPos3svMESA = _mesa_WindowPos3svMESA;
4551a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul   exec->WindowPos4dMESA = _mesa_WindowPos4dMESA;
4561a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul   exec->WindowPos4dvMESA = _mesa_WindowPos4dvMESA;
4571a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul   exec->WindowPos4fMESA = _mesa_WindowPos4fMESA;
4581a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul   exec->WindowPos4fvMESA = _mesa_WindowPos4fvMESA;
4591a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul   exec->WindowPos4iMESA = _mesa_WindowPos4iMESA;
4601a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul   exec->WindowPos4ivMESA = _mesa_WindowPos4ivMESA;
4611a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul   exec->WindowPos4sMESA = _mesa_WindowPos4sMESA;
4621a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul   exec->WindowPos4svMESA = _mesa_WindowPos4svMESA;
463d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul
464b638c34381004aa2a778227bad51d259d05a9b53Brian Paul   /* 233. GL_NV_vertex_program */
46586b842790b720cd6b1499ce8edca8a4e9c8dc029Brian Paul   exec->BindProgramNV = _mesa_BindProgramNV;
46686b842790b720cd6b1499ce8edca8a4e9c8dc029Brian Paul   exec->DeleteProgramsNV = _mesa_DeleteProgramsNV;
46786b842790b720cd6b1499ce8edca8a4e9c8dc029Brian Paul   exec->ExecuteProgramNV = _mesa_ExecuteProgramNV;
46886b842790b720cd6b1499ce8edca8a4e9c8dc029Brian Paul   exec->GenProgramsNV = _mesa_GenProgramsNV;
46986b842790b720cd6b1499ce8edca8a4e9c8dc029Brian Paul   exec->AreProgramsResidentNV = _mesa_AreProgramsResidentNV;
47086b842790b720cd6b1499ce8edca8a4e9c8dc029Brian Paul   exec->RequestResidentProgramsNV = _mesa_RequestResidentProgramsNV;
47186b842790b720cd6b1499ce8edca8a4e9c8dc029Brian Paul   exec->GetProgramParameterfvNV = _mesa_GetProgramParameterfvNV;
47286b842790b720cd6b1499ce8edca8a4e9c8dc029Brian Paul   exec->GetProgramParameterdvNV = _mesa_GetProgramParameterdvNV;
47386b842790b720cd6b1499ce8edca8a4e9c8dc029Brian Paul   exec->GetProgramivNV = _mesa_GetProgramivNV;
47486b842790b720cd6b1499ce8edca8a4e9c8dc029Brian Paul   exec->GetProgramStringNV = _mesa_GetProgramStringNV;
47586b842790b720cd6b1499ce8edca8a4e9c8dc029Brian Paul   exec->GetTrackMatrixivNV = _mesa_GetTrackMatrixivNV;
47686b842790b720cd6b1499ce8edca8a4e9c8dc029Brian Paul   exec->GetVertexAttribdvNV = _mesa_GetVertexAttribdvNV;
47786b842790b720cd6b1499ce8edca8a4e9c8dc029Brian Paul   exec->GetVertexAttribfvNV = _mesa_GetVertexAttribfvNV;
47886b842790b720cd6b1499ce8edca8a4e9c8dc029Brian Paul   exec->GetVertexAttribivNV = _mesa_GetVertexAttribivNV;
47986b842790b720cd6b1499ce8edca8a4e9c8dc029Brian Paul   exec->GetVertexAttribPointervNV = _mesa_GetVertexAttribPointervNV;
48086b842790b720cd6b1499ce8edca8a4e9c8dc029Brian Paul   exec->IsProgramNV = _mesa_IsProgramNV;
48186b842790b720cd6b1499ce8edca8a4e9c8dc029Brian Paul   exec->LoadProgramNV = _mesa_LoadProgramNV;
48286b842790b720cd6b1499ce8edca8a4e9c8dc029Brian Paul   exec->ProgramParameter4dNV = _mesa_ProgramParameter4dNV;
48386b842790b720cd6b1499ce8edca8a4e9c8dc029Brian Paul   exec->ProgramParameter4dvNV = _mesa_ProgramParameter4dvNV;
48486b842790b720cd6b1499ce8edca8a4e9c8dc029Brian Paul   exec->ProgramParameter4fNV = _mesa_ProgramParameter4fNV;
48586b842790b720cd6b1499ce8edca8a4e9c8dc029Brian Paul   exec->ProgramParameter4fvNV = _mesa_ProgramParameter4fvNV;
48686b842790b720cd6b1499ce8edca8a4e9c8dc029Brian Paul   exec->ProgramParameters4dvNV = _mesa_ProgramParameters4dvNV;
48786b842790b720cd6b1499ce8edca8a4e9c8dc029Brian Paul   exec->ProgramParameters4fvNV = _mesa_ProgramParameters4fvNV;
48886b842790b720cd6b1499ce8edca8a4e9c8dc029Brian Paul   exec->TrackMatrixNV = _mesa_TrackMatrixNV;
48986b842790b720cd6b1499ce8edca8a4e9c8dc029Brian Paul   exec->VertexAttribPointerNV = _mesa_VertexAttribPointerNV;
49086b842790b720cd6b1499ce8edca8a4e9c8dc029Brian Paul
49123d8ef3937b3b66684f7feb62446abca8e91d307Brian Paul   /* 262. GL_NV_point_sprite */
49223d8ef3937b3b66684f7feb62446abca8e91d307Brian Paul   exec->PointParameteriNV = _mesa_PointParameteriNV;
49323d8ef3937b3b66684f7feb62446abca8e91d307Brian Paul   exec->PointParameterivNV = _mesa_PointParameterivNV;
49423d8ef3937b3b66684f7feb62446abca8e91d307Brian Paul
4951a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul   /* ARB 1. GL_ARB_multitexture */
496471a774f433c23b263828aa591415741e78a35daBrian Paul   exec->ActiveTextureARB = _mesa_ActiveTextureARB;
497471a774f433c23b263828aa591415741e78a35daBrian Paul   exec->ClientActiveTextureARB = _mesa_ClientActiveTextureARB;
498d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul
4991a1cf7ed75d799bbda34399ddab7949b8c06686eBrian Paul   /* ARB 3. GL_ARB_transpose_matrix */
500471a774f433c23b263828aa591415741e78a35daBrian Paul   exec->LoadTransposeMatrixdARB = _mesa_LoadTransposeMatrixdARB;
501471a774f433c23b263828aa591415741e78a35daBrian Paul   exec->LoadTransposeMatrixfARB = _mesa_LoadTransposeMatrixfARB;
502471a774f433c23b263828aa591415741e78a35daBrian Paul   exec->MultTransposeMatrixdARB = _mesa_MultTransposeMatrixdARB;
503471a774f433c23b263828aa591415741e78a35daBrian Paul   exec->MultTransposeMatrixfARB = _mesa_MultTransposeMatrixfARB;
5041207bf057aeea3376e5e0f03f789a5d67ed4d29dBrian Paul
505736fcbec4732830e7976fb5eb309b13e03be132cBrian Paul   /* ARB 5. GL_ARB_multisample */
506471a774f433c23b263828aa591415741e78a35daBrian Paul   exec->SampleCoverageARB = _mesa_SampleCoverageARB;
507736fcbec4732830e7976fb5eb309b13e03be132cBrian Paul
5081207bf057aeea3376e5e0f03f789a5d67ed4d29dBrian Paul   /* ARB 12. GL_ARB_texture_compression */
509471a774f433c23b263828aa591415741e78a35daBrian Paul   exec->CompressedTexImage3DARB = _mesa_CompressedTexImage3DARB;
510471a774f433c23b263828aa591415741e78a35daBrian Paul   exec->CompressedTexImage2DARB = _mesa_CompressedTexImage2DARB;
511471a774f433c23b263828aa591415741e78a35daBrian Paul   exec->CompressedTexImage1DARB = _mesa_CompressedTexImage1DARB;
512471a774f433c23b263828aa591415741e78a35daBrian Paul   exec->CompressedTexSubImage3DARB = _mesa_CompressedTexSubImage3DARB;
513471a774f433c23b263828aa591415741e78a35daBrian Paul   exec->CompressedTexSubImage2DARB = _mesa_CompressedTexSubImage2DARB;
514471a774f433c23b263828aa591415741e78a35daBrian Paul   exec->CompressedTexSubImage1DARB = _mesa_CompressedTexSubImage1DARB;
515471a774f433c23b263828aa591415741e78a35daBrian Paul   exec->GetCompressedTexImageARB = _mesa_GetCompressedTexImageARB;
5161207bf057aeea3376e5e0f03f789a5d67ed4d29dBrian Paul
5171537b63fce36f87b3606d0e7cdca2d10bbdffd56Brian Paul   /* ARB 14. GL_ARB_point_parameters */
5181537b63fce36f87b3606d0e7cdca2d10bbdffd56Brian Paul   /* reuse EXT_point_parameters functions */
5191537b63fce36f87b3606d0e7cdca2d10bbdffd56Brian Paul
520d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul}
521d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul
522d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul
5231207bf057aeea3376e5e0f03f789a5d67ed4d29dBrian Paul
524d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul/**********************************************************************/
525d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul/*****                   State update logic                       *****/
526d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul/**********************************************************************/
527d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul
528d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul
5290c3f820bf069785723510f4ad2bf4b69ba7f72e0Brian Paul/*
5300c3f820bf069785723510f4ad2bf4b69ba7f72e0Brian Paul * Check polygon state and set DD_TRI_CULL_FRONT_BACK and/or DD_TRI_OFFSET
5310c3f820bf069785723510f4ad2bf4b69ba7f72e0Brian Paul * in ctx->_TriangleCaps if needed.
5320c3f820bf069785723510f4ad2bf4b69ba7f72e0Brian Paul */
5331e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwellstatic void
534a852378a6289d154364dde440f89a39bbfc33e2dBrian Paulupdate_polygon( GLcontext *ctx )
5351e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell{
536cab974cf6c2dbfbf5dd5d291e1aae0f8eeb34290Keith Whitwell   ctx->_TriangleCaps &= ~(DD_TRI_CULL_FRONT_BACK | DD_TRI_OFFSET);
537cab974cf6c2dbfbf5dd5d291e1aae0f8eeb34290Keith Whitwell
538bfa023921c9d1aa872237e0ac6085160f7c2cbc5Keith Whitwell   if (ctx->Polygon.CullFlag && ctx->Polygon.CullFaceMode == GL_FRONT_AND_BACK)
539bfa023921c9d1aa872237e0ac6085160f7c2cbc5Keith Whitwell      ctx->_TriangleCaps |= DD_TRI_CULL_FRONT_BACK;
540d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul
5411e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell   /* Any Polygon offsets enabled? */
542f1d6b384415a083c358d3824e77f3d434f08bfccBrian Paul   ctx->Polygon._OffsetAny = GL_FALSE;
5431e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell   if (ctx->Polygon.OffsetPoint ||
5441e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell       ctx->Polygon.OffsetLine ||
545f1d6b384415a083c358d3824e77f3d434f08bfccBrian Paul       ctx->Polygon.OffsetFill) {
5461e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell      ctx->_TriangleCaps |= DD_TRI_OFFSET;
547f1d6b384415a083c358d3824e77f3d434f08bfccBrian Paul      ctx->Polygon._OffsetAny = GL_TRUE;
548f1d6b384415a083c358d3824e77f3d434f08bfccBrian Paul   }
5491e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell}
550d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul
5515e3bc0c2a2bcdf59949410f94c9b705fc1281ce8Jouk Jansenstatic void
552a852378a6289d154364dde440f89a39bbfc33e2dBrian Paulcalculate_model_project_matrix( GLcontext *ctx )
5531e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell{
55423caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell      _math_matrix_mul_matrix( &ctx->_ModelProjectMatrix,
55530f51ae067379c2b3573c06b707d25a9704df7beBrian Paul			       ctx->ProjectionMatrixStack.Top,
55630f51ae067379c2b3573c06b707d25a9704df7beBrian Paul			       ctx->ModelviewMatrixStack.Top );
5571e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell
558ad2ac216fa0cbebc36530bf9e5256e902710b892Keith Whitwell      _math_matrix_analyse( &ctx->_ModelProjectMatrix );
5591e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell}
560d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul
5611e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwellstatic void
562a852378a6289d154364dde440f89a39bbfc33e2dBrian Paulupdate_modelview_scale( GLcontext *ctx )
5631e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell{
5641e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell   ctx->_ModelViewInvScale = 1.0F;
56530f51ae067379c2b3573c06b707d25a9704df7beBrian Paul   if (ctx->ModelviewMatrixStack.Top->flags & (MAT_FLAG_UNIFORM_SCALE |
5661e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell			       MAT_FLAG_GENERAL_SCALE |
5671e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell			       MAT_FLAG_GENERAL_3D |
5681e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell			       MAT_FLAG_GENERAL) ) {
56930f51ae067379c2b3573c06b707d25a9704df7beBrian Paul      const GLfloat *m = ctx->ModelviewMatrixStack.Top->inv;
5701e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell      GLfloat f = m[2] * m[2] + m[6] * m[6] + m[10] * m[10];
5711e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell      if (f < 1e-12) f = 1.0;
5721e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell      if (ctx->_NeedEyeCoords)
5737b9fe820a3fba3849864682fbb1cb512362934abKarl Schultz	 ctx->_ModelViewInvScale = (GLfloat) (1.0/GL_SQRT(f));
5741e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell      else
5757b9fe820a3fba3849864682fbb1cb512362934abKarl Schultz	 ctx->_ModelViewInvScale = (GLfloat) GL_SQRT(f);
5761e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell   }
5771e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell}
578d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul
5791e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell
5805e3bc0c2a2bcdf59949410f94c9b705fc1281ce8Jouk Jansen/* Bring uptodate any state that relies on _NeedEyeCoords.
5811e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell */
5821e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwellstatic void
583a852378a6289d154364dde440f89a39bbfc33e2dBrian Paulupdate_tnl_spaces( GLcontext *ctx, GLuint oldneedeyecoords )
5845e3bc0c2a2bcdf59949410f94c9b705fc1281ce8Jouk Jansen{
5851e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell   /* Check if the truth-value interpretations of the bitfields have
5865e3bc0c2a2bcdf59949410f94c9b705fc1281ce8Jouk Jansen    * changed:
5871e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell    */
588a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul   if ((oldneedeyecoords == 0) != (ctx->_NeedEyeCoords == 0)) {
5891e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell      /* Recalculate all state that depends on _NeedEyeCoords.
590d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul       */
591a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul      update_modelview_scale(ctx);
59208836341788a9f9d638d9dc8328510ccd18ddeb5Brian Paul      _mesa_compute_light_positions( ctx );
5931e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell
5941e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell      if (ctx->Driver.LightingSpaceChange)
5951e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell	 ctx->Driver.LightingSpaceChange( ctx );
596d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   }
597a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul   else {
5981e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell      GLuint new_state = ctx->NewState;
599d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul
600cab974cf6c2dbfbf5dd5d291e1aae0f8eeb34290Keith Whitwell      /* Recalculate that same state only if it has been invalidated
60122144ab7552f0799bcfca506bf4ffa7f70a06649Gareth Hughes       * by other statechanges.
6021e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell       */
6035e3bc0c2a2bcdf59949410f94c9b705fc1281ce8Jouk Jansen      if (new_state & _NEW_MODELVIEW)
604a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul	 update_modelview_scale(ctx);
6051e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell
6061e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell      if (new_state & (_NEW_LIGHT|_NEW_MODELVIEW))
60708836341788a9f9d638d9dc8328510ccd18ddeb5Brian Paul	 _mesa_compute_light_positions( ctx );
6081e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell   }
6091e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell}
6101e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell
6111e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell
6121e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwellstatic void
613a852378a6289d154364dde440f89a39bbfc33e2dBrian Paulupdate_drawbuffer( GLcontext *ctx )
6141e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell{
6151e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell   ctx->DrawBuffer->_Xmin = 0;
6161e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell   ctx->DrawBuffer->_Ymin = 0;
6171e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell   ctx->DrawBuffer->_Xmax = ctx->DrawBuffer->Width;
6181e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell   ctx->DrawBuffer->_Ymax = ctx->DrawBuffer->Height;
6191e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell   if (ctx->Scissor.Enabled) {
6201e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell      if (ctx->Scissor.X > ctx->DrawBuffer->_Xmin) {
6211e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell	 ctx->DrawBuffer->_Xmin = ctx->Scissor.X;
6221e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell      }
6231e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell      if (ctx->Scissor.Y > ctx->DrawBuffer->_Ymin) {
6241e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell	 ctx->DrawBuffer->_Ymin = ctx->Scissor.Y;
6251e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell      }
6261e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell      if (ctx->Scissor.X + ctx->Scissor.Width < ctx->DrawBuffer->_Xmax) {
6271e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell	 ctx->DrawBuffer->_Xmax = ctx->Scissor.X + ctx->Scissor.Width;
628d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul      }
6291e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell      if (ctx->Scissor.Y + ctx->Scissor.Height < ctx->DrawBuffer->_Ymax) {
6301e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell	 ctx->DrawBuffer->_Ymax = ctx->Scissor.Y + ctx->Scissor.Height;
6311e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell      }
6321e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell   }
6331e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell}
634d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul
635d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul
6361e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell/* NOTE: This routine references Tranform attribute values to compute
6371e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell * userclip positions in clip space, but is only called on
6381e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell * _NEW_PROJECTION.  The _mesa_ClipPlane() function keeps these values
6391043a6498a7f94922be5f4b5deac89fd05cfa670Brian Paul * up to date across changes to the Transform attributes.
6401e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell */
6411e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwellstatic void
642a852378a6289d154364dde440f89a39bbfc33e2dBrian Paulupdate_projection( GLcontext *ctx )
6431e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell{
64430f51ae067379c2b3573c06b707d25a9704df7beBrian Paul   _math_matrix_analyse( ctx->ProjectionMatrixStack.Top );
64522144ab7552f0799bcfca506bf4ffa7f70a06649Gareth Hughes
6461e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell   /* Recompute clip plane positions in clipspace.  This is also done
6471e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell    * in _mesa_ClipPlane().
6481e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell    */
649103bc0f75c00dfcf671dc50d8d9666f88a42a59dBrian Paul   if (ctx->Transform.ClipPlanesEnabled) {
6501e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell      GLuint p;
651a864432fb4333dfbbe669554de7485d8426e1c38Brian Paul      for (p = 0; p < ctx->Const.MaxClipPlanes; p++) {
652103bc0f75c00dfcf671dc50d8d9666f88a42a59dBrian Paul	 if (ctx->Transform.ClipPlanesEnabled & (1 << p)) {
65308836341788a9f9d638d9dc8328510ccd18ddeb5Brian Paul	    _mesa_transform_vector( ctx->Transform._ClipUserPlane[p],
6541e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell				 ctx->Transform.EyeUserPlane[p],
65530f51ae067379c2b3573c06b707d25a9704df7beBrian Paul				 ctx->ProjectionMatrixStack.Top->inv );
656d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul	 }
657d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul      }
658d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   }
6591e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell}
6601e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell
6611e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell
662a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul/*
663a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul * Return a bitmask of IMAGE_*_BIT flags which to indicate which
664a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul * pixel transfer operations are enabled.
665a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul */
666a852378a6289d154364dde440f89a39bbfc33e2dBrian Paulstatic void
667a852378a6289d154364dde440f89a39bbfc33e2dBrian Paulupdate_image_transfer_state(GLcontext *ctx)
668a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul{
669a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul   GLuint mask = 0;
670a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul
671a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul   if (ctx->Pixel.RedScale   != 1.0F || ctx->Pixel.RedBias   != 0.0F ||
672a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul       ctx->Pixel.GreenScale != 1.0F || ctx->Pixel.GreenBias != 0.0F ||
673a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul       ctx->Pixel.BlueScale  != 1.0F || ctx->Pixel.BlueBias  != 0.0F ||
674a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul       ctx->Pixel.AlphaScale != 1.0F || ctx->Pixel.AlphaBias != 0.0F)
675a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul      mask |= IMAGE_SCALE_BIAS_BIT;
676a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul
677a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul   if (ctx->Pixel.IndexShift || ctx->Pixel.IndexOffset)
678a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul      mask |= IMAGE_SHIFT_OFFSET_BIT;
6795e3bc0c2a2bcdf59949410f94c9b705fc1281ce8Jouk Jansen
680a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul   if (ctx->Pixel.MapColorFlag)
681a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul      mask |= IMAGE_MAP_COLOR_BIT;
682a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul
683a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul   if (ctx->Pixel.ColorTableEnabled)
684a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul      mask |= IMAGE_COLOR_TABLE_BIT;
685a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul
686a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul   if (ctx->Pixel.Convolution1DEnabled ||
687a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul       ctx->Pixel.Convolution2DEnabled ||
68845015e4d79d63183f6d9c4e4fad655921e07b0abBrian Paul       ctx->Pixel.Separable2DEnabled) {
689a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul      mask |= IMAGE_CONVOLUTION_BIT;
69045015e4d79d63183f6d9c4e4fad655921e07b0abBrian Paul      if (ctx->Pixel.PostConvolutionScale[0] != 1.0F ||
69145015e4d79d63183f6d9c4e4fad655921e07b0abBrian Paul          ctx->Pixel.PostConvolutionScale[1] != 1.0F ||
69245015e4d79d63183f6d9c4e4fad655921e07b0abBrian Paul          ctx->Pixel.PostConvolutionScale[2] != 1.0F ||
69345015e4d79d63183f6d9c4e4fad655921e07b0abBrian Paul          ctx->Pixel.PostConvolutionScale[3] != 1.0F ||
69445015e4d79d63183f6d9c4e4fad655921e07b0abBrian Paul          ctx->Pixel.PostConvolutionBias[0] != 0.0F ||
69545015e4d79d63183f6d9c4e4fad655921e07b0abBrian Paul          ctx->Pixel.PostConvolutionBias[1] != 0.0F ||
69645015e4d79d63183f6d9c4e4fad655921e07b0abBrian Paul          ctx->Pixel.PostConvolutionBias[2] != 0.0F ||
69745015e4d79d63183f6d9c4e4fad655921e07b0abBrian Paul          ctx->Pixel.PostConvolutionBias[3] != 0.0F) {
69845015e4d79d63183f6d9c4e4fad655921e07b0abBrian Paul         mask |= IMAGE_POST_CONVOLUTION_SCALE_BIAS;
69945015e4d79d63183f6d9c4e4fad655921e07b0abBrian Paul      }
70045015e4d79d63183f6d9c4e4fad655921e07b0abBrian Paul   }
701a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul
702a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul   if (ctx->Pixel.PostConvolutionColorTableEnabled)
703a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul      mask |= IMAGE_POST_CONVOLUTION_COLOR_TABLE_BIT;
704a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul
70530f51ae067379c2b3573c06b707d25a9704df7beBrian Paul   if (ctx->ColorMatrixStack.Top->type != MATRIX_IDENTITY ||
706a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul       ctx->Pixel.PostColorMatrixScale[0] != 1.0F ||
707a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul       ctx->Pixel.PostColorMatrixBias[0]  != 0.0F ||
708a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul       ctx->Pixel.PostColorMatrixScale[1] != 1.0F ||
709a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul       ctx->Pixel.PostColorMatrixBias[1]  != 0.0F ||
710a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul       ctx->Pixel.PostColorMatrixScale[2] != 1.0F ||
711a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul       ctx->Pixel.PostColorMatrixBias[2]  != 0.0F ||
712a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul       ctx->Pixel.PostColorMatrixScale[3] != 1.0F ||
713a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul       ctx->Pixel.PostColorMatrixBias[3]  != 0.0F)
714a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul      mask |= IMAGE_COLOR_MATRIX_BIT;
715a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul
716a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul   if (ctx->Pixel.PostColorMatrixColorTableEnabled)
717a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul      mask |= IMAGE_POST_COLOR_MATRIX_COLOR_TABLE_BIT;
718a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul
719a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul   if (ctx->Pixel.HistogramEnabled)
720a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul      mask |= IMAGE_HISTOGRAM_BIT;
721a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul
722a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul   if (ctx->Pixel.MinMaxEnabled)
723a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul      mask |= IMAGE_MIN_MAX_BIT;
724a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul
725a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul   ctx->_ImageTransferState = mask;
726a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul}
727a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul
7281e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell
7298e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul
7308e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul
7318e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul/* Note: This routine refers to derived texture attribute values to
7328e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul * compute the ENABLE_TEXMAT flags, but is only called on
7338e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul * _NEW_TEXTURE_MATRIX.  On changes to _NEW_TEXTURE, the ENABLE_TEXMAT
7348e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul * flags are updated by _mesa_update_textures(), below.
7358e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul *
7368e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul * If both TEXTURE and TEXTURE_MATRIX change at once, these values
7378e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul * will be computed twice.
7388e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul */
7398e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paulstatic void
7408e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paulupdate_texture_matrices( GLcontext *ctx )
7418e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul{
7428e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul   GLuint i;
7438e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul
744ed39a43b8cb2e1cf69b097fc89365cde470ebf51Keith Whitwell   ctx->Texture._TexMatEnabled = 0;
7458e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul
7468e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul   for (i=0; i < ctx->Const.MaxTextureUnits; i++) {
74730f51ae067379c2b3573c06b707d25a9704df7beBrian Paul      if (ctx->TextureMatrixStack[i].Top->flags & MAT_DIRTY) {
74830f51ae067379c2b3573c06b707d25a9704df7beBrian Paul	 _math_matrix_analyse( ctx->TextureMatrixStack[i].Top );
7498e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul
7508e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul	 if (ctx->Texture.Unit[i]._ReallyEnabled &&
75130f51ae067379c2b3573c06b707d25a9704df7beBrian Paul	     ctx->TextureMatrixStack[i].Top->type != MATRIX_IDENTITY)
752ed39a43b8cb2e1cf69b097fc89365cde470ebf51Keith Whitwell	    ctx->Texture._TexMatEnabled |= ENABLE_TEXMAT(i);
7530cb28418d06c30e431bdff515c1d36a812d5950dKeith Whitwell
7540cb28418d06c30e431bdff515c1d36a812d5950dKeith Whitwell	 if (ctx->Driver.TextureMatrix)
7550cb28418d06c30e431bdff515c1d36a812d5950dKeith Whitwell	    ctx->Driver.TextureMatrix( ctx, i, ctx->TextureMatrixStack[i].Top);
7568e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul      }
7578e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul   }
7588e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul}
7598e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul
7608e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul
7618e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul/* Note: This routine refers to derived texture matrix values to
7628e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul * compute the ENABLE_TEXMAT flags, but is only called on
7638e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul * _NEW_TEXTURE.  On changes to _NEW_TEXTURE_MATRIX, the ENABLE_TEXMAT
7648e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul * flags are updated by _mesa_update_texture_matrices, above.
7658e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul *
7668e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul * If both TEXTURE and TEXTURE_MATRIX change at once, these values
7678e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul * will be computed twice.
7688e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul */
7698e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paulstatic void
7708e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paulupdate_texture_state( GLcontext *ctx )
7718e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul{
7728afe7de8deaf3c9613fd68b344de8c52b02b1879Brian Paul   GLuint unit;
7738e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul
7748afe7de8deaf3c9613fd68b344de8c52b02b1879Brian Paul   ctx->Texture._ReallyEnabled = 0;  /* XXX obsolete */
7758afe7de8deaf3c9613fd68b344de8c52b02b1879Brian Paul   ctx->Texture._EnabledUnits = 0;
7768e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul   ctx->Texture._GenFlags = 0;
7778e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul   ctx->_NeedNormals &= ~NEED_NORMALS_TEXGEN;
7788e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul   ctx->_NeedEyeCoords &= ~NEED_EYE_TEXGEN;
779ed39a43b8cb2e1cf69b097fc89365cde470ebf51Keith Whitwell   ctx->Texture._TexMatEnabled = 0;
780ed39a43b8cb2e1cf69b097fc89365cde470ebf51Keith Whitwell   ctx->Texture._TexGenEnabled = 0;
7818e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul
7828e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul   /* Update texture unit state.
7838e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul    */
7848afe7de8deaf3c9613fd68b344de8c52b02b1879Brian Paul   for (unit = 0; unit < ctx->Const.MaxTextureUnits; unit++) {
7858afe7de8deaf3c9613fd68b344de8c52b02b1879Brian Paul      struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
7868e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul
7878e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul      texUnit->_ReallyEnabled = 0;
7888e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul      texUnit->_GenFlags = 0;
7898e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul
7908e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul      if (!texUnit->Enabled)
7918e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul	 continue;
7928e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul
7938afe7de8deaf3c9613fd68b344de8c52b02b1879Brian Paul      /* Look for the highest-priority texture target that's enabled and
7948afe7de8deaf3c9613fd68b344de8c52b02b1879Brian Paul       * complete.  That's the one we'll use for texturing.
7958e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul       */
7968afe7de8deaf3c9613fd68b344de8c52b02b1879Brian Paul      if (texUnit->Enabled & TEXTURE_CUBE_BIT) {
7978e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul         struct gl_texture_object *texObj = texUnit->CurrentCubeMap;
7988e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul         if (!texObj->Complete) {
7998e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul            _mesa_test_texobj_completeness(ctx, texObj);
8008e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul         }
8018e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul         if (texObj->Complete) {
8028afe7de8deaf3c9613fd68b344de8c52b02b1879Brian Paul            texUnit->_ReallyEnabled = TEXTURE_CUBE_BIT;
8038e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul            texUnit->_Current = texObj;
8048e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul         }
8058e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul      }
8068e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul
8078afe7de8deaf3c9613fd68b344de8c52b02b1879Brian Paul      if (!texUnit->_ReallyEnabled && (texUnit->Enabled & TEXTURE_3D_BIT)) {
8088e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul         struct gl_texture_object *texObj = texUnit->Current3D;
8098e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul         if (!texObj->Complete) {
8108e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul            _mesa_test_texobj_completeness(ctx, texObj);
8118e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul         }
8128e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul         if (texObj->Complete) {
8138afe7de8deaf3c9613fd68b344de8c52b02b1879Brian Paul            texUnit->_ReallyEnabled = TEXTURE_3D_BIT;
8148e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul            texUnit->_Current = texObj;
8158e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul         }
8168e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul      }
8178e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul
8188afe7de8deaf3c9613fd68b344de8c52b02b1879Brian Paul      if (!texUnit->_ReallyEnabled && (texUnit->Enabled & TEXTURE_RECT_BIT)) {
8198afe7de8deaf3c9613fd68b344de8c52b02b1879Brian Paul         struct gl_texture_object *texObj = texUnit->CurrentRect;
8208afe7de8deaf3c9613fd68b344de8c52b02b1879Brian Paul         if (!texObj->Complete) {
8218afe7de8deaf3c9613fd68b344de8c52b02b1879Brian Paul            _mesa_test_texobj_completeness(ctx, texObj);
8228afe7de8deaf3c9613fd68b344de8c52b02b1879Brian Paul         }
8238afe7de8deaf3c9613fd68b344de8c52b02b1879Brian Paul         if (texObj->Complete) {
8248afe7de8deaf3c9613fd68b344de8c52b02b1879Brian Paul            texUnit->_ReallyEnabled = TEXTURE_RECT_BIT;
8258afe7de8deaf3c9613fd68b344de8c52b02b1879Brian Paul            texUnit->_Current = texObj;
8268afe7de8deaf3c9613fd68b344de8c52b02b1879Brian Paul         }
8278afe7de8deaf3c9613fd68b344de8c52b02b1879Brian Paul      }
8288afe7de8deaf3c9613fd68b344de8c52b02b1879Brian Paul
8298afe7de8deaf3c9613fd68b344de8c52b02b1879Brian Paul      if (!texUnit->_ReallyEnabled && (texUnit->Enabled & TEXTURE_2D_BIT)) {
8308e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul         struct gl_texture_object *texObj = texUnit->Current2D;
8318e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul         if (!texObj->Complete) {
8328e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul            _mesa_test_texobj_completeness(ctx, texObj);
8338e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul         }
8348e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul         if (texObj->Complete) {
8358afe7de8deaf3c9613fd68b344de8c52b02b1879Brian Paul            texUnit->_ReallyEnabled = TEXTURE_2D_BIT;
8368e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul            texUnit->_Current = texObj;
8378e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul         }
8388e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul      }
8398e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul
8408afe7de8deaf3c9613fd68b344de8c52b02b1879Brian Paul      if (!texUnit->_ReallyEnabled && (texUnit->Enabled & TEXTURE_1D_BIT)) {
8418e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul         struct gl_texture_object *texObj = texUnit->Current1D;
8428e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul         if (!texObj->Complete) {
8438e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul            _mesa_test_texobj_completeness(ctx, texObj);
8448e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul         }
8458e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul         if (texObj->Complete) {
8468afe7de8deaf3c9613fd68b344de8c52b02b1879Brian Paul            texUnit->_ReallyEnabled = TEXTURE_1D_BIT;
8478e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul            texUnit->_Current = texObj;
8488e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul         }
8498e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul      }
8508e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul
8518e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul      if (!texUnit->_ReallyEnabled) {
8528e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul	 texUnit->_Current = NULL;
8538e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul	 continue;
8548e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul      }
8558e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul
8568afe7de8deaf3c9613fd68b344de8c52b02b1879Brian Paul      /* Texture._ReallyEnabled records the enable state for all units in
8578afe7de8deaf3c9613fd68b344de8c52b02b1879Brian Paul       * one word.
8588afe7de8deaf3c9613fd68b344de8c52b02b1879Brian Paul       */
8598e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul      {
8608afe7de8deaf3c9613fd68b344de8c52b02b1879Brian Paul         GLuint flag = texUnit->_ReallyEnabled << (unit * NUM_TEXTURE_TARGETS);
8618afe7de8deaf3c9613fd68b344de8c52b02b1879Brian Paul	 ctx->Texture._ReallyEnabled |= flag;  /* XXX obsolete field! */
8628afe7de8deaf3c9613fd68b344de8c52b02b1879Brian Paul         if (texUnit->_ReallyEnabled)
8638afe7de8deaf3c9613fd68b344de8c52b02b1879Brian Paul            ctx->Texture._EnabledUnits |= (1 << unit);
8648e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul      }
8658e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul
8668e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul      if (texUnit->TexGenEnabled) {
8678e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul	 if (texUnit->TexGenEnabled & S_BIT) {
8688e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul	    texUnit->_GenFlags |= texUnit->_GenBitS;
8698e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul	 }
8708e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul	 if (texUnit->TexGenEnabled & T_BIT) {
8718e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul	    texUnit->_GenFlags |= texUnit->_GenBitT;
8728e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul	 }
8738e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul	 if (texUnit->TexGenEnabled & Q_BIT) {
8748e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul	    texUnit->_GenFlags |= texUnit->_GenBitQ;
8758e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul	 }
8768e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul	 if (texUnit->TexGenEnabled & R_BIT) {
8778e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul	    texUnit->_GenFlags |= texUnit->_GenBitR;
8788e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul	 }
8798e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul
8808afe7de8deaf3c9613fd68b344de8c52b02b1879Brian Paul	 ctx->Texture._TexGenEnabled |= ENABLE_TEXGEN(unit);
8818e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul	 ctx->Texture._GenFlags |= texUnit->_GenFlags;
8828e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul      }
8838e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul
8848afe7de8deaf3c9613fd68b344de8c52b02b1879Brian Paul      if (ctx->TextureMatrixStack[unit].Top->type != MATRIX_IDENTITY)
8858afe7de8deaf3c9613fd68b344de8c52b02b1879Brian Paul	 ctx->Texture._TexMatEnabled |= ENABLE_TEXMAT(unit);
8868e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul   }
8878e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul
8888e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul   if (ctx->Texture._GenFlags & TEXGEN_NEED_NORMALS) {
8898e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul      ctx->_NeedNormals |= NEED_NORMALS_TEXGEN;
8908e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul      ctx->_NeedEyeCoords |= NEED_EYE_TEXGEN;
8918e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul   }
8928e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul
8938e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul   if (ctx->Texture._GenFlags & TEXGEN_NEED_EYE_COORD) {
8948e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul      ctx->_NeedEyeCoords |= NEED_EYE_TEXGEN;
8958e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul   }
8968e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul}
8978e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul
8988e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul
8990cb28418d06c30e431bdff515c1d36a812d5950dKeith Whitwell
9001e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell/*
9011e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell * If ctx->NewState is non-zero then this function MUST be called before
9021e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell * rendering any primitive.  Basically, function pointers and miscellaneous
9031e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell * flags are updated to reflect the current state of the state machine.
9041e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell *
905cab974cf6c2dbfbf5dd5d291e1aae0f8eeb34290Keith Whitwell * The above constraint is now maintained largely by the two Exec
906cab974cf6c2dbfbf5dd5d291e1aae0f8eeb34290Keith Whitwell * dispatch tables, which trigger the appropriate flush on transition
907cab974cf6c2dbfbf5dd5d291e1aae0f8eeb34290Keith Whitwell * between State and Geometry modes.
908cab974cf6c2dbfbf5dd5d291e1aae0f8eeb34290Keith Whitwell *
909cab974cf6c2dbfbf5dd5d291e1aae0f8eeb34290Keith Whitwell * Special care is taken with the derived value _NeedEyeCoords.  This
9101e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell * is a bitflag which is updated with information from a number of
9111e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell * attribute groups (MODELVIEW, LIGHT, TEXTURE).  A lot of derived
9121e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell * state references this value, and must be treated with care to
9131e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell * ensure that updates are done correctly.  All state dependent on
9141e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell * _NeedEyeCoords is calculated from within _mesa_update_tnl_spaces(),
91522144ab7552f0799bcfca506bf4ffa7f70a06649Gareth Hughes * and from nowhere else.
9161e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell */
91708836341788a9f9d638d9dc8328510ccd18ddeb5Brian Paulvoid _mesa_update_state( GLcontext *ctx )
9181e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell{
919479fa1db1dc7cb8e48219ac28edfb2f2a9c971b2Brian Paul   const GLuint new_state = ctx->NewState;
920479fa1db1dc7cb8e48219ac28edfb2f2a9c971b2Brian Paul   const GLuint oldneedeyecoords = ctx->_NeedEyeCoords;
9211e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell
9221e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell   if (MESA_VERBOSE & VERBOSE_STATE)
923306d3fcdbad523428501833405e47e9897896defKeith Whitwell      _mesa_print_state("_mesa_update_state", new_state);
9241e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell
9255e3bc0c2a2bcdf59949410f94c9b705fc1281ce8Jouk Jansen   if (new_state & _NEW_MODELVIEW)
92630f51ae067379c2b3573c06b707d25a9704df7beBrian Paul      _math_matrix_analyse( ctx->ModelviewMatrixStack.Top );
9271e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell
9285e3bc0c2a2bcdf59949410f94c9b705fc1281ce8Jouk Jansen   if (new_state & _NEW_PROJECTION)
929a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul      update_projection( ctx );
930d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul
9315e3bc0c2a2bcdf59949410f94c9b705fc1281ce8Jouk Jansen   if (new_state & _NEW_TEXTURE_MATRIX)
9328e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul      update_texture_matrices( ctx );
9331e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell
9345e3bc0c2a2bcdf59949410f94c9b705fc1281ce8Jouk Jansen   if (new_state & _NEW_COLOR_MATRIX)
93530f51ae067379c2b3573c06b707d25a9704df7beBrian Paul      _math_matrix_analyse( ctx->ColorMatrixStack.Top );
9365e3bc0c2a2bcdf59949410f94c9b705fc1281ce8Jouk Jansen
9371e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell   /* References ColorMatrix.type (derived above).
9381e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell    */
939cab974cf6c2dbfbf5dd5d291e1aae0f8eeb34290Keith Whitwell   if (new_state & _IMAGE_NEW_TRANSFER_STATE)
940a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul      update_image_transfer_state(ctx);
9411e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell
9421e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell   /* Contributes to NeedEyeCoords, NeedNormals.
943d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul    */
9445e3bc0c2a2bcdf59949410f94c9b705fc1281ce8Jouk Jansen   if (new_state & _NEW_TEXTURE)
9458e39ad2cd67d49be40ff0822f3269affdf83d601Brian Paul      update_texture_state( ctx );
946d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul
9475e3bc0c2a2bcdf59949410f94c9b705fc1281ce8Jouk Jansen   if (new_state & (_NEW_BUFFERS|_NEW_SCISSOR))
948a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul      update_drawbuffer( ctx );
949d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul
9505e3bc0c2a2bcdf59949410f94c9b705fc1281ce8Jouk Jansen   if (new_state & _NEW_POLYGON)
951a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul      update_polygon( ctx );
952d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul
9531e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell   /* Contributes to NeedEyeCoords, NeedNormals.
9541e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell    */
9555e3bc0c2a2bcdf59949410f94c9b705fc1281ce8Jouk Jansen   if (new_state & _NEW_LIGHT)
95608836341788a9f9d638d9dc8328510ccd18ddeb5Brian Paul      _mesa_update_lighting( ctx );
957d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul
9581e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell   /* We can light in object space if the modelview matrix preserves
9591e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell    * lengths and relative angles.
9601e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell    */
9611e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell   if (new_state & (_NEW_MODELVIEW|_NEW_LIGHT)) {
9621e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell      ctx->_NeedEyeCoords &= ~NEED_EYE_LIGHT_MODELVIEW;
9631e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell      if (ctx->Light.Enabled &&
96430f51ae067379c2b3573c06b707d25a9704df7beBrian Paul	  !TEST_MAT_FLAGS( ctx->ModelviewMatrixStack.Top, MAT_FLAGS_LENGTH_PRESERVING))
9651e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell	    ctx->_NeedEyeCoords |= NEED_EYE_LIGHT_MODELVIEW;
9661e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell   }
967d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul
9680cb28418d06c30e431bdff515c1d36a812d5950dKeith Whitwell
9690cb28418d06c30e431bdff515c1d36a812d5950dKeith Whitwell#if 0
970c6755aa6d55493a000644ba74233387d408d070fBrian Paul   /* XXX this is a bit of a hack.  We should be checking elsewhere if
971c6755aa6d55493a000644ba74233387d408d070fBrian Paul    * vertex program mode is enabled.  We set _NeedEyeCoords to zero to
972c6755aa6d55493a000644ba74233387d408d070fBrian Paul    * ensure that the combined modelview/projection matrix is computed
973c6755aa6d55493a000644ba74233387d408d070fBrian Paul    * in calculate_model_project_matrix().
974c6755aa6d55493a000644ba74233387d408d070fBrian Paul    */
975c6755aa6d55493a000644ba74233387d408d070fBrian Paul   if (ctx->VertexProgram.Enabled)
976c6755aa6d55493a000644ba74233387d408d070fBrian Paul      ctx->_NeedEyeCoords = 0;
9770cb28418d06c30e431bdff515c1d36a812d5950dKeith Whitwell   /* KW: it's now always computed.
9780cb28418d06c30e431bdff515c1d36a812d5950dKeith Whitwell    */
9790cb28418d06c30e431bdff515c1d36a812d5950dKeith Whitwell#endif
9800cb28418d06c30e431bdff515c1d36a812d5950dKeith Whitwell
9810cb28418d06c30e431bdff515c1d36a812d5950dKeith Whitwell   /* Keep ModelviewProject uptodate always to allow tnl
9820cb28418d06c30e431bdff515c1d36a812d5950dKeith Whitwell    * implementations that go model->clip even when eye is required.
9830cb28418d06c30e431bdff515c1d36a812d5950dKeith Whitwell    */
9840cb28418d06c30e431bdff515c1d36a812d5950dKeith Whitwell   if (new_state & (_NEW_MODELVIEW|_NEW_PROJECTION))
9850cb28418d06c30e431bdff515c1d36a812d5950dKeith Whitwell      calculate_model_project_matrix(ctx);
98606d05afdd687fcd1d59d46c6a86c2e5707e1859bBrian Paul
987cab974cf6c2dbfbf5dd5d291e1aae0f8eeb34290Keith Whitwell   /* ctx->_NeedEyeCoords is now uptodate.
9881e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell    *
989cab974cf6c2dbfbf5dd5d291e1aae0f8eeb34290Keith Whitwell    * If the truth value of this variable has changed, update for the
990cab974cf6c2dbfbf5dd5d291e1aae0f8eeb34290Keith Whitwell    * new lighting space and recompute the positions of lights and the
9911e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell    * normal transform.
9925e3bc0c2a2bcdf59949410f94c9b705fc1281ce8Jouk Jansen    *
9931e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell    * If the lighting space hasn't changed, may still need to recompute
99422144ab7552f0799bcfca506bf4ffa7f70a06649Gareth Hughes    * light positions & normal transforms for other reasons.
9951e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell    */
9961e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell   if (new_state & (_NEW_MODELVIEW |
9971e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell		    _NEW_LIGHT |
998cab974cf6c2dbfbf5dd5d291e1aae0f8eeb34290Keith Whitwell		    _MESA_NEW_NEED_EYE_COORDS))
999a852378a6289d154364dde440f89a39bbfc33e2dBrian Paul      update_tnl_spaces( ctx, oldneedeyecoords );
10001e1aac034c986a08248861363c0baa27dc2ae2d5Keith Whitwell
100123caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell   /*
100223caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell    * Here the driver sets up all the ctx->Driver function pointers
100323caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell    * to it's specific, private functions, and performs any
100423caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell    * internal state management necessary, including invalidating
100523caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell    * state of active modules.
1006cab974cf6c2dbfbf5dd5d291e1aae0f8eeb34290Keith Whitwell    *
1007cab974cf6c2dbfbf5dd5d291e1aae0f8eeb34290Keith Whitwell    * Set ctx->NewState to zero to avoid recursion if
1008cab974cf6c2dbfbf5dd5d291e1aae0f8eeb34290Keith Whitwell    * Driver.UpdateState() has to call FLUSH_VERTICES().  (fixed?)
100923caf20169ac38436ee9c13914f1d6aa7cf6bb5eKeith Whitwell    */
1010d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul   ctx->NewState = 0;
1011cab974cf6c2dbfbf5dd5d291e1aae0f8eeb34290Keith Whitwell   ctx->Driver.UpdateState(ctx, new_state);
10122448fc7deeaa870d879de17158f243f239c05b15Keith Whitwell   ctx->Array.NewState = 0;
1013479fa1db1dc7cb8e48219ac28edfb2f2a9c971b2Brian Paul
10142448fc7deeaa870d879de17158f243f239c05b15Keith Whitwell   /* At this point we can do some assertions to be sure the required
101522144ab7552f0799bcfca506bf4ffa7f70a06649Gareth Hughes    * device driver function pointers are all initialized.
1016479fa1db1dc7cb8e48219ac28edfb2f2a9c971b2Brian Paul    */
10172448fc7deeaa870d879de17158f243f239c05b15Keith Whitwell   ASSERT(ctx->Driver.GetString);
10182448fc7deeaa870d879de17158f243f239c05b15Keith Whitwell   ASSERT(ctx->Driver.UpdateState);
10192448fc7deeaa870d879de17158f243f239c05b15Keith Whitwell   ASSERT(ctx->Driver.Clear);
10202448fc7deeaa870d879de17158f243f239c05b15Keith Whitwell   ASSERT(ctx->Driver.SetDrawBuffer);
10212448fc7deeaa870d879de17158f243f239c05b15Keith Whitwell   ASSERT(ctx->Driver.GetBufferSize);
1022479fa1db1dc7cb8e48219ac28edfb2f2a9c971b2Brian Paul   if (ctx->Visual.accumRedBits > 0) {
10232448fc7deeaa870d879de17158f243f239c05b15Keith Whitwell      ASSERT(ctx->Driver.Accum);
1024479fa1db1dc7cb8e48219ac28edfb2f2a9c971b2Brian Paul   }
10252448fc7deeaa870d879de17158f243f239c05b15Keith Whitwell   ASSERT(ctx->Driver.DrawPixels);
10262448fc7deeaa870d879de17158f243f239c05b15Keith Whitwell   ASSERT(ctx->Driver.ReadPixels);
10272448fc7deeaa870d879de17158f243f239c05b15Keith Whitwell   ASSERT(ctx->Driver.CopyPixels);
10282448fc7deeaa870d879de17158f243f239c05b15Keith Whitwell   ASSERT(ctx->Driver.Bitmap);
1029f7c830e35ca243c391bde1bfd0ae059c292ac649Brian Paul   ASSERT(ctx->Driver.ResizeBuffers);
10302448fc7deeaa870d879de17158f243f239c05b15Keith Whitwell   ASSERT(ctx->Driver.TexImage1D);
10312448fc7deeaa870d879de17158f243f239c05b15Keith Whitwell   ASSERT(ctx->Driver.TexImage2D);
10322448fc7deeaa870d879de17158f243f239c05b15Keith Whitwell   ASSERT(ctx->Driver.TexImage3D);
10332448fc7deeaa870d879de17158f243f239c05b15Keith Whitwell   ASSERT(ctx->Driver.TexSubImage1D);
10342448fc7deeaa870d879de17158f243f239c05b15Keith Whitwell   ASSERT(ctx->Driver.TexSubImage2D);
10352448fc7deeaa870d879de17158f243f239c05b15Keith Whitwell   ASSERT(ctx->Driver.TexSubImage3D);
1036c499ce31baf820e84d133c2189f88e15a1a36672Brian Paul   ASSERT(ctx->Driver.CopyTexImage1D);
1037c499ce31baf820e84d133c2189f88e15a1a36672Brian Paul   ASSERT(ctx->Driver.CopyTexImage2D);
1038c499ce31baf820e84d133c2189f88e15a1a36672Brian Paul   ASSERT(ctx->Driver.CopyTexSubImage1D);
1039c499ce31baf820e84d133c2189f88e15a1a36672Brian Paul   ASSERT(ctx->Driver.CopyTexSubImage2D);
1040c499ce31baf820e84d133c2189f88e15a1a36672Brian Paul   ASSERT(ctx->Driver.CopyTexSubImage3D);
1041479fa1db1dc7cb8e48219ac28edfb2f2a9c971b2Brian Paul   if (ctx->Extensions.ARB_texture_compression) {
1042e4276667dafc8de0c6e64af8300fc7598437de6eBrian Paul      ASSERT(ctx->Driver.BaseCompressedTexFormat);
1043e4276667dafc8de0c6e64af8300fc7598437de6eBrian Paul      ASSERT(ctx->Driver.CompressedTextureSize);
1044e4276667dafc8de0c6e64af8300fc7598437de6eBrian Paul      ASSERT(ctx->Driver.GetCompressedTexImage);
1045e4276667dafc8de0c6e64af8300fc7598437de6eBrian Paul#if 0  /* HW drivers need these, but not SW rasterizers */
10462448fc7deeaa870d879de17158f243f239c05b15Keith Whitwell      ASSERT(ctx->Driver.CompressedTexImage1D);
10472448fc7deeaa870d879de17158f243f239c05b15Keith Whitwell      ASSERT(ctx->Driver.CompressedTexImage2D);
10482448fc7deeaa870d879de17158f243f239c05b15Keith Whitwell      ASSERT(ctx->Driver.CompressedTexImage3D);
10492448fc7deeaa870d879de17158f243f239c05b15Keith Whitwell      ASSERT(ctx->Driver.CompressedTexSubImage1D);
10502448fc7deeaa870d879de17158f243f239c05b15Keith Whitwell      ASSERT(ctx->Driver.CompressedTexSubImage2D);
10512448fc7deeaa870d879de17158f243f239c05b15Keith Whitwell      ASSERT(ctx->Driver.CompressedTexSubImage3D);
1052e4276667dafc8de0c6e64af8300fc7598437de6eBrian Paul#endif
1053479fa1db1dc7cb8e48219ac28edfb2f2a9c971b2Brian Paul   }
1054d0a3ea051a3825441cdc97a82fa9a9c6e7e83087Brian Paul}
10550cb28418d06c30e431bdff515c1d36a812d5950dKeith Whitwell
10560cb28418d06c30e431bdff515c1d36a812d5950dKeith Whitwell/* Is this helpful?
10570cb28418d06c30e431bdff515c1d36a812d5950dKeith Whitwell */
10580cb28418d06c30e431bdff515c1d36a812d5950dKeith Whitwellvoid
10590cb28418d06c30e431bdff515c1d36a812d5950dKeith Whitwell_mesa_allow_light_in_model( GLcontext *ctx, GLboolean flag )
10600cb28418d06c30e431bdff515c1d36a812d5950dKeith Whitwell{
10610cb28418d06c30e431bdff515c1d36a812d5950dKeith Whitwell   if (flag)
10620cb28418d06c30e431bdff515c1d36a812d5950dKeith Whitwell      ctx->_NeedEyeCoords &= ~NEED_EYE_DRIVER;
10630cb28418d06c30e431bdff515c1d36a812d5950dKeith Whitwell   else
10640cb28418d06c30e431bdff515c1d36a812d5950dKeith Whitwell      ctx->_NeedEyeCoords |= NEED_EYE_DRIVER;
10650cb28418d06c30e431bdff515c1d36a812d5950dKeith Whitwell
10660cb28418d06c30e431bdff515c1d36a812d5950dKeith Whitwell   ctx->NewState |= _NEW_POINT;	/* one of the bits from
10670cb28418d06c30e431bdff515c1d36a812d5950dKeith Whitwell				 * _MESA_NEW_NEED_EYE_COORDS.
10680cb28418d06c30e431bdff515c1d36a812d5950dKeith Whitwell				 */
10690cb28418d06c30e431bdff515c1d36a812d5950dKeith Whitwell}
1070