state.c revision 7117f1b4
17117f1b4Smrg/*
27117f1b4Smrg * Mesa 3-D graphics library
37117f1b4Smrg * Version:  6.5.1
47117f1b4Smrg *
57117f1b4Smrg * Copyright (C) 1999-2006  Brian Paul   All Rights Reserved.
67117f1b4Smrg *
77117f1b4Smrg * Permission is hereby granted, free of charge, to any person obtaining a
87117f1b4Smrg * copy of this software and associated documentation files (the "Software"),
97117f1b4Smrg * to deal in the Software without restriction, including without limitation
107117f1b4Smrg * the rights to use, copy, modify, merge, publish, distribute, sublicense,
117117f1b4Smrg * and/or sell copies of the Software, and to permit persons to whom the
127117f1b4Smrg * Software is furnished to do so, subject to the following conditions:
137117f1b4Smrg *
147117f1b4Smrg * The above copyright notice and this permission notice shall be included
157117f1b4Smrg * in all copies or substantial portions of the Software.
167117f1b4Smrg *
177117f1b4Smrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
187117f1b4Smrg * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
197117f1b4Smrg * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
207117f1b4Smrg * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
217117f1b4Smrg * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
227117f1b4Smrg * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
237117f1b4Smrg */
247117f1b4Smrg
257117f1b4Smrg
267117f1b4Smrg/**
277117f1b4Smrg * \file state.c
287117f1b4Smrg * State management.
297117f1b4Smrg *
307117f1b4Smrg * This file manages recalculation of derived values in the __GLcontextRec.
317117f1b4Smrg * Also, this is where we initialize the API dispatch table.
327117f1b4Smrg */
337117f1b4Smrg
347117f1b4Smrg#include "glheader.h"
357117f1b4Smrg#include "accum.h"
367117f1b4Smrg#include "api_loopback.h"
377117f1b4Smrg#if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
387117f1b4Smrg#include "arbprogram.h"
397117f1b4Smrg#endif
407117f1b4Smrg#if FEATURE_ATI_fragment_shader
417117f1b4Smrg#include "atifragshader.h"
427117f1b4Smrg#endif
437117f1b4Smrg#include "attrib.h"
447117f1b4Smrg#include "blend.h"
457117f1b4Smrg#if FEATURE_ARB_vertex_buffer_object
467117f1b4Smrg#include "bufferobj.h"
477117f1b4Smrg#endif
487117f1b4Smrg#include "arrayobj.h"
497117f1b4Smrg#include "buffers.h"
507117f1b4Smrg#include "clip.h"
517117f1b4Smrg#include "colortab.h"
527117f1b4Smrg#include "context.h"
537117f1b4Smrg#include "convolve.h"
547117f1b4Smrg#include "depth.h"
557117f1b4Smrg#include "dlist.h"
567117f1b4Smrg#include "drawpix.h"
577117f1b4Smrg#include "enable.h"
587117f1b4Smrg#include "eval.h"
597117f1b4Smrg#include "get.h"
607117f1b4Smrg#include "feedback.h"
617117f1b4Smrg#include "fog.h"
627117f1b4Smrg#if FEATURE_EXT_framebuffer_object
637117f1b4Smrg#include "fbobject.h"
647117f1b4Smrg#endif
657117f1b4Smrg#include "framebuffer.h"
667117f1b4Smrg#include "hint.h"
677117f1b4Smrg#include "histogram.h"
687117f1b4Smrg#include "imports.h"
697117f1b4Smrg#include "light.h"
707117f1b4Smrg#include "lines.h"
717117f1b4Smrg#include "macros.h"
727117f1b4Smrg#include "matrix.h"
737117f1b4Smrg#include "pixel.h"
747117f1b4Smrg#include "points.h"
757117f1b4Smrg#include "polygon.h"
767117f1b4Smrg#if FEATURE_ARB_occlusion_query || FEATURE_EXT_timer_query
777117f1b4Smrg#include "queryobj.h"
787117f1b4Smrg#endif
797117f1b4Smrg#include "rastpos.h"
807117f1b4Smrg#include "state.h"
817117f1b4Smrg#include "stencil.h"
827117f1b4Smrg#include "teximage.h"
837117f1b4Smrg#include "texobj.h"
847117f1b4Smrg#include "texstate.h"
857117f1b4Smrg#include "mtypes.h"
867117f1b4Smrg#include "varray.h"
877117f1b4Smrg#if FEATURE_NV_vertex_program
887117f1b4Smrg#include "nvprogram.h"
897117f1b4Smrg#endif
907117f1b4Smrg#if FEATURE_NV_fragment_program
917117f1b4Smrg#include "nvprogram.h"
927117f1b4Smrg#include "program.h"
937117f1b4Smrg#include "texenvprogram.h"
947117f1b4Smrg#endif
957117f1b4Smrg#if FEATURE_ARB_shader_objects
967117f1b4Smrg#include "shaders.h"
977117f1b4Smrg#endif
987117f1b4Smrg#include "debug.h"
997117f1b4Smrg#include "dispatch.h"
1007117f1b4Smrg
1017117f1b4Smrg
1027117f1b4Smrg
1037117f1b4Smrg/**
1047117f1b4Smrg * Initialize a dispatch table with pointers to Mesa's immediate-mode
1057117f1b4Smrg * commands.
1067117f1b4Smrg *
1077117f1b4Smrg * Pointers to glBegin()/glEnd() object commands and a few others
1087117f1b4Smrg * are provided via the GLvertexformat interface.
1097117f1b4Smrg *
1107117f1b4Smrg * \param ctx  GL context to which \c exec belongs.
1117117f1b4Smrg * \param exec dispatch table.
1127117f1b4Smrg */
1137117f1b4Smrgvoid
1147117f1b4Smrg_mesa_init_exec_table(struct _glapi_table *exec)
1157117f1b4Smrg{
1167117f1b4Smrg#if _HAVE_FULL_GL
1177117f1b4Smrg   _mesa_loopback_init_api_table( exec );
1187117f1b4Smrg#endif
1197117f1b4Smrg
1207117f1b4Smrg   /* load the dispatch slots we understand */
1217117f1b4Smrg   SET_AlphaFunc(exec, _mesa_AlphaFunc);
1227117f1b4Smrg   SET_BlendFunc(exec, _mesa_BlendFunc);
1237117f1b4Smrg   SET_Clear(exec, _mesa_Clear);
1247117f1b4Smrg   SET_ClearColor(exec, _mesa_ClearColor);
1257117f1b4Smrg   SET_ClearStencil(exec, _mesa_ClearStencil);
1267117f1b4Smrg   SET_ColorMask(exec, _mesa_ColorMask);
1277117f1b4Smrg   SET_CullFace(exec, _mesa_CullFace);
1287117f1b4Smrg   SET_Disable(exec, _mesa_Disable);
1297117f1b4Smrg   SET_DrawBuffer(exec, _mesa_DrawBuffer);
1307117f1b4Smrg   SET_Enable(exec, _mesa_Enable);
1317117f1b4Smrg   SET_Finish(exec, _mesa_Finish);
1327117f1b4Smrg   SET_Flush(exec, _mesa_Flush);
1337117f1b4Smrg   SET_FrontFace(exec, _mesa_FrontFace);
1347117f1b4Smrg   SET_Frustum(exec, _mesa_Frustum);
1357117f1b4Smrg   SET_GetError(exec, _mesa_GetError);
1367117f1b4Smrg   SET_GetFloatv(exec, _mesa_GetFloatv);
1377117f1b4Smrg   SET_GetString(exec, _mesa_GetString);
1387117f1b4Smrg   SET_InitNames(exec, _mesa_InitNames);
1397117f1b4Smrg   SET_LineStipple(exec, _mesa_LineStipple);
1407117f1b4Smrg   SET_LineWidth(exec, _mesa_LineWidth);
1417117f1b4Smrg   SET_LoadIdentity(exec, _mesa_LoadIdentity);
1427117f1b4Smrg   SET_LoadMatrixf(exec, _mesa_LoadMatrixf);
1437117f1b4Smrg   SET_LoadName(exec, _mesa_LoadName);
1447117f1b4Smrg   SET_LogicOp(exec, _mesa_LogicOp);
1457117f1b4Smrg   SET_MatrixMode(exec, _mesa_MatrixMode);
1467117f1b4Smrg   SET_MultMatrixf(exec, _mesa_MultMatrixf);
1477117f1b4Smrg   SET_Ortho(exec, _mesa_Ortho);
1487117f1b4Smrg   SET_PixelStorei(exec, _mesa_PixelStorei);
1497117f1b4Smrg   SET_PopMatrix(exec, _mesa_PopMatrix);
1507117f1b4Smrg   SET_PopName(exec, _mesa_PopName);
1517117f1b4Smrg   SET_PushMatrix(exec, _mesa_PushMatrix);
1527117f1b4Smrg   SET_PushName(exec, _mesa_PushName);
1537117f1b4Smrg   SET_RasterPos2f(exec, _mesa_RasterPos2f);
1547117f1b4Smrg   SET_RasterPos2fv(exec, _mesa_RasterPos2fv);
1557117f1b4Smrg   SET_RasterPos2i(exec, _mesa_RasterPos2i);
1567117f1b4Smrg   SET_RasterPos2iv(exec, _mesa_RasterPos2iv);
1577117f1b4Smrg   SET_ReadBuffer(exec, _mesa_ReadBuffer);
1587117f1b4Smrg   SET_RenderMode(exec, _mesa_RenderMode);
1597117f1b4Smrg   SET_Rotatef(exec, _mesa_Rotatef);
1607117f1b4Smrg   SET_Scalef(exec, _mesa_Scalef);
1617117f1b4Smrg   SET_Scissor(exec, _mesa_Scissor);
1627117f1b4Smrg   SET_SelectBuffer(exec, _mesa_SelectBuffer);
1637117f1b4Smrg   SET_ShadeModel(exec, _mesa_ShadeModel);
1647117f1b4Smrg   SET_StencilFunc(exec, _mesa_StencilFunc);
1657117f1b4Smrg   SET_StencilMask(exec, _mesa_StencilMask);
1667117f1b4Smrg   SET_StencilOp(exec, _mesa_StencilOp);
1677117f1b4Smrg   SET_TexEnvfv(exec, _mesa_TexEnvfv);
1687117f1b4Smrg   SET_TexEnvi(exec, _mesa_TexEnvi);
1697117f1b4Smrg   SET_TexImage2D(exec, _mesa_TexImage2D);
1707117f1b4Smrg   SET_TexParameteri(exec, _mesa_TexParameteri);
1717117f1b4Smrg   SET_Translatef(exec, _mesa_Translatef);
1727117f1b4Smrg   SET_Viewport(exec, _mesa_Viewport);
1737117f1b4Smrg#if _HAVE_FULL_GL
1747117f1b4Smrg   SET_Accum(exec, _mesa_Accum);
1757117f1b4Smrg   SET_Bitmap(exec, _mesa_Bitmap);
1767117f1b4Smrg   SET_CallList(exec, _mesa_CallList);
1777117f1b4Smrg   SET_CallLists(exec, _mesa_CallLists);
1787117f1b4Smrg   SET_ClearAccum(exec, _mesa_ClearAccum);
1797117f1b4Smrg   SET_ClearDepth(exec, _mesa_ClearDepth);
1807117f1b4Smrg   SET_ClearIndex(exec, _mesa_ClearIndex);
1817117f1b4Smrg   SET_ClipPlane(exec, _mesa_ClipPlane);
1827117f1b4Smrg   SET_ColorMaterial(exec, _mesa_ColorMaterial);
1837117f1b4Smrg   SET_CopyPixels(exec, _mesa_CopyPixels);
1847117f1b4Smrg   SET_CullParameterfvEXT(exec, _mesa_CullParameterfvEXT);
1857117f1b4Smrg   SET_CullParameterdvEXT(exec, _mesa_CullParameterdvEXT);
1867117f1b4Smrg   SET_DeleteLists(exec, _mesa_DeleteLists);
1877117f1b4Smrg   SET_DepthFunc(exec, _mesa_DepthFunc);
1887117f1b4Smrg   SET_DepthMask(exec, _mesa_DepthMask);
1897117f1b4Smrg   SET_DepthRange(exec, _mesa_DepthRange);
1907117f1b4Smrg   SET_DrawPixels(exec, _mesa_DrawPixels);
1917117f1b4Smrg   SET_EndList(exec, _mesa_EndList);
1927117f1b4Smrg   SET_FeedbackBuffer(exec, _mesa_FeedbackBuffer);
1937117f1b4Smrg   SET_FogCoordPointerEXT(exec, _mesa_FogCoordPointerEXT);
1947117f1b4Smrg   SET_Fogf(exec, _mesa_Fogf);
1957117f1b4Smrg   SET_Fogfv(exec, _mesa_Fogfv);
1967117f1b4Smrg   SET_Fogi(exec, _mesa_Fogi);
1977117f1b4Smrg   SET_Fogiv(exec, _mesa_Fogiv);
1987117f1b4Smrg   SET_GenLists(exec, _mesa_GenLists);
1997117f1b4Smrg   SET_GetClipPlane(exec, _mesa_GetClipPlane);
2007117f1b4Smrg   SET_GetBooleanv(exec, _mesa_GetBooleanv);
2017117f1b4Smrg   SET_GetDoublev(exec, _mesa_GetDoublev);
2027117f1b4Smrg   SET_GetIntegerv(exec, _mesa_GetIntegerv);
2037117f1b4Smrg   SET_GetLightfv(exec, _mesa_GetLightfv);
2047117f1b4Smrg   SET_GetLightiv(exec, _mesa_GetLightiv);
2057117f1b4Smrg   SET_GetMapdv(exec, _mesa_GetMapdv);
2067117f1b4Smrg   SET_GetMapfv(exec, _mesa_GetMapfv);
2077117f1b4Smrg   SET_GetMapiv(exec, _mesa_GetMapiv);
2087117f1b4Smrg   SET_GetMaterialfv(exec, _mesa_GetMaterialfv);
2097117f1b4Smrg   SET_GetMaterialiv(exec, _mesa_GetMaterialiv);
2107117f1b4Smrg   SET_GetPixelMapfv(exec, _mesa_GetPixelMapfv);
2117117f1b4Smrg   SET_GetPixelMapuiv(exec, _mesa_GetPixelMapuiv);
2127117f1b4Smrg   SET_GetPixelMapusv(exec, _mesa_GetPixelMapusv);
2137117f1b4Smrg   SET_GetPolygonStipple(exec, _mesa_GetPolygonStipple);
2147117f1b4Smrg   SET_GetTexEnvfv(exec, _mesa_GetTexEnvfv);
2157117f1b4Smrg   SET_GetTexEnviv(exec, _mesa_GetTexEnviv);
2167117f1b4Smrg   SET_GetTexLevelParameterfv(exec, _mesa_GetTexLevelParameterfv);
2177117f1b4Smrg   SET_GetTexLevelParameteriv(exec, _mesa_GetTexLevelParameteriv);
2187117f1b4Smrg   SET_GetTexParameterfv(exec, _mesa_GetTexParameterfv);
2197117f1b4Smrg   SET_GetTexParameteriv(exec, _mesa_GetTexParameteriv);
2207117f1b4Smrg   SET_GetTexGendv(exec, _mesa_GetTexGendv);
2217117f1b4Smrg   SET_GetTexGenfv(exec, _mesa_GetTexGenfv);
2227117f1b4Smrg   SET_GetTexGeniv(exec, _mesa_GetTexGeniv);
2237117f1b4Smrg   SET_GetTexImage(exec, _mesa_GetTexImage);
2247117f1b4Smrg   SET_Hint(exec, _mesa_Hint);
2257117f1b4Smrg   SET_IndexMask(exec, _mesa_IndexMask);
2267117f1b4Smrg   SET_IsEnabled(exec, _mesa_IsEnabled);
2277117f1b4Smrg   SET_IsList(exec, _mesa_IsList);
2287117f1b4Smrg   SET_LightModelf(exec, _mesa_LightModelf);
2297117f1b4Smrg   SET_LightModelfv(exec, _mesa_LightModelfv);
2307117f1b4Smrg   SET_LightModeli(exec, _mesa_LightModeli);
2317117f1b4Smrg   SET_LightModeliv(exec, _mesa_LightModeliv);
2327117f1b4Smrg   SET_Lightf(exec, _mesa_Lightf);
2337117f1b4Smrg   SET_Lightfv(exec, _mesa_Lightfv);
2347117f1b4Smrg   SET_Lighti(exec, _mesa_Lighti);
2357117f1b4Smrg   SET_Lightiv(exec, _mesa_Lightiv);
2367117f1b4Smrg   SET_ListBase(exec, _mesa_ListBase);
2377117f1b4Smrg   SET_LoadMatrixd(exec, _mesa_LoadMatrixd);
2387117f1b4Smrg   SET_Map1d(exec, _mesa_Map1d);
2397117f1b4Smrg   SET_Map1f(exec, _mesa_Map1f);
2407117f1b4Smrg   SET_Map2d(exec, _mesa_Map2d);
2417117f1b4Smrg   SET_Map2f(exec, _mesa_Map2f);
2427117f1b4Smrg   SET_MapGrid1d(exec, _mesa_MapGrid1d);
2437117f1b4Smrg   SET_MapGrid1f(exec, _mesa_MapGrid1f);
2447117f1b4Smrg   SET_MapGrid2d(exec, _mesa_MapGrid2d);
2457117f1b4Smrg   SET_MapGrid2f(exec, _mesa_MapGrid2f);
2467117f1b4Smrg   SET_MultMatrixd(exec, _mesa_MultMatrixd);
2477117f1b4Smrg   SET_NewList(exec, _mesa_NewList);
2487117f1b4Smrg   SET_PassThrough(exec, _mesa_PassThrough);
2497117f1b4Smrg   SET_PixelMapfv(exec, _mesa_PixelMapfv);
2507117f1b4Smrg   SET_PixelMapuiv(exec, _mesa_PixelMapuiv);
2517117f1b4Smrg   SET_PixelMapusv(exec, _mesa_PixelMapusv);
2527117f1b4Smrg   SET_PixelStoref(exec, _mesa_PixelStoref);
2537117f1b4Smrg   SET_PixelTransferf(exec, _mesa_PixelTransferf);
2547117f1b4Smrg   SET_PixelTransferi(exec, _mesa_PixelTransferi);
2557117f1b4Smrg   SET_PixelZoom(exec, _mesa_PixelZoom);
2567117f1b4Smrg   SET_PointSize(exec, _mesa_PointSize);
2577117f1b4Smrg   SET_PolygonMode(exec, _mesa_PolygonMode);
2587117f1b4Smrg   SET_PolygonOffset(exec, _mesa_PolygonOffset);
2597117f1b4Smrg   SET_PolygonStipple(exec, _mesa_PolygonStipple);
2607117f1b4Smrg   SET_PopAttrib(exec, _mesa_PopAttrib);
2617117f1b4Smrg   SET_PushAttrib(exec, _mesa_PushAttrib);
2627117f1b4Smrg   SET_RasterPos2d(exec, _mesa_RasterPos2d);
2637117f1b4Smrg   SET_RasterPos2dv(exec, _mesa_RasterPos2dv);
2647117f1b4Smrg   SET_RasterPos2s(exec, _mesa_RasterPos2s);
2657117f1b4Smrg   SET_RasterPos2sv(exec, _mesa_RasterPos2sv);
2667117f1b4Smrg   SET_RasterPos3d(exec, _mesa_RasterPos3d);
2677117f1b4Smrg   SET_RasterPos3dv(exec, _mesa_RasterPos3dv);
2687117f1b4Smrg   SET_RasterPos3f(exec, _mesa_RasterPos3f);
2697117f1b4Smrg   SET_RasterPos3fv(exec, _mesa_RasterPos3fv);
2707117f1b4Smrg   SET_RasterPos3i(exec, _mesa_RasterPos3i);
2717117f1b4Smrg   SET_RasterPos3iv(exec, _mesa_RasterPos3iv);
2727117f1b4Smrg   SET_RasterPos3s(exec, _mesa_RasterPos3s);
2737117f1b4Smrg   SET_RasterPos3sv(exec, _mesa_RasterPos3sv);
2747117f1b4Smrg   SET_RasterPos4d(exec, _mesa_RasterPos4d);
2757117f1b4Smrg   SET_RasterPos4dv(exec, _mesa_RasterPos4dv);
2767117f1b4Smrg   SET_RasterPos4f(exec, _mesa_RasterPos4f);
2777117f1b4Smrg   SET_RasterPos4fv(exec, _mesa_RasterPos4fv);
2787117f1b4Smrg   SET_RasterPos4i(exec, _mesa_RasterPos4i);
2797117f1b4Smrg   SET_RasterPos4iv(exec, _mesa_RasterPos4iv);
2807117f1b4Smrg   SET_RasterPos4s(exec, _mesa_RasterPos4s);
2817117f1b4Smrg   SET_RasterPos4sv(exec, _mesa_RasterPos4sv);
2827117f1b4Smrg   SET_ReadPixels(exec, _mesa_ReadPixels);
2837117f1b4Smrg   SET_Rotated(exec, _mesa_Rotated);
2847117f1b4Smrg   SET_Scaled(exec, _mesa_Scaled);
2857117f1b4Smrg   SET_SecondaryColorPointerEXT(exec, _mesa_SecondaryColorPointerEXT);
2867117f1b4Smrg   SET_TexEnvf(exec, _mesa_TexEnvf);
2877117f1b4Smrg   SET_TexEnviv(exec, _mesa_TexEnviv);
2887117f1b4Smrg   SET_TexGend(exec, _mesa_TexGend);
2897117f1b4Smrg   SET_TexGendv(exec, _mesa_TexGendv);
2907117f1b4Smrg   SET_TexGenf(exec, _mesa_TexGenf);
2917117f1b4Smrg   SET_TexGenfv(exec, _mesa_TexGenfv);
2927117f1b4Smrg   SET_TexGeni(exec, _mesa_TexGeni);
2937117f1b4Smrg   SET_TexGeniv(exec, _mesa_TexGeniv);
2947117f1b4Smrg   SET_TexImage1D(exec, _mesa_TexImage1D);
2957117f1b4Smrg   SET_TexParameterf(exec, _mesa_TexParameterf);
2967117f1b4Smrg   SET_TexParameterfv(exec, _mesa_TexParameterfv);
2977117f1b4Smrg   SET_TexParameteriv(exec, _mesa_TexParameteriv);
2987117f1b4Smrg   SET_Translated(exec, _mesa_Translated);
2997117f1b4Smrg#endif
3007117f1b4Smrg
3017117f1b4Smrg   /* 1.1 */
3027117f1b4Smrg   SET_BindTexture(exec, _mesa_BindTexture);
3037117f1b4Smrg   SET_DeleteTextures(exec, _mesa_DeleteTextures);
3047117f1b4Smrg   SET_GenTextures(exec, _mesa_GenTextures);
3057117f1b4Smrg#if _HAVE_FULL_GL
3067117f1b4Smrg   SET_AreTexturesResident(exec, _mesa_AreTexturesResident);
3077117f1b4Smrg   SET_ColorPointer(exec, _mesa_ColorPointer);
3087117f1b4Smrg   SET_CopyTexImage1D(exec, _mesa_CopyTexImage1D);
3097117f1b4Smrg   SET_CopyTexImage2D(exec, _mesa_CopyTexImage2D);
3107117f1b4Smrg   SET_CopyTexSubImage1D(exec, _mesa_CopyTexSubImage1D);
3117117f1b4Smrg   SET_CopyTexSubImage2D(exec, _mesa_CopyTexSubImage2D);
3127117f1b4Smrg   SET_DisableClientState(exec, _mesa_DisableClientState);
3137117f1b4Smrg   SET_EdgeFlagPointer(exec, _mesa_EdgeFlagPointer);
3147117f1b4Smrg   SET_EnableClientState(exec, _mesa_EnableClientState);
3157117f1b4Smrg   SET_GetPointerv(exec, _mesa_GetPointerv);
3167117f1b4Smrg   SET_IndexPointer(exec, _mesa_IndexPointer);
3177117f1b4Smrg   SET_InterleavedArrays(exec, _mesa_InterleavedArrays);
3187117f1b4Smrg   SET_IsTexture(exec, _mesa_IsTexture);
3197117f1b4Smrg   SET_NormalPointer(exec, _mesa_NormalPointer);
3207117f1b4Smrg   SET_PopClientAttrib(exec, _mesa_PopClientAttrib);
3217117f1b4Smrg   SET_PrioritizeTextures(exec, _mesa_PrioritizeTextures);
3227117f1b4Smrg   SET_PushClientAttrib(exec, _mesa_PushClientAttrib);
3237117f1b4Smrg   SET_TexCoordPointer(exec, _mesa_TexCoordPointer);
3247117f1b4Smrg   SET_TexSubImage1D(exec, _mesa_TexSubImage1D);
3257117f1b4Smrg   SET_TexSubImage2D(exec, _mesa_TexSubImage2D);
3267117f1b4Smrg   SET_VertexPointer(exec, _mesa_VertexPointer);
3277117f1b4Smrg#endif
3287117f1b4Smrg
3297117f1b4Smrg   /* 1.2 */
3307117f1b4Smrg#if _HAVE_FULL_GL
3317117f1b4Smrg   SET_CopyTexSubImage3D(exec, _mesa_CopyTexSubImage3D);
3327117f1b4Smrg   SET_TexImage3D(exec, _mesa_TexImage3D);
3337117f1b4Smrg   SET_TexSubImage3D(exec, _mesa_TexSubImage3D);
3347117f1b4Smrg#endif
3357117f1b4Smrg
3367117f1b4Smrg   /* OpenGL 1.2  GL_ARB_imaging */
3377117f1b4Smrg#if _HAVE_FULL_GL
3387117f1b4Smrg   SET_BlendColor(exec, _mesa_BlendColor);
3397117f1b4Smrg   SET_BlendEquation(exec, _mesa_BlendEquation);
3407117f1b4Smrg   SET_BlendEquationSeparateEXT(exec, _mesa_BlendEquationSeparateEXT);
3417117f1b4Smrg   SET_ColorSubTable(exec, _mesa_ColorSubTable);
3427117f1b4Smrg   SET_ColorTable(exec, _mesa_ColorTable);
3437117f1b4Smrg   SET_ColorTableParameterfv(exec, _mesa_ColorTableParameterfv);
3447117f1b4Smrg   SET_ColorTableParameteriv(exec, _mesa_ColorTableParameteriv);
3457117f1b4Smrg   SET_ConvolutionFilter1D(exec, _mesa_ConvolutionFilter1D);
3467117f1b4Smrg   SET_ConvolutionFilter2D(exec, _mesa_ConvolutionFilter2D);
3477117f1b4Smrg   SET_ConvolutionParameterf(exec, _mesa_ConvolutionParameterf);
3487117f1b4Smrg   SET_ConvolutionParameterfv(exec, _mesa_ConvolutionParameterfv);
3497117f1b4Smrg   SET_ConvolutionParameteri(exec, _mesa_ConvolutionParameteri);
3507117f1b4Smrg   SET_ConvolutionParameteriv(exec, _mesa_ConvolutionParameteriv);
3517117f1b4Smrg   SET_CopyColorSubTable(exec, _mesa_CopyColorSubTable);
3527117f1b4Smrg   SET_CopyColorTable(exec, _mesa_CopyColorTable);
3537117f1b4Smrg   SET_CopyConvolutionFilter1D(exec, _mesa_CopyConvolutionFilter1D);
3547117f1b4Smrg   SET_CopyConvolutionFilter2D(exec, _mesa_CopyConvolutionFilter2D);
3557117f1b4Smrg   SET_GetColorTable(exec, _mesa_GetColorTable);
3567117f1b4Smrg   SET_GetColorTableParameterfv(exec, _mesa_GetColorTableParameterfv);
3577117f1b4Smrg   SET_GetColorTableParameteriv(exec, _mesa_GetColorTableParameteriv);
3587117f1b4Smrg   SET_GetConvolutionFilter(exec, _mesa_GetConvolutionFilter);
3597117f1b4Smrg   SET_GetConvolutionParameterfv(exec, _mesa_GetConvolutionParameterfv);
3607117f1b4Smrg   SET_GetConvolutionParameteriv(exec, _mesa_GetConvolutionParameteriv);
3617117f1b4Smrg   SET_GetHistogram(exec, _mesa_GetHistogram);
3627117f1b4Smrg   SET_GetHistogramParameterfv(exec, _mesa_GetHistogramParameterfv);
3637117f1b4Smrg   SET_GetHistogramParameteriv(exec, _mesa_GetHistogramParameteriv);
3647117f1b4Smrg   SET_GetMinmax(exec, _mesa_GetMinmax);
3657117f1b4Smrg   SET_GetMinmaxParameterfv(exec, _mesa_GetMinmaxParameterfv);
3667117f1b4Smrg   SET_GetMinmaxParameteriv(exec, _mesa_GetMinmaxParameteriv);
3677117f1b4Smrg   SET_GetSeparableFilter(exec, _mesa_GetSeparableFilter);
3687117f1b4Smrg   SET_Histogram(exec, _mesa_Histogram);
3697117f1b4Smrg   SET_Minmax(exec, _mesa_Minmax);
3707117f1b4Smrg   SET_ResetHistogram(exec, _mesa_ResetHistogram);
3717117f1b4Smrg   SET_ResetMinmax(exec, _mesa_ResetMinmax);
3727117f1b4Smrg   SET_SeparableFilter2D(exec, _mesa_SeparableFilter2D);
3737117f1b4Smrg#endif
3747117f1b4Smrg
3757117f1b4Smrg   /* OpenGL 2.0 */
3767117f1b4Smrg   SET_StencilFuncSeparate(exec, _mesa_StencilFuncSeparate);
3777117f1b4Smrg   SET_StencilMaskSeparate(exec, _mesa_StencilMaskSeparate);
3787117f1b4Smrg   SET_StencilOpSeparate(exec, _mesa_StencilOpSeparate);
3797117f1b4Smrg#if FEATURE_ARB_shader_objects
3807117f1b4Smrg   SET_AttachShader(exec, _mesa_AttachShader);
3817117f1b4Smrg   SET_CreateProgram(exec, _mesa_CreateProgram);
3827117f1b4Smrg   SET_CreateShader(exec, _mesa_CreateShader);
3837117f1b4Smrg   SET_DeleteProgram(exec, _mesa_DeleteProgram);
3847117f1b4Smrg   SET_DeleteShader(exec, _mesa_DeleteShader);
3857117f1b4Smrg   SET_DetachShader(exec, _mesa_DetachShader);
3867117f1b4Smrg   SET_GetAttachedShaders(exec, _mesa_GetAttachedShaders);
3877117f1b4Smrg   SET_GetProgramiv(exec, _mesa_GetProgramiv);
3887117f1b4Smrg   SET_GetProgramInfoLog(exec, _mesa_GetProgramInfoLog);
3897117f1b4Smrg   SET_GetShaderiv(exec, _mesa_GetShaderiv);
3907117f1b4Smrg   SET_GetShaderInfoLog(exec, _mesa_GetShaderInfoLog);
3917117f1b4Smrg   SET_IsProgram(exec, _mesa_IsProgram);
3927117f1b4Smrg   SET_IsShader(exec, _mesa_IsShader);
3937117f1b4Smrg#endif
3947117f1b4Smrg
3957117f1b4Smrg   /* OpenGL 2.1 */
3967117f1b4Smrg#if FEATURE_ARB_shader_objects
3977117f1b4Smrg   SET_UniformMatrix2x3fv(exec, _mesa_UniformMatrix2x3fv);
3987117f1b4Smrg   SET_UniformMatrix3x2fv(exec, _mesa_UniformMatrix3x2fv);
3997117f1b4Smrg   SET_UniformMatrix2x4fv(exec, _mesa_UniformMatrix2x4fv);
4007117f1b4Smrg   SET_UniformMatrix4x2fv(exec, _mesa_UniformMatrix4x2fv);
4017117f1b4Smrg   SET_UniformMatrix3x4fv(exec, _mesa_UniformMatrix3x4fv);
4027117f1b4Smrg   SET_UniformMatrix4x3fv(exec, _mesa_UniformMatrix4x3fv);
4037117f1b4Smrg#endif
4047117f1b4Smrg
4057117f1b4Smrg
4067117f1b4Smrg   /* 2. GL_EXT_blend_color */
4077117f1b4Smrg#if 0
4087117f1b4Smrg/*    SET_BlendColorEXT(exec, _mesa_BlendColorEXT); */
4097117f1b4Smrg#endif
4107117f1b4Smrg
4117117f1b4Smrg   /* 3. GL_EXT_polygon_offset */
4127117f1b4Smrg#if _HAVE_FULL_GL
4137117f1b4Smrg   SET_PolygonOffsetEXT(exec, _mesa_PolygonOffsetEXT);
4147117f1b4Smrg#endif
4157117f1b4Smrg
4167117f1b4Smrg   /* 6. GL_EXT_texture3d */
4177117f1b4Smrg#if 0
4187117f1b4Smrg/*    SET_CopyTexSubImage3DEXT(exec, _mesa_CopyTexSubImage3D); */
4197117f1b4Smrg/*    SET_TexImage3DEXT(exec, _mesa_TexImage3DEXT); */
4207117f1b4Smrg/*    SET_TexSubImage3DEXT(exec, _mesa_TexSubImage3D); */
4217117f1b4Smrg#endif
4227117f1b4Smrg
4237117f1b4Smrg   /* 11. GL_EXT_histogram */
4247117f1b4Smrg#if 0
4257117f1b4Smrg   SET_GetHistogramEXT(exec, _mesa_GetHistogram);
4267117f1b4Smrg   SET_GetHistogramParameterfvEXT(exec, _mesa_GetHistogramParameterfv);
4277117f1b4Smrg   SET_GetHistogramParameterivEXT(exec, _mesa_GetHistogramParameteriv);
4287117f1b4Smrg   SET_GetMinmaxEXT(exec, _mesa_GetMinmax);
4297117f1b4Smrg   SET_GetMinmaxParameterfvEXT(exec, _mesa_GetMinmaxParameterfv);
4307117f1b4Smrg   SET_GetMinmaxParameterivEXT(exec, _mesa_GetMinmaxParameteriv);
4317117f1b4Smrg#endif
4327117f1b4Smrg
4337117f1b4Smrg   /* 14. SGI_color_table */
4347117f1b4Smrg#if 0
4357117f1b4Smrg   SET_ColorTableSGI(exec, _mesa_ColorTable);
4367117f1b4Smrg   SET_ColorSubTableSGI(exec, _mesa_ColorSubTable);
4377117f1b4Smrg   SET_GetColorTableSGI(exec, _mesa_GetColorTable);
4387117f1b4Smrg   SET_GetColorTableParameterfvSGI(exec, _mesa_GetColorTableParameterfv);
4397117f1b4Smrg   SET_GetColorTableParameterivSGI(exec, _mesa_GetColorTableParameteriv);
4407117f1b4Smrg#endif
4417117f1b4Smrg
4427117f1b4Smrg   /* 30. GL_EXT_vertex_array */
4437117f1b4Smrg#if _HAVE_FULL_GL
4447117f1b4Smrg   SET_ColorPointerEXT(exec, _mesa_ColorPointerEXT);
4457117f1b4Smrg   SET_EdgeFlagPointerEXT(exec, _mesa_EdgeFlagPointerEXT);
4467117f1b4Smrg   SET_IndexPointerEXT(exec, _mesa_IndexPointerEXT);
4477117f1b4Smrg   SET_NormalPointerEXT(exec, _mesa_NormalPointerEXT);
4487117f1b4Smrg   SET_TexCoordPointerEXT(exec, _mesa_TexCoordPointerEXT);
4497117f1b4Smrg   SET_VertexPointerEXT(exec, _mesa_VertexPointerEXT);
4507117f1b4Smrg#endif
4517117f1b4Smrg
4527117f1b4Smrg   /* 37. GL_EXT_blend_minmax */
4537117f1b4Smrg#if 0
4547117f1b4Smrg   SET_BlendEquationEXT(exec, _mesa_BlendEquationEXT);
4557117f1b4Smrg#endif
4567117f1b4Smrg
4577117f1b4Smrg   /* 54. GL_EXT_point_parameters */
4587117f1b4Smrg#if _HAVE_FULL_GL
4597117f1b4Smrg   SET_PointParameterfEXT(exec, _mesa_PointParameterfEXT);
4607117f1b4Smrg   SET_PointParameterfvEXT(exec, _mesa_PointParameterfvEXT);
4617117f1b4Smrg#endif
4627117f1b4Smrg
4637117f1b4Smrg   /* 97. GL_EXT_compiled_vertex_array */
4647117f1b4Smrg#if _HAVE_FULL_GL
4657117f1b4Smrg   SET_LockArraysEXT(exec, _mesa_LockArraysEXT);
4667117f1b4Smrg   SET_UnlockArraysEXT(exec, _mesa_UnlockArraysEXT);
4677117f1b4Smrg#endif
4687117f1b4Smrg
4697117f1b4Smrg   /* 148. GL_EXT_multi_draw_arrays */
4707117f1b4Smrg#if _HAVE_FULL_GL
4717117f1b4Smrg   SET_MultiDrawArraysEXT(exec, _mesa_MultiDrawArraysEXT);
4727117f1b4Smrg   SET_MultiDrawElementsEXT(exec, _mesa_MultiDrawElementsEXT);
4737117f1b4Smrg#endif
4747117f1b4Smrg
4757117f1b4Smrg   /* 173. GL_INGR_blend_func_separate */
4767117f1b4Smrg#if _HAVE_FULL_GL
4777117f1b4Smrg   SET_BlendFuncSeparateEXT(exec, _mesa_BlendFuncSeparateEXT);
4787117f1b4Smrg#endif
4797117f1b4Smrg
4807117f1b4Smrg   /* 196. GL_MESA_resize_buffers */
4817117f1b4Smrg#if _HAVE_FULL_GL
4827117f1b4Smrg   SET_ResizeBuffersMESA(exec, _mesa_ResizeBuffersMESA);
4837117f1b4Smrg#endif
4847117f1b4Smrg
4857117f1b4Smrg   /* 197. GL_MESA_window_pos */
4867117f1b4Smrg#if _HAVE_FULL_GL
4877117f1b4Smrg   SET_WindowPos2dMESA(exec, _mesa_WindowPos2dMESA);
4887117f1b4Smrg   SET_WindowPos2dvMESA(exec, _mesa_WindowPos2dvMESA);
4897117f1b4Smrg   SET_WindowPos2fMESA(exec, _mesa_WindowPos2fMESA);
4907117f1b4Smrg   SET_WindowPos2fvMESA(exec, _mesa_WindowPos2fvMESA);
4917117f1b4Smrg   SET_WindowPos2iMESA(exec, _mesa_WindowPos2iMESA);
4927117f1b4Smrg   SET_WindowPos2ivMESA(exec, _mesa_WindowPos2ivMESA);
4937117f1b4Smrg   SET_WindowPos2sMESA(exec, _mesa_WindowPos2sMESA);
4947117f1b4Smrg   SET_WindowPos2svMESA(exec, _mesa_WindowPos2svMESA);
4957117f1b4Smrg   SET_WindowPos3dMESA(exec, _mesa_WindowPos3dMESA);
4967117f1b4Smrg   SET_WindowPos3dvMESA(exec, _mesa_WindowPos3dvMESA);
4977117f1b4Smrg   SET_WindowPos3fMESA(exec, _mesa_WindowPos3fMESA);
4987117f1b4Smrg   SET_WindowPos3fvMESA(exec, _mesa_WindowPos3fvMESA);
4997117f1b4Smrg   SET_WindowPos3iMESA(exec, _mesa_WindowPos3iMESA);
5007117f1b4Smrg   SET_WindowPos3ivMESA(exec, _mesa_WindowPos3ivMESA);
5017117f1b4Smrg   SET_WindowPos3sMESA(exec, _mesa_WindowPos3sMESA);
5027117f1b4Smrg   SET_WindowPos3svMESA(exec, _mesa_WindowPos3svMESA);
5037117f1b4Smrg   SET_WindowPos4dMESA(exec, _mesa_WindowPos4dMESA);
5047117f1b4Smrg   SET_WindowPos4dvMESA(exec, _mesa_WindowPos4dvMESA);
5057117f1b4Smrg   SET_WindowPos4fMESA(exec, _mesa_WindowPos4fMESA);
5067117f1b4Smrg   SET_WindowPos4fvMESA(exec, _mesa_WindowPos4fvMESA);
5077117f1b4Smrg   SET_WindowPos4iMESA(exec, _mesa_WindowPos4iMESA);
5087117f1b4Smrg   SET_WindowPos4ivMESA(exec, _mesa_WindowPos4ivMESA);
5097117f1b4Smrg   SET_WindowPos4sMESA(exec, _mesa_WindowPos4sMESA);
5107117f1b4Smrg   SET_WindowPos4svMESA(exec, _mesa_WindowPos4svMESA);
5117117f1b4Smrg#endif
5127117f1b4Smrg
5137117f1b4Smrg   /* 200. GL_IBM_multimode_draw_arrays */
5147117f1b4Smrg#if _HAVE_FULL_GL
5157117f1b4Smrg   SET_MultiModeDrawArraysIBM(exec, _mesa_MultiModeDrawArraysIBM);
5167117f1b4Smrg   SET_MultiModeDrawElementsIBM(exec, _mesa_MultiModeDrawElementsIBM);
5177117f1b4Smrg#endif
5187117f1b4Smrg
5197117f1b4Smrg   /* 233. GL_NV_vertex_program */
5207117f1b4Smrg#if FEATURE_NV_vertex_program
5217117f1b4Smrg   SET_BindProgramNV(exec, _mesa_BindProgram);
5227117f1b4Smrg   SET_DeleteProgramsNV(exec, _mesa_DeletePrograms);
5237117f1b4Smrg   SET_ExecuteProgramNV(exec, _mesa_ExecuteProgramNV);
5247117f1b4Smrg   SET_GenProgramsNV(exec, _mesa_GenPrograms);
5257117f1b4Smrg   SET_AreProgramsResidentNV(exec, _mesa_AreProgramsResidentNV);
5267117f1b4Smrg   SET_RequestResidentProgramsNV(exec, _mesa_RequestResidentProgramsNV);
5277117f1b4Smrg   SET_GetProgramParameterfvNV(exec, _mesa_GetProgramParameterfvNV);
5287117f1b4Smrg   SET_GetProgramParameterdvNV(exec, _mesa_GetProgramParameterdvNV);
5297117f1b4Smrg   SET_GetProgramivNV(exec, _mesa_GetProgramivNV);
5307117f1b4Smrg   SET_GetProgramStringNV(exec, _mesa_GetProgramStringNV);
5317117f1b4Smrg   SET_GetTrackMatrixivNV(exec, _mesa_GetTrackMatrixivNV);
5327117f1b4Smrg   SET_GetVertexAttribdvNV(exec, _mesa_GetVertexAttribdvNV);
5337117f1b4Smrg   SET_GetVertexAttribfvNV(exec, _mesa_GetVertexAttribfvNV);
5347117f1b4Smrg   SET_GetVertexAttribivNV(exec, _mesa_GetVertexAttribivNV);
5357117f1b4Smrg   SET_GetVertexAttribPointervNV(exec, _mesa_GetVertexAttribPointervNV);
5367117f1b4Smrg   SET_IsProgramNV(exec, _mesa_IsProgramARB);
5377117f1b4Smrg   SET_LoadProgramNV(exec, _mesa_LoadProgramNV);
5387117f1b4Smrg   SET_ProgramParameter4dNV(exec, _mesa_ProgramParameter4dNV);
5397117f1b4Smrg   SET_ProgramParameter4dvNV(exec, _mesa_ProgramParameter4dvNV);
5407117f1b4Smrg   SET_ProgramParameter4fNV(exec, _mesa_ProgramParameter4fNV);
5417117f1b4Smrg   SET_ProgramParameter4fvNV(exec, _mesa_ProgramParameter4fvNV);
5427117f1b4Smrg   SET_ProgramParameters4dvNV(exec, _mesa_ProgramParameters4dvNV);
5437117f1b4Smrg   SET_ProgramParameters4fvNV(exec, _mesa_ProgramParameters4fvNV);
5447117f1b4Smrg   SET_TrackMatrixNV(exec, _mesa_TrackMatrixNV);
5457117f1b4Smrg   SET_VertexAttribPointerNV(exec, _mesa_VertexAttribPointerNV);
5467117f1b4Smrg   /* glVertexAttrib*NV functions handled in api_loopback.c */
5477117f1b4Smrg#endif
5487117f1b4Smrg
5497117f1b4Smrg   /* 273. GL_APPLE_vertex_array_object */
5507117f1b4Smrg   SET_BindVertexArrayAPPLE(exec, _mesa_BindVertexArrayAPPLE);
5517117f1b4Smrg   SET_DeleteVertexArraysAPPLE(exec, _mesa_DeleteVertexArraysAPPLE);
5527117f1b4Smrg   SET_GenVertexArraysAPPLE(exec, _mesa_GenVertexArraysAPPLE);
5537117f1b4Smrg   SET_IsVertexArrayAPPLE(exec, _mesa_IsVertexArrayAPPLE);
5547117f1b4Smrg
5557117f1b4Smrg   /* 282. GL_NV_fragment_program */
5567117f1b4Smrg#if FEATURE_NV_fragment_program
5577117f1b4Smrg   SET_ProgramNamedParameter4fNV(exec, _mesa_ProgramNamedParameter4fNV);
5587117f1b4Smrg   SET_ProgramNamedParameter4dNV(exec, _mesa_ProgramNamedParameter4dNV);
5597117f1b4Smrg   SET_ProgramNamedParameter4fvNV(exec, _mesa_ProgramNamedParameter4fvNV);
5607117f1b4Smrg   SET_ProgramNamedParameter4dvNV(exec, _mesa_ProgramNamedParameter4dvNV);
5617117f1b4Smrg   SET_GetProgramNamedParameterfvNV(exec, _mesa_GetProgramNamedParameterfvNV);
5627117f1b4Smrg   SET_GetProgramNamedParameterdvNV(exec, _mesa_GetProgramNamedParameterdvNV);
5637117f1b4Smrg   SET_ProgramLocalParameter4dARB(exec, _mesa_ProgramLocalParameter4dARB);
5647117f1b4Smrg   SET_ProgramLocalParameter4dvARB(exec, _mesa_ProgramLocalParameter4dvARB);
5657117f1b4Smrg   SET_ProgramLocalParameter4fARB(exec, _mesa_ProgramLocalParameter4fARB);
5667117f1b4Smrg   SET_ProgramLocalParameter4fvARB(exec, _mesa_ProgramLocalParameter4fvARB);
5677117f1b4Smrg   SET_GetProgramLocalParameterdvARB(exec, _mesa_GetProgramLocalParameterdvARB);
5687117f1b4Smrg   SET_GetProgramLocalParameterfvARB(exec, _mesa_GetProgramLocalParameterfvARB);
5697117f1b4Smrg#endif
5707117f1b4Smrg
5717117f1b4Smrg   /* 262. GL_NV_point_sprite */
5727117f1b4Smrg#if _HAVE_FULL_GL
5737117f1b4Smrg   SET_PointParameteriNV(exec, _mesa_PointParameteriNV);
5747117f1b4Smrg   SET_PointParameterivNV(exec, _mesa_PointParameterivNV);
5757117f1b4Smrg#endif
5767117f1b4Smrg
5777117f1b4Smrg   /* 268. GL_EXT_stencil_two_side */
5787117f1b4Smrg#if _HAVE_FULL_GL
5797117f1b4Smrg   SET_ActiveStencilFaceEXT(exec, _mesa_ActiveStencilFaceEXT);
5807117f1b4Smrg#endif
5817117f1b4Smrg
5827117f1b4Smrg   /* ???. GL_EXT_depth_bounds_test */
5837117f1b4Smrg   SET_DepthBoundsEXT(exec, _mesa_DepthBoundsEXT);
5847117f1b4Smrg
5857117f1b4Smrg   /* ARB 1. GL_ARB_multitexture */
5867117f1b4Smrg#if _HAVE_FULL_GL
5877117f1b4Smrg   SET_ActiveTextureARB(exec, _mesa_ActiveTextureARB);
5887117f1b4Smrg   SET_ClientActiveTextureARB(exec, _mesa_ClientActiveTextureARB);
5897117f1b4Smrg#endif
5907117f1b4Smrg
5917117f1b4Smrg   /* ARB 3. GL_ARB_transpose_matrix */
5927117f1b4Smrg#if _HAVE_FULL_GL
5937117f1b4Smrg   SET_LoadTransposeMatrixdARB(exec, _mesa_LoadTransposeMatrixdARB);
5947117f1b4Smrg   SET_LoadTransposeMatrixfARB(exec, _mesa_LoadTransposeMatrixfARB);
5957117f1b4Smrg   SET_MultTransposeMatrixdARB(exec, _mesa_MultTransposeMatrixdARB);
5967117f1b4Smrg   SET_MultTransposeMatrixfARB(exec, _mesa_MultTransposeMatrixfARB);
5977117f1b4Smrg#endif
5987117f1b4Smrg
5997117f1b4Smrg   /* ARB 5. GL_ARB_multisample */
6007117f1b4Smrg#if _HAVE_FULL_GL
6017117f1b4Smrg   SET_SampleCoverageARB(exec, _mesa_SampleCoverageARB);
6027117f1b4Smrg#endif
6037117f1b4Smrg
6047117f1b4Smrg   /* ARB 12. GL_ARB_texture_compression */
6057117f1b4Smrg#if _HAVE_FULL_GL
6067117f1b4Smrg   SET_CompressedTexImage3DARB(exec, _mesa_CompressedTexImage3DARB);
6077117f1b4Smrg   SET_CompressedTexImage2DARB(exec, _mesa_CompressedTexImage2DARB);
6087117f1b4Smrg   SET_CompressedTexImage1DARB(exec, _mesa_CompressedTexImage1DARB);
6097117f1b4Smrg   SET_CompressedTexSubImage3DARB(exec, _mesa_CompressedTexSubImage3DARB);
6107117f1b4Smrg   SET_CompressedTexSubImage2DARB(exec, _mesa_CompressedTexSubImage2DARB);
6117117f1b4Smrg   SET_CompressedTexSubImage1DARB(exec, _mesa_CompressedTexSubImage1DARB);
6127117f1b4Smrg   SET_GetCompressedTexImageARB(exec, _mesa_GetCompressedTexImageARB);
6137117f1b4Smrg#endif
6147117f1b4Smrg
6157117f1b4Smrg   /* ARB 14. GL_ARB_point_parameters */
6167117f1b4Smrg   /* reuse EXT_point_parameters functions */
6177117f1b4Smrg
6187117f1b4Smrg   /* ARB 26. GL_ARB_vertex_program */
6197117f1b4Smrg   /* ARB 27. GL_ARB_fragment_program */
6207117f1b4Smrg#if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
6217117f1b4Smrg   /* glVertexAttrib1sARB aliases glVertexAttrib1sNV */
6227117f1b4Smrg   /* glVertexAttrib1fARB aliases glVertexAttrib1fNV */
6237117f1b4Smrg   /* glVertexAttrib1dARB aliases glVertexAttrib1dNV */
6247117f1b4Smrg   /* glVertexAttrib2sARB aliases glVertexAttrib2sNV */
6257117f1b4Smrg   /* glVertexAttrib2fARB aliases glVertexAttrib2fNV */
6267117f1b4Smrg   /* glVertexAttrib2dARB aliases glVertexAttrib2dNV */
6277117f1b4Smrg   /* glVertexAttrib3sARB aliases glVertexAttrib3sNV */
6287117f1b4Smrg   /* glVertexAttrib3fARB aliases glVertexAttrib3fNV */
6297117f1b4Smrg   /* glVertexAttrib3dARB aliases glVertexAttrib3dNV */
6307117f1b4Smrg   /* glVertexAttrib4sARB aliases glVertexAttrib4sNV */
6317117f1b4Smrg   /* glVertexAttrib4fARB aliases glVertexAttrib4fNV */
6327117f1b4Smrg   /* glVertexAttrib4dARB aliases glVertexAttrib4dNV */
6337117f1b4Smrg   /* glVertexAttrib4NubARB aliases glVertexAttrib4NubNV */
6347117f1b4Smrg   /* glVertexAttrib1svARB aliases glVertexAttrib1svNV */
6357117f1b4Smrg   /* glVertexAttrib1fvARB aliases glVertexAttrib1fvNV */
6367117f1b4Smrg   /* glVertexAttrib1dvARB aliases glVertexAttrib1dvNV */
6377117f1b4Smrg   /* glVertexAttrib2svARB aliases glVertexAttrib2svNV */
6387117f1b4Smrg   /* glVertexAttrib2fvARB aliases glVertexAttrib2fvNV */
6397117f1b4Smrg   /* glVertexAttrib2dvARB aliases glVertexAttrib2dvNV */
6407117f1b4Smrg   /* glVertexAttrib3svARB aliases glVertexAttrib3svNV */
6417117f1b4Smrg   /* glVertexAttrib3fvARB aliases glVertexAttrib3fvNV */
6427117f1b4Smrg   /* glVertexAttrib3dvARB aliases glVertexAttrib3dvNV */
6437117f1b4Smrg   /* glVertexAttrib4svARB aliases glVertexAttrib4svNV */
6447117f1b4Smrg   /* glVertexAttrib4fvARB aliases glVertexAttrib4fvNV */
6457117f1b4Smrg   /* glVertexAttrib4dvARB aliases glVertexAttrib4dvNV */
6467117f1b4Smrg   /* glVertexAttrib4NubvARB aliases glVertexAttrib4NubvNV */
6477117f1b4Smrg   /* glVertexAttrib4bvARB handled in api_loopback.c */
6487117f1b4Smrg   /* glVertexAttrib4ivARB handled in api_loopback.c */
6497117f1b4Smrg   /* glVertexAttrib4ubvARB handled in api_loopback.c */
6507117f1b4Smrg   /* glVertexAttrib4usvARB handled in api_loopback.c */
6517117f1b4Smrg   /* glVertexAttrib4uivARB handled in api_loopback.c */
6527117f1b4Smrg   /* glVertexAttrib4NbvARB handled in api_loopback.c */
6537117f1b4Smrg   /* glVertexAttrib4NsvARB handled in api_loopback.c */
6547117f1b4Smrg   /* glVertexAttrib4NivARB handled in api_loopback.c */
6557117f1b4Smrg   /* glVertexAttrib4NusvARB handled in api_loopback.c */
6567117f1b4Smrg   /* glVertexAttrib4NuivARB handled in api_loopback.c */
6577117f1b4Smrg   SET_VertexAttribPointerARB(exec, _mesa_VertexAttribPointerARB);
6587117f1b4Smrg   SET_EnableVertexAttribArrayARB(exec, _mesa_EnableVertexAttribArrayARB);
6597117f1b4Smrg   SET_DisableVertexAttribArrayARB(exec, _mesa_DisableVertexAttribArrayARB);
6607117f1b4Smrg   SET_ProgramStringARB(exec, _mesa_ProgramStringARB);
6617117f1b4Smrg   /* glBindProgramARB aliases glBindProgramNV */
6627117f1b4Smrg   /* glDeleteProgramsARB aliases glDeleteProgramsNV */
6637117f1b4Smrg   /* glGenProgramsARB aliases glGenProgramsNV */
6647117f1b4Smrg   /* glIsProgramARB aliases glIsProgramNV */
6657117f1b4Smrg   SET_GetVertexAttribdvARB(exec, _mesa_GetVertexAttribdvARB);
6667117f1b4Smrg   SET_GetVertexAttribfvARB(exec, _mesa_GetVertexAttribfvARB);
6677117f1b4Smrg   SET_GetVertexAttribivARB(exec, _mesa_GetVertexAttribivARB);
6687117f1b4Smrg   /* glGetVertexAttribPointervARB aliases glGetVertexAttribPointervNV */
6697117f1b4Smrg   SET_ProgramEnvParameter4dARB(exec, _mesa_ProgramEnvParameter4dARB);
6707117f1b4Smrg   SET_ProgramEnvParameter4dvARB(exec, _mesa_ProgramEnvParameter4dvARB);
6717117f1b4Smrg   SET_ProgramEnvParameter4fARB(exec, _mesa_ProgramEnvParameter4fARB);
6727117f1b4Smrg   SET_ProgramEnvParameter4fvARB(exec, _mesa_ProgramEnvParameter4fvARB);
6737117f1b4Smrg   SET_ProgramLocalParameter4dARB(exec, _mesa_ProgramLocalParameter4dARB);
6747117f1b4Smrg   SET_ProgramLocalParameter4dvARB(exec, _mesa_ProgramLocalParameter4dvARB);
6757117f1b4Smrg   SET_ProgramLocalParameter4fARB(exec, _mesa_ProgramLocalParameter4fARB);
6767117f1b4Smrg   SET_ProgramLocalParameter4fvARB(exec, _mesa_ProgramLocalParameter4fvARB);
6777117f1b4Smrg   SET_GetProgramEnvParameterdvARB(exec, _mesa_GetProgramEnvParameterdvARB);
6787117f1b4Smrg   SET_GetProgramEnvParameterfvARB(exec, _mesa_GetProgramEnvParameterfvARB);
6797117f1b4Smrg   SET_GetProgramLocalParameterdvARB(exec, _mesa_GetProgramLocalParameterdvARB);
6807117f1b4Smrg   SET_GetProgramLocalParameterfvARB(exec, _mesa_GetProgramLocalParameterfvARB);
6817117f1b4Smrg   SET_GetProgramivARB(exec, _mesa_GetProgramivARB);
6827117f1b4Smrg   SET_GetProgramStringARB(exec, _mesa_GetProgramStringARB);
6837117f1b4Smrg#endif
6847117f1b4Smrg
6857117f1b4Smrg   /* ARB 28. GL_ARB_vertex_buffer_object */
6867117f1b4Smrg#if FEATURE_ARB_vertex_buffer_object
6877117f1b4Smrg   SET_BindBufferARB(exec, _mesa_BindBufferARB);
6887117f1b4Smrg   SET_BufferDataARB(exec, _mesa_BufferDataARB);
6897117f1b4Smrg   SET_BufferSubDataARB(exec, _mesa_BufferSubDataARB);
6907117f1b4Smrg   SET_DeleteBuffersARB(exec, _mesa_DeleteBuffersARB);
6917117f1b4Smrg   SET_GenBuffersARB(exec, _mesa_GenBuffersARB);
6927117f1b4Smrg   SET_GetBufferParameterivARB(exec, _mesa_GetBufferParameterivARB);
6937117f1b4Smrg   SET_GetBufferPointervARB(exec, _mesa_GetBufferPointervARB);
6947117f1b4Smrg   SET_GetBufferSubDataARB(exec, _mesa_GetBufferSubDataARB);
6957117f1b4Smrg   SET_IsBufferARB(exec, _mesa_IsBufferARB);
6967117f1b4Smrg   SET_MapBufferARB(exec, _mesa_MapBufferARB);
6977117f1b4Smrg   SET_UnmapBufferARB(exec, _mesa_UnmapBufferARB);
6987117f1b4Smrg#endif
6997117f1b4Smrg
7007117f1b4Smrg   /* ARB 29. GL_ARB_occlusion_query */
7017117f1b4Smrg#if FEATURE_ARB_occlusion_query
7027117f1b4Smrg   SET_GenQueriesARB(exec, _mesa_GenQueriesARB);
7037117f1b4Smrg   SET_DeleteQueriesARB(exec, _mesa_DeleteQueriesARB);
7047117f1b4Smrg   SET_IsQueryARB(exec, _mesa_IsQueryARB);
7057117f1b4Smrg   SET_BeginQueryARB(exec, _mesa_BeginQueryARB);
7067117f1b4Smrg   SET_EndQueryARB(exec, _mesa_EndQueryARB);
7077117f1b4Smrg   SET_GetQueryivARB(exec, _mesa_GetQueryivARB);
7087117f1b4Smrg   SET_GetQueryObjectivARB(exec, _mesa_GetQueryObjectivARB);
7097117f1b4Smrg   SET_GetQueryObjectuivARB(exec, _mesa_GetQueryObjectuivARB);
7107117f1b4Smrg#endif
7117117f1b4Smrg
7127117f1b4Smrg   /* ARB 37. GL_ARB_draw_buffers */
7137117f1b4Smrg   SET_DrawBuffersARB(exec, _mesa_DrawBuffersARB);
7147117f1b4Smrg
7157117f1b4Smrg#if FEATURE_ARB_shader_objects
7167117f1b4Smrg   SET_DeleteObjectARB(exec, _mesa_DeleteObjectARB);
7177117f1b4Smrg   SET_GetHandleARB(exec, _mesa_GetHandleARB);
7187117f1b4Smrg   SET_DetachObjectARB(exec, _mesa_DetachObjectARB);
7197117f1b4Smrg   SET_CreateShaderObjectARB(exec, _mesa_CreateShaderObjectARB);
7207117f1b4Smrg   SET_ShaderSourceARB(exec, _mesa_ShaderSourceARB);
7217117f1b4Smrg   SET_CompileShaderARB(exec, _mesa_CompileShaderARB);
7227117f1b4Smrg   SET_CreateProgramObjectARB(exec, _mesa_CreateProgramObjectARB);
7237117f1b4Smrg   SET_AttachObjectARB(exec, _mesa_AttachObjectARB);
7247117f1b4Smrg   SET_LinkProgramARB(exec, _mesa_LinkProgramARB);
7257117f1b4Smrg   SET_UseProgramObjectARB(exec, _mesa_UseProgramObjectARB);
7267117f1b4Smrg   SET_ValidateProgramARB(exec, _mesa_ValidateProgramARB);
7277117f1b4Smrg   SET_Uniform1fARB(exec, _mesa_Uniform1fARB);
7287117f1b4Smrg   SET_Uniform2fARB(exec, _mesa_Uniform2fARB);
7297117f1b4Smrg   SET_Uniform3fARB(exec, _mesa_Uniform3fARB);
7307117f1b4Smrg   SET_Uniform4fARB(exec, _mesa_Uniform4fARB);
7317117f1b4Smrg   SET_Uniform1iARB(exec, _mesa_Uniform1iARB);
7327117f1b4Smrg   SET_Uniform2iARB(exec, _mesa_Uniform2iARB);
7337117f1b4Smrg   SET_Uniform3iARB(exec, _mesa_Uniform3iARB);
7347117f1b4Smrg   SET_Uniform4iARB(exec, _mesa_Uniform4iARB);
7357117f1b4Smrg   SET_Uniform1fvARB(exec, _mesa_Uniform1fvARB);
7367117f1b4Smrg   SET_Uniform2fvARB(exec, _mesa_Uniform2fvARB);
7377117f1b4Smrg   SET_Uniform3fvARB(exec, _mesa_Uniform3fvARB);
7387117f1b4Smrg   SET_Uniform4fvARB(exec, _mesa_Uniform4fvARB);
7397117f1b4Smrg   SET_Uniform1ivARB(exec, _mesa_Uniform1ivARB);
7407117f1b4Smrg   SET_Uniform2ivARB(exec, _mesa_Uniform2ivARB);
7417117f1b4Smrg   SET_Uniform3ivARB(exec, _mesa_Uniform3ivARB);
7427117f1b4Smrg   SET_Uniform4ivARB(exec, _mesa_Uniform4ivARB);
7437117f1b4Smrg   SET_UniformMatrix2fvARB(exec, _mesa_UniformMatrix2fvARB);
7447117f1b4Smrg   SET_UniformMatrix3fvARB(exec, _mesa_UniformMatrix3fvARB);
7457117f1b4Smrg   SET_UniformMatrix4fvARB(exec, _mesa_UniformMatrix4fvARB);
7467117f1b4Smrg   SET_GetObjectParameterfvARB(exec, _mesa_GetObjectParameterfvARB);
7477117f1b4Smrg   SET_GetObjectParameterivARB(exec, _mesa_GetObjectParameterivARB);
7487117f1b4Smrg   SET_GetInfoLogARB(exec, _mesa_GetInfoLogARB);
7497117f1b4Smrg   SET_GetAttachedObjectsARB(exec, _mesa_GetAttachedObjectsARB);
7507117f1b4Smrg   SET_GetUniformLocationARB(exec, _mesa_GetUniformLocationARB);
7517117f1b4Smrg   SET_GetActiveUniformARB(exec, _mesa_GetActiveUniformARB);
7527117f1b4Smrg   SET_GetUniformfvARB(exec, _mesa_GetUniformfvARB);
7537117f1b4Smrg   SET_GetUniformivARB(exec, _mesa_GetUniformivARB);
7547117f1b4Smrg   SET_GetShaderSourceARB(exec, _mesa_GetShaderSourceARB);
7557117f1b4Smrg#endif    /* FEATURE_ARB_shader_objects */
7567117f1b4Smrg
7577117f1b4Smrg#if FEATURE_ARB_vertex_shader
7587117f1b4Smrg   SET_BindAttribLocationARB(exec, _mesa_BindAttribLocationARB);
7597117f1b4Smrg   SET_GetActiveAttribARB(exec, _mesa_GetActiveAttribARB);
7607117f1b4Smrg   SET_GetAttribLocationARB(exec, _mesa_GetAttribLocationARB);
7617117f1b4Smrg#endif    /* FEATURE_ARB_vertex_shader */
7627117f1b4Smrg
7637117f1b4Smrg  /* GL_ATI_fragment_shader */
7647117f1b4Smrg#if FEATURE_ATI_fragment_shader
7657117f1b4Smrg   SET_GenFragmentShadersATI(exec, _mesa_GenFragmentShadersATI);
7667117f1b4Smrg   SET_BindFragmentShaderATI(exec, _mesa_BindFragmentShaderATI);
7677117f1b4Smrg   SET_DeleteFragmentShaderATI(exec, _mesa_DeleteFragmentShaderATI);
7687117f1b4Smrg   SET_BeginFragmentShaderATI(exec, _mesa_BeginFragmentShaderATI);
7697117f1b4Smrg   SET_EndFragmentShaderATI(exec, _mesa_EndFragmentShaderATI);
7707117f1b4Smrg   SET_PassTexCoordATI(exec, _mesa_PassTexCoordATI);
7717117f1b4Smrg   SET_SampleMapATI(exec, _mesa_SampleMapATI);
7727117f1b4Smrg   SET_ColorFragmentOp1ATI(exec, _mesa_ColorFragmentOp1ATI);
7737117f1b4Smrg   SET_ColorFragmentOp2ATI(exec, _mesa_ColorFragmentOp2ATI);
7747117f1b4Smrg   SET_ColorFragmentOp3ATI(exec, _mesa_ColorFragmentOp3ATI);
7757117f1b4Smrg   SET_AlphaFragmentOp1ATI(exec, _mesa_AlphaFragmentOp1ATI);
7767117f1b4Smrg   SET_AlphaFragmentOp2ATI(exec, _mesa_AlphaFragmentOp2ATI);
7777117f1b4Smrg   SET_AlphaFragmentOp3ATI(exec, _mesa_AlphaFragmentOp3ATI);
7787117f1b4Smrg   SET_SetFragmentShaderConstantATI(exec, _mesa_SetFragmentShaderConstantATI);
7797117f1b4Smrg#endif
7807117f1b4Smrg
7817117f1b4Smrg#if FEATURE_EXT_framebuffer_object
7827117f1b4Smrg   SET_IsRenderbufferEXT(exec, _mesa_IsRenderbufferEXT);
7837117f1b4Smrg   SET_BindRenderbufferEXT(exec, _mesa_BindRenderbufferEXT);
7847117f1b4Smrg   SET_DeleteRenderbuffersEXT(exec, _mesa_DeleteRenderbuffersEXT);
7857117f1b4Smrg   SET_GenRenderbuffersEXT(exec, _mesa_GenRenderbuffersEXT);
7867117f1b4Smrg   SET_RenderbufferStorageEXT(exec, _mesa_RenderbufferStorageEXT);
7877117f1b4Smrg   SET_GetRenderbufferParameterivEXT(exec, _mesa_GetRenderbufferParameterivEXT);
7887117f1b4Smrg   SET_IsFramebufferEXT(exec, _mesa_IsFramebufferEXT);
7897117f1b4Smrg   SET_BindFramebufferEXT(exec, _mesa_BindFramebufferEXT);
7907117f1b4Smrg   SET_DeleteFramebuffersEXT(exec, _mesa_DeleteFramebuffersEXT);
7917117f1b4Smrg   SET_GenFramebuffersEXT(exec, _mesa_GenFramebuffersEXT);
7927117f1b4Smrg   SET_CheckFramebufferStatusEXT(exec, _mesa_CheckFramebufferStatusEXT);
7937117f1b4Smrg   SET_FramebufferTexture1DEXT(exec, _mesa_FramebufferTexture1DEXT);
7947117f1b4Smrg   SET_FramebufferTexture2DEXT(exec, _mesa_FramebufferTexture2DEXT);
7957117f1b4Smrg   SET_FramebufferTexture3DEXT(exec, _mesa_FramebufferTexture3DEXT);
7967117f1b4Smrg   SET_FramebufferRenderbufferEXT(exec, _mesa_FramebufferRenderbufferEXT);
7977117f1b4Smrg   SET_GetFramebufferAttachmentParameterivEXT(exec, _mesa_GetFramebufferAttachmentParameterivEXT);
7987117f1b4Smrg   SET_GenerateMipmapEXT(exec, _mesa_GenerateMipmapEXT);
7997117f1b4Smrg#endif
8007117f1b4Smrg
8017117f1b4Smrg#if FEATURE_EXT_timer_query
8027117f1b4Smrg   SET_GetQueryObjecti64vEXT(exec, _mesa_GetQueryObjecti64vEXT);
8037117f1b4Smrg   SET_GetQueryObjectui64vEXT(exec, _mesa_GetQueryObjectui64vEXT);
8047117f1b4Smrg#endif
8057117f1b4Smrg
8067117f1b4Smrg#if FEATURE_EXT_framebuffer_blit
8077117f1b4Smrg   SET_BlitFramebufferEXT(exec, _mesa_BlitFramebufferEXT);
8087117f1b4Smrg#endif
8097117f1b4Smrg
8107117f1b4Smrg   /* GL_EXT_gpu_program_parameters */
8117117f1b4Smrg#if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
8127117f1b4Smrg   SET_ProgramEnvParameters4fvEXT(exec, _mesa_ProgramEnvParameters4fvEXT);
8137117f1b4Smrg   SET_ProgramLocalParameters4fvEXT(exec, _mesa_ProgramLocalParameters4fvEXT);
8147117f1b4Smrg#endif
8157117f1b4Smrg
8167117f1b4Smrg   /* GL_ATI_separate_stencil */
8177117f1b4Smrg   SET_StencilFuncSeparateATI(exec, _mesa_StencilFuncSeparateATI);
8187117f1b4Smrg}
8197117f1b4Smrg
8207117f1b4Smrg
8217117f1b4Smrg
8227117f1b4Smrg/**********************************************************************/
8237117f1b4Smrg/** \name State update logic */
8247117f1b4Smrg/*@{*/
8257117f1b4Smrg
8267117f1b4Smrg
8277117f1b4Smrgstatic void
8287117f1b4Smrgupdate_separate_specular( GLcontext *ctx )
8297117f1b4Smrg{
8307117f1b4Smrg   if (NEED_SECONDARY_COLOR(ctx))
8317117f1b4Smrg      ctx->_TriangleCaps |= DD_SEPARATE_SPECULAR;
8327117f1b4Smrg   else
8337117f1b4Smrg      ctx->_TriangleCaps &= ~DD_SEPARATE_SPECULAR;
8347117f1b4Smrg}
8357117f1b4Smrg
8367117f1b4Smrg
8377117f1b4Smrg/**
8387117f1b4Smrg * Update state dependent on vertex arrays.
8397117f1b4Smrg */
8407117f1b4Smrgstatic void
8417117f1b4Smrgupdate_arrays( GLcontext *ctx )
8427117f1b4Smrg{
8437117f1b4Smrg   GLuint i, min;
8447117f1b4Smrg
8457117f1b4Smrg   /* find min of _MaxElement values for all enabled arrays */
8467117f1b4Smrg
8477117f1b4Smrg   /* 0 */
8487117f1b4Smrg   if (ctx->VertexProgram._Current
8497117f1b4Smrg       && ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_POS].Enabled) {
8507117f1b4Smrg      min = ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_POS]._MaxElement;
8517117f1b4Smrg   }
8527117f1b4Smrg   else if (ctx->Array.ArrayObj->Vertex.Enabled) {
8537117f1b4Smrg      min = ctx->Array.ArrayObj->Vertex._MaxElement;
8547117f1b4Smrg   }
8557117f1b4Smrg   else {
8567117f1b4Smrg      /* can't draw anything without vertex positions! */
8577117f1b4Smrg      min = 0;
8587117f1b4Smrg   }
8597117f1b4Smrg
8607117f1b4Smrg   /* 1 */
8617117f1b4Smrg   if (ctx->VertexProgram._Enabled
8627117f1b4Smrg       && ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_WEIGHT].Enabled) {
8637117f1b4Smrg      min = MIN2(min, ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_WEIGHT]._MaxElement);
8647117f1b4Smrg   }
8657117f1b4Smrg   /* no conventional vertex weight array */
8667117f1b4Smrg
8677117f1b4Smrg   /* 2 */
8687117f1b4Smrg   if (ctx->VertexProgram._Enabled
8697117f1b4Smrg       && ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_NORMAL].Enabled) {
8707117f1b4Smrg      min = MIN2(min, ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_NORMAL]._MaxElement);
8717117f1b4Smrg   }
8727117f1b4Smrg   else if (ctx->Array.ArrayObj->Normal.Enabled) {
8737117f1b4Smrg      min = MIN2(min, ctx->Array.ArrayObj->Normal._MaxElement);
8747117f1b4Smrg   }
8757117f1b4Smrg
8767117f1b4Smrg   /* 3 */
8777117f1b4Smrg   if (ctx->VertexProgram._Enabled
8787117f1b4Smrg       && ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_COLOR0].Enabled) {
8797117f1b4Smrg      min = MIN2(min, ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_COLOR0]._MaxElement);
8807117f1b4Smrg   }
8817117f1b4Smrg   else if (ctx->Array.ArrayObj->Color.Enabled) {
8827117f1b4Smrg      min = MIN2(min, ctx->Array.ArrayObj->Color._MaxElement);
8837117f1b4Smrg   }
8847117f1b4Smrg
8857117f1b4Smrg   /* 4 */
8867117f1b4Smrg   if (ctx->VertexProgram._Enabled
8877117f1b4Smrg       && ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_COLOR1].Enabled) {
8887117f1b4Smrg      min = MIN2(min, ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_COLOR1]._MaxElement);
8897117f1b4Smrg   }
8907117f1b4Smrg   else if (ctx->Array.ArrayObj->SecondaryColor.Enabled) {
8917117f1b4Smrg      min = MIN2(min, ctx->Array.ArrayObj->SecondaryColor._MaxElement);
8927117f1b4Smrg   }
8937117f1b4Smrg
8947117f1b4Smrg   /* 5 */
8957117f1b4Smrg   if (ctx->VertexProgram._Enabled
8967117f1b4Smrg       && ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_FOG].Enabled) {
8977117f1b4Smrg      min = MIN2(min, ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_FOG]._MaxElement);
8987117f1b4Smrg   }
8997117f1b4Smrg   else if (ctx->Array.ArrayObj->FogCoord.Enabled) {
9007117f1b4Smrg      min = MIN2(min, ctx->Array.ArrayObj->FogCoord._MaxElement);
9017117f1b4Smrg   }
9027117f1b4Smrg
9037117f1b4Smrg   /* 6 */
9047117f1b4Smrg   if (ctx->VertexProgram._Enabled
9057117f1b4Smrg       && ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_COLOR_INDEX].Enabled) {
9067117f1b4Smrg      min = MIN2(min, ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_COLOR_INDEX]._MaxElement);
9077117f1b4Smrg   }
9087117f1b4Smrg   else if (ctx->Array.ArrayObj->Index.Enabled) {
9097117f1b4Smrg      min = MIN2(min, ctx->Array.ArrayObj->Index._MaxElement);
9107117f1b4Smrg   }
9117117f1b4Smrg
9127117f1b4Smrg
9137117f1b4Smrg   /* 7 */
9147117f1b4Smrg   if (ctx->VertexProgram._Enabled
9157117f1b4Smrg       && ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_EDGEFLAG].Enabled) {
9167117f1b4Smrg      min = MIN2(min, ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_EDGEFLAG]._MaxElement);
9177117f1b4Smrg   }
9187117f1b4Smrg
9197117f1b4Smrg   /* 8..15 */
9207117f1b4Smrg   for (i = VERT_ATTRIB_TEX0; i <= VERT_ATTRIB_TEX7; i++) {
9217117f1b4Smrg      if (ctx->VertexProgram._Enabled
9227117f1b4Smrg          && ctx->Array.ArrayObj->VertexAttrib[i].Enabled) {
9237117f1b4Smrg         min = MIN2(min, ctx->Array.ArrayObj->VertexAttrib[i]._MaxElement);
9247117f1b4Smrg      }
9257117f1b4Smrg      else if (i - VERT_ATTRIB_TEX0 < ctx->Const.MaxTextureCoordUnits
9267117f1b4Smrg               && ctx->Array.ArrayObj->TexCoord[i - VERT_ATTRIB_TEX0].Enabled) {
9277117f1b4Smrg         min = MIN2(min, ctx->Array.ArrayObj->TexCoord[i - VERT_ATTRIB_TEX0]._MaxElement);
9287117f1b4Smrg      }
9297117f1b4Smrg   }
9307117f1b4Smrg
9317117f1b4Smrg   /* 16..31 */
9327117f1b4Smrg   if (ctx->VertexProgram._Current) {
9337117f1b4Smrg      for (i = VERT_ATTRIB_GENERIC0; i < VERT_ATTRIB_MAX; i++) {
9347117f1b4Smrg         if (ctx->Array.ArrayObj->VertexAttrib[i].Enabled) {
9357117f1b4Smrg            min = MIN2(min, ctx->Array.ArrayObj->VertexAttrib[i]._MaxElement);
9367117f1b4Smrg         }
9377117f1b4Smrg      }
9387117f1b4Smrg   }
9397117f1b4Smrg
9407117f1b4Smrg   if (ctx->Array.ArrayObj->EdgeFlag.Enabled) {
9417117f1b4Smrg      min = MIN2(min, ctx->Array.ArrayObj->EdgeFlag._MaxElement);
9427117f1b4Smrg   }
9437117f1b4Smrg
9447117f1b4Smrg   /* _MaxElement is one past the last legal array element */
9457117f1b4Smrg   ctx->Array._MaxElement = min;
9467117f1b4Smrg}
9477117f1b4Smrg
9487117f1b4Smrg
9497117f1b4Smrg/**
9507117f1b4Smrg * Update derived vertex/fragment program state.
9517117f1b4Smrg */
9527117f1b4Smrgstatic void
9537117f1b4Smrgupdate_program(GLcontext *ctx)
9547117f1b4Smrg{
9557117f1b4Smrg   const struct gl_shader_program *shProg = ctx->Shader.CurrentProgram;
9567117f1b4Smrg
9577117f1b4Smrg   /* These _Enabled flags indicate if the program is enabled AND valid. */
9587117f1b4Smrg   ctx->VertexProgram._Enabled = ctx->VertexProgram.Enabled
9597117f1b4Smrg      && ctx->VertexProgram.Current->Base.Instructions;
9607117f1b4Smrg   ctx->FragmentProgram._Enabled = ctx->FragmentProgram.Enabled
9617117f1b4Smrg      && ctx->FragmentProgram.Current->Base.Instructions;
9627117f1b4Smrg   ctx->ATIFragmentShader._Enabled = ctx->ATIFragmentShader.Enabled
9637117f1b4Smrg      && ctx->ATIFragmentShader.Current->Instructions[0];
9647117f1b4Smrg
9657117f1b4Smrg   /*
9667117f1b4Smrg    * Set the ctx->VertexProgram._Current and ctx->FragmentProgram._Current
9677117f1b4Smrg    * pointers to the programs that should be enabled/used.
9687117f1b4Smrg    *
9697117f1b4Smrg    * These programs may come from several sources.  The priority is as
9707117f1b4Smrg    * follows:
9717117f1b4Smrg    *   1. OpenGL 2.0/ARB vertex/fragment shaders
9727117f1b4Smrg    *   2. ARB/NV vertex/fragment programs
9737117f1b4Smrg    *   3. Programs derived from fixed-function state.
9747117f1b4Smrg    */
9757117f1b4Smrg
9767117f1b4Smrg   ctx->FragmentProgram._Current = NULL;
9777117f1b4Smrg
9787117f1b4Smrg   if (shProg && shProg->LinkStatus) {
9797117f1b4Smrg      /* Use shader programs */
9807117f1b4Smrg      /* XXX this isn't quite right, since we may have either a vertex
9817117f1b4Smrg       * _or_ fragment shader (not always both).
9827117f1b4Smrg       */
9837117f1b4Smrg      ctx->VertexProgram._Current = shProg->VertexProgram;
9847117f1b4Smrg      ctx->FragmentProgram._Current = shProg->FragmentProgram;
9857117f1b4Smrg   }
9867117f1b4Smrg   else {
9877117f1b4Smrg      if (ctx->VertexProgram._Enabled) {
9887117f1b4Smrg         /* use user-defined vertex program */
9897117f1b4Smrg         ctx->VertexProgram._Current = ctx->VertexProgram.Current;
9907117f1b4Smrg      }
9917117f1b4Smrg      else if (ctx->VertexProgram._MaintainTnlProgram) {
9927117f1b4Smrg         /* Use vertex program generated from fixed-function state.
9937117f1b4Smrg          * The _Current pointer will get set in
9947117f1b4Smrg          * _tnl_UpdateFixedFunctionProgram() later if appropriate.
9957117f1b4Smrg          */
9967117f1b4Smrg         ctx->VertexProgram._Current = NULL;
9977117f1b4Smrg      }
9987117f1b4Smrg      else {
9997117f1b4Smrg         /* no vertex program */
10007117f1b4Smrg         ctx->VertexProgram._Current = NULL;
10017117f1b4Smrg      }
10027117f1b4Smrg
10037117f1b4Smrg      if (ctx->FragmentProgram._Enabled) {
10047117f1b4Smrg         /* use user-defined vertex program */
10057117f1b4Smrg         ctx->FragmentProgram._Current = ctx->FragmentProgram.Current;
10067117f1b4Smrg      }
10077117f1b4Smrg      else if (ctx->FragmentProgram._MaintainTexEnvProgram) {
10087117f1b4Smrg         /* Use fragment program generated from fixed-function state.
10097117f1b4Smrg          * The _Current pointer will get set in _mesa_UpdateTexEnvProgram()
10107117f1b4Smrg          * later if appropriate.
10117117f1b4Smrg          */
10127117f1b4Smrg         ctx->FragmentProgram._Current = NULL;
10137117f1b4Smrg      }
10147117f1b4Smrg      else {
10157117f1b4Smrg         /* no fragment program */
10167117f1b4Smrg         ctx->FragmentProgram._Current = NULL;
10177117f1b4Smrg      }
10187117f1b4Smrg   }
10197117f1b4Smrg
10207117f1b4Smrg   ctx->FragmentProgram._Active = ctx->FragmentProgram._Enabled;
10217117f1b4Smrg   if (ctx->FragmentProgram._MaintainTexEnvProgram &&
10227117f1b4Smrg       !ctx->FragmentProgram._Enabled) {
10237117f1b4Smrg      if (ctx->FragmentProgram._UseTexEnvProgram)
10247117f1b4Smrg	 ctx->FragmentProgram._Active = GL_TRUE;
10257117f1b4Smrg   }
10267117f1b4Smrg}
10277117f1b4Smrg
10287117f1b4Smrg
10297117f1b4Smrgstatic void
10307117f1b4Smrgupdate_viewport_matrix(GLcontext *ctx)
10317117f1b4Smrg{
10327117f1b4Smrg   const GLfloat depthMax = ctx->DrawBuffer->_DepthMaxF;
10337117f1b4Smrg
10347117f1b4Smrg   ASSERT(depthMax > 0);
10357117f1b4Smrg
10367117f1b4Smrg   /* Compute scale and bias values. This is really driver-specific
10377117f1b4Smrg    * and should be maintained elsewhere if at all.
10387117f1b4Smrg    * NOTE: RasterPos uses this.
10397117f1b4Smrg    */
10407117f1b4Smrg   _math_matrix_viewport(&ctx->Viewport._WindowMap,
10417117f1b4Smrg                         ctx->Viewport.X, ctx->Viewport.Y,
10427117f1b4Smrg                         ctx->Viewport.Width, ctx->Viewport.Height,
10437117f1b4Smrg                         ctx->Viewport.Near, ctx->Viewport.Far,
10447117f1b4Smrg                         depthMax);
10457117f1b4Smrg}
10467117f1b4Smrg
10477117f1b4Smrg
10487117f1b4Smrg/**
10497117f1b4Smrg * Update derived color/blend/logicop state.
10507117f1b4Smrg */
10517117f1b4Smrgstatic void
10527117f1b4Smrgupdate_color(GLcontext *ctx)
10537117f1b4Smrg{
10547117f1b4Smrg   /* This is needed to support 1.1's RGB logic ops AND
10557117f1b4Smrg    * 1.0's blending logicops.
10567117f1b4Smrg    */
10577117f1b4Smrg   ctx->Color._LogicOpEnabled = RGBA_LOGICOP_ENABLED(ctx);
10587117f1b4Smrg}
10597117f1b4Smrg
10607117f1b4Smrg
10617117f1b4Smrg/*
10627117f1b4Smrg * Check polygon state and set DD_TRI_CULL_FRONT_BACK and/or DD_TRI_OFFSET
10637117f1b4Smrg * in ctx->_TriangleCaps if needed.
10647117f1b4Smrg */
10657117f1b4Smrgstatic void
10667117f1b4Smrgupdate_polygon( GLcontext *ctx )
10677117f1b4Smrg{
10687117f1b4Smrg   ctx->_TriangleCaps &= ~(DD_TRI_CULL_FRONT_BACK | DD_TRI_OFFSET);
10697117f1b4Smrg
10707117f1b4Smrg   if (ctx->Polygon.CullFlag && ctx->Polygon.CullFaceMode == GL_FRONT_AND_BACK)
10717117f1b4Smrg      ctx->_TriangleCaps |= DD_TRI_CULL_FRONT_BACK;
10727117f1b4Smrg
10737117f1b4Smrg   /* Any Polygon offsets enabled? */
10747117f1b4Smrg   if (ctx->Polygon.OffsetPoint ||
10757117f1b4Smrg       ctx->Polygon.OffsetLine ||
10767117f1b4Smrg       ctx->Polygon.OffsetFill) {
10777117f1b4Smrg      ctx->_TriangleCaps |= DD_TRI_OFFSET;
10787117f1b4Smrg   }
10797117f1b4Smrg}
10807117f1b4Smrg
10817117f1b4Smrg
10827117f1b4Smrg/**
10837117f1b4Smrg * Update the ctx->_TriangleCaps bitfield.
10847117f1b4Smrg * XXX that bitfield should really go away someday!
10857117f1b4Smrg * This function must be called after other update_*() functions since
10867117f1b4Smrg * there are dependencies on some other derived values.
10877117f1b4Smrg */
10887117f1b4Smrg#if 0
10897117f1b4Smrgstatic void
10907117f1b4Smrgupdate_tricaps(GLcontext *ctx, GLbitfield new_state)
10917117f1b4Smrg{
10927117f1b4Smrg   ctx->_TriangleCaps = 0;
10937117f1b4Smrg
10947117f1b4Smrg   /*
10957117f1b4Smrg    * Points
10967117f1b4Smrg    */
10977117f1b4Smrg   if (1/*new_state & _NEW_POINT*/) {
10987117f1b4Smrg      if (ctx->Point.SmoothFlag)
10997117f1b4Smrg         ctx->_TriangleCaps |= DD_POINT_SMOOTH;
11007117f1b4Smrg      if (ctx->Point._Size != 1.0F)
11017117f1b4Smrg         ctx->_TriangleCaps |= DD_POINT_SIZE;
11027117f1b4Smrg      if (ctx->Point._Attenuated)
11037117f1b4Smrg         ctx->_TriangleCaps |= DD_POINT_ATTEN;
11047117f1b4Smrg   }
11057117f1b4Smrg
11067117f1b4Smrg   /*
11077117f1b4Smrg    * Lines
11087117f1b4Smrg    */
11097117f1b4Smrg   if (1/*new_state & _NEW_LINE*/) {
11107117f1b4Smrg      if (ctx->Line.SmoothFlag)
11117117f1b4Smrg         ctx->_TriangleCaps |= DD_LINE_SMOOTH;
11127117f1b4Smrg      if (ctx->Line.StippleFlag)
11137117f1b4Smrg         ctx->_TriangleCaps |= DD_LINE_STIPPLE;
11147117f1b4Smrg      if (ctx->Line._Width != 1.0)
11157117f1b4Smrg         ctx->_TriangleCaps |= DD_LINE_WIDTH;
11167117f1b4Smrg   }
11177117f1b4Smrg
11187117f1b4Smrg   /*
11197117f1b4Smrg    * Polygons
11207117f1b4Smrg    */
11217117f1b4Smrg   if (1/*new_state & _NEW_POLYGON*/) {
11227117f1b4Smrg      if (ctx->Polygon.SmoothFlag)
11237117f1b4Smrg         ctx->_TriangleCaps |= DD_TRI_SMOOTH;
11247117f1b4Smrg      if (ctx->Polygon.StippleFlag)
11257117f1b4Smrg         ctx->_TriangleCaps |= DD_TRI_STIPPLE;
11267117f1b4Smrg      if (ctx->Polygon.FrontMode != GL_FILL
11277117f1b4Smrg          || ctx->Polygon.BackMode != GL_FILL)
11287117f1b4Smrg         ctx->_TriangleCaps |= DD_TRI_UNFILLED;
11297117f1b4Smrg      if (ctx->Polygon.CullFlag
11307117f1b4Smrg          && ctx->Polygon.CullFaceMode == GL_FRONT_AND_BACK)
11317117f1b4Smrg         ctx->_TriangleCaps |= DD_TRI_CULL_FRONT_BACK;
11327117f1b4Smrg      if (ctx->Polygon.OffsetPoint ||
11337117f1b4Smrg          ctx->Polygon.OffsetLine ||
11347117f1b4Smrg          ctx->Polygon.OffsetFill)
11357117f1b4Smrg         ctx->_TriangleCaps |= DD_TRI_OFFSET;
11367117f1b4Smrg   }
11377117f1b4Smrg
11387117f1b4Smrg   /*
11397117f1b4Smrg    * Lighting and shading
11407117f1b4Smrg    */
11417117f1b4Smrg   if (ctx->Light.Enabled && ctx->Light.Model.TwoSide)
11427117f1b4Smrg      ctx->_TriangleCaps |= DD_TRI_LIGHT_TWOSIDE;
11437117f1b4Smrg   if (ctx->Light.ShadeModel == GL_FLAT)
11447117f1b4Smrg      ctx->_TriangleCaps |= DD_FLATSHADE;
11457117f1b4Smrg   if (NEED_SECONDARY_COLOR(ctx))
11467117f1b4Smrg      ctx->_TriangleCaps |= DD_SEPARATE_SPECULAR;
11477117f1b4Smrg
11487117f1b4Smrg   /*
11497117f1b4Smrg    * Stencil
11507117f1b4Smrg    */
11517117f1b4Smrg   if (ctx->Stencil._TestTwoSide)
11527117f1b4Smrg      ctx->_TriangleCaps |= DD_TRI_TWOSTENCIL;
11537117f1b4Smrg}
11547117f1b4Smrg#endif
11557117f1b4Smrg
11567117f1b4Smrg
11577117f1b4Smrg/**
11587117f1b4Smrg * Compute derived GL state.
11597117f1b4Smrg * If __GLcontextRec::NewState is non-zero then this function \b must
11607117f1b4Smrg * be called before rendering anything.
11617117f1b4Smrg *
11627117f1b4Smrg * Calls dd_function_table::UpdateState to perform any internal state
11637117f1b4Smrg * management necessary.
11647117f1b4Smrg *
11657117f1b4Smrg * \sa _mesa_update_modelview_project(), _mesa_update_texture(),
11667117f1b4Smrg * _mesa_update_buffer_bounds(),
11677117f1b4Smrg * _mesa_update_lighting() and _mesa_update_tnl_spaces().
11687117f1b4Smrg */
11697117f1b4Smrgvoid
11707117f1b4Smrg_mesa_update_state_locked( GLcontext *ctx )
11717117f1b4Smrg{
11727117f1b4Smrg   GLbitfield new_state = ctx->NewState;
11737117f1b4Smrg
11747117f1b4Smrg   if (MESA_VERBOSE & VERBOSE_STATE)
11757117f1b4Smrg      _mesa_print_state("_mesa_update_state", new_state);
11767117f1b4Smrg
11777117f1b4Smrg   if (new_state & _NEW_PROGRAM)
11787117f1b4Smrg      update_program( ctx );
11797117f1b4Smrg
11807117f1b4Smrg   if (new_state & (_NEW_MODELVIEW|_NEW_PROJECTION))
11817117f1b4Smrg      _mesa_update_modelview_project( ctx, new_state );
11827117f1b4Smrg
11837117f1b4Smrg   if (new_state & (_NEW_PROGRAM|_NEW_TEXTURE|_NEW_TEXTURE_MATRIX))
11847117f1b4Smrg      _mesa_update_texture( ctx, new_state );
11857117f1b4Smrg
11867117f1b4Smrg   if (new_state & (_NEW_BUFFERS | _NEW_COLOR | _NEW_PIXEL))
11877117f1b4Smrg      _mesa_update_framebuffer(ctx);
11887117f1b4Smrg
11897117f1b4Smrg   if (new_state & (_NEW_SCISSOR | _NEW_BUFFERS | _NEW_VIEWPORT))
11907117f1b4Smrg      _mesa_update_draw_buffer_bounds( ctx );
11917117f1b4Smrg
11927117f1b4Smrg   if (new_state & _NEW_POLYGON)
11937117f1b4Smrg      update_polygon( ctx );
11947117f1b4Smrg
11957117f1b4Smrg   if (new_state & _NEW_LIGHT)
11967117f1b4Smrg      _mesa_update_lighting( ctx );
11977117f1b4Smrg
11987117f1b4Smrg   if (new_state & _NEW_STENCIL)
11997117f1b4Smrg      _mesa_update_stencil( ctx );
12007117f1b4Smrg
12017117f1b4Smrg   if (new_state & _IMAGE_NEW_TRANSFER_STATE)
12027117f1b4Smrg      _mesa_update_pixel( ctx, new_state );
12037117f1b4Smrg
12047117f1b4Smrg   if (new_state & _DD_NEW_SEPARATE_SPECULAR)
12057117f1b4Smrg      update_separate_specular( ctx );
12067117f1b4Smrg
12077117f1b4Smrg   if (new_state & (_NEW_ARRAY | _NEW_PROGRAM))
12087117f1b4Smrg      update_arrays( ctx );
12097117f1b4Smrg
12107117f1b4Smrg   if (new_state & (_NEW_BUFFERS | _NEW_VIEWPORT))
12117117f1b4Smrg      update_viewport_matrix(ctx);
12127117f1b4Smrg
12137117f1b4Smrg   if (new_state & _NEW_COLOR)
12147117f1b4Smrg      update_color( ctx );
12157117f1b4Smrg
12167117f1b4Smrg#if 0
12177117f1b4Smrg   if (new_state & (_NEW_POINT | _NEW_LINE | _NEW_POLYGON | _NEW_LIGHT
12187117f1b4Smrg                    | _NEW_STENCIL | _DD_NEW_SEPARATE_SPECULAR))
12197117f1b4Smrg      update_tricaps( ctx, new_state );
12207117f1b4Smrg#endif
12217117f1b4Smrg
12227117f1b4Smrg   if (ctx->FragmentProgram._MaintainTexEnvProgram) {
12237117f1b4Smrg      if (new_state & (_NEW_TEXTURE | _DD_NEW_SEPARATE_SPECULAR | _NEW_FOG))
12247117f1b4Smrg	 _mesa_UpdateTexEnvProgram(ctx);
12257117f1b4Smrg   }
12267117f1b4Smrg
12277117f1b4Smrg   /* ctx->_NeedEyeCoords is now up to date.
12287117f1b4Smrg    *
12297117f1b4Smrg    * If the truth value of this variable has changed, update for the
12307117f1b4Smrg    * new lighting space and recompute the positions of lights and the
12317117f1b4Smrg    * normal transform.
12327117f1b4Smrg    *
12337117f1b4Smrg    * If the lighting space hasn't changed, may still need to recompute
12347117f1b4Smrg    * light positions & normal transforms for other reasons.
12357117f1b4Smrg    */
12367117f1b4Smrg   if (new_state & _MESA_NEW_NEED_EYE_COORDS)
12377117f1b4Smrg      _mesa_update_tnl_spaces( ctx, new_state );
12387117f1b4Smrg
12397117f1b4Smrg   /*
12407117f1b4Smrg    * Give the driver a chance to act upon the new_state flags.
12417117f1b4Smrg    * The driver might plug in different span functions, for example.
12427117f1b4Smrg    * Also, this is where the driver can invalidate the state of any
12437117f1b4Smrg    * active modules (such as swrast_setup, swrast, tnl, etc).
12447117f1b4Smrg    *
12457117f1b4Smrg    * Set ctx->NewState to zero to avoid recursion if
12467117f1b4Smrg    * Driver.UpdateState() has to call FLUSH_VERTICES().  (fixed?)
12477117f1b4Smrg    */
12487117f1b4Smrg   new_state = ctx->NewState;
12497117f1b4Smrg   ctx->NewState = 0;
12507117f1b4Smrg   ctx->Driver.UpdateState(ctx, new_state);
12517117f1b4Smrg   ctx->Array.NewState = 0;
12527117f1b4Smrg}
12537117f1b4Smrg
12547117f1b4Smrg
12557117f1b4Smrg/* This is the usual entrypoint for state updates:
12567117f1b4Smrg */
12577117f1b4Smrgvoid
12587117f1b4Smrg_mesa_update_state( GLcontext *ctx )
12597117f1b4Smrg{
12607117f1b4Smrg   _mesa_lock_context_textures(ctx);
12617117f1b4Smrg   _mesa_update_state_locked(ctx);
12627117f1b4Smrg   _mesa_unlock_context_textures(ctx);
12637117f1b4Smrg}
12647117f1b4Smrg
12657117f1b4Smrg
12667117f1b4Smrg
12677117f1b4Smrg/*@}*/
12687117f1b4Smrg
12697117f1b4Smrg
1270