1 /* $Id: state.c,v 1.38 2000/10/30 16:32:43 brianp Exp $ */
4 * Mesa 3-D graphics library
7 * Copyright (C) 1999-2000 Brian Paul All Rights Reserved.
9 * Permission is hereby granted, free of charge, to any person obtaining a
10 * copy of this software and associated documentation files (the "Software"),
11 * to deal in the Software without restriction, including without limitation
12 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
13 * and/or sell copies of the Software, and to permit persons to whom the
14 * Software is furnished to do so, subject to the following conditions:
16 * The above copyright notice and this permission notice shall be included
17 * in all copies or substantial portions of the Software.
19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
20 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
22 * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
23 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
24 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
29 * This file initializes the immediate-mode dispatch table (which may
30 * be state-dependant) and manages internal Mesa state update.
97 gl_problem(NULL
, "undefined function dispatch");
104 * Set all pointers in the given dispatch table to point to a
105 * generic no-op function.
108 _mesa_init_no_op_table(struct _glapi_table
*table
, GLuint tableSize
)
111 void **dispatch
= (void **) table
;
112 for (i
= 0; i
< tableSize
; i
++) {
113 dispatch
[i
] = (void *) generic_noop
;
119 * Initialize the given dispatch table with pointers to Mesa's
120 * immediate-mode commands.
123 _mesa_init_exec_table(struct _glapi_table
*exec
, GLuint tableSize
)
125 /* first initialize all dispatch slots to no-op */
126 _mesa_init_no_op_table(exec
, tableSize
);
128 /* load the dispatch slots we understand */
129 exec
->Accum
= _mesa_Accum
;
130 exec
->AlphaFunc
= _mesa_AlphaFunc
;
131 exec
->Begin
= _mesa_Begin
;
132 exec
->Bitmap
= _mesa_Bitmap
;
133 exec
->BlendFunc
= _mesa_BlendFunc
;
134 exec
->CallList
= _mesa_CallList
;
135 exec
->CallLists
= _mesa_CallLists
;
136 exec
->Clear
= _mesa_Clear
;
137 exec
->ClearAccum
= _mesa_ClearAccum
;
138 exec
->ClearColor
= _mesa_ClearColor
;
139 exec
->ClearDepth
= _mesa_ClearDepth
;
140 exec
->ClearIndex
= _mesa_ClearIndex
;
141 exec
->ClearStencil
= _mesa_ClearStencil
;
142 exec
->ClipPlane
= _mesa_ClipPlane
;
143 exec
->Color3b
= _mesa_Color3b
;
144 exec
->Color3bv
= _mesa_Color3bv
;
145 exec
->Color3d
= _mesa_Color3d
;
146 exec
->Color3dv
= _mesa_Color3dv
;
147 exec
->Color3f
= _mesa_Color3f
;
148 exec
->Color3fv
= _mesa_Color3fv
;
149 exec
->Color3i
= _mesa_Color3i
;
150 exec
->Color3iv
= _mesa_Color3iv
;
151 exec
->Color3s
= _mesa_Color3s
;
152 exec
->Color3sv
= _mesa_Color3sv
;
153 exec
->Color3ub
= _mesa_Color3ub
;
154 exec
->Color3ubv
= _mesa_Color3ubv
;
155 exec
->Color3ui
= _mesa_Color3ui
;
156 exec
->Color3uiv
= _mesa_Color3uiv
;
157 exec
->Color3us
= _mesa_Color3us
;
158 exec
->Color3usv
= _mesa_Color3usv
;
159 exec
->Color4b
= _mesa_Color4b
;
160 exec
->Color4bv
= _mesa_Color4bv
;
161 exec
->Color4d
= _mesa_Color4d
;
162 exec
->Color4dv
= _mesa_Color4dv
;
163 exec
->Color4f
= _mesa_Color4f
;
164 exec
->Color4fv
= _mesa_Color4fv
;
165 exec
->Color4i
= _mesa_Color4i
;
166 exec
->Color4iv
= _mesa_Color4iv
;
167 exec
->Color4s
= _mesa_Color4s
;
168 exec
->Color4sv
= _mesa_Color4sv
;
169 exec
->Color4ub
= _mesa_Color4ub
;
170 exec
->Color4ubv
= _mesa_Color4ubv
;
171 exec
->Color4ui
= _mesa_Color4ui
;
172 exec
->Color4uiv
= _mesa_Color4uiv
;
173 exec
->Color4us
= _mesa_Color4us
;
174 exec
->Color4usv
= _mesa_Color4usv
;
175 exec
->ColorMask
= _mesa_ColorMask
;
176 exec
->ColorMaterial
= _mesa_ColorMaterial
;
177 exec
->CopyPixels
= _mesa_CopyPixels
;
178 exec
->CullFace
= _mesa_CullFace
;
179 exec
->DeleteLists
= _mesa_DeleteLists
;
180 exec
->DepthFunc
= _mesa_DepthFunc
;
181 exec
->DepthMask
= _mesa_DepthMask
;
182 exec
->DepthRange
= _mesa_DepthRange
;
183 exec
->Disable
= _mesa_Disable
;
184 exec
->DrawBuffer
= _mesa_DrawBuffer
;
185 exec
->DrawPixels
= _mesa_DrawPixels
;
186 exec
->EdgeFlag
= _mesa_EdgeFlag
;
187 exec
->EdgeFlagv
= _mesa_EdgeFlagv
;
188 exec
->Enable
= _mesa_Enable
;
189 exec
->End
= _mesa_End
;
190 exec
->EndList
= _mesa_EndList
;
191 exec
->EvalCoord1d
= _mesa_EvalCoord1d
;
192 exec
->EvalCoord1dv
= _mesa_EvalCoord1dv
;
193 exec
->EvalCoord1f
= _mesa_EvalCoord1f
;
194 exec
->EvalCoord1fv
= _mesa_EvalCoord1fv
;
195 exec
->EvalCoord2d
= _mesa_EvalCoord2d
;
196 exec
->EvalCoord2dv
= _mesa_EvalCoord2dv
;
197 exec
->EvalCoord2f
= _mesa_EvalCoord2f
;
198 exec
->EvalCoord2fv
= _mesa_EvalCoord2fv
;
199 exec
->EvalMesh1
= _mesa_EvalMesh1
;
200 exec
->EvalMesh2
= _mesa_EvalMesh2
;
201 exec
->EvalPoint1
= _mesa_EvalPoint1
;
202 exec
->EvalPoint2
= _mesa_EvalPoint2
;
203 exec
->FeedbackBuffer
= _mesa_FeedbackBuffer
;
204 exec
->Finish
= _mesa_Finish
;
205 exec
->Flush
= _mesa_Flush
;
207 exec
->FogCoordfEXT
= _mesa_FogCoordfEXT
;
208 exec
->FogCoordfvEXT
= _mesa_FogCoordfvEXT
;
209 exec
->FogCoorddEXT
= _mesa_FogCoorddEXT
;
210 exec
->FogCoorddvEXT
= _mesa_FogCoorddvEXT
;
211 exec
->FogCoordPointerEXT
= _mesa_FogCoordPointerEXT
;
213 exec
->Fogf
= _mesa_Fogf
;
214 exec
->Fogfv
= _mesa_Fogfv
;
215 exec
->Fogi
= _mesa_Fogi
;
216 exec
->Fogiv
= _mesa_Fogiv
;
217 exec
->FrontFace
= _mesa_FrontFace
;
218 exec
->Frustum
= _mesa_Frustum
;
219 exec
->GenLists
= _mesa_GenLists
;
220 exec
->GetBooleanv
= _mesa_GetBooleanv
;
221 exec
->GetClipPlane
= _mesa_GetClipPlane
;
222 exec
->GetDoublev
= _mesa_GetDoublev
;
223 exec
->GetError
= _mesa_GetError
;
224 exec
->GetFloatv
= _mesa_GetFloatv
;
225 exec
->GetIntegerv
= _mesa_GetIntegerv
;
226 exec
->GetLightfv
= _mesa_GetLightfv
;
227 exec
->GetLightiv
= _mesa_GetLightiv
;
228 exec
->GetMapdv
= _mesa_GetMapdv
;
229 exec
->GetMapfv
= _mesa_GetMapfv
;
230 exec
->GetMapiv
= _mesa_GetMapiv
;
231 exec
->GetMaterialfv
= _mesa_GetMaterialfv
;
232 exec
->GetMaterialiv
= _mesa_GetMaterialiv
;
233 exec
->GetPixelMapfv
= _mesa_GetPixelMapfv
;
234 exec
->GetPixelMapuiv
= _mesa_GetPixelMapuiv
;
235 exec
->GetPixelMapusv
= _mesa_GetPixelMapusv
;
236 exec
->GetPolygonStipple
= _mesa_GetPolygonStipple
;
237 exec
->GetString
= _mesa_GetString
;
238 exec
->GetTexEnvfv
= _mesa_GetTexEnvfv
;
239 exec
->GetTexEnviv
= _mesa_GetTexEnviv
;
240 exec
->GetTexGendv
= _mesa_GetTexGendv
;
241 exec
->GetTexGenfv
= _mesa_GetTexGenfv
;
242 exec
->GetTexGeniv
= _mesa_GetTexGeniv
;
243 exec
->GetTexImage
= _mesa_GetTexImage
;
244 exec
->GetTexLevelParameterfv
= _mesa_GetTexLevelParameterfv
;
245 exec
->GetTexLevelParameteriv
= _mesa_GetTexLevelParameteriv
;
246 exec
->GetTexParameterfv
= _mesa_GetTexParameterfv
;
247 exec
->GetTexParameteriv
= _mesa_GetTexParameteriv
;
248 exec
->Hint
= _mesa_Hint
;
249 exec
->IndexMask
= _mesa_IndexMask
;
250 exec
->Indexd
= _mesa_Indexd
;
251 exec
->Indexdv
= _mesa_Indexdv
;
252 exec
->Indexf
= _mesa_Indexf
;
253 exec
->Indexfv
= _mesa_Indexfv
;
254 exec
->Indexi
= _mesa_Indexi
;
255 exec
->Indexiv
= _mesa_Indexiv
;
256 exec
->Indexs
= _mesa_Indexs
;
257 exec
->Indexsv
= _mesa_Indexsv
;
258 exec
->InitNames
= _mesa_InitNames
;
259 exec
->IsEnabled
= _mesa_IsEnabled
;
260 exec
->IsList
= _mesa_IsList
;
261 exec
->LightModelf
= _mesa_LightModelf
;
262 exec
->LightModelfv
= _mesa_LightModelfv
;
263 exec
->LightModeli
= _mesa_LightModeli
;
264 exec
->LightModeliv
= _mesa_LightModeliv
;
265 exec
->Lightf
= _mesa_Lightf
;
266 exec
->Lightfv
= _mesa_Lightfv
;
267 exec
->Lighti
= _mesa_Lighti
;
268 exec
->Lightiv
= _mesa_Lightiv
;
269 exec
->LineStipple
= _mesa_LineStipple
;
270 exec
->LineWidth
= _mesa_LineWidth
;
271 exec
->ListBase
= _mesa_ListBase
;
272 exec
->LoadIdentity
= _mesa_LoadIdentity
;
273 exec
->LoadMatrixd
= _mesa_LoadMatrixd
;
274 exec
->LoadMatrixf
= _mesa_LoadMatrixf
;
275 exec
->LoadName
= _mesa_LoadName
;
276 exec
->LogicOp
= _mesa_LogicOp
;
277 exec
->Map1d
= _mesa_Map1d
;
278 exec
->Map1f
= _mesa_Map1f
;
279 exec
->Map2d
= _mesa_Map2d
;
280 exec
->Map2f
= _mesa_Map2f
;
281 exec
->MapGrid1d
= _mesa_MapGrid1d
;
282 exec
->MapGrid1f
= _mesa_MapGrid1f
;
283 exec
->MapGrid2d
= _mesa_MapGrid2d
;
284 exec
->MapGrid2f
= _mesa_MapGrid2f
;
285 exec
->Materialf
= _mesa_Materialf
;
286 exec
->Materialfv
= _mesa_Materialfv
;
287 exec
->Materiali
= _mesa_Materiali
;
288 exec
->Materialiv
= _mesa_Materialiv
;
289 exec
->MatrixMode
= _mesa_MatrixMode
;
290 exec
->MultMatrixd
= _mesa_MultMatrixd
;
291 exec
->MultMatrixf
= _mesa_MultMatrixf
;
292 exec
->NewList
= _mesa_NewList
;
293 exec
->Normal3b
= _mesa_Normal3b
;
294 exec
->Normal3bv
= _mesa_Normal3bv
;
295 exec
->Normal3d
= _mesa_Normal3d
;
296 exec
->Normal3dv
= _mesa_Normal3dv
;
297 exec
->Normal3f
= _mesa_Normal3f
;
298 exec
->Normal3fv
= _mesa_Normal3fv
;
299 exec
->Normal3i
= _mesa_Normal3i
;
300 exec
->Normal3iv
= _mesa_Normal3iv
;
301 exec
->Normal3s
= _mesa_Normal3s
;
302 exec
->Normal3sv
= _mesa_Normal3sv
;
303 exec
->Ortho
= _mesa_Ortho
;
304 exec
->PassThrough
= _mesa_PassThrough
;
305 exec
->PixelMapfv
= _mesa_PixelMapfv
;
306 exec
->PixelMapuiv
= _mesa_PixelMapuiv
;
307 exec
->PixelMapusv
= _mesa_PixelMapusv
;
308 exec
->PixelStoref
= _mesa_PixelStoref
;
309 exec
->PixelStorei
= _mesa_PixelStorei
;
310 exec
->PixelTransferf
= _mesa_PixelTransferf
;
311 exec
->PixelTransferi
= _mesa_PixelTransferi
;
312 exec
->PixelZoom
= _mesa_PixelZoom
;
313 exec
->PointSize
= _mesa_PointSize
;
314 exec
->PolygonMode
= _mesa_PolygonMode
;
315 exec
->PolygonOffset
= _mesa_PolygonOffset
;
316 exec
->PolygonStipple
= _mesa_PolygonStipple
;
317 exec
->PopAttrib
= _mesa_PopAttrib
;
318 exec
->PopMatrix
= _mesa_PopMatrix
;
319 exec
->PopName
= _mesa_PopName
;
320 exec
->PushAttrib
= _mesa_PushAttrib
;
321 exec
->PushMatrix
= _mesa_PushMatrix
;
322 exec
->PushName
= _mesa_PushName
;
323 exec
->RasterPos2d
= _mesa_RasterPos2d
;
324 exec
->RasterPos2dv
= _mesa_RasterPos2dv
;
325 exec
->RasterPos2f
= _mesa_RasterPos2f
;
326 exec
->RasterPos2fv
= _mesa_RasterPos2fv
;
327 exec
->RasterPos2i
= _mesa_RasterPos2i
;
328 exec
->RasterPos2iv
= _mesa_RasterPos2iv
;
329 exec
->RasterPos2s
= _mesa_RasterPos2s
;
330 exec
->RasterPos2sv
= _mesa_RasterPos2sv
;
331 exec
->RasterPos3d
= _mesa_RasterPos3d
;
332 exec
->RasterPos3dv
= _mesa_RasterPos3dv
;
333 exec
->RasterPos3f
= _mesa_RasterPos3f
;
334 exec
->RasterPos3fv
= _mesa_RasterPos3fv
;
335 exec
->RasterPos3i
= _mesa_RasterPos3i
;
336 exec
->RasterPos3iv
= _mesa_RasterPos3iv
;
337 exec
->RasterPos3s
= _mesa_RasterPos3s
;
338 exec
->RasterPos3sv
= _mesa_RasterPos3sv
;
339 exec
->RasterPos4d
= _mesa_RasterPos4d
;
340 exec
->RasterPos4dv
= _mesa_RasterPos4dv
;
341 exec
->RasterPos4f
= _mesa_RasterPos4f
;
342 exec
->RasterPos4fv
= _mesa_RasterPos4fv
;
343 exec
->RasterPos4i
= _mesa_RasterPos4i
;
344 exec
->RasterPos4iv
= _mesa_RasterPos4iv
;
345 exec
->RasterPos4s
= _mesa_RasterPos4s
;
346 exec
->RasterPos4sv
= _mesa_RasterPos4sv
;
347 exec
->ReadBuffer
= _mesa_ReadBuffer
;
348 exec
->ReadPixels
= _mesa_ReadPixels
;
349 exec
->Rectd
= _mesa_Rectd
;
350 exec
->Rectdv
= _mesa_Rectdv
;
351 exec
->Rectf
= _mesa_Rectf
;
352 exec
->Rectfv
= _mesa_Rectfv
;
353 exec
->Recti
= _mesa_Recti
;
354 exec
->Rectiv
= _mesa_Rectiv
;
355 exec
->Rects
= _mesa_Rects
;
356 exec
->Rectsv
= _mesa_Rectsv
;
357 exec
->RenderMode
= _mesa_RenderMode
;
358 exec
->Rotated
= _mesa_Rotated
;
359 exec
->Rotatef
= _mesa_Rotatef
;
360 exec
->Scaled
= _mesa_Scaled
;
361 exec
->Scalef
= _mesa_Scalef
;
362 exec
->Scissor
= _mesa_Scissor
;
363 exec
->SecondaryColor3bEXT
= _mesa_SecondaryColor3bEXT
;
364 exec
->SecondaryColor3bvEXT
= _mesa_SecondaryColor3bvEXT
;
365 exec
->SecondaryColor3sEXT
= _mesa_SecondaryColor3sEXT
;
366 exec
->SecondaryColor3svEXT
= _mesa_SecondaryColor3svEXT
;
367 exec
->SecondaryColor3iEXT
= _mesa_SecondaryColor3iEXT
;
368 exec
->SecondaryColor3ivEXT
= _mesa_SecondaryColor3ivEXT
;
369 exec
->SecondaryColor3fEXT
= _mesa_SecondaryColor3fEXT
;
370 exec
->SecondaryColor3fvEXT
= _mesa_SecondaryColor3fvEXT
;
371 exec
->SecondaryColor3dEXT
= _mesa_SecondaryColor3dEXT
;
372 exec
->SecondaryColor3dvEXT
= _mesa_SecondaryColor3dvEXT
;
373 exec
->SecondaryColor3ubEXT
= _mesa_SecondaryColor3ubEXT
;
374 exec
->SecondaryColor3ubvEXT
= _mesa_SecondaryColor3ubvEXT
;
375 exec
->SecondaryColor3usEXT
= _mesa_SecondaryColor3usEXT
;
376 exec
->SecondaryColor3usvEXT
= _mesa_SecondaryColor3usvEXT
;
377 exec
->SecondaryColor3uiEXT
= _mesa_SecondaryColor3uiEXT
;
378 exec
->SecondaryColor3uivEXT
= _mesa_SecondaryColor3uivEXT
;
379 exec
->SecondaryColorPointerEXT
= _mesa_SecondaryColorPointerEXT
;
380 exec
->SelectBuffer
= _mesa_SelectBuffer
;
381 exec
->ShadeModel
= _mesa_ShadeModel
;
382 exec
->StencilFunc
= _mesa_StencilFunc
;
383 exec
->StencilMask
= _mesa_StencilMask
;
384 exec
->StencilOp
= _mesa_StencilOp
;
385 exec
->TexCoord1d
= _mesa_TexCoord1d
;
386 exec
->TexCoord1dv
= _mesa_TexCoord1dv
;
387 exec
->TexCoord1f
= _mesa_TexCoord1f
;
388 exec
->TexCoord1fv
= _mesa_TexCoord1fv
;
389 exec
->TexCoord1i
= _mesa_TexCoord1i
;
390 exec
->TexCoord1iv
= _mesa_TexCoord1iv
;
391 exec
->TexCoord1s
= _mesa_TexCoord1s
;
392 exec
->TexCoord1sv
= _mesa_TexCoord1sv
;
393 exec
->TexCoord2d
= _mesa_TexCoord2d
;
394 exec
->TexCoord2dv
= _mesa_TexCoord2dv
;
395 exec
->TexCoord2f
= _mesa_TexCoord2f
;
396 exec
->TexCoord2fv
= _mesa_TexCoord2fv
;
397 exec
->TexCoord2i
= _mesa_TexCoord2i
;
398 exec
->TexCoord2iv
= _mesa_TexCoord2iv
;
399 exec
->TexCoord2s
= _mesa_TexCoord2s
;
400 exec
->TexCoord2sv
= _mesa_TexCoord2sv
;
401 exec
->TexCoord3d
= _mesa_TexCoord3d
;
402 exec
->TexCoord3dv
= _mesa_TexCoord3dv
;
403 exec
->TexCoord3f
= _mesa_TexCoord3f
;
404 exec
->TexCoord3fv
= _mesa_TexCoord3fv
;
405 exec
->TexCoord3i
= _mesa_TexCoord3i
;
406 exec
->TexCoord3iv
= _mesa_TexCoord3iv
;
407 exec
->TexCoord3s
= _mesa_TexCoord3s
;
408 exec
->TexCoord3sv
= _mesa_TexCoord3sv
;
409 exec
->TexCoord4d
= _mesa_TexCoord4d
;
410 exec
->TexCoord4dv
= _mesa_TexCoord4dv
;
411 exec
->TexCoord4f
= _mesa_TexCoord4f
;
412 exec
->TexCoord4fv
= _mesa_TexCoord4fv
;
413 exec
->TexCoord4i
= _mesa_TexCoord4i
;
414 exec
->TexCoord4iv
= _mesa_TexCoord4iv
;
415 exec
->TexCoord4s
= _mesa_TexCoord4s
;
416 exec
->TexCoord4sv
= _mesa_TexCoord4sv
;
417 exec
->TexEnvf
= _mesa_TexEnvf
;
418 exec
->TexEnvfv
= _mesa_TexEnvfv
;
419 exec
->TexEnvi
= _mesa_TexEnvi
;
420 exec
->TexEnviv
= _mesa_TexEnviv
;
421 exec
->TexGend
= _mesa_TexGend
;
422 exec
->TexGendv
= _mesa_TexGendv
;
423 exec
->TexGenf
= _mesa_TexGenf
;
424 exec
->TexGenfv
= _mesa_TexGenfv
;
425 exec
->TexGeni
= _mesa_TexGeni
;
426 exec
->TexGeniv
= _mesa_TexGeniv
;
427 exec
->TexImage1D
= _mesa_TexImage1D
;
428 exec
->TexImage2D
= _mesa_TexImage2D
;
429 exec
->TexParameterf
= _mesa_TexParameterf
;
430 exec
->TexParameterfv
= _mesa_TexParameterfv
;
431 exec
->TexParameteri
= _mesa_TexParameteri
;
432 exec
->TexParameteriv
= _mesa_TexParameteriv
;
433 exec
->Translated
= _mesa_Translated
;
434 exec
->Translatef
= _mesa_Translatef
;
435 exec
->Vertex2d
= _mesa_Vertex2d
;
436 exec
->Vertex2dv
= _mesa_Vertex2dv
;
437 exec
->Vertex2f
= _mesa_Vertex2f
;
438 exec
->Vertex2fv
= _mesa_Vertex2fv
;
439 exec
->Vertex2i
= _mesa_Vertex2i
;
440 exec
->Vertex2iv
= _mesa_Vertex2iv
;
441 exec
->Vertex2s
= _mesa_Vertex2s
;
442 exec
->Vertex2sv
= _mesa_Vertex2sv
;
443 exec
->Vertex3d
= _mesa_Vertex3d
;
444 exec
->Vertex3dv
= _mesa_Vertex3dv
;
445 exec
->Vertex3f
= _mesa_Vertex3f
;
446 exec
->Vertex3fv
= _mesa_Vertex3fv
;
447 exec
->Vertex3i
= _mesa_Vertex3i
;
448 exec
->Vertex3iv
= _mesa_Vertex3iv
;
449 exec
->Vertex3s
= _mesa_Vertex3s
;
450 exec
->Vertex3sv
= _mesa_Vertex3sv
;
451 exec
->Vertex4d
= _mesa_Vertex4d
;
452 exec
->Vertex4dv
= _mesa_Vertex4dv
;
453 exec
->Vertex4f
= _mesa_Vertex4f
;
454 exec
->Vertex4fv
= _mesa_Vertex4fv
;
455 exec
->Vertex4i
= _mesa_Vertex4i
;
456 exec
->Vertex4iv
= _mesa_Vertex4iv
;
457 exec
->Vertex4s
= _mesa_Vertex4s
;
458 exec
->Vertex4sv
= _mesa_Vertex4sv
;
459 exec
->Viewport
= _mesa_Viewport
;
462 exec
->AreTexturesResident
= _mesa_AreTexturesResident
;
463 exec
->ArrayElement
= _mesa_ArrayElement
;
464 exec
->BindTexture
= _mesa_BindTexture
;
465 exec
->ColorPointer
= _mesa_ColorPointer
;
466 exec
->CopyTexImage1D
= _mesa_CopyTexImage1D
;
467 exec
->CopyTexImage2D
= _mesa_CopyTexImage2D
;
468 exec
->CopyTexSubImage1D
= _mesa_CopyTexSubImage1D
;
469 exec
->CopyTexSubImage2D
= _mesa_CopyTexSubImage2D
;
470 exec
->DeleteTextures
= _mesa_DeleteTextures
;
471 exec
->DisableClientState
= _mesa_DisableClientState
;
472 exec
->DrawArrays
= _mesa_DrawArrays
;
473 exec
->DrawElements
= _mesa_DrawElements
;
474 exec
->EdgeFlagPointer
= _mesa_EdgeFlagPointer
;
475 exec
->EnableClientState
= _mesa_EnableClientState
;
476 exec
->GenTextures
= _mesa_GenTextures
;
477 exec
->GetPointerv
= _mesa_GetPointerv
;
478 exec
->IndexPointer
= _mesa_IndexPointer
;
479 exec
->Indexub
= _mesa_Indexub
;
480 exec
->Indexubv
= _mesa_Indexubv
;
481 exec
->InterleavedArrays
= _mesa_InterleavedArrays
;
482 exec
->IsTexture
= _mesa_IsTexture
;
483 exec
->NormalPointer
= _mesa_NormalPointer
;
484 exec
->PopClientAttrib
= _mesa_PopClientAttrib
;
485 exec
->PrioritizeTextures
= _mesa_PrioritizeTextures
;
486 exec
->PushClientAttrib
= _mesa_PushClientAttrib
;
487 exec
->TexCoordPointer
= _mesa_TexCoordPointer
;
488 exec
->TexSubImage1D
= _mesa_TexSubImage1D
;
489 exec
->TexSubImage2D
= _mesa_TexSubImage2D
;
490 exec
->VertexPointer
= _mesa_VertexPointer
;
493 exec
->CopyTexSubImage3D
= _mesa_CopyTexSubImage3D
;
494 exec
->DrawRangeElements
= _mesa_DrawRangeElements
;
495 exec
->TexImage3D
= _mesa_TexImage3D
;
496 exec
->TexSubImage3D
= _mesa_TexSubImage3D
;
498 /* OpenGL 1.2 GL_ARB_imaging */
499 exec
->BlendColor
= _mesa_BlendColor
;
500 exec
->BlendEquation
= _mesa_BlendEquation
;
501 exec
->ColorSubTable
= _mesa_ColorSubTable
;
502 exec
->ColorTable
= _mesa_ColorTable
;
503 exec
->ColorTableParameterfv
= _mesa_ColorTableParameterfv
;
504 exec
->ColorTableParameteriv
= _mesa_ColorTableParameteriv
;
505 exec
->ConvolutionFilter1D
= _mesa_ConvolutionFilter1D
;
506 exec
->ConvolutionFilter2D
= _mesa_ConvolutionFilter2D
;
507 exec
->ConvolutionParameterf
= _mesa_ConvolutionParameterf
;
508 exec
->ConvolutionParameterfv
= _mesa_ConvolutionParameterfv
;
509 exec
->ConvolutionParameteri
= _mesa_ConvolutionParameteri
;
510 exec
->ConvolutionParameteriv
= _mesa_ConvolutionParameteriv
;
511 exec
->CopyColorSubTable
= _mesa_CopyColorSubTable
;
512 exec
->CopyColorTable
= _mesa_CopyColorTable
;
513 exec
->CopyConvolutionFilter1D
= _mesa_CopyConvolutionFilter1D
;
514 exec
->CopyConvolutionFilter2D
= _mesa_CopyConvolutionFilter2D
;
515 exec
->GetColorTable
= _mesa_GetColorTable
;
516 exec
->GetColorTableParameterfv
= _mesa_GetColorTableParameterfv
;
517 exec
->GetColorTableParameteriv
= _mesa_GetColorTableParameteriv
;
518 exec
->GetConvolutionFilter
= _mesa_GetConvolutionFilter
;
519 exec
->GetConvolutionParameterfv
= _mesa_GetConvolutionParameterfv
;
520 exec
->GetConvolutionParameteriv
= _mesa_GetConvolutionParameteriv
;
521 exec
->GetHistogram
= _mesa_GetHistogram
;
522 exec
->GetHistogramParameterfv
= _mesa_GetHistogramParameterfv
;
523 exec
->GetHistogramParameteriv
= _mesa_GetHistogramParameteriv
;
524 exec
->GetMinmax
= _mesa_GetMinmax
;
525 exec
->GetMinmaxParameterfv
= _mesa_GetMinmaxParameterfv
;
526 exec
->GetMinmaxParameteriv
= _mesa_GetMinmaxParameteriv
;
527 exec
->GetSeparableFilter
= _mesa_GetSeparableFilter
;
528 exec
->Histogram
= _mesa_Histogram
;
529 exec
->Minmax
= _mesa_Minmax
;
530 exec
->ResetHistogram
= _mesa_ResetHistogram
;
531 exec
->ResetMinmax
= _mesa_ResetMinmax
;
532 exec
->SeparableFilter2D
= _mesa_SeparableFilter2D
;
534 /* 2. GL_EXT_blend_color */
536 exec
->BlendColorEXT
= _mesa_BlendColorEXT
;
539 /* 3. GL_EXT_polygon_offset */
540 exec
->PolygonOffsetEXT
= _mesa_PolygonOffsetEXT
;
542 /* 6. GL_EXT_texture3d */
544 exec
->CopyTexSubImage3DEXT
= _mesa_CopyTexSubImage3D
;
545 exec
->TexImage3DEXT
= _mesa_TexImage3DEXT
;
546 exec
->TexSubImage3DEXT
= _mesa_TexSubImage3D
;
549 /* 11. GL_EXT_histogram */
550 exec
->GetHistogramEXT
= _mesa_GetHistogram
;
551 exec
->GetHistogramParameterfvEXT
= _mesa_GetHistogramParameterfv
;
552 exec
->GetHistogramParameterivEXT
= _mesa_GetHistogramParameteriv
;
553 exec
->GetMinmaxEXT
= _mesa_GetMinmax
;
554 exec
->GetMinmaxParameterfvEXT
= _mesa_GetMinmaxParameterfv
;
555 exec
->GetMinmaxParameterivEXT
= _mesa_GetMinmaxParameteriv
;
557 /* ?. GL_SGIX_pixel_texture */
558 exec
->PixelTexGenSGIX
= _mesa_PixelTexGenSGIX
;
560 /* 15. GL_SGIS_pixel_texture */
561 exec
->PixelTexGenParameteriSGIS
= _mesa_PixelTexGenParameteriSGIS
;
562 exec
->PixelTexGenParameterivSGIS
= _mesa_PixelTexGenParameterivSGIS
;
563 exec
->PixelTexGenParameterfSGIS
= _mesa_PixelTexGenParameterfSGIS
;
564 exec
->PixelTexGenParameterfvSGIS
= _mesa_PixelTexGenParameterfvSGIS
;
565 exec
->GetPixelTexGenParameterivSGIS
= _mesa_GetPixelTexGenParameterivSGIS
;
566 exec
->GetPixelTexGenParameterfvSGIS
= _mesa_GetPixelTexGenParameterfvSGIS
;
568 /* 30. GL_EXT_vertex_array */
569 exec
->ColorPointerEXT
= _mesa_ColorPointerEXT
;
570 exec
->EdgeFlagPointerEXT
= _mesa_EdgeFlagPointerEXT
;
571 exec
->IndexPointerEXT
= _mesa_IndexPointerEXT
;
572 exec
->NormalPointerEXT
= _mesa_NormalPointerEXT
;
573 exec
->TexCoordPointerEXT
= _mesa_TexCoordPointerEXT
;
574 exec
->VertexPointerEXT
= _mesa_VertexPointerEXT
;
576 /* 37. GL_EXT_blend_minmax */
578 exec
->BlendEquationEXT
= _mesa_BlendEquationEXT
;
581 /* 54. GL_EXT_point_parameters */
582 exec
->PointParameterfEXT
= _mesa_PointParameterfEXT
;
583 exec
->PointParameterfvEXT
= _mesa_PointParameterfvEXT
;
585 /* 77. GL_PGI_misc_hints */
586 exec
->HintPGI
= _mesa_HintPGI
;
588 /* 78. GL_EXT_paletted_texture */
590 exec
->ColorTableEXT
= _mesa_ColorTableEXT
;
591 exec
->ColorSubTableEXT
= _mesa_ColorSubTableEXT
;
593 exec
->GetColorTableEXT
= _mesa_GetColorTable
;
594 exec
->GetColorTableParameterfvEXT
= _mesa_GetColorTableParameterfv
;
595 exec
->GetColorTableParameterivEXT
= _mesa_GetColorTableParameteriv
;
597 /* 97. GL_EXT_compiled_vertex_array */
598 exec
->LockArraysEXT
= _mesa_LockArraysEXT
;
599 exec
->UnlockArraysEXT
= _mesa_UnlockArraysEXT
;
601 /* 173. GL_INGR_blend_func_separate */
602 exec
->BlendFuncSeparateEXT
= _mesa_BlendFuncSeparateEXT
;
604 /* 196. GL_MESA_resize_buffers */
605 exec
->ResizeBuffersMESA
= _mesa_ResizeBuffersMESA
;
607 /* 197. GL_MESA_window_pos */
608 exec
->WindowPos2dMESA
= _mesa_WindowPos2dMESA
;
609 exec
->WindowPos2dvMESA
= _mesa_WindowPos2dvMESA
;
610 exec
->WindowPos2fMESA
= _mesa_WindowPos2fMESA
;
611 exec
->WindowPos2fvMESA
= _mesa_WindowPos2fvMESA
;
612 exec
->WindowPos2iMESA
= _mesa_WindowPos2iMESA
;
613 exec
->WindowPos2ivMESA
= _mesa_WindowPos2ivMESA
;
614 exec
->WindowPos2sMESA
= _mesa_WindowPos2sMESA
;
615 exec
->WindowPos2svMESA
= _mesa_WindowPos2svMESA
;
616 exec
->WindowPos3dMESA
= _mesa_WindowPos3dMESA
;
617 exec
->WindowPos3dvMESA
= _mesa_WindowPos3dvMESA
;
618 exec
->WindowPos3fMESA
= _mesa_WindowPos3fMESA
;
619 exec
->WindowPos3fvMESA
= _mesa_WindowPos3fvMESA
;
620 exec
->WindowPos3iMESA
= _mesa_WindowPos3iMESA
;
621 exec
->WindowPos3ivMESA
= _mesa_WindowPos3ivMESA
;
622 exec
->WindowPos3sMESA
= _mesa_WindowPos3sMESA
;
623 exec
->WindowPos3svMESA
= _mesa_WindowPos3svMESA
;
624 exec
->WindowPos4dMESA
= _mesa_WindowPos4dMESA
;
625 exec
->WindowPos4dvMESA
= _mesa_WindowPos4dvMESA
;
626 exec
->WindowPos4fMESA
= _mesa_WindowPos4fMESA
;
627 exec
->WindowPos4fvMESA
= _mesa_WindowPos4fvMESA
;
628 exec
->WindowPos4iMESA
= _mesa_WindowPos4iMESA
;
629 exec
->WindowPos4ivMESA
= _mesa_WindowPos4ivMESA
;
630 exec
->WindowPos4sMESA
= _mesa_WindowPos4sMESA
;
631 exec
->WindowPos4svMESA
= _mesa_WindowPos4svMESA
;
633 /* ARB 1. GL_ARB_multitexture */
634 exec
->ActiveTextureARB
= _mesa_ActiveTextureARB
;
635 exec
->ClientActiveTextureARB
= _mesa_ClientActiveTextureARB
;
636 exec
->MultiTexCoord1dARB
= _mesa_MultiTexCoord1dARB
;
637 exec
->MultiTexCoord1dvARB
= _mesa_MultiTexCoord1dvARB
;
638 exec
->MultiTexCoord1fARB
= _mesa_MultiTexCoord1fARB
;
639 exec
->MultiTexCoord1fvARB
= _mesa_MultiTexCoord1fvARB
;
640 exec
->MultiTexCoord1iARB
= _mesa_MultiTexCoord1iARB
;
641 exec
->MultiTexCoord1ivARB
= _mesa_MultiTexCoord1ivARB
;
642 exec
->MultiTexCoord1sARB
= _mesa_MultiTexCoord1sARB
;
643 exec
->MultiTexCoord1svARB
= _mesa_MultiTexCoord1svARB
;
644 exec
->MultiTexCoord2dARB
= _mesa_MultiTexCoord2dARB
;
645 exec
->MultiTexCoord2dvARB
= _mesa_MultiTexCoord2dvARB
;
646 exec
->MultiTexCoord2fARB
= _mesa_MultiTexCoord2fARB
;
647 exec
->MultiTexCoord2fvARB
= _mesa_MultiTexCoord2fvARB
;
648 exec
->MultiTexCoord2iARB
= _mesa_MultiTexCoord2iARB
;
649 exec
->MultiTexCoord2ivARB
= _mesa_MultiTexCoord2ivARB
;
650 exec
->MultiTexCoord2sARB
= _mesa_MultiTexCoord2sARB
;
651 exec
->MultiTexCoord2svARB
= _mesa_MultiTexCoord2svARB
;
652 exec
->MultiTexCoord3dARB
= _mesa_MultiTexCoord3dARB
;
653 exec
->MultiTexCoord3dvARB
= _mesa_MultiTexCoord3dvARB
;
654 exec
->MultiTexCoord3fARB
= _mesa_MultiTexCoord3fARB
;
655 exec
->MultiTexCoord3fvARB
= _mesa_MultiTexCoord3fvARB
;
656 exec
->MultiTexCoord3iARB
= _mesa_MultiTexCoord3iARB
;
657 exec
->MultiTexCoord3ivARB
= _mesa_MultiTexCoord3ivARB
;
658 exec
->MultiTexCoord3sARB
= _mesa_MultiTexCoord3sARB
;
659 exec
->MultiTexCoord3svARB
= _mesa_MultiTexCoord3svARB
;
660 exec
->MultiTexCoord4dARB
= _mesa_MultiTexCoord4dARB
;
661 exec
->MultiTexCoord4dvARB
= _mesa_MultiTexCoord4dvARB
;
662 exec
->MultiTexCoord4fARB
= _mesa_MultiTexCoord4fARB
;
663 exec
->MultiTexCoord4fvARB
= _mesa_MultiTexCoord4fvARB
;
664 exec
->MultiTexCoord4iARB
= _mesa_MultiTexCoord4iARB
;
665 exec
->MultiTexCoord4ivARB
= _mesa_MultiTexCoord4ivARB
;
666 exec
->MultiTexCoord4sARB
= _mesa_MultiTexCoord4sARB
;
667 exec
->MultiTexCoord4svARB
= _mesa_MultiTexCoord4svARB
;
669 /* ARB 3. GL_ARB_transpose_matrix */
670 exec
->LoadTransposeMatrixdARB
= _mesa_LoadTransposeMatrixdARB
;
671 exec
->LoadTransposeMatrixfARB
= _mesa_LoadTransposeMatrixfARB
;
672 exec
->MultTransposeMatrixdARB
= _mesa_MultTransposeMatrixdARB
;
673 exec
->MultTransposeMatrixfARB
= _mesa_MultTransposeMatrixfARB
;
675 /* ARB 12. GL_ARB_texture_compression */
676 exec
->CompressedTexImage3DARB
= _mesa_CompressedTexImage3DARB
;
677 exec
->CompressedTexImage2DARB
= _mesa_CompressedTexImage2DARB
;
678 exec
->CompressedTexImage1DARB
= _mesa_CompressedTexImage1DARB
;
679 exec
->CompressedTexSubImage3DARB
= _mesa_CompressedTexSubImage3DARB
;
680 exec
->CompressedTexSubImage2DARB
= _mesa_CompressedTexSubImage2DARB
;
681 exec
->CompressedTexSubImage1DARB
= _mesa_CompressedTexSubImage1DARB
;
682 exec
->GetCompressedTexImageARB
= _mesa_GetCompressedTexImageARB
;
688 /**********************************************************************/
689 /***** State update logic *****/
690 /**********************************************************************/
695 * Recompute the value of ctx->RasterMask, etc. according to
696 * the current context.
698 static void update_rasterflags( GLcontext
*ctx
)
702 if (ctx
->Color
.AlphaEnabled
) ctx
->RasterMask
|= ALPHATEST_BIT
;
703 if (ctx
->Color
.BlendEnabled
) ctx
->RasterMask
|= BLEND_BIT
;
704 if (ctx
->Depth
.Test
) ctx
->RasterMask
|= DEPTH_BIT
;
705 if (ctx
->Fog
.Enabled
) ctx
->RasterMask
|= FOG_BIT
;
706 if (ctx
->Scissor
.Enabled
) ctx
->RasterMask
|= SCISSOR_BIT
;
707 if (ctx
->Stencil
.Enabled
) ctx
->RasterMask
|= STENCIL_BIT
;
708 if (ctx
->Visual
.RGBAflag
) {
709 const GLuint colorMask
= *((GLuint
*) &ctx
->Color
.ColorMask
);
710 if (colorMask
!= 0xffffffff) ctx
->RasterMask
|= MASKING_BIT
;
711 if (ctx
->Color
.ColorLogicOpEnabled
) ctx
->RasterMask
|= LOGIC_OP_BIT
;
712 if (ctx
->Texture
.ReallyEnabled
) ctx
->RasterMask
|= TEXTURE_BIT
;
715 if (ctx
->Color
.IndexMask
!= 0xffffffff) ctx
->RasterMask
|= MASKING_BIT
;
716 if (ctx
->Color
.IndexLogicOpEnabled
) ctx
->RasterMask
|= LOGIC_OP_BIT
;
719 if (ctx
->DrawBuffer
->UseSoftwareAlphaBuffers
720 && ctx
->Color
.ColorMask
[ACOMP
]
721 && ctx
->Color
.DrawBuffer
!= GL_NONE
)
722 ctx
->RasterMask
|= ALPHABUF_BIT
;
724 if ( ctx
->Viewport
.X
< 0
725 || ctx
->Viewport
.X
+ ctx
->Viewport
.Width
> ctx
->DrawBuffer
->Width
726 || ctx
->Viewport
.Y
< 0
727 || ctx
->Viewport
.Y
+ ctx
->Viewport
.Height
> ctx
->DrawBuffer
->Height
) {
728 ctx
->RasterMask
|= WINCLIP_BIT
;
731 if (ctx
->Depth
.OcclusionTest
)
732 ctx
->RasterMask
|= OCCLUSION_BIT
;
735 /* If we're not drawing to exactly one color buffer set the
736 * MULTI_DRAW_BIT flag. Also set it if we're drawing to no
737 * buffers or the RGBA or CI mask disables all writes.
739 ctx
->TriangleCaps
&= ~DD_MULTIDRAW
;
741 if (ctx
->Color
.MultiDrawBuffer
) {
742 ctx
->RasterMask
|= MULTI_DRAW_BIT
;
743 ctx
->TriangleCaps
|= DD_MULTIDRAW
;
745 else if (ctx
->Color
.DrawBuffer
==GL_NONE
) {
746 ctx
->RasterMask
|= MULTI_DRAW_BIT
;
747 ctx
->TriangleCaps
|= DD_MULTIDRAW
;
749 else if (ctx
->Visual
.RGBAflag
&& *((GLuint
*) ctx
->Color
.ColorMask
) == 0) {
750 /* all RGBA channels disabled */
751 ctx
->RasterMask
|= MULTI_DRAW_BIT
;
752 ctx
->TriangleCaps
|= DD_MULTIDRAW
;
754 else if (!ctx
->Visual
.RGBAflag
&& ctx
->Color
.IndexMask
==0) {
755 /* all color index bits disabled */
756 ctx
->RasterMask
|= MULTI_DRAW_BIT
;
757 ctx
->TriangleCaps
|= DD_MULTIDRAW
;
762 void gl_print_state( const char *msg
, GLuint state
)
765 "%s: (0x%x) %s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n",
768 (state
& _NEW_MODELVIEW
) ? "ctx->ModelView, " : "",
769 (state
& _NEW_PROJECTION
) ? "ctx->Projection, " : "",
770 (state
& _NEW_TEXTURE_MATRIX
) ? "ctx->TextureMatrix, " : "",
771 (state
& _NEW_COLOR_MATRIX
) ? "ctx->ColorMatrix, " : "",
772 (state
& _NEW_ACCUM
) ? "ctx->Accum, " : "",
773 (state
& _NEW_COLOR
) ? "ctx->Color, " : "",
774 (state
& _NEW_DEPTH
) ? "ctx->Depth, " : "",
775 (state
& _NEW_EVAL
) ? "ctx->Eval/EvalMap, " : "",
776 (state
& _NEW_FOG
) ? "ctx->Fog, " : "",
777 (state
& _NEW_HINT
) ? "ctx->Hint, " : "",
778 (state
& _NEW_IMAGING
) ? "ctx->Histogram/MinMax/Convolve/Seperable, ": "",
779 (state
& _NEW_LIGHT
) ? "ctx->Light, " : "",
780 (state
& _NEW_LINE
) ? "ctx->Line, " : "",
781 (state
& _NEW_FEEDBACK_SELECT
) ? "ctx->Feedback/Select, " : "",
782 (state
& _NEW_PIXEL
) ? "ctx->Pixel, " : "",
783 (state
& _NEW_POINT
) ? "ctx->Point, " : "",
784 (state
& _NEW_POLYGON
) ? "ctx->Polygon, " : "",
785 (state
& _NEW_POLYGONSTIPPLE
) ? "ctx->PolygonStipple, " : "",
786 (state
& _NEW_SCISSOR
) ? "ctx->Scissor, " : "",
787 (state
& _NEW_TEXTURE
) ? "ctx->Texture, " : "",
788 (state
& _NEW_TRANSFORM
) ? "ctx->Transform, " : "",
789 (state
& _NEW_VIEWPORT
) ? "ctx->Viewport, " : "",
790 (state
& _NEW_PACKUNPACK
) ? "ctx->Pack/Unpack, " : "",
791 (state
& _NEW_ARRAY
) ? "ctx->Array, " : "",
792 (state
& _NEW_COLORTABLE
) ? "ctx->{*}ColorTable, " : "",
793 (state
& _NEW_RENDERMODE
) ? "ctx->RenderMode, " : "",
794 (state
& _NEW_BUFFERS
) ? "ctx->Visual, ctx->DrawBuffer,, " : "");
798 void gl_print_enable_flags( const char *msg
, GLuint flags
)
801 "%s: (0x%x) %s%s%s%s%s%s%s%s%s%s%s\n",
804 (flags
& ENABLE_TEX0
) ? "tex-0, " : "",
805 (flags
& ENABLE_TEX1
) ? "tex-1, " : "",
806 (flags
& ENABLE_LIGHT
) ? "light, " : "",
807 (flags
& ENABLE_FOG
) ? "fog, " : "",
808 (flags
& ENABLE_USERCLIP
) ? "userclip, " : "",
809 (flags
& ENABLE_TEXGEN0
) ? "tex-gen-0, " : "",
810 (flags
& ENABLE_TEXGEN1
) ? "tex-gen-1, " : "",
811 (flags
& ENABLE_TEXMAT0
) ? "tex-mat-0, " : "",
812 (flags
& ENABLE_TEXMAT1
) ? "tex-mat-1, " : "",
813 (flags
& ENABLE_NORMALIZE
) ? "normalize, " : "",
814 (flags
& ENABLE_RESCALE
) ? "rescale, " : "");
819 * If ctx->NewState is non-zero then this function MUST be called before
820 * rendering any primitive. Basically, function pointers and miscellaneous
821 * flags are updated to reflect the current state of the state machine.
823 void gl_update_state( GLcontext
*ctx
)
827 if (MESA_VERBOSE
& VERBOSE_STATE
)
828 gl_print_state("", ctx
->NewState
);
830 if (ctx
->NewState
& _NEW_PIXEL
)
831 _mesa_update_image_transfer_state(ctx
);
833 if (ctx
->NewState
& _NEW_ARRAY
)
834 gl_update_client_state( ctx
);
836 if (ctx
->NewState
& _NEW_TEXTURE_MATRIX
) {
837 ctx
->Enabled
&= ~(ENABLE_TEXMAT0
| ENABLE_TEXMAT1
| ENABLE_TEXMAT2
);
839 for (i
=0; i
< ctx
->Const
.MaxTextureUnits
; i
++) {
840 if (ctx
->TextureMatrix
[i
].flags
& MAT_DIRTY_ALL_OVER
) {
841 gl_matrix_analyze( &ctx
->TextureMatrix
[i
] );
842 ctx
->TextureMatrix
[i
].flags
&= ~MAT_DIRTY_DEPENDENTS
;
844 if (ctx
->Texture
.Unit
[i
].Enabled
&&
845 ctx
->TextureMatrix
[i
].type
!= MATRIX_IDENTITY
)
846 ctx
->Enabled
|= ENABLE_TEXMAT0
<< i
;
851 if (ctx
->NewState
& _NEW_TEXTURE
) {
852 ctx
->Texture
.MultiTextureEnabled
= GL_FALSE
;
853 ctx
->Texture
.NeedNormals
= GL_FALSE
;
854 gl_update_dirty_texobjs(ctx
);
855 ctx
->Enabled
&= ~(ENABLE_TEXGEN0
| ENABLE_TEXGEN1
| ENABLE_TEXGEN2
);
856 ctx
->Texture
.ReallyEnabled
= 0;
858 for (i
=0; i
< ctx
->Const
.MaxTextureUnits
; i
++) {
859 if (ctx
->Texture
.Unit
[i
].Enabled
) {
860 gl_update_texture_unit( ctx
, &ctx
->Texture
.Unit
[i
] );
862 ctx
->Texture
.ReallyEnabled
|=
863 ctx
->Texture
.Unit
[i
].ReallyEnabled
<< (i
* 4);
865 if (ctx
->Texture
.Unit
[i
].GenFlags
!= 0) {
866 ctx
->Enabled
|= ENABLE_TEXGEN0
<< i
;
868 if (ctx
->Texture
.Unit
[i
].GenFlags
& TEXGEN_NEED_NORMALS
) {
869 ctx
->Texture
.NeedNormals
= GL_TRUE
;
870 ctx
->Texture
.NeedEyeCoords
= GL_TRUE
;
873 if (ctx
->Texture
.Unit
[i
].GenFlags
& TEXGEN_NEED_EYE_COORD
) {
874 ctx
->Texture
.NeedEyeCoords
= GL_TRUE
;
878 if (i
> 0 && ctx
->Texture
.Unit
[i
].ReallyEnabled
) {
879 ctx
->Texture
.MultiTextureEnabled
= GL_TRUE
;
883 ctx
->Texture
.Unit
[i
].ReallyEnabled
= 0;
886 ctx
->Enabled
= (ctx
->Enabled
& ~ENABLE_TEX_ANY
) | ctx
->Texture
.ReallyEnabled
;
887 ctx
->NeedNormals
= (ctx
->Light
.Enabled
|| ctx
->Texture
.NeedNormals
);
891 if (ctx
->NewState
& _SWRAST_NEW_RASTERMASK
)
892 update_rasterflags(ctx
);
894 if (ctx
->NewState
& (_NEW_BUFFERS
|_NEW_SCISSOR
)) {
895 /* update scissor region */
896 ctx
->DrawBuffer
->Xmin
= 0;
897 ctx
->DrawBuffer
->Ymin
= 0;
898 ctx
->DrawBuffer
->Xmax
= ctx
->DrawBuffer
->Width
;
899 ctx
->DrawBuffer
->Ymax
= ctx
->DrawBuffer
->Height
;
900 if (ctx
->Scissor
.Enabled
) {
901 if (ctx
->Scissor
.X
> ctx
->DrawBuffer
->Xmin
) {
902 ctx
->DrawBuffer
->Xmin
= ctx
->Scissor
.X
;
904 if (ctx
->Scissor
.Y
> ctx
->DrawBuffer
->Ymin
) {
905 ctx
->DrawBuffer
->Ymin
= ctx
->Scissor
.Y
;
907 if (ctx
->Scissor
.X
+ ctx
->Scissor
.Width
< ctx
->DrawBuffer
->Xmax
) {
908 ctx
->DrawBuffer
->Xmax
= ctx
->Scissor
.X
+ ctx
->Scissor
.Width
;
910 if (ctx
->Scissor
.Y
+ ctx
->Scissor
.Height
< ctx
->DrawBuffer
->Ymax
) {
911 ctx
->DrawBuffer
->Ymax
= ctx
->Scissor
.Y
+ ctx
->Scissor
.Height
;
916 if (ctx
->NewState
& _NEW_LIGHT
) {
917 ctx
->TriangleCaps
&= ~(DD_TRI_LIGHT_TWOSIDE
|DD_LIGHTING_CULL
);
918 if (ctx
->Light
.Enabled
) {
919 if (ctx
->Light
.Model
.TwoSide
)
920 ctx
->TriangleCaps
|= (DD_TRI_LIGHT_TWOSIDE
|DD_LIGHTING_CULL
);
921 gl_update_lighting(ctx
);
925 if (ctx
->NewState
& (_NEW_POLYGON
| _NEW_LIGHT
)) {
927 ctx
->TriangleCaps
&= ~DD_TRI_CULL_FRONT_BACK
;
929 if (ctx
->NewState
& _NEW_POLYGON
) {
930 /* Setup CullBits bitmask */
931 if (ctx
->Polygon
.CullFlag
) {
932 ctx
->backface_sign
= 1;
933 switch(ctx
->Polygon
.CullFaceMode
) {
935 if(ctx
->Polygon
.FrontFace
==GL_CCW
)
936 ctx
->backface_sign
= -1;
937 ctx
->Polygon
.CullBits
= 1;
940 if(ctx
->Polygon
.FrontFace
!=GL_CCW
)
941 ctx
->backface_sign
= -1;
942 ctx
->Polygon
.CullBits
= 2;
945 case GL_FRONT_AND_BACK
:
946 ctx
->backface_sign
= 0;
947 ctx
->Polygon
.CullBits
= 0;
948 ctx
->TriangleCaps
|= DD_TRI_CULL_FRONT_BACK
;
953 ctx
->Polygon
.CullBits
= 3;
954 ctx
->backface_sign
= 0;
957 /* Any Polygon offsets enabled? */
958 ctx
->TriangleCaps
&= ~DD_TRI_OFFSET
;
960 if (ctx
->Polygon
.OffsetPoint
||
961 ctx
->Polygon
.OffsetLine
||
962 ctx
->Polygon
.OffsetFill
)
963 ctx
->TriangleCaps
|= DD_TRI_OFFSET
;
967 if (ctx
->NewState
& (_NEW_LIGHT
|
971 gl_update_clipmask(ctx
);
973 if (ctx
->NewState
& ctx
->Driver
.UpdateStateNotify
)
975 ctx
->IndirectTriangles
= ctx
->TriangleCaps
& ~ctx
->Driver
.TriangleCaps
;
976 ctx
->IndirectTriangles
|= DD_SW_RASTERIZE
;
978 if (MESA_VERBOSE
&VERBOSE_CULL
)
979 gl_print_tri_caps("initial indirect tris", ctx
->IndirectTriangles
);
981 ctx
->Driver
.PointsFunc
= NULL
;
982 ctx
->Driver
.LineFunc
= NULL
;
983 ctx
->Driver
.TriangleFunc
= NULL
;
984 ctx
->Driver
.QuadFunc
= NULL
;
985 ctx
->Driver
.RectFunc
= NULL
;
986 ctx
->Driver
.RenderVBClippedTab
= NULL
;
987 ctx
->Driver
.RenderVBCulledTab
= NULL
;
988 ctx
->Driver
.RenderVBRawTab
= NULL
;
991 * Here the driver sets up all the ctx->Driver function pointers to
992 * it's specific, private functions.
994 ctx
->Driver
.UpdateState(ctx
);
996 if (MESA_VERBOSE
&VERBOSE_CULL
)
997 gl_print_tri_caps("indirect tris", ctx
->IndirectTriangles
);
1000 * In case the driver didn't hook in an optimized point, line or
1001 * triangle function we'll now select "core/fallback" point, line
1002 * and triangle functions.
1004 if (ctx
->IndirectTriangles
& DD_SW_RASTERIZE
) {
1005 gl_set_point_function(ctx
);
1006 gl_set_line_function(ctx
);
1007 gl_set_triangle_function(ctx
);
1008 gl_set_quad_function(ctx
);
1010 if ((ctx
->IndirectTriangles
&
1011 (DD_TRI_SW_RASTERIZE
|DD_QUAD_SW_RASTERIZE
|DD_TRI_CULL
)) ==
1012 (DD_TRI_SW_RASTERIZE
|DD_QUAD_SW_RASTERIZE
|DD_TRI_CULL
))
1013 ctx
->IndirectTriangles
&= ~DD_TRI_CULL
;
1016 if (MESA_VERBOSE
&VERBOSE_CULL
)
1017 gl_print_tri_caps("indirect tris 2", ctx
->IndirectTriangles
);
1019 gl_set_render_vb_function(ctx
);
1022 /* Should only be calc'd when !need_eye_coords and not culling.
1024 if (ctx
->NewState
& (_NEW_MODELVIEW
|_NEW_PROJECTION
)) {
1025 if (ctx
->NewState
& _NEW_MODELVIEW
) {
1026 gl_matrix_analyze( &ctx
->ModelView
);
1027 ctx
->ProjectionMatrix
.flags
&= ~MAT_DIRTY_DEPENDENTS
;
1030 if (ctx
->NewState
& _NEW_PROJECTION
) {
1031 gl_matrix_analyze( &ctx
->ProjectionMatrix
);
1032 ctx
->ProjectionMatrix
.flags
&= ~MAT_DIRTY_DEPENDENTS
;
1034 if (ctx
->Transform
.AnyClip
) {
1035 gl_update_userclip( ctx
);
1039 gl_calculate_model_project_matrix( ctx
);
1042 if (ctx
->NewState
& _NEW_COLOR_MATRIX
) {
1043 gl_matrix_analyze( &ctx
->ColorMatrix
);
1046 /* Figure out whether we can light in object space or not. If we
1047 * can, find the current positions of the lights in object space
1049 if ((ctx
->Enabled
& (ENABLE_POINT_ATTEN
| ENABLE_LIGHT
| ENABLE_FOG
|
1050 ENABLE_TEXGEN0
| ENABLE_TEXGEN1
| ENABLE_TEXGEN2
)) &&
1051 (ctx
->NewState
& (_NEW_LIGHT
|
1061 GLboolean oldcoord
, oldnorm
;
1063 oldcoord
= ctx
->NeedEyeCoords
;
1064 oldnorm
= ctx
->NeedEyeNormals
;
1066 ctx
->NeedNormals
= (ctx
->Light
.Enabled
|| ctx
->Texture
.NeedNormals
);
1067 ctx
->NeedEyeCoords
= (ctx
->Fog
.Enabled
|| ctx
->Point
.Attenuated
);
1068 ctx
->NeedEyeNormals
= GL_FALSE
;
1070 if (ctx
->Light
.Enabled
) {
1071 if ((ctx
->Light
.Flags
& LIGHT_POSITIONAL
) ||
1072 ctx
->Light
.NeedVertices
||
1073 !TEST_MAT_FLAGS( &ctx
->ModelView
, MAT_FLAGS_LENGTH_PRESERVING
)) {
1074 /* Need length for attenuation or need angle for spotlights
1075 * or non-uniform scale matrix
1077 ctx
->NeedEyeCoords
= GL_TRUE
;
1079 ctx
->NeedEyeNormals
= ctx
->NeedEyeCoords
;
1081 if (ctx
->Texture
.ReallyEnabled
|| ctx
->RenderMode
==GL_FEEDBACK
) {
1082 if (ctx
->Texture
.NeedEyeCoords
) ctx
->NeedEyeCoords
= GL_TRUE
;
1083 if (ctx
->Texture
.NeedNormals
)
1084 ctx
->NeedNormals
= ctx
->NeedEyeNormals
= GL_TRUE
;
1087 ctx
->vb_proj_matrix
= &ctx
->ModelProjectMatrix
;
1089 if (ctx
->NeedEyeCoords
)
1090 ctx
->vb_proj_matrix
= &ctx
->ProjectionMatrix
;
1092 if (ctx
->Light
.Enabled
) {
1093 gl_update_lighting_function(ctx
);
1095 if ( (ctx
->NewState
& _NEW_LIGHT
) ||
1096 ((ctx
->NewState
& (_NEW_MODELVIEW
|_NEW_PROJECTION
)) &&
1097 !ctx
->NeedEyeCoords
) ||
1098 oldcoord
!= ctx
->NeedEyeCoords
||
1099 oldnorm
!= ctx
->NeedEyeNormals
) {
1100 gl_compute_light_positions(ctx
);
1103 ctx
->rescale_factor
= 1.0F
;
1104 if (ctx
->ModelView
.flags
& (MAT_FLAG_UNIFORM_SCALE
|
1105 MAT_FLAG_GENERAL_SCALE
|
1106 MAT_FLAG_GENERAL_3D
|
1107 MAT_FLAG_GENERAL
) ) {
1108 const GLfloat
*m
= ctx
->ModelView
.inv
;
1109 const GLfloat f
= m
[2] * m
[2] + m
[6] * m
[6] + m
[10] * m
[10];
1110 if (f
> 1e-12 && (f
- 1.0) * (f
- 1.0) > 1e-12)
1111 ctx
->rescale_factor
= 1.0 / GL_SQRT(f
);
1115 gl_update_normal_transform( ctx
);
1118 gl_update_pipelines(ctx
);
1126 * Return a bitmask of IMAGE_*_BIT flags which to indicate which
1127 * pixel transfer operations are enabled.
1130 _mesa_update_image_transfer_state(GLcontext
*ctx
)
1134 if (ctx
->Pixel
.RedScale
!= 1.0F
|| ctx
->Pixel
.RedBias
!= 0.0F
||
1135 ctx
->Pixel
.GreenScale
!= 1.0F
|| ctx
->Pixel
.GreenBias
!= 0.0F
||
1136 ctx
->Pixel
.BlueScale
!= 1.0F
|| ctx
->Pixel
.BlueBias
!= 0.0F
||
1137 ctx
->Pixel
.AlphaScale
!= 1.0F
|| ctx
->Pixel
.AlphaBias
!= 0.0F
)
1138 mask
|= IMAGE_SCALE_BIAS_BIT
;
1140 if (ctx
->Pixel
.IndexShift
|| ctx
->Pixel
.IndexOffset
)
1141 mask
|= IMAGE_SHIFT_OFFSET_BIT
;
1143 if (ctx
->Pixel
.MapColorFlag
)
1144 mask
|= IMAGE_MAP_COLOR_BIT
;
1146 if (ctx
->Pixel
.ColorTableEnabled
)
1147 mask
|= IMAGE_COLOR_TABLE_BIT
;
1149 if (ctx
->Pixel
.Convolution1DEnabled
||
1150 ctx
->Pixel
.Convolution2DEnabled
||
1151 ctx
->Pixel
.Separable2DEnabled
)
1152 mask
|= IMAGE_CONVOLUTION_BIT
;
1154 if (ctx
->Pixel
.PostConvolutionColorTableEnabled
)
1155 mask
|= IMAGE_POST_CONVOLUTION_COLOR_TABLE_BIT
;
1157 if (ctx
->ColorMatrix
.type
!= MATRIX_IDENTITY
||
1158 ctx
->Pixel
.PostColorMatrixScale
[0] != 1.0F
||
1159 ctx
->Pixel
.PostColorMatrixBias
[0] != 0.0F
||
1160 ctx
->Pixel
.PostColorMatrixScale
[1] != 1.0F
||
1161 ctx
->Pixel
.PostColorMatrixBias
[1] != 0.0F
||
1162 ctx
->Pixel
.PostColorMatrixScale
[2] != 1.0F
||
1163 ctx
->Pixel
.PostColorMatrixBias
[2] != 0.0F
||
1164 ctx
->Pixel
.PostColorMatrixScale
[3] != 1.0F
||
1165 ctx
->Pixel
.PostColorMatrixBias
[3] != 0.0F
)
1166 mask
|= IMAGE_COLOR_MATRIX_BIT
;
1168 if (ctx
->Pixel
.PostColorMatrixColorTableEnabled
)
1169 mask
|= IMAGE_POST_COLOR_MATRIX_COLOR_TABLE_BIT
;
1171 if (ctx
->Pixel
.HistogramEnabled
)
1172 mask
|= IMAGE_HISTOGRAM_BIT
;
1174 if (ctx
->Pixel
.MinMaxEnabled
)
1175 mask
|= IMAGE_MIN_MAX_BIT
;
1177 ctx
->ImageTransferState
= mask
;