vtxfmt.c revision 60b08eb1fdf287d28ec66b9282513ab35a61aee0
1d8aa0269cdadba1608522287bcb3b446c5848c09Gareth Hughes/*
2d8aa0269cdadba1608522287bcb3b446c5848c09Gareth Hughes * Mesa 3-D graphics library
3b5b8d22c4ee921dff99b898a5907023b20670a27Brian Paul * Version:  6.3
4d8aa0269cdadba1608522287bcb3b446c5848c09Gareth Hughes *
50f1e19c03cdf5bd8a7c3db59cf395a0833ab0173Brian Paul * Copyright (C) 1999-2004  Brian Paul   All Rights Reserved.
6d8aa0269cdadba1608522287bcb3b446c5848c09Gareth Hughes *
7d8aa0269cdadba1608522287bcb3b446c5848c09Gareth Hughes * Permission is hereby granted, free of charge, to any person obtaining a
8d8aa0269cdadba1608522287bcb3b446c5848c09Gareth Hughes * copy of this software and associated documentation files (the "Software"),
9d8aa0269cdadba1608522287bcb3b446c5848c09Gareth Hughes * to deal in the Software without restriction, including without limitation
10d8aa0269cdadba1608522287bcb3b446c5848c09Gareth Hughes * the rights to use, copy, modify, merge, publish, distribute, sublicense,
11d8aa0269cdadba1608522287bcb3b446c5848c09Gareth Hughes * and/or sell copies of the Software, and to permit persons to whom the
12d8aa0269cdadba1608522287bcb3b446c5848c09Gareth Hughes * Software is furnished to do so, subject to the following conditions:
13d8aa0269cdadba1608522287bcb3b446c5848c09Gareth Hughes *
14d8aa0269cdadba1608522287bcb3b446c5848c09Gareth Hughes * The above copyright notice and this permission notice shall be included
15d8aa0269cdadba1608522287bcb3b446c5848c09Gareth Hughes * in all copies or substantial portions of the Software.
16d8aa0269cdadba1608522287bcb3b446c5848c09Gareth Hughes *
17d8aa0269cdadba1608522287bcb3b446c5848c09Gareth Hughes * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18d8aa0269cdadba1608522287bcb3b446c5848c09Gareth Hughes * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19d8aa0269cdadba1608522287bcb3b446c5848c09Gareth Hughes * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
20d8aa0269cdadba1608522287bcb3b446c5848c09Gareth Hughes * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
21d8aa0269cdadba1608522287bcb3b446c5848c09Gareth Hughes * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22d8aa0269cdadba1608522287bcb3b446c5848c09Gareth Hughes * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23d8aa0269cdadba1608522287bcb3b446c5848c09Gareth Hughes *
2422144ab7552f0799bcfca506bf4ffa7f70a06649Gareth Hughes * Authors:
2505a4b37707d2c598ea68c05d07a3d65bcbf5a076Brian Paul *    Keith Whitwell <keith@tungstengraphics.com>
2605a4b37707d2c598ea68c05d07a3d65bcbf5a076Brian Paul *    Gareth Hughes
27d8aa0269cdadba1608522287bcb3b446c5848c09Gareth Hughes */
28d8aa0269cdadba1608522287bcb3b446c5848c09Gareth Hughes
29b014986fdb259eb60bd3e5a3fbcfcb218969f5f5Keith Whitwell#include "glheader.h"
30b014986fdb259eb60bd3e5a3fbcfcb218969f5f5Keith Whitwell#include "api_loopback.h"
31d8aa0269cdadba1608522287bcb3b446c5848c09Gareth Hughes#include "context.h"
323c63452e64df7e10aa073c6c3b9492b1d7dabbb8Brian Paul#include "imports.h"
33b014986fdb259eb60bd3e5a3fbcfcb218969f5f5Keith Whitwell#include "mtypes.h"
34467037de2233e1512b1e2981e4092a5d9764a4eeGareth Hughes#include "state.h"
35b014986fdb259eb60bd3e5a3fbcfcb218969f5f5Keith Whitwell#include "vtxfmt.h"
36b014986fdb259eb60bd3e5a3fbcfcb218969f5f5Keith Whitwell
37b014986fdb259eb60bd3e5a3fbcfcb218969f5f5Keith Whitwell
38d8aa0269cdadba1608522287bcb3b446c5848c09Gareth Hughes/* The neutral vertex format.  This wraps all tnl module functions,
39d8aa0269cdadba1608522287bcb3b446c5848c09Gareth Hughes * verifying that the currently-installed module is valid and then
40d8aa0269cdadba1608522287bcb3b446c5848c09Gareth Hughes * installing the function pointers in a lazy fashion.  It records the
41d8aa0269cdadba1608522287bcb3b446c5848c09Gareth Hughes * function pointers that have been swapped out, which allows a fast
42d8aa0269cdadba1608522287bcb3b446c5848c09Gareth Hughes * restoration of the neutral module in almost all cases -- a typical
43d8aa0269cdadba1608522287bcb3b446c5848c09Gareth Hughes * app might only require 4-6 functions to be modified from the neutral
44d8aa0269cdadba1608522287bcb3b446c5848c09Gareth Hughes * baseline, and only restoring these is certainly preferable to doing
45d8aa0269cdadba1608522287bcb3b446c5848c09Gareth Hughes * the entire module's 60 or so function pointers.
46d8aa0269cdadba1608522287bcb3b446c5848c09Gareth Hughes */
47d8aa0269cdadba1608522287bcb3b446c5848c09Gareth Hughes
48d8aa0269cdadba1608522287bcb3b446c5848c09Gareth Hughes#define PRE_LOOPBACK( FUNC )						\
49d8aa0269cdadba1608522287bcb3b446c5848c09Gareth Hughes{									\
50d8aa0269cdadba1608522287bcb3b446c5848c09Gareth Hughes   GET_CURRENT_CONTEXT(ctx);						\
51126c89e35fb5179fe077f7593f31ea874c89dd65Ian Romanick   struct gl_tnl_module * const tnl = &(ctx->TnlModule);		\
52126c89e35fb5179fe077f7593f31ea874c89dd65Ian Romanick   const int tmp_offset = _gloffset_ ## FUNC ;				\
53d8aa0269cdadba1608522287bcb3b446c5848c09Gareth Hughes									\
54d8aa0269cdadba1608522287bcb3b446c5848c09Gareth Hughes   ASSERT( tnl->Current );						\
55d8aa0269cdadba1608522287bcb3b446c5848c09Gareth Hughes   ASSERT( tnl->SwapCount < NUM_VERTEX_FORMAT_ENTRIES );		\
56126c89e35fb5179fe077f7593f31ea874c89dd65Ian Romanick   ASSERT( tmp_offset >= 0 );						\
57c64a2b708944ec671b1104067245500fcfc6ed94Keith Whitwell                                                                        \
58c64a2b708944ec671b1104067245500fcfc6ed94Keith Whitwell   if (tnl->SwapCount == 0)                                             \
59c64a2b708944ec671b1104067245500fcfc6ed94Keith Whitwell      ctx->Driver.BeginVertices( ctx );                                 \
60c64a2b708944ec671b1104067245500fcfc6ed94Keith Whitwell                                                                        \
61c64a2b708944ec671b1104067245500fcfc6ed94Keith Whitwell   /* Save the swapped function's dispatch entry so it can be */        \
62c64a2b708944ec671b1104067245500fcfc6ed94Keith Whitwell   /* restored later. */                                                \
63126c89e35fb5179fe077f7593f31ea874c89dd65Ian Romanick   tnl->Swapped[tnl->SwapCount].location = & (((_glapi_proc *)ctx->Exec)[tmp_offset]); \
641585c234e0db4bfb7cd85c4111594f6da1582e6fIan Romanick   tnl->Swapped[tnl->SwapCount].function = (_glapi_proc)TAG(FUNC);	\
65d8aa0269cdadba1608522287bcb3b446c5848c09Gareth Hughes   tnl->SwapCount++;							\
66d8aa0269cdadba1608522287bcb3b446c5848c09Gareth Hughes									\
67d8aa0269cdadba1608522287bcb3b446c5848c09Gareth Hughes   if ( 0 )								\
684e9676fb13f60ecdbc247b120031f18cd3febcb0Brian Paul      _mesa_debug(ctx, "   swapping gl" #FUNC"...\n" );			\
69d8aa0269cdadba1608522287bcb3b446c5848c09Gareth Hughes									\
70471a774f433c23b263828aa591415741e78a35daBrian Paul   /* Install the tnl function pointer.	*/				\
719bdfee3a470a535ebe31074651fbacf680bcea6aIan Romanick   SET_ ## FUNC(ctx->Exec, tnl->Current->FUNC);				\
72d8aa0269cdadba1608522287bcb3b446c5848c09Gareth Hughes}
73d8aa0269cdadba1608522287bcb3b446c5848c09Gareth Hughes
74d8aa0269cdadba1608522287bcb3b446c5848c09Gareth Hughes#define TAG(x) neutral_##x
75d8aa0269cdadba1608522287bcb3b446c5848c09Gareth Hughes#include "vtxfmt_tmp.h"
76d8aa0269cdadba1608522287bcb3b446c5848c09Gareth Hughes
77d8aa0269cdadba1608522287bcb3b446c5848c09Gareth Hughes
78095c6699f449ed4803f23e844cc0227743a9c3e1Brian Paul/**
79095c6699f449ed4803f23e844cc0227743a9c3e1Brian Paul * Use the per-vertex functions found in <vfmt> to initialze the given
80095c6699f449ed4803f23e844cc0227743a9c3e1Brian Paul * API dispatch table.
81095c6699f449ed4803f23e844cc0227743a9c3e1Brian Paul */
820f1e19c03cdf5bd8a7c3db59cf395a0833ab0173Brian Paulstatic void
830f1e19c03cdf5bd8a7c3db59cf395a0833ab0173Brian Paulinstall_vtxfmt( struct _glapi_table *tab, const GLvertexformat *vfmt )
84b014986fdb259eb60bd3e5a3fbcfcb218969f5f5Keith Whitwell{
859bdfee3a470a535ebe31074651fbacf680bcea6aIan Romanick   SET_ArrayElement(tab, vfmt->ArrayElement);
869bdfee3a470a535ebe31074651fbacf680bcea6aIan Romanick   SET_Color3f(tab, vfmt->Color3f);
879bdfee3a470a535ebe31074651fbacf680bcea6aIan Romanick   SET_Color3fv(tab, vfmt->Color3fv);
889bdfee3a470a535ebe31074651fbacf680bcea6aIan Romanick   SET_Color4f(tab, vfmt->Color4f);
899bdfee3a470a535ebe31074651fbacf680bcea6aIan Romanick   SET_Color4fv(tab, vfmt->Color4fv);
909bdfee3a470a535ebe31074651fbacf680bcea6aIan Romanick   SET_EdgeFlag(tab, vfmt->EdgeFlag);
919bdfee3a470a535ebe31074651fbacf680bcea6aIan Romanick   SET_EvalCoord1f(tab, vfmt->EvalCoord1f);
929bdfee3a470a535ebe31074651fbacf680bcea6aIan Romanick   SET_EvalCoord1fv(tab, vfmt->EvalCoord1fv);
939bdfee3a470a535ebe31074651fbacf680bcea6aIan Romanick   SET_EvalCoord2f(tab, vfmt->EvalCoord2f);
949bdfee3a470a535ebe31074651fbacf680bcea6aIan Romanick   SET_EvalCoord2fv(tab, vfmt->EvalCoord2fv);
959bdfee3a470a535ebe31074651fbacf680bcea6aIan Romanick   SET_EvalPoint1(tab, vfmt->EvalPoint1);
969bdfee3a470a535ebe31074651fbacf680bcea6aIan Romanick   SET_EvalPoint2(tab, vfmt->EvalPoint2);
979bdfee3a470a535ebe31074651fbacf680bcea6aIan Romanick   SET_FogCoordfEXT(tab, vfmt->FogCoordfEXT);
989bdfee3a470a535ebe31074651fbacf680bcea6aIan Romanick   SET_FogCoordfvEXT(tab, vfmt->FogCoordfvEXT);
999bdfee3a470a535ebe31074651fbacf680bcea6aIan Romanick   SET_Indexf(tab, vfmt->Indexf);
1009bdfee3a470a535ebe31074651fbacf680bcea6aIan Romanick   SET_Indexfv(tab, vfmt->Indexfv);
1019bdfee3a470a535ebe31074651fbacf680bcea6aIan Romanick   SET_Materialfv(tab, vfmt->Materialfv);
1029bdfee3a470a535ebe31074651fbacf680bcea6aIan Romanick   SET_MultiTexCoord1fARB(tab, vfmt->MultiTexCoord1fARB);
1039bdfee3a470a535ebe31074651fbacf680bcea6aIan Romanick   SET_MultiTexCoord1fvARB(tab, vfmt->MultiTexCoord1fvARB);
1049bdfee3a470a535ebe31074651fbacf680bcea6aIan Romanick   SET_MultiTexCoord2fARB(tab, vfmt->MultiTexCoord2fARB);
1059bdfee3a470a535ebe31074651fbacf680bcea6aIan Romanick   SET_MultiTexCoord2fvARB(tab, vfmt->MultiTexCoord2fvARB);
1069bdfee3a470a535ebe31074651fbacf680bcea6aIan Romanick   SET_MultiTexCoord3fARB(tab, vfmt->MultiTexCoord3fARB);
1079bdfee3a470a535ebe31074651fbacf680bcea6aIan Romanick   SET_MultiTexCoord3fvARB(tab, vfmt->MultiTexCoord3fvARB);
1089bdfee3a470a535ebe31074651fbacf680bcea6aIan Romanick   SET_MultiTexCoord4fARB(tab, vfmt->MultiTexCoord4fARB);
1099bdfee3a470a535ebe31074651fbacf680bcea6aIan Romanick   SET_MultiTexCoord4fvARB(tab, vfmt->MultiTexCoord4fvARB);
1109bdfee3a470a535ebe31074651fbacf680bcea6aIan Romanick   SET_Normal3f(tab, vfmt->Normal3f);
1119bdfee3a470a535ebe31074651fbacf680bcea6aIan Romanick   SET_Normal3fv(tab, vfmt->Normal3fv);
1129bdfee3a470a535ebe31074651fbacf680bcea6aIan Romanick   SET_SecondaryColor3fEXT(tab, vfmt->SecondaryColor3fEXT);
1139bdfee3a470a535ebe31074651fbacf680bcea6aIan Romanick   SET_SecondaryColor3fvEXT(tab, vfmt->SecondaryColor3fvEXT);
1149bdfee3a470a535ebe31074651fbacf680bcea6aIan Romanick   SET_TexCoord1f(tab, vfmt->TexCoord1f);
1159bdfee3a470a535ebe31074651fbacf680bcea6aIan Romanick   SET_TexCoord1fv(tab, vfmt->TexCoord1fv);
1169bdfee3a470a535ebe31074651fbacf680bcea6aIan Romanick   SET_TexCoord2f(tab, vfmt->TexCoord2f);
1179bdfee3a470a535ebe31074651fbacf680bcea6aIan Romanick   SET_TexCoord2fv(tab, vfmt->TexCoord2fv);
1189bdfee3a470a535ebe31074651fbacf680bcea6aIan Romanick   SET_TexCoord3f(tab, vfmt->TexCoord3f);
1199bdfee3a470a535ebe31074651fbacf680bcea6aIan Romanick   SET_TexCoord3fv(tab, vfmt->TexCoord3fv);
1209bdfee3a470a535ebe31074651fbacf680bcea6aIan Romanick   SET_TexCoord4f(tab, vfmt->TexCoord4f);
1219bdfee3a470a535ebe31074651fbacf680bcea6aIan Romanick   SET_TexCoord4fv(tab, vfmt->TexCoord4fv);
1229bdfee3a470a535ebe31074651fbacf680bcea6aIan Romanick   SET_Vertex2f(tab, vfmt->Vertex2f);
1239bdfee3a470a535ebe31074651fbacf680bcea6aIan Romanick   SET_Vertex2fv(tab, vfmt->Vertex2fv);
1249bdfee3a470a535ebe31074651fbacf680bcea6aIan Romanick   SET_Vertex3f(tab, vfmt->Vertex3f);
1259bdfee3a470a535ebe31074651fbacf680bcea6aIan Romanick   SET_Vertex3fv(tab, vfmt->Vertex3fv);
1269bdfee3a470a535ebe31074651fbacf680bcea6aIan Romanick   SET_Vertex4f(tab, vfmt->Vertex4f);
1279bdfee3a470a535ebe31074651fbacf680bcea6aIan Romanick   SET_Vertex4fv(tab, vfmt->Vertex4fv);
1289bdfee3a470a535ebe31074651fbacf680bcea6aIan Romanick   SET_CallList(tab, vfmt->CallList);
1299bdfee3a470a535ebe31074651fbacf680bcea6aIan Romanick   SET_CallLists(tab, vfmt->CallLists);
1309bdfee3a470a535ebe31074651fbacf680bcea6aIan Romanick   SET_Begin(tab, vfmt->Begin);
1319bdfee3a470a535ebe31074651fbacf680bcea6aIan Romanick   SET_End(tab, vfmt->End);
132095c6699f449ed4803f23e844cc0227743a9c3e1Brian Paul   SET_Rectf(tab, vfmt->Rectf);
133095c6699f449ed4803f23e844cc0227743a9c3e1Brian Paul   SET_DrawArrays(tab, vfmt->DrawArrays);
134095c6699f449ed4803f23e844cc0227743a9c3e1Brian Paul   SET_DrawElements(tab, vfmt->DrawElements);
135095c6699f449ed4803f23e844cc0227743a9c3e1Brian Paul   SET_DrawRangeElements(tab, vfmt->DrawRangeElements);
13660b08eb1fdf287d28ec66b9282513ab35a61aee0Eric Anholt   SET_MultiDrawElementsEXT(tab, vfmt->MultiDrawElementsEXT);
137095c6699f449ed4803f23e844cc0227743a9c3e1Brian Paul   SET_EvalMesh1(tab, vfmt->EvalMesh1);
138095c6699f449ed4803f23e844cc0227743a9c3e1Brian Paul   SET_EvalMesh2(tab, vfmt->EvalMesh2);
139095c6699f449ed4803f23e844cc0227743a9c3e1Brian Paul   ASSERT(tab->EvalMesh2);
140095c6699f449ed4803f23e844cc0227743a9c3e1Brian Paul
141095c6699f449ed4803f23e844cc0227743a9c3e1Brian Paul   /* GL_NV_vertex_program */
1429bdfee3a470a535ebe31074651fbacf680bcea6aIan Romanick   SET_VertexAttrib1fNV(tab, vfmt->VertexAttrib1fNV);
1439bdfee3a470a535ebe31074651fbacf680bcea6aIan Romanick   SET_VertexAttrib1fvNV(tab, vfmt->VertexAttrib1fvNV);
1449bdfee3a470a535ebe31074651fbacf680bcea6aIan Romanick   SET_VertexAttrib2fNV(tab, vfmt->VertexAttrib2fNV);
1459bdfee3a470a535ebe31074651fbacf680bcea6aIan Romanick   SET_VertexAttrib2fvNV(tab, vfmt->VertexAttrib2fvNV);
1469bdfee3a470a535ebe31074651fbacf680bcea6aIan Romanick   SET_VertexAttrib3fNV(tab, vfmt->VertexAttrib3fNV);
1479bdfee3a470a535ebe31074651fbacf680bcea6aIan Romanick   SET_VertexAttrib3fvNV(tab, vfmt->VertexAttrib3fvNV);
1489bdfee3a470a535ebe31074651fbacf680bcea6aIan Romanick   SET_VertexAttrib4fNV(tab, vfmt->VertexAttrib4fNV);
1499bdfee3a470a535ebe31074651fbacf680bcea6aIan Romanick   SET_VertexAttrib4fvNV(tab, vfmt->VertexAttrib4fvNV);
150095c6699f449ed4803f23e844cc0227743a9c3e1Brian Paul#if FEATURE_ARB_vertex_program
1519bdfee3a470a535ebe31074651fbacf680bcea6aIan Romanick   SET_VertexAttrib1fARB(tab, vfmt->VertexAttrib1fARB);
1529bdfee3a470a535ebe31074651fbacf680bcea6aIan Romanick   SET_VertexAttrib1fvARB(tab, vfmt->VertexAttrib1fvARB);
1539bdfee3a470a535ebe31074651fbacf680bcea6aIan Romanick   SET_VertexAttrib2fARB(tab, vfmt->VertexAttrib2fARB);
1549bdfee3a470a535ebe31074651fbacf680bcea6aIan Romanick   SET_VertexAttrib2fvARB(tab, vfmt->VertexAttrib2fvARB);
1559bdfee3a470a535ebe31074651fbacf680bcea6aIan Romanick   SET_VertexAttrib3fARB(tab, vfmt->VertexAttrib3fARB);
1569bdfee3a470a535ebe31074651fbacf680bcea6aIan Romanick   SET_VertexAttrib3fvARB(tab, vfmt->VertexAttrib3fvARB);
1579bdfee3a470a535ebe31074651fbacf680bcea6aIan Romanick   SET_VertexAttrib4fARB(tab, vfmt->VertexAttrib4fARB);
1589bdfee3a470a535ebe31074651fbacf680bcea6aIan Romanick   SET_VertexAttrib4fvARB(tab, vfmt->VertexAttrib4fvARB);
159095c6699f449ed4803f23e844cc0227743a9c3e1Brian Paul#endif
160b014986fdb259eb60bd3e5a3fbcfcb218969f5f5Keith Whitwell}
161b014986fdb259eb60bd3e5a3fbcfcb218969f5f5Keith Whitwell
162b014986fdb259eb60bd3e5a3fbcfcb218969f5f5Keith Whitwell
163de6a2e0d194d1afa1a917cff7e80d77773b73c39Gareth Hughesvoid _mesa_init_exec_vtxfmt( GLcontext *ctx )
164b014986fdb259eb60bd3e5a3fbcfcb218969f5f5Keith Whitwell{
165d8aa0269cdadba1608522287bcb3b446c5848c09Gareth Hughes   install_vtxfmt( ctx->Exec, &neutral_vtxfmt );
166306d3fcdbad523428501833405e47e9897896defKeith Whitwell   ctx->TnlModule.SwapCount = 0;
167de6a2e0d194d1afa1a917cff7e80d77773b73c39Gareth Hughes}
168de6a2e0d194d1afa1a917cff7e80d77773b73c39Gareth Hughes
16922144ab7552f0799bcfca506bf4ffa7f70a06649Gareth Hughes
1700f1e19c03cdf5bd8a7c3db59cf395a0833ab0173Brian Paulvoid _mesa_install_exec_vtxfmt( GLcontext *ctx, const GLvertexformat *vfmt )
171de6a2e0d194d1afa1a917cff7e80d77773b73c39Gareth Hughes{
17257ffddba9870a0e602ae454e13072a0af48fa150Gareth Hughes   ctx->TnlModule.Current = vfmt;
173de6a2e0d194d1afa1a917cff7e80d77773b73c39Gareth Hughes   _mesa_restore_exec_vtxfmt( ctx );
174b014986fdb259eb60bd3e5a3fbcfcb218969f5f5Keith Whitwell}
175b014986fdb259eb60bd3e5a3fbcfcb218969f5f5Keith Whitwell
1760f1e19c03cdf5bd8a7c3db59cf395a0833ab0173Brian Paul
1770f1e19c03cdf5bd8a7c3db59cf395a0833ab0173Brian Paulvoid _mesa_install_save_vtxfmt( GLcontext *ctx, const GLvertexformat *vfmt )
178b014986fdb259eb60bd3e5a3fbcfcb218969f5f5Keith Whitwell{
179b014986fdb259eb60bd3e5a3fbcfcb218969f5f5Keith Whitwell   install_vtxfmt( ctx->Save, vfmt );
180b014986fdb259eb60bd3e5a3fbcfcb218969f5f5Keith Whitwell}
181b014986fdb259eb60bd3e5a3fbcfcb218969f5f5Keith Whitwell
18222144ab7552f0799bcfca506bf4ffa7f70a06649Gareth Hughes
183de6a2e0d194d1afa1a917cff7e80d77773b73c39Gareth Hughesvoid _mesa_restore_exec_vtxfmt( GLcontext *ctx )
184d8aa0269cdadba1608522287bcb3b446c5848c09Gareth Hughes{
185d8aa0269cdadba1608522287bcb3b446c5848c09Gareth Hughes   struct gl_tnl_module *tnl = &(ctx->TnlModule);
186d8aa0269cdadba1608522287bcb3b446c5848c09Gareth Hughes   GLuint i;
187d8aa0269cdadba1608522287bcb3b446c5848c09Gareth Hughes
188d8aa0269cdadba1608522287bcb3b446c5848c09Gareth Hughes   /* Restore the neutral tnl module wrapper.
189d8aa0269cdadba1608522287bcb3b446c5848c09Gareth Hughes    */
190d8aa0269cdadba1608522287bcb3b446c5848c09Gareth Hughes   for ( i = 0 ; i < tnl->SwapCount ; i++ ) {
1911585c234e0db4bfb7cd85c4111594f6da1582e6fIan Romanick      *(tnl->Swapped[i].location) = tnl->Swapped[i].function;
192d8aa0269cdadba1608522287bcb3b446c5848c09Gareth Hughes   }
193d8aa0269cdadba1608522287bcb3b446c5848c09Gareth Hughes
194d8aa0269cdadba1608522287bcb3b446c5848c09Gareth Hughes   tnl->SwapCount = 0;
195d8aa0269cdadba1608522287bcb3b446c5848c09Gareth Hughes}
196