2 * Mesa 3-D graphics library
5 * Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
7 * Permission is hereby granted, free of charge, to any person obtaining a
8 * copy of this software and associated documentation files (the "Software"),
9 * to deal in the Software without restriction, including without limitation
10 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
11 * and/or sell copies of the Software, and to permit persons to whom the
12 * Software is furnished to do so, subject to the following conditions:
14 * The above copyright notice and this permission notice shall be included
15 * in all copies or substantial portions of the Software.
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20 * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
21 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30 * This file manages recalculation of derived values in the __GLcontextRec.
31 * Also, this is where we initialize the API dispatch table.
36 #include "api_loopback.h"
37 #if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
38 #include "arbprogram.h"
42 #if FEATURE_ARB_vertex_buffer_object
43 #include "bufferobj.h"
59 #include "histogram.h"
65 #if FEATURE_ARB_occlusion_query
79 #if FEATURE_NV_vertex_program
80 #include "nvprogram.h"
82 #if FEATURE_NV_fragment_program
83 #include "nvfragprog.h"
84 #include "nvprogram.h"
87 #if FEATURE_ARB_shader_objects
88 #include "shaderobjects.h"
92 /* #include "math/m_matrix.h" */
93 /* #include "math/m_xform.h" */
96 /**********************************************************************/
97 /** \name Dispatch table setup */
101 * Generic no-op dispatch function.
103 * Used in replacement of the functions which are not part of Mesa subset.
105 * Displays a message.
110 _mesa_problem(NULL
, "User called no-op dispatch function (an unsupported extension function?)");
116 * Set all pointers in the given dispatch table to point to a
117 * generic no-op function - generic_noop().
119 * \param table dispatch table.
120 * \param tableSize dispatch table size.
123 _mesa_init_no_op_table(struct _glapi_table
*table
, GLuint tableSize
)
125 typedef void (*func_ptr_t
)();
127 func_ptr_t
*dispatch
= (func_ptr_t
*) table
;
128 for (i
= 0; i
< tableSize
; i
++) {
129 dispatch
[i
] = (func_ptr_t
)generic_noop
;
135 * Initialize a dispatch table with pointers to Mesa's immediate-mode
138 * Pointers to glBegin()/glEnd() object commands and a few others
139 * are provided via the GLvertexformat interface.
141 * \param exec dispatch table.
142 * \param tableSize dispatch table size.
145 _mesa_init_exec_table(struct _glapi_table
*exec
, GLuint tableSize
)
147 /* first initialize all dispatch slots to no-op */
148 _mesa_init_no_op_table(exec
, tableSize
);
151 _mesa_loopback_init_api_table( exec
);
154 /* load the dispatch slots we understand */
155 exec
->AlphaFunc
= _mesa_AlphaFunc
;
156 exec
->BlendFunc
= _mesa_BlendFunc
;
157 exec
->Clear
= _mesa_Clear
;
158 exec
->ClearColor
= _mesa_ClearColor
;
159 exec
->ClearStencil
= _mesa_ClearStencil
;
160 exec
->ColorMask
= _mesa_ColorMask
;
161 exec
->CullFace
= _mesa_CullFace
;
162 exec
->Disable
= _mesa_Disable
;
163 exec
->DrawBuffer
= _mesa_DrawBuffer
;
164 exec
->Enable
= _mesa_Enable
;
165 exec
->Finish
= _mesa_Finish
;
166 exec
->Flush
= _mesa_Flush
;
167 exec
->FrontFace
= _mesa_FrontFace
;
168 exec
->Frustum
= _mesa_Frustum
;
169 exec
->GetError
= _mesa_GetError
;
170 exec
->GetFloatv
= _mesa_GetFloatv
;
171 exec
->GetString
= _mesa_GetString
;
172 exec
->InitNames
= _mesa_InitNames
;
173 exec
->LineStipple
= _mesa_LineStipple
;
174 exec
->LineWidth
= _mesa_LineWidth
;
175 exec
->LoadIdentity
= _mesa_LoadIdentity
;
176 exec
->LoadMatrixf
= _mesa_LoadMatrixf
;
177 exec
->LoadName
= _mesa_LoadName
;
178 exec
->LogicOp
= _mesa_LogicOp
;
179 exec
->MatrixMode
= _mesa_MatrixMode
;
180 exec
->MultMatrixf
= _mesa_MultMatrixf
;
181 exec
->Ortho
= _mesa_Ortho
;
182 exec
->PixelStorei
= _mesa_PixelStorei
;
183 exec
->PopMatrix
= _mesa_PopMatrix
;
184 exec
->PopName
= _mesa_PopName
;
185 exec
->PushMatrix
= _mesa_PushMatrix
;
186 exec
->PushName
= _mesa_PushName
;
187 exec
->RasterPos2f
= _mesa_RasterPos2f
;
188 exec
->RasterPos2fv
= _mesa_RasterPos2fv
;
189 exec
->RasterPos2i
= _mesa_RasterPos2i
;
190 exec
->RasterPos2iv
= _mesa_RasterPos2iv
;
191 exec
->ReadBuffer
= _mesa_ReadBuffer
;
192 exec
->RenderMode
= _mesa_RenderMode
;
193 exec
->Rotatef
= _mesa_Rotatef
;
194 exec
->Scalef
= _mesa_Scalef
;
195 exec
->Scissor
= _mesa_Scissor
;
196 exec
->SelectBuffer
= _mesa_SelectBuffer
;
197 exec
->ShadeModel
= _mesa_ShadeModel
;
198 exec
->StencilFunc
= _mesa_StencilFunc
;
199 exec
->StencilMask
= _mesa_StencilMask
;
200 exec
->StencilOp
= _mesa_StencilOp
;
201 exec
->TexEnvfv
= _mesa_TexEnvfv
;
202 exec
->TexEnvi
= _mesa_TexEnvi
;
203 exec
->TexImage2D
= _mesa_TexImage2D
;
204 exec
->TexParameteri
= _mesa_TexParameteri
;
205 exec
->Translatef
= _mesa_Translatef
;
206 exec
->Viewport
= _mesa_Viewport
;
208 exec
->Accum
= _mesa_Accum
;
209 exec
->Bitmap
= _mesa_Bitmap
;
210 exec
->CallList
= _mesa_CallList
;
211 exec
->CallLists
= _mesa_CallLists
;
212 exec
->ClearAccum
= _mesa_ClearAccum
;
213 exec
->ClearDepth
= _mesa_ClearDepth
;
214 exec
->ClearIndex
= _mesa_ClearIndex
;
215 exec
->ClipPlane
= _mesa_ClipPlane
;
216 exec
->ColorMaterial
= _mesa_ColorMaterial
;
217 exec
->CopyPixels
= _mesa_CopyPixels
;
218 exec
->CullParameterfvEXT
= _mesa_CullParameterfvEXT
;
219 exec
->CullParameterdvEXT
= _mesa_CullParameterdvEXT
;
220 exec
->DeleteLists
= _mesa_DeleteLists
;
221 exec
->DepthFunc
= _mesa_DepthFunc
;
222 exec
->DepthMask
= _mesa_DepthMask
;
223 exec
->DepthRange
= _mesa_DepthRange
;
224 exec
->DrawPixels
= _mesa_DrawPixels
;
225 exec
->EndList
= _mesa_EndList
;
226 exec
->FeedbackBuffer
= _mesa_FeedbackBuffer
;
227 exec
->FogCoordPointerEXT
= _mesa_FogCoordPointerEXT
;
228 exec
->Fogf
= _mesa_Fogf
;
229 exec
->Fogfv
= _mesa_Fogfv
;
230 exec
->Fogi
= _mesa_Fogi
;
231 exec
->Fogiv
= _mesa_Fogiv
;
232 exec
->GenLists
= _mesa_GenLists
;
233 exec
->GetClipPlane
= _mesa_GetClipPlane
;
234 exec
->GetBooleanv
= _mesa_GetBooleanv
;
235 exec
->GetDoublev
= _mesa_GetDoublev
;
236 exec
->GetIntegerv
= _mesa_GetIntegerv
;
237 exec
->GetLightfv
= _mesa_GetLightfv
;
238 exec
->GetLightiv
= _mesa_GetLightiv
;
239 exec
->GetMapdv
= _mesa_GetMapdv
;
240 exec
->GetMapfv
= _mesa_GetMapfv
;
241 exec
->GetMapiv
= _mesa_GetMapiv
;
242 exec
->GetMaterialfv
= _mesa_GetMaterialfv
;
243 exec
->GetMaterialiv
= _mesa_GetMaterialiv
;
244 exec
->GetPixelMapfv
= _mesa_GetPixelMapfv
;
245 exec
->GetPixelMapuiv
= _mesa_GetPixelMapuiv
;
246 exec
->GetPixelMapusv
= _mesa_GetPixelMapusv
;
247 exec
->GetPolygonStipple
= _mesa_GetPolygonStipple
;
248 exec
->GetTexEnvfv
= _mesa_GetTexEnvfv
;
249 exec
->GetTexEnviv
= _mesa_GetTexEnviv
;
250 exec
->GetTexLevelParameterfv
= _mesa_GetTexLevelParameterfv
;
251 exec
->GetTexLevelParameteriv
= _mesa_GetTexLevelParameteriv
;
252 exec
->GetTexParameterfv
= _mesa_GetTexParameterfv
;
253 exec
->GetTexParameteriv
= _mesa_GetTexParameteriv
;
254 exec
->GetTexGendv
= _mesa_GetTexGendv
;
255 exec
->GetTexGenfv
= _mesa_GetTexGenfv
;
256 exec
->GetTexGeniv
= _mesa_GetTexGeniv
;
257 exec
->GetTexImage
= _mesa_GetTexImage
;
258 exec
->Hint
= _mesa_Hint
;
259 exec
->IndexMask
= _mesa_IndexMask
;
260 exec
->IsEnabled
= _mesa_IsEnabled
;
261 exec
->IsList
= _mesa_IsList
;
262 exec
->LightModelf
= _mesa_LightModelf
;
263 exec
->LightModelfv
= _mesa_LightModelfv
;
264 exec
->LightModeli
= _mesa_LightModeli
;
265 exec
->LightModeliv
= _mesa_LightModeliv
;
266 exec
->Lightf
= _mesa_Lightf
;
267 exec
->Lightfv
= _mesa_Lightfv
;
268 exec
->Lighti
= _mesa_Lighti
;
269 exec
->Lightiv
= _mesa_Lightiv
;
270 exec
->ListBase
= _mesa_ListBase
;
271 exec
->LoadMatrixd
= _mesa_LoadMatrixd
;
272 exec
->Map1d
= _mesa_Map1d
;
273 exec
->Map1f
= _mesa_Map1f
;
274 exec
->Map2d
= _mesa_Map2d
;
275 exec
->Map2f
= _mesa_Map2f
;
276 exec
->MapGrid1d
= _mesa_MapGrid1d
;
277 exec
->MapGrid1f
= _mesa_MapGrid1f
;
278 exec
->MapGrid2d
= _mesa_MapGrid2d
;
279 exec
->MapGrid2f
= _mesa_MapGrid2f
;
280 exec
->MultMatrixd
= _mesa_MultMatrixd
;
281 exec
->NewList
= _mesa_NewList
;
282 exec
->PassThrough
= _mesa_PassThrough
;
283 exec
->PixelMapfv
= _mesa_PixelMapfv
;
284 exec
->PixelMapuiv
= _mesa_PixelMapuiv
;
285 exec
->PixelMapusv
= _mesa_PixelMapusv
;
286 exec
->PixelStoref
= _mesa_PixelStoref
;
287 exec
->PixelTransferf
= _mesa_PixelTransferf
;
288 exec
->PixelTransferi
= _mesa_PixelTransferi
;
289 exec
->PixelZoom
= _mesa_PixelZoom
;
290 exec
->PointSize
= _mesa_PointSize
;
291 exec
->PolygonMode
= _mesa_PolygonMode
;
292 exec
->PolygonOffset
= _mesa_PolygonOffset
;
293 exec
->PolygonStipple
= _mesa_PolygonStipple
;
294 exec
->PopAttrib
= _mesa_PopAttrib
;
295 exec
->PushAttrib
= _mesa_PushAttrib
;
296 exec
->RasterPos2d
= _mesa_RasterPos2d
;
297 exec
->RasterPos2dv
= _mesa_RasterPos2dv
;
298 exec
->RasterPos2s
= _mesa_RasterPos2s
;
299 exec
->RasterPos2sv
= _mesa_RasterPos2sv
;
300 exec
->RasterPos3d
= _mesa_RasterPos3d
;
301 exec
->RasterPos3dv
= _mesa_RasterPos3dv
;
302 exec
->RasterPos3f
= _mesa_RasterPos3f
;
303 exec
->RasterPos3fv
= _mesa_RasterPos3fv
;
304 exec
->RasterPos3i
= _mesa_RasterPos3i
;
305 exec
->RasterPos3iv
= _mesa_RasterPos3iv
;
306 exec
->RasterPos3s
= _mesa_RasterPos3s
;
307 exec
->RasterPos3sv
= _mesa_RasterPos3sv
;
308 exec
->RasterPos4d
= _mesa_RasterPos4d
;
309 exec
->RasterPos4dv
= _mesa_RasterPos4dv
;
310 exec
->RasterPos4f
= _mesa_RasterPos4f
;
311 exec
->RasterPos4fv
= _mesa_RasterPos4fv
;
312 exec
->RasterPos4i
= _mesa_RasterPos4i
;
313 exec
->RasterPos4iv
= _mesa_RasterPos4iv
;
314 exec
->RasterPos4s
= _mesa_RasterPos4s
;
315 exec
->RasterPos4sv
= _mesa_RasterPos4sv
;
316 exec
->ReadPixels
= _mesa_ReadPixels
;
317 exec
->Rotated
= _mesa_Rotated
;
318 exec
->Scaled
= _mesa_Scaled
;
319 exec
->SecondaryColorPointerEXT
= _mesa_SecondaryColorPointerEXT
;
320 exec
->TexEnvf
= _mesa_TexEnvf
;
321 exec
->TexEnviv
= _mesa_TexEnviv
;
322 exec
->TexGend
= _mesa_TexGend
;
323 exec
->TexGendv
= _mesa_TexGendv
;
324 exec
->TexGenf
= _mesa_TexGenf
;
325 exec
->TexGenfv
= _mesa_TexGenfv
;
326 exec
->TexGeni
= _mesa_TexGeni
;
327 exec
->TexGeniv
= _mesa_TexGeniv
;
328 exec
->TexImage1D
= _mesa_TexImage1D
;
329 exec
->TexParameterf
= _mesa_TexParameterf
;
330 exec
->TexParameterfv
= _mesa_TexParameterfv
;
331 exec
->TexParameteriv
= _mesa_TexParameteriv
;
332 exec
->Translated
= _mesa_Translated
;
336 exec
->BindTexture
= _mesa_BindTexture
;
337 exec
->DeleteTextures
= _mesa_DeleteTextures
;
338 exec
->GenTextures
= _mesa_GenTextures
;
340 exec
->AreTexturesResident
= _mesa_AreTexturesResident
;
341 exec
->AreTexturesResidentEXT
= _mesa_AreTexturesResident
;
342 exec
->ColorPointer
= _mesa_ColorPointer
;
343 exec
->CopyTexImage1D
= _mesa_CopyTexImage1D
;
344 exec
->CopyTexImage2D
= _mesa_CopyTexImage2D
;
345 exec
->CopyTexSubImage1D
= _mesa_CopyTexSubImage1D
;
346 exec
->CopyTexSubImage2D
= _mesa_CopyTexSubImage2D
;
347 exec
->DisableClientState
= _mesa_DisableClientState
;
348 exec
->EdgeFlagPointer
= _mesa_EdgeFlagPointer
;
349 exec
->EnableClientState
= _mesa_EnableClientState
;
350 exec
->GenTexturesEXT
= _mesa_GenTextures
;
351 exec
->GetPointerv
= _mesa_GetPointerv
;
352 exec
->IndexPointer
= _mesa_IndexPointer
;
353 exec
->InterleavedArrays
= _mesa_InterleavedArrays
;
354 exec
->IsTexture
= _mesa_IsTexture
;
355 exec
->IsTextureEXT
= _mesa_IsTexture
;
356 exec
->NormalPointer
= _mesa_NormalPointer
;
357 exec
->PopClientAttrib
= _mesa_PopClientAttrib
;
358 exec
->PrioritizeTextures
= _mesa_PrioritizeTextures
;
359 exec
->PushClientAttrib
= _mesa_PushClientAttrib
;
360 exec
->TexCoordPointer
= _mesa_TexCoordPointer
;
361 exec
->TexSubImage1D
= _mesa_TexSubImage1D
;
362 exec
->TexSubImage2D
= _mesa_TexSubImage2D
;
363 exec
->VertexPointer
= _mesa_VertexPointer
;
368 exec
->CopyTexSubImage3D
= _mesa_CopyTexSubImage3D
;
369 exec
->TexImage3D
= _mesa_TexImage3D
;
370 exec
->TexSubImage3D
= _mesa_TexSubImage3D
;
373 /* OpenGL 1.2 GL_ARB_imaging */
375 exec
->BlendColor
= _mesa_BlendColor
;
376 exec
->BlendEquation
= _mesa_BlendEquation
;
377 exec
->BlendEquationSeparateEXT
= _mesa_BlendEquationSeparateEXT
;
378 exec
->ColorSubTable
= _mesa_ColorSubTable
;
379 exec
->ColorTable
= _mesa_ColorTable
;
380 exec
->ColorTableParameterfv
= _mesa_ColorTableParameterfv
;
381 exec
->ColorTableParameteriv
= _mesa_ColorTableParameteriv
;
382 exec
->ConvolutionFilter1D
= _mesa_ConvolutionFilter1D
;
383 exec
->ConvolutionFilter2D
= _mesa_ConvolutionFilter2D
;
384 exec
->ConvolutionParameterf
= _mesa_ConvolutionParameterf
;
385 exec
->ConvolutionParameterfv
= _mesa_ConvolutionParameterfv
;
386 exec
->ConvolutionParameteri
= _mesa_ConvolutionParameteri
;
387 exec
->ConvolutionParameteriv
= _mesa_ConvolutionParameteriv
;
388 exec
->CopyColorSubTable
= _mesa_CopyColorSubTable
;
389 exec
->CopyColorTable
= _mesa_CopyColorTable
;
390 exec
->CopyConvolutionFilter1D
= _mesa_CopyConvolutionFilter1D
;
391 exec
->CopyConvolutionFilter2D
= _mesa_CopyConvolutionFilter2D
;
392 exec
->GetColorTable
= _mesa_GetColorTable
;
393 exec
->GetColorTableEXT
= _mesa_GetColorTable
;
394 exec
->GetColorTableParameterfv
= _mesa_GetColorTableParameterfv
;
395 exec
->GetColorTableParameterfvEXT
= _mesa_GetColorTableParameterfv
;
396 exec
->GetColorTableParameteriv
= _mesa_GetColorTableParameteriv
;
397 exec
->GetColorTableParameterivEXT
= _mesa_GetColorTableParameteriv
;
398 exec
->GetConvolutionFilter
= _mesa_GetConvolutionFilter
;
399 exec
->GetConvolutionFilterEXT
= _mesa_GetConvolutionFilter
;
400 exec
->GetConvolutionParameterfv
= _mesa_GetConvolutionParameterfv
;
401 exec
->GetConvolutionParameterfvEXT
= _mesa_GetConvolutionParameterfv
;
402 exec
->GetConvolutionParameteriv
= _mesa_GetConvolutionParameteriv
;
403 exec
->GetConvolutionParameterivEXT
= _mesa_GetConvolutionParameteriv
;
404 exec
->GetHistogram
= _mesa_GetHistogram
;
405 exec
->GetHistogramEXT
= _mesa_GetHistogram
;
406 exec
->GetHistogramParameterfv
= _mesa_GetHistogramParameterfv
;
407 exec
->GetHistogramParameterfvEXT
= _mesa_GetHistogramParameterfv
;
408 exec
->GetHistogramParameteriv
= _mesa_GetHistogramParameteriv
;
409 exec
->GetHistogramParameterivEXT
= _mesa_GetHistogramParameteriv
;
410 exec
->GetMinmax
= _mesa_GetMinmax
;
411 exec
->GetMinmaxEXT
= _mesa_GetMinmax
;
412 exec
->GetMinmaxParameterfv
= _mesa_GetMinmaxParameterfv
;
413 exec
->GetMinmaxParameterfvEXT
= _mesa_GetMinmaxParameterfv
;
414 exec
->GetMinmaxParameteriv
= _mesa_GetMinmaxParameteriv
;
415 exec
->GetMinmaxParameterivEXT
= _mesa_GetMinmaxParameteriv
;
416 exec
->GetSeparableFilter
= _mesa_GetSeparableFilter
;
417 exec
->GetSeparableFilterEXT
= _mesa_GetSeparableFilter
;
418 exec
->Histogram
= _mesa_Histogram
;
419 exec
->Minmax
= _mesa_Minmax
;
420 exec
->ResetHistogram
= _mesa_ResetHistogram
;
421 exec
->ResetMinmax
= _mesa_ResetMinmax
;
422 exec
->SeparableFilter2D
= _mesa_SeparableFilter2D
;
425 /* 2. GL_EXT_blend_color */
427 /* exec->BlendColorEXT = _mesa_BlendColorEXT; */
430 /* 3. GL_EXT_polygon_offset */
432 exec
->PolygonOffsetEXT
= _mesa_PolygonOffsetEXT
;
435 /* 6. GL_EXT_texture3d */
437 /* exec->CopyTexSubImage3DEXT = _mesa_CopyTexSubImage3D; */
438 /* exec->TexImage3DEXT = _mesa_TexImage3DEXT; */
439 /* exec->TexSubImage3DEXT = _mesa_TexSubImage3D; */
442 /* 11. GL_EXT_histogram */
444 exec
->GetHistogramEXT
= _mesa_GetHistogram
;
445 exec
->GetHistogramParameterfvEXT
= _mesa_GetHistogramParameterfv
;
446 exec
->GetHistogramParameterivEXT
= _mesa_GetHistogramParameteriv
;
447 exec
->GetMinmaxEXT
= _mesa_GetMinmax
;
448 exec
->GetMinmaxParameterfvEXT
= _mesa_GetMinmaxParameterfv
;
449 exec
->GetMinmaxParameterivEXT
= _mesa_GetMinmaxParameteriv
;
452 /* ?. GL_SGIX_pixel_texture */
454 exec
->PixelTexGenSGIX
= _mesa_PixelTexGenSGIX
;
457 /* 15. GL_SGIS_pixel_texture */
459 exec
->PixelTexGenParameteriSGIS
= _mesa_PixelTexGenParameteriSGIS
;
460 exec
->PixelTexGenParameterivSGIS
= _mesa_PixelTexGenParameterivSGIS
;
461 exec
->PixelTexGenParameterfSGIS
= _mesa_PixelTexGenParameterfSGIS
;
462 exec
->PixelTexGenParameterfvSGIS
= _mesa_PixelTexGenParameterfvSGIS
;
463 exec
->GetPixelTexGenParameterivSGIS
= _mesa_GetPixelTexGenParameterivSGIS
;
464 exec
->GetPixelTexGenParameterfvSGIS
= _mesa_GetPixelTexGenParameterfvSGIS
;
467 /* 30. GL_EXT_vertex_array */
469 exec
->ColorPointerEXT
= _mesa_ColorPointerEXT
;
470 exec
->EdgeFlagPointerEXT
= _mesa_EdgeFlagPointerEXT
;
471 exec
->IndexPointerEXT
= _mesa_IndexPointerEXT
;
472 exec
->NormalPointerEXT
= _mesa_NormalPointerEXT
;
473 exec
->TexCoordPointerEXT
= _mesa_TexCoordPointerEXT
;
474 exec
->VertexPointerEXT
= _mesa_VertexPointerEXT
;
477 /* 37. GL_EXT_blend_minmax */
479 exec
->BlendEquationEXT
= _mesa_BlendEquationEXT
;
482 /* 54. GL_EXT_point_parameters */
484 exec
->PointParameterfEXT
= _mesa_PointParameterfEXT
;
485 exec
->PointParameterfvEXT
= _mesa_PointParameterfvEXT
;
488 /* 78. GL_EXT_paletted_texture */
490 exec
->ColorTableEXT
= _mesa_ColorTableEXT
;
491 exec
->ColorSubTableEXT
= _mesa_ColorSubTableEXT
;
494 exec
->GetColorTableEXT
= _mesa_GetColorTable
;
495 exec
->GetColorTableParameterfvEXT
= _mesa_GetColorTableParameterfv
;
496 exec
->GetColorTableParameterivEXT
= _mesa_GetColorTableParameteriv
;
499 /* 97. GL_EXT_compiled_vertex_array */
501 exec
->LockArraysEXT
= _mesa_LockArraysEXT
;
502 exec
->UnlockArraysEXT
= _mesa_UnlockArraysEXT
;
505 /* 148. GL_EXT_multi_draw_arrays */
507 exec
->MultiDrawArraysEXT
= _mesa_MultiDrawArraysEXT
;
508 exec
->MultiDrawElementsEXT
= _mesa_MultiDrawElementsEXT
;
511 /* 173. GL_INGR_blend_func_separate */
513 exec
->BlendFuncSeparateEXT
= _mesa_BlendFuncSeparateEXT
;
516 /* 196. GL_MESA_resize_buffers */
518 exec
->ResizeBuffersMESA
= _mesa_ResizeBuffersMESA
;
521 /* 197. GL_MESA_window_pos */
523 exec
->WindowPos2dMESA
= _mesa_WindowPos2dMESA
;
524 exec
->WindowPos2dvMESA
= _mesa_WindowPos2dvMESA
;
525 exec
->WindowPos2fMESA
= _mesa_WindowPos2fMESA
;
526 exec
->WindowPos2fvMESA
= _mesa_WindowPos2fvMESA
;
527 exec
->WindowPos2iMESA
= _mesa_WindowPos2iMESA
;
528 exec
->WindowPos2ivMESA
= _mesa_WindowPos2ivMESA
;
529 exec
->WindowPos2sMESA
= _mesa_WindowPos2sMESA
;
530 exec
->WindowPos2svMESA
= _mesa_WindowPos2svMESA
;
531 exec
->WindowPos3dMESA
= _mesa_WindowPos3dMESA
;
532 exec
->WindowPos3dvMESA
= _mesa_WindowPos3dvMESA
;
533 exec
->WindowPos3fMESA
= _mesa_WindowPos3fMESA
;
534 exec
->WindowPos3fvMESA
= _mesa_WindowPos3fvMESA
;
535 exec
->WindowPos3iMESA
= _mesa_WindowPos3iMESA
;
536 exec
->WindowPos3ivMESA
= _mesa_WindowPos3ivMESA
;
537 exec
->WindowPos3sMESA
= _mesa_WindowPos3sMESA
;
538 exec
->WindowPos3svMESA
= _mesa_WindowPos3svMESA
;
539 exec
->WindowPos4dMESA
= _mesa_WindowPos4dMESA
;
540 exec
->WindowPos4dvMESA
= _mesa_WindowPos4dvMESA
;
541 exec
->WindowPos4fMESA
= _mesa_WindowPos4fMESA
;
542 exec
->WindowPos4fvMESA
= _mesa_WindowPos4fvMESA
;
543 exec
->WindowPos4iMESA
= _mesa_WindowPos4iMESA
;
544 exec
->WindowPos4ivMESA
= _mesa_WindowPos4ivMESA
;
545 exec
->WindowPos4sMESA
= _mesa_WindowPos4sMESA
;
546 exec
->WindowPos4svMESA
= _mesa_WindowPos4svMESA
;
549 /* 200. GL_IBM_multimode_draw_arrays */
551 exec
->MultiModeDrawArraysIBM
= _mesa_MultiModeDrawArraysIBM
;
552 exec
->MultiModeDrawElementsIBM
= _mesa_MultiModeDrawElementsIBM
;
555 /* 233. GL_NV_vertex_program */
556 #if FEATURE_NV_vertex_program
557 exec
->BindProgramNV
= _mesa_BindProgram
;
558 exec
->DeleteProgramsNV
= _mesa_DeletePrograms
;
559 exec
->ExecuteProgramNV
= _mesa_ExecuteProgramNV
;
560 exec
->GenProgramsNV
= _mesa_GenPrograms
;
561 exec
->AreProgramsResidentNV
= _mesa_AreProgramsResidentNV
;
562 exec
->RequestResidentProgramsNV
= _mesa_RequestResidentProgramsNV
;
563 exec
->GetProgramParameterfvNV
= _mesa_GetProgramParameterfvNV
;
564 exec
->GetProgramParameterdvNV
= _mesa_GetProgramParameterdvNV
;
565 exec
->GetProgramivNV
= _mesa_GetProgramivNV
;
566 exec
->GetProgramStringNV
= _mesa_GetProgramStringNV
;
567 exec
->GetTrackMatrixivNV
= _mesa_GetTrackMatrixivNV
;
568 exec
->GetVertexAttribdvNV
= _mesa_GetVertexAttribdvNV
;
569 exec
->GetVertexAttribfvNV
= _mesa_GetVertexAttribfvNV
;
570 exec
->GetVertexAttribivNV
= _mesa_GetVertexAttribivNV
;
571 exec
->GetVertexAttribPointervNV
= _mesa_GetVertexAttribPointervNV
;
572 exec
->IsProgramNV
= _mesa_IsProgram
;
573 exec
->LoadProgramNV
= _mesa_LoadProgramNV
;
574 exec
->ProgramParameter4dNV
= _mesa_ProgramParameter4dNV
;
575 exec
->ProgramParameter4dvNV
= _mesa_ProgramParameter4dvNV
;
576 exec
->ProgramParameter4fNV
= _mesa_ProgramParameter4fNV
;
577 exec
->ProgramParameter4fvNV
= _mesa_ProgramParameter4fvNV
;
578 exec
->ProgramParameters4dvNV
= _mesa_ProgramParameters4dvNV
;
579 exec
->ProgramParameters4fvNV
= _mesa_ProgramParameters4fvNV
;
580 exec
->TrackMatrixNV
= _mesa_TrackMatrixNV
;
581 exec
->VertexAttribPointerNV
= _mesa_VertexAttribPointerNV
;
582 /* glVertexAttrib*NV functions handled in api_loopback.c */
585 /* 282. GL_NV_fragment_program */
586 #if FEATURE_NV_fragment_program
587 exec
->ProgramNamedParameter4fNV
= _mesa_ProgramNamedParameter4fNV
;
588 exec
->ProgramNamedParameter4dNV
= _mesa_ProgramNamedParameter4dNV
;
589 exec
->ProgramNamedParameter4fvNV
= _mesa_ProgramNamedParameter4fvNV
;
590 exec
->ProgramNamedParameter4dvNV
= _mesa_ProgramNamedParameter4dvNV
;
591 exec
->GetProgramNamedParameterfvNV
= _mesa_GetProgramNamedParameterfvNV
;
592 exec
->GetProgramNamedParameterdvNV
= _mesa_GetProgramNamedParameterdvNV
;
593 exec
->ProgramLocalParameter4dARB
= _mesa_ProgramLocalParameter4dARB
;
594 exec
->ProgramLocalParameter4dvARB
= _mesa_ProgramLocalParameter4dvARB
;
595 exec
->ProgramLocalParameter4fARB
= _mesa_ProgramLocalParameter4fARB
;
596 exec
->ProgramLocalParameter4fvARB
= _mesa_ProgramLocalParameter4fvARB
;
597 exec
->GetProgramLocalParameterdvARB
= _mesa_GetProgramLocalParameterdvARB
;
598 exec
->GetProgramLocalParameterfvARB
= _mesa_GetProgramLocalParameterfvARB
;
601 /* 262. GL_NV_point_sprite */
603 exec
->PointParameteriNV
= _mesa_PointParameteriNV
;
604 exec
->PointParameterivNV
= _mesa_PointParameterivNV
;
607 /* 268. GL_EXT_stencil_two_side */
609 exec
->ActiveStencilFaceEXT
= _mesa_ActiveStencilFaceEXT
;
612 /* ???. GL_EXT_depth_bounds_test */
613 exec
->DepthBoundsEXT
= _mesa_DepthBoundsEXT
;
615 /* ARB 1. GL_ARB_multitexture */
617 exec
->ActiveTextureARB
= _mesa_ActiveTextureARB
;
618 exec
->ClientActiveTextureARB
= _mesa_ClientActiveTextureARB
;
621 /* ARB 3. GL_ARB_transpose_matrix */
623 exec
->LoadTransposeMatrixdARB
= _mesa_LoadTransposeMatrixdARB
;
624 exec
->LoadTransposeMatrixfARB
= _mesa_LoadTransposeMatrixfARB
;
625 exec
->MultTransposeMatrixdARB
= _mesa_MultTransposeMatrixdARB
;
626 exec
->MultTransposeMatrixfARB
= _mesa_MultTransposeMatrixfARB
;
629 /* ARB 5. GL_ARB_multisample */
631 exec
->SampleCoverageARB
= _mesa_SampleCoverageARB
;
634 /* ARB 12. GL_ARB_texture_compression */
636 exec
->CompressedTexImage3DARB
= _mesa_CompressedTexImage3DARB
;
637 exec
->CompressedTexImage2DARB
= _mesa_CompressedTexImage2DARB
;
638 exec
->CompressedTexImage1DARB
= _mesa_CompressedTexImage1DARB
;
639 exec
->CompressedTexSubImage3DARB
= _mesa_CompressedTexSubImage3DARB
;
640 exec
->CompressedTexSubImage2DARB
= _mesa_CompressedTexSubImage2DARB
;
641 exec
->CompressedTexSubImage1DARB
= _mesa_CompressedTexSubImage1DARB
;
642 exec
->GetCompressedTexImageARB
= _mesa_GetCompressedTexImageARB
;
645 /* ARB 14. GL_ARB_point_parameters */
646 /* reuse EXT_point_parameters functions */
648 /* ARB 26. GL_ARB_vertex_program */
649 /* ARB 27. GL_ARB_fragment_program */
650 #if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
651 /* glVertexAttrib1sARB aliases glVertexAttrib1sNV */
652 /* glVertexAttrib1fARB aliases glVertexAttrib1fNV */
653 /* glVertexAttrib1dARB aliases glVertexAttrib1dNV */
654 /* glVertexAttrib2sARB aliases glVertexAttrib2sNV */
655 /* glVertexAttrib2fARB aliases glVertexAttrib2fNV */
656 /* glVertexAttrib2dARB aliases glVertexAttrib2dNV */
657 /* glVertexAttrib3sARB aliases glVertexAttrib3sNV */
658 /* glVertexAttrib3fARB aliases glVertexAttrib3fNV */
659 /* glVertexAttrib3dARB aliases glVertexAttrib3dNV */
660 /* glVertexAttrib4sARB aliases glVertexAttrib4sNV */
661 /* glVertexAttrib4fARB aliases glVertexAttrib4fNV */
662 /* glVertexAttrib4dARB aliases glVertexAttrib4dNV */
663 /* glVertexAttrib4NubARB aliases glVertexAttrib4NubNV */
664 /* glVertexAttrib1svARB aliases glVertexAttrib1svNV */
665 /* glVertexAttrib1fvARB aliases glVertexAttrib1fvNV */
666 /* glVertexAttrib1dvARB aliases glVertexAttrib1dvNV */
667 /* glVertexAttrib2svARB aliases glVertexAttrib2svNV */
668 /* glVertexAttrib2fvARB aliases glVertexAttrib2fvNV */
669 /* glVertexAttrib2dvARB aliases glVertexAttrib2dvNV */
670 /* glVertexAttrib3svARB aliases glVertexAttrib3svNV */
671 /* glVertexAttrib3fvARB aliases glVertexAttrib3fvNV */
672 /* glVertexAttrib3dvARB aliases glVertexAttrib3dvNV */
673 /* glVertexAttrib4svARB aliases glVertexAttrib4svNV */
674 /* glVertexAttrib4fvARB aliases glVertexAttrib4fvNV */
675 /* glVertexAttrib4dvARB aliases glVertexAttrib4dvNV */
676 /* glVertexAttrib4NubvARB aliases glVertexAttrib4NubvNV */
677 /* glVertexAttrib4bvARB handled in api_loopback.c */
678 /* glVertexAttrib4ivARB handled in api_loopback.c */
679 /* glVertexAttrib4ubvARB handled in api_loopback.c */
680 /* glVertexAttrib4usvARB handled in api_loopback.c */
681 /* glVertexAttrib4uivARB handled in api_loopback.c */
682 /* glVertexAttrib4NbvARB handled in api_loopback.c */
683 /* glVertexAttrib4NsvARB handled in api_loopback.c */
684 /* glVertexAttrib4NivARB handled in api_loopback.c */
685 /* glVertexAttrib4NusvARB handled in api_loopback.c */
686 /* glVertexAttrib4NuivARB handled in api_loopback.c */
687 exec
->VertexAttribPointerARB
= _mesa_VertexAttribPointerARB
;
688 exec
->EnableVertexAttribArrayARB
= _mesa_EnableVertexAttribArrayARB
;
689 exec
->DisableVertexAttribArrayARB
= _mesa_DisableVertexAttribArrayARB
;
690 exec
->ProgramStringARB
= _mesa_ProgramStringARB
;
691 /* glBindProgramARB aliases glBindProgramNV */
692 /* glDeleteProgramsARB aliases glDeleteProgramsNV */
693 /* glGenProgramsARB aliases glGenProgramsNV */
694 /* glIsProgramARB aliases glIsProgramNV */
695 /* glGetVertexAttribdvARB aliases glGetVertexAttribdvNV */
696 /* glGetVertexAttribfvARB aliases glGetVertexAttribfvNV */
697 /* glGetVertexAttribivARB aliases glGetVertexAttribivNV */
698 /* glGetVertexAttribPointervARB aliases glGetVertexAttribPointervNV */
699 exec
->ProgramEnvParameter4dARB
= _mesa_ProgramEnvParameter4dARB
;
700 exec
->ProgramEnvParameter4dvARB
= _mesa_ProgramEnvParameter4dvARB
;
701 exec
->ProgramEnvParameter4fARB
= _mesa_ProgramEnvParameter4fARB
;
702 exec
->ProgramEnvParameter4fvARB
= _mesa_ProgramEnvParameter4fvARB
;
703 exec
->ProgramLocalParameter4dARB
= _mesa_ProgramLocalParameter4dARB
;
704 exec
->ProgramLocalParameter4dvARB
= _mesa_ProgramLocalParameter4dvARB
;
705 exec
->ProgramLocalParameter4fARB
= _mesa_ProgramLocalParameter4fARB
;
706 exec
->ProgramLocalParameter4fvARB
= _mesa_ProgramLocalParameter4fvARB
;
707 exec
->GetProgramEnvParameterdvARB
= _mesa_GetProgramEnvParameterdvARB
;
708 exec
->GetProgramEnvParameterfvARB
= _mesa_GetProgramEnvParameterfvARB
;
709 exec
->GetProgramLocalParameterdvARB
= _mesa_GetProgramLocalParameterdvARB
;
710 exec
->GetProgramLocalParameterfvARB
= _mesa_GetProgramLocalParameterfvARB
;
711 exec
->GetProgramivARB
= _mesa_GetProgramivARB
;
712 exec
->GetProgramStringARB
= _mesa_GetProgramStringARB
;
715 /* ARB 28. GL_ARB_vertex_buffer_object */
716 #if FEATURE_ARB_vertex_buffer_object
717 exec
->BindBufferARB
= _mesa_BindBufferARB
;
718 exec
->BufferDataARB
= _mesa_BufferDataARB
;
719 exec
->BufferSubDataARB
= _mesa_BufferSubDataARB
;
720 exec
->DeleteBuffersARB
= _mesa_DeleteBuffersARB
;
721 exec
->GenBuffersARB
= _mesa_GenBuffersARB
;
722 exec
->GetBufferParameterivARB
= _mesa_GetBufferParameterivARB
;
723 exec
->GetBufferPointervARB
= _mesa_GetBufferPointervARB
;
724 exec
->GetBufferSubDataARB
= _mesa_GetBufferSubDataARB
;
725 exec
->IsBufferARB
= _mesa_IsBufferARB
;
726 exec
->MapBufferARB
= _mesa_MapBufferARB
;
727 exec
->UnmapBufferARB
= _mesa_UnmapBufferARB
;
730 /* ARB 29. GL_ARB_occlusion_query */
731 #if FEATURE_ARB_occlusion_query
732 exec
->GenQueriesARB
= _mesa_GenQueriesARB
;
733 exec
->DeleteQueriesARB
= _mesa_DeleteQueriesARB
;
734 exec
->IsQueryARB
= _mesa_IsQueryARB
;
735 exec
->BeginQueryARB
= _mesa_BeginQueryARB
;
736 exec
->EndQueryARB
= _mesa_EndQueryARB
;
737 exec
->GetQueryivARB
= _mesa_GetQueryivARB
;
738 exec
->GetQueryObjectivARB
= _mesa_GetQueryObjectivARB
;
739 exec
->GetQueryObjectuivARB
= _mesa_GetQueryObjectuivARB
;
742 /* ARB 37. GL_ARB_draw_buffers */
743 exec
->DrawBuffersARB
= _mesa_DrawBuffersARB
;
745 #if FEATURE_ARB_shader_objects
746 exec
->DeleteObjectARB
= _mesa_DeleteObjectARB
;
747 exec
->GetHandleARB
= _mesa_GetHandleARB
;
748 exec
->DetachObjectARB
= _mesa_DetachObjectARB
;
749 exec
->CreateShaderObjectARB
= _mesa_CreateShaderObjectARB
;
750 exec
->ShaderSourceARB
= _mesa_ShaderSourceARB
;
751 exec
->CompileShaderARB
= _mesa_CompileShaderARB
;
752 exec
->CreateProgramObjectARB
= _mesa_CreateProgramObjectARB
;
753 exec
->AttachObjectARB
= _mesa_AttachObjectARB
;
754 exec
->LinkProgramARB
= _mesa_LinkProgramARB
;
755 exec
->UseProgramObjectARB
= _mesa_UseProgramObjectARB
;
756 exec
->ValidateProgramARB
= _mesa_ValidateProgramARB
;
757 exec
->Uniform1fARB
= _mesa_Uniform1fARB
;
758 exec
->Uniform2fARB
= _mesa_Uniform2fARB
;
759 exec
->Uniform3fARB
= _mesa_Uniform3fARB
;
760 exec
->Uniform4fARB
= _mesa_Uniform4fARB
;
761 exec
->Uniform1iARB
= _mesa_Uniform1iARB
;
762 exec
->Uniform2iARB
= _mesa_Uniform2iARB
;
763 exec
->Uniform3iARB
= _mesa_Uniform3iARB
;
764 exec
->Uniform4iARB
= _mesa_Uniform4iARB
;
765 exec
->Uniform1fvARB
= _mesa_Uniform1fvARB
;
766 exec
->Uniform2fvARB
= _mesa_Uniform2fvARB
;
767 exec
->Uniform3fvARB
= _mesa_Uniform3fvARB
;
768 exec
->Uniform4fvARB
= _mesa_Uniform4fvARB
;
769 exec
->Uniform1ivARB
= _mesa_Uniform1ivARB
;
770 exec
->Uniform2ivARB
= _mesa_Uniform2ivARB
;
771 exec
->Uniform3ivARB
= _mesa_Uniform3ivARB
;
772 exec
->Uniform4ivARB
= _mesa_Uniform4ivARB
;
773 exec
->UniformMatrix2fvARB
= _mesa_UniformMatrix2fvARB
;
774 exec
->UniformMatrix3fvARB
= _mesa_UniformMatrix3fvARB
;
775 exec
->UniformMatrix4fvARB
= _mesa_UniformMatrix4fvARB
;
776 exec
->GetObjectParameterfvARB
= _mesa_GetObjectParameterfvARB
;
777 exec
->GetObjectParameterivARB
= _mesa_GetObjectParameterivARB
;
778 exec
->GetInfoLogARB
= _mesa_GetInfoLogARB
;
779 exec
->GetAttachedObjectsARB
= _mesa_GetAttachedObjectsARB
;
780 exec
->GetUniformLocationARB
= _mesa_GetUniformLocationARB
;
781 exec
->GetActiveUniformARB
= _mesa_GetActiveUniformARB
;
782 exec
->GetUniformfvARB
= _mesa_GetUniformfvARB
;
783 exec
->GetUniformivARB
= _mesa_GetUniformivARB
;
784 exec
->GetShaderSourceARB
= _mesa_GetShaderSourceARB
;
785 #if FEATURE_ARB_vertex_shader
786 exec
->BindAttribLocationARB
= _mesa_BindAttribLocationARB
;
787 exec
->GetActiveAttribARB
= _mesa_GetActiveAttribARB
;
788 exec
->GetAttribLocationARB
= _mesa_GetAttribLocationARB
;
790 #endif /* FEATURE_ARB_shader_objects */
796 /**********************************************************************/
797 /** \name State update logic */
802 update_separate_specular( GLcontext
*ctx
)
804 if (NEED_SECONDARY_COLOR(ctx
))
805 ctx
->_TriangleCaps
|= DD_SEPARATE_SPECULAR
;
807 ctx
->_TriangleCaps
&= ~DD_SEPARATE_SPECULAR
;
812 * Update state dependent on vertex arrays.
815 update_arrays( GLcontext
*ctx
)
819 /* find min of _MaxElement values for all enabled arrays */
822 if (ctx
->VertexProgram
._Enabled
823 && ctx
->Array
.VertexAttrib
[VERT_ATTRIB_POS
].Enabled
) {
824 min
= ctx
->Array
.VertexAttrib
[VERT_ATTRIB_POS
]._MaxElement
;
826 else if (ctx
->Array
.Vertex
.Enabled
) {
827 min
= ctx
->Array
.Vertex
._MaxElement
;
830 /* can't draw anything without vertex positions! */
835 if (ctx
->VertexProgram
._Enabled
836 && ctx
->Array
.VertexAttrib
[VERT_ATTRIB_WEIGHT
].Enabled
) {
837 min
= MIN2(min
, ctx
->Array
.VertexAttrib
[VERT_ATTRIB_WEIGHT
]._MaxElement
);
839 /* no conventional vertex weight array */
842 if (ctx
->VertexProgram
._Enabled
843 && ctx
->Array
.VertexAttrib
[VERT_ATTRIB_NORMAL
].Enabled
) {
844 min
= MIN2(min
, ctx
->Array
.VertexAttrib
[VERT_ATTRIB_NORMAL
]._MaxElement
);
846 else if (ctx
->Array
.Normal
.Enabled
) {
847 min
= MIN2(min
, ctx
->Array
.Normal
._MaxElement
);
851 if (ctx
->VertexProgram
._Enabled
852 && ctx
->Array
.VertexAttrib
[VERT_ATTRIB_COLOR0
].Enabled
) {
853 min
= MIN2(min
, ctx
->Array
.VertexAttrib
[VERT_ATTRIB_COLOR0
]._MaxElement
);
855 else if (ctx
->Array
.Color
.Enabled
) {
856 min
= MIN2(min
, ctx
->Array
.Color
._MaxElement
);
860 if (ctx
->VertexProgram
._Enabled
861 && ctx
->Array
.VertexAttrib
[VERT_ATTRIB_COLOR1
].Enabled
) {
862 min
= MIN2(min
, ctx
->Array
.VertexAttrib
[VERT_ATTRIB_COLOR1
]._MaxElement
);
864 else if (ctx
->Array
.SecondaryColor
.Enabled
) {
865 min
= MIN2(min
, ctx
->Array
.SecondaryColor
._MaxElement
);
869 if (ctx
->VertexProgram
._Enabled
870 && ctx
->Array
.VertexAttrib
[VERT_ATTRIB_FOG
].Enabled
) {
871 min
= MIN2(min
, ctx
->Array
.VertexAttrib
[VERT_ATTRIB_FOG
]._MaxElement
);
873 else if (ctx
->Array
.FogCoord
.Enabled
) {
874 min
= MIN2(min
, ctx
->Array
.FogCoord
._MaxElement
);
878 if (ctx
->VertexProgram
._Enabled
879 && ctx
->Array
.VertexAttrib
[VERT_ATTRIB_SIX
].Enabled
) {
880 min
= MIN2(min
, ctx
->Array
.VertexAttrib
[VERT_ATTRIB_SIX
]._MaxElement
);
884 if (ctx
->VertexProgram
._Enabled
885 && ctx
->Array
.VertexAttrib
[VERT_ATTRIB_SEVEN
].Enabled
) {
886 min
= MIN2(min
, ctx
->Array
.VertexAttrib
[VERT_ATTRIB_SEVEN
]._MaxElement
);
890 for (i
= VERT_ATTRIB_TEX0
; i
< VERT_ATTRIB_MAX
; i
++) {
891 if (ctx
->VertexProgram
._Enabled
892 && ctx
->Array
.VertexAttrib
[i
].Enabled
) {
893 min
= MIN2(min
, ctx
->Array
.VertexAttrib
[i
]._MaxElement
);
895 else if (i
- VERT_ATTRIB_TEX0
< ctx
->Const
.MaxTextureCoordUnits
896 && ctx
->Array
.TexCoord
[i
- VERT_ATTRIB_TEX0
].Enabled
) {
897 min
= MIN2(min
, ctx
->Array
.TexCoord
[i
- VERT_ATTRIB_TEX0
]._MaxElement
);
901 if (ctx
->Array
.Index
.Enabled
) {
902 min
= MIN2(min
, ctx
->Array
.Index
._MaxElement
);
905 if (ctx
->Array
.EdgeFlag
.Enabled
) {
906 min
= MIN2(min
, ctx
->Array
.EdgeFlag
._MaxElement
);
909 /* _MaxElement is one past the last legal array element */
910 ctx
->Array
._MaxElement
= min
;
915 * Update derived vertex/fragment program state.
918 update_program(GLcontext
*ctx
)
920 /* For now, just set the _Enabled (really enabled) flags.
921 * In the future we may have to check other state to be sure we really
922 * have a runable program or shader.
924 ctx
->VertexProgram
._Enabled
= ctx
->VertexProgram
.Enabled
925 && ctx
->VertexProgram
.Current
->Instructions
;
926 ctx
->FragmentProgram
._Enabled
= ctx
->FragmentProgram
.Enabled
927 && ctx
->FragmentProgram
.Current
->Instructions
;
932 * If __GLcontextRec::NewState is non-zero then this function \b must be called
933 * before rendering any primitive. Basically, function pointers and
934 * miscellaneous flags are updated to reflect the current state of the state
937 * Calls dd_function_table::UpdateState to perform any internal state management
940 * \sa _mesa_update_modelview_project(), _mesa_update_texture(),
941 * _mesa_update_buffers(), _mesa_update_polygon(), _mesa_update_lighting() and
942 * _mesa_update_tnl_spaces().
944 void _mesa_update_state( GLcontext
*ctx
)
946 GLuint new_state
= ctx
->NewState
;
948 if (MESA_VERBOSE
& VERBOSE_STATE
)
949 _mesa_print_state("_mesa_update_state", new_state
);
951 if (new_state
& _NEW_PROGRAM
)
952 update_program( ctx
);
954 if (new_state
& (_NEW_MODELVIEW
|_NEW_PROJECTION
))
955 _mesa_update_modelview_project( ctx
, new_state
);
957 if (new_state
& (_NEW_PROGRAM
|_NEW_TEXTURE
|_NEW_TEXTURE_MATRIX
))
958 _mesa_update_texture( ctx
, new_state
);
960 if (new_state
& (_NEW_SCISSOR
|_NEW_BUFFERS
))
961 _mesa_update_buffers( ctx
);
963 if (new_state
& _NEW_POLYGON
)
964 _mesa_update_polygon( ctx
);
966 if (new_state
& _NEW_LIGHT
)
967 _mesa_update_lighting( ctx
);
969 if (new_state
& _IMAGE_NEW_TRANSFER_STATE
)
970 _mesa_update_pixel( ctx
, new_state
);
972 if (new_state
& _DD_NEW_SEPARATE_SPECULAR
)
973 update_separate_specular( ctx
);
975 if (new_state
& (_NEW_ARRAY
| _NEW_PROGRAM
))
976 update_arrays( ctx
);
978 /* ctx->_NeedEyeCoords is now up to date.
980 * If the truth value of this variable has changed, update for the
981 * new lighting space and recompute the positions of lights and the
984 * If the lighting space hasn't changed, may still need to recompute
985 * light positions & normal transforms for other reasons.
987 if (new_state
& _MESA_NEW_NEED_EYE_COORDS
)
988 _mesa_update_tnl_spaces( ctx
, new_state
);
991 * Give the driver a chance to act upon the new_state flags.
992 * The driver might plug in different span functions, for example.
993 * Also, this is where the driver can invalidate the state of any
994 * active modules (such as swrast_setup, swrast, tnl, etc).
996 * Set ctx->NewState to zero to avoid recursion if
997 * Driver.UpdateState() has to call FLUSH_VERTICES(). (fixed?)
999 new_state
= ctx
->NewState
;
1001 ctx
->Driver
.UpdateState(ctx
, new_state
);
1002 ctx
->Array
.NewState
= 0;