vtxfmt.c revision 7ec681f3
1/*
2 * Mesa 3-D graphics library
3 *
4 * Copyright (C) 1999-2004  Brian Paul   All Rights Reserved.
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the "Software"),
8 * to deal in the Software without restriction, including without limitation
9 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 * and/or sell copies of the Software, and to permit persons to whom the
11 * Software is furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included
14 * in all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
17 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
19 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
20 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22 * OTHER DEALINGS IN THE SOFTWARE.
23 *
24 * Authors:
25 *    Keith Whitwell <keithw@vmware.com> Gareth Hughes
26 */
27
28#include "glheader.h"
29#include "api_arrayelt.h"
30#include "context.h"
31
32#include "mtypes.h"
33#include "vtxfmt.h"
34#include "eval.h"
35#include "dlist.h"
36#include "main/dispatch.h"
37#include "vbo/vbo.h"
38
39
40/**
41 * Copy the functions found in the GLvertexformat object into the
42 * dispatch table.
43 */
44static void
45install_vtxfmt(struct gl_context *ctx, struct _glapi_table *tab,
46               const GLvertexformat *vfmt)
47{
48   assert(ctx->Version > 0);
49
50   if (ctx->API != API_OPENGL_CORE && ctx->API != API_OPENGLES2) {
51      SET_Color4f(tab, vfmt->Color4f);
52   }
53
54   if (ctx->API == API_OPENGL_COMPAT) {
55      _mesa_install_arrayelt_vtxfmt(tab, vfmt);
56      SET_Color3f(tab, vfmt->Color3f);
57      SET_Color3fv(tab, vfmt->Color3fv);
58      SET_Color4fv(tab, vfmt->Color4fv);
59      SET_EdgeFlag(tab, vfmt->EdgeFlag);
60   }
61
62   if (ctx->API == API_OPENGL_COMPAT) {
63      _mesa_install_eval_vtxfmt(tab, vfmt);
64   }
65
66   if (ctx->API != API_OPENGL_CORE && ctx->API != API_OPENGLES2) {
67      SET_Materialfv(tab, vfmt->Materialfv);
68      SET_MultiTexCoord4fARB(tab, vfmt->MultiTexCoord4fARB);
69      SET_Normal3f(tab, vfmt->Normal3f);
70   }
71
72   if (ctx->API == API_OPENGL_COMPAT) {
73      SET_FogCoordfEXT(tab, vfmt->FogCoordfEXT);
74      SET_FogCoordfvEXT(tab, vfmt->FogCoordfvEXT);
75      SET_Indexf(tab, vfmt->Indexf);
76      SET_Indexfv(tab, vfmt->Indexfv);
77      SET_MultiTexCoord1fARB(tab, vfmt->MultiTexCoord1fARB);
78      SET_MultiTexCoord1fvARB(tab, vfmt->MultiTexCoord1fvARB);
79      SET_MultiTexCoord2fARB(tab, vfmt->MultiTexCoord2fARB);
80      SET_MultiTexCoord2fvARB(tab, vfmt->MultiTexCoord2fvARB);
81      SET_MultiTexCoord3fARB(tab, vfmt->MultiTexCoord3fARB);
82      SET_MultiTexCoord3fvARB(tab, vfmt->MultiTexCoord3fvARB);
83      SET_MultiTexCoord4fvARB(tab, vfmt->MultiTexCoord4fvARB);
84      SET_Normal3fv(tab, vfmt->Normal3fv);
85   }
86
87   if (ctx->API == API_OPENGL_COMPAT) {
88      SET_SecondaryColor3fEXT(tab, vfmt->SecondaryColor3fEXT);
89      SET_SecondaryColor3fvEXT(tab, vfmt->SecondaryColor3fvEXT);
90      SET_TexCoord1f(tab, vfmt->TexCoord1f);
91      SET_TexCoord1fv(tab, vfmt->TexCoord1fv);
92      SET_TexCoord2f(tab, vfmt->TexCoord2f);
93      SET_TexCoord2fv(tab, vfmt->TexCoord2fv);
94      SET_TexCoord3f(tab, vfmt->TexCoord3f);
95      SET_TexCoord3fv(tab, vfmt->TexCoord3fv);
96      SET_TexCoord4f(tab, vfmt->TexCoord4f);
97      SET_TexCoord4fv(tab, vfmt->TexCoord4fv);
98      SET_Vertex2f(tab, vfmt->Vertex2f);
99      SET_Vertex2fv(tab, vfmt->Vertex2fv);
100      SET_Vertex3f(tab, vfmt->Vertex3f);
101      SET_Vertex3fv(tab, vfmt->Vertex3fv);
102      SET_Vertex4f(tab, vfmt->Vertex4f);
103      SET_Vertex4fv(tab, vfmt->Vertex4fv);
104   }
105
106   if (ctx->API == API_OPENGL_COMPAT) {
107      _mesa_install_dlist_vtxfmt(tab, vfmt);   /* glCallList / glCallLists */
108
109      SET_Begin(tab, vfmt->Begin);
110      SET_End(tab, vfmt->End);
111      SET_PrimitiveRestartNV(tab, vfmt->PrimitiveRestartNV);
112   }
113
114   /* Originally for GL_NV_vertex_program, this is now only used by dlist.c */
115   if (ctx->API == API_OPENGL_COMPAT) {
116      SET_VertexAttrib1fNV(tab, vfmt->VertexAttrib1fNV);
117      SET_VertexAttrib1fvNV(tab, vfmt->VertexAttrib1fvNV);
118      SET_VertexAttrib2fNV(tab, vfmt->VertexAttrib2fNV);
119      SET_VertexAttrib2fvNV(tab, vfmt->VertexAttrib2fvNV);
120      SET_VertexAttrib3fNV(tab, vfmt->VertexAttrib3fNV);
121      SET_VertexAttrib3fvNV(tab, vfmt->VertexAttrib3fvNV);
122      SET_VertexAttrib4fNV(tab, vfmt->VertexAttrib4fNV);
123      SET_VertexAttrib4fvNV(tab, vfmt->VertexAttrib4fvNV);
124   }
125
126   if (ctx->API != API_OPENGLES) {
127      SET_VertexAttrib1fARB(tab, vfmt->VertexAttrib1fARB);
128      SET_VertexAttrib1fvARB(tab, vfmt->VertexAttrib1fvARB);
129      SET_VertexAttrib2fARB(tab, vfmt->VertexAttrib2fARB);
130      SET_VertexAttrib2fvARB(tab, vfmt->VertexAttrib2fvARB);
131      SET_VertexAttrib3fARB(tab, vfmt->VertexAttrib3fARB);
132      SET_VertexAttrib3fvARB(tab, vfmt->VertexAttrib3fvARB);
133      SET_VertexAttrib4fARB(tab, vfmt->VertexAttrib4fARB);
134      SET_VertexAttrib4fvARB(tab, vfmt->VertexAttrib4fvARB);
135   }
136
137   /* GL_EXT_gpu_shader4 / OpenGL 3.0 */
138   if (_mesa_is_desktop_gl(ctx)) {
139      SET_VertexAttribI1iEXT(tab, vfmt->VertexAttribI1i);
140      SET_VertexAttribI2iEXT(tab, vfmt->VertexAttribI2i);
141      SET_VertexAttribI3iEXT(tab, vfmt->VertexAttribI3i);
142      SET_VertexAttribI2ivEXT(tab, vfmt->VertexAttribI2iv);
143      SET_VertexAttribI3ivEXT(tab, vfmt->VertexAttribI3iv);
144
145      SET_VertexAttribI1uiEXT(tab, vfmt->VertexAttribI1ui);
146      SET_VertexAttribI2uiEXT(tab, vfmt->VertexAttribI2ui);
147      SET_VertexAttribI3uiEXT(tab, vfmt->VertexAttribI3ui);
148      SET_VertexAttribI2uivEXT(tab, vfmt->VertexAttribI2uiv);
149      SET_VertexAttribI3uivEXT(tab, vfmt->VertexAttribI3uiv);
150   }
151
152   if (_mesa_is_desktop_gl(ctx) || _mesa_is_gles3(ctx)) {
153      SET_VertexAttribI4iEXT(tab, vfmt->VertexAttribI4i);
154      SET_VertexAttribI4ivEXT(tab, vfmt->VertexAttribI4iv);
155      SET_VertexAttribI4uiEXT(tab, vfmt->VertexAttribI4ui);
156      SET_VertexAttribI4uivEXT(tab, vfmt->VertexAttribI4uiv);
157   }
158
159   if (ctx->API == API_OPENGL_COMPAT) {
160      /* GL_ARB_vertex_type_10_10_10_2_rev / GL 3.3 */
161      SET_VertexP2ui(tab, vfmt->VertexP2ui);
162      SET_VertexP2uiv(tab, vfmt->VertexP2uiv);
163      SET_VertexP3ui(tab, vfmt->VertexP3ui);
164      SET_VertexP3uiv(tab, vfmt->VertexP3uiv);
165      SET_VertexP4ui(tab, vfmt->VertexP4ui);
166      SET_VertexP4uiv(tab, vfmt->VertexP4uiv);
167
168      SET_TexCoordP1ui(tab, vfmt->TexCoordP1ui);
169      SET_TexCoordP1uiv(tab, vfmt->TexCoordP1uiv);
170      SET_TexCoordP2ui(tab, vfmt->TexCoordP2ui);
171      SET_TexCoordP2uiv(tab, vfmt->TexCoordP2uiv);
172      SET_TexCoordP3ui(tab, vfmt->TexCoordP3ui);
173      SET_TexCoordP3uiv(tab, vfmt->TexCoordP3uiv);
174      SET_TexCoordP4ui(tab, vfmt->TexCoordP4ui);
175      SET_TexCoordP4uiv(tab, vfmt->TexCoordP4uiv);
176
177      SET_MultiTexCoordP1ui(tab, vfmt->MultiTexCoordP1ui);
178      SET_MultiTexCoordP2ui(tab, vfmt->MultiTexCoordP2ui);
179      SET_MultiTexCoordP3ui(tab, vfmt->MultiTexCoordP3ui);
180      SET_MultiTexCoordP4ui(tab, vfmt->MultiTexCoordP4ui);
181      SET_MultiTexCoordP1uiv(tab, vfmt->MultiTexCoordP1uiv);
182      SET_MultiTexCoordP2uiv(tab, vfmt->MultiTexCoordP2uiv);
183      SET_MultiTexCoordP3uiv(tab, vfmt->MultiTexCoordP3uiv);
184      SET_MultiTexCoordP4uiv(tab, vfmt->MultiTexCoordP4uiv);
185
186      SET_NormalP3ui(tab, vfmt->NormalP3ui);
187      SET_NormalP3uiv(tab, vfmt->NormalP3uiv);
188
189      SET_ColorP3ui(tab, vfmt->ColorP3ui);
190      SET_ColorP4ui(tab, vfmt->ColorP4ui);
191      SET_ColorP3uiv(tab, vfmt->ColorP3uiv);
192      SET_ColorP4uiv(tab, vfmt->ColorP4uiv);
193
194      SET_SecondaryColorP3ui(tab, vfmt->SecondaryColorP3ui);
195      SET_SecondaryColorP3uiv(tab, vfmt->SecondaryColorP3uiv);
196
197      /* GL_NV_half_float */
198      SET_Vertex2hNV(tab, vfmt->Vertex2hNV);
199      SET_Vertex2hvNV(tab, vfmt->Vertex2hvNV);
200      SET_Vertex3hNV(tab, vfmt->Vertex3hNV);
201      SET_Vertex3hvNV(tab, vfmt->Vertex3hvNV);
202      SET_Vertex4hNV(tab, vfmt->Vertex4hNV);
203      SET_Vertex4hvNV(tab, vfmt->Vertex4hvNV);
204      SET_Normal3hNV(tab, vfmt->Normal3hNV);
205      SET_Normal3hvNV(tab, vfmt->Normal3hvNV);
206      SET_Color3hNV(tab, vfmt->Color3hNV);
207      SET_Color3hvNV(tab, vfmt->Color4hvNV);
208      SET_Color4hNV(tab, vfmt->Color4hNV);
209      SET_Color4hvNV(tab, vfmt->Color3hvNV);
210      SET_TexCoord1hNV(tab, vfmt->TexCoord1hNV);
211      SET_TexCoord1hvNV(tab, vfmt->TexCoord1hvNV);
212      SET_TexCoord2hNV(tab, vfmt->TexCoord2hNV);
213      SET_TexCoord2hvNV(tab, vfmt->TexCoord2hvNV);
214      SET_TexCoord3hNV(tab, vfmt->TexCoord3hNV);
215      SET_TexCoord3hvNV(tab, vfmt->TexCoord3hvNV);
216      SET_TexCoord4hNV(tab, vfmt->TexCoord4hNV);
217      SET_TexCoord4hvNV(tab, vfmt->TexCoord4hvNV);
218      SET_MultiTexCoord1hNV(tab, vfmt->MultiTexCoord1hNV);
219      SET_MultiTexCoord1hvNV(tab, vfmt->MultiTexCoord1hvNV);
220      SET_MultiTexCoord2hNV(tab, vfmt->MultiTexCoord2hNV);
221      SET_MultiTexCoord2hvNV(tab, vfmt->MultiTexCoord2hvNV);
222      SET_MultiTexCoord3hNV(tab, vfmt->MultiTexCoord3hNV);
223      SET_MultiTexCoord3hvNV(tab, vfmt->MultiTexCoord3hvNV);
224      SET_MultiTexCoord4hNV(tab, vfmt->MultiTexCoord4hNV);
225      SET_MultiTexCoord4hvNV(tab, vfmt->MultiTexCoord4hvNV);
226      SET_VertexAttrib1hNV(tab, vfmt->VertexAttrib1hNV);
227      SET_VertexAttrib2hNV(tab, vfmt->VertexAttrib2hNV);
228      SET_VertexAttrib3hNV(tab, vfmt->VertexAttrib3hNV);
229      SET_VertexAttrib4hNV(tab, vfmt->VertexAttrib4hNV);
230      SET_VertexAttrib1hvNV(tab, vfmt->VertexAttrib1hvNV);
231      SET_VertexAttrib2hvNV(tab, vfmt->VertexAttrib2hvNV);
232      SET_VertexAttrib3hvNV(tab, vfmt->VertexAttrib3hvNV);
233      SET_VertexAttrib4hvNV(tab, vfmt->VertexAttrib4hvNV);
234      SET_VertexAttribs1hvNV(tab, vfmt->VertexAttribs1hvNV);
235      SET_VertexAttribs2hvNV(tab, vfmt->VertexAttribs2hvNV);
236      SET_VertexAttribs3hvNV(tab, vfmt->VertexAttribs3hvNV);
237      SET_VertexAttribs4hvNV(tab, vfmt->VertexAttribs4hvNV);
238      SET_FogCoordhNV(tab, vfmt->FogCoordhNV);
239      SET_FogCoordhvNV(tab, vfmt->FogCoordhvNV);
240      SET_SecondaryColor3hNV(tab, vfmt->SecondaryColor3hNV);
241      SET_SecondaryColor3hvNV(tab, vfmt->SecondaryColor3hvNV);
242   }
243
244   if (_mesa_is_desktop_gl(ctx)) {
245      SET_VertexAttribP1ui(tab, vfmt->VertexAttribP1ui);
246      SET_VertexAttribP2ui(tab, vfmt->VertexAttribP2ui);
247      SET_VertexAttribP3ui(tab, vfmt->VertexAttribP3ui);
248      SET_VertexAttribP4ui(tab, vfmt->VertexAttribP4ui);
249
250      SET_VertexAttribP1uiv(tab, vfmt->VertexAttribP1uiv);
251      SET_VertexAttribP2uiv(tab, vfmt->VertexAttribP2uiv);
252      SET_VertexAttribP3uiv(tab, vfmt->VertexAttribP3uiv);
253      SET_VertexAttribP4uiv(tab, vfmt->VertexAttribP4uiv);
254
255      /* GL_ARB_bindless_texture */
256      SET_VertexAttribL1ui64ARB(tab, vfmt->VertexAttribL1ui64ARB);
257      SET_VertexAttribL1ui64vARB(tab, vfmt->VertexAttribL1ui64vARB);
258   }
259
260   if (_mesa_is_desktop_gl(ctx)) {
261      /* GL_ARB_vertex_attrib_64bit */
262      SET_VertexAttribL1d(tab, vfmt->VertexAttribL1d);
263      SET_VertexAttribL2d(tab, vfmt->VertexAttribL2d);
264      SET_VertexAttribL3d(tab, vfmt->VertexAttribL3d);
265      SET_VertexAttribL4d(tab, vfmt->VertexAttribL4d);
266
267      SET_VertexAttribL1dv(tab, vfmt->VertexAttribL1dv);
268      SET_VertexAttribL2dv(tab, vfmt->VertexAttribL2dv);
269      SET_VertexAttribL3dv(tab, vfmt->VertexAttribL3dv);
270      SET_VertexAttribL4dv(tab, vfmt->VertexAttribL4dv);
271   }
272
273   if (ctx->API != API_OPENGL_CORE && ctx->API != API_OPENGLES2) {
274      SET_Color4ub(tab, vfmt->Color4ub);
275      SET_Materialf(tab, vfmt->Materialf);
276   }
277   if (ctx->API == API_OPENGL_COMPAT) {
278      SET_Color3b(tab, vfmt->Color3b);
279      SET_Color3d(tab, vfmt->Color3d);
280      SET_Color3i(tab, vfmt->Color3i);
281      SET_Color3s(tab, vfmt->Color3s);
282      SET_Color3ui(tab, vfmt->Color3ui);
283      SET_Color3us(tab, vfmt->Color3us);
284      SET_Color3ub(tab, vfmt->Color3ub);
285      SET_Color4b(tab, vfmt->Color4b);
286      SET_Color4d(tab, vfmt->Color4d);
287      SET_Color4i(tab, vfmt->Color4i);
288      SET_Color4s(tab, vfmt->Color4s);
289      SET_Color4ui(tab, vfmt->Color4ui);
290      SET_Color4us(tab, vfmt->Color4us);
291      SET_Color3bv(tab, vfmt->Color3bv);
292      SET_Color3dv(tab, vfmt->Color3dv);
293      SET_Color3iv(tab, vfmt->Color3iv);
294      SET_Color3sv(tab, vfmt->Color3sv);
295      SET_Color3uiv(tab, vfmt->Color3uiv);
296      SET_Color3usv(tab, vfmt->Color3usv);
297      SET_Color3ubv(tab, vfmt->Color3ubv);
298      SET_Color4bv(tab, vfmt->Color4bv);
299      SET_Color4dv(tab, vfmt->Color4dv);
300      SET_Color4iv(tab, vfmt->Color4iv);
301      SET_Color4sv(tab, vfmt->Color4sv);
302      SET_Color4uiv(tab, vfmt->Color4uiv);
303      SET_Color4usv(tab, vfmt->Color4usv);
304      SET_Color4ubv(tab, vfmt->Color4ubv);
305
306      SET_SecondaryColor3b(tab, vfmt->SecondaryColor3b);
307      SET_SecondaryColor3d(tab, vfmt->SecondaryColor3d);
308      SET_SecondaryColor3i(tab, vfmt->SecondaryColor3i);
309      SET_SecondaryColor3s(tab, vfmt->SecondaryColor3s);
310      SET_SecondaryColor3ui(tab, vfmt->SecondaryColor3ui);
311      SET_SecondaryColor3us(tab, vfmt->SecondaryColor3us);
312      SET_SecondaryColor3ub(tab, vfmt->SecondaryColor3ub);
313      SET_SecondaryColor3bv(tab, vfmt->SecondaryColor3bv);
314      SET_SecondaryColor3dv(tab, vfmt->SecondaryColor3dv);
315      SET_SecondaryColor3iv(tab, vfmt->SecondaryColor3iv);
316      SET_SecondaryColor3sv(tab, vfmt->SecondaryColor3sv);
317      SET_SecondaryColor3uiv(tab, vfmt->SecondaryColor3uiv);
318      SET_SecondaryColor3usv(tab, vfmt->SecondaryColor3usv);
319      SET_SecondaryColor3ubv(tab, vfmt->SecondaryColor3ubv);
320
321      SET_EdgeFlagv(tab, vfmt->EdgeFlagv);
322
323      SET_Indexd(tab, vfmt->Indexd);
324      SET_Indexi(tab, vfmt->Indexi);
325      SET_Indexs(tab, vfmt->Indexs);
326      SET_Indexub(tab, vfmt->Indexub);
327      SET_Indexdv(tab, vfmt->Indexdv);
328      SET_Indexiv(tab, vfmt->Indexiv);
329      SET_Indexsv(tab, vfmt->Indexsv);
330      SET_Indexubv(tab, vfmt->Indexubv);
331      SET_Normal3b(tab, vfmt->Normal3b);
332      SET_Normal3d(tab, vfmt->Normal3d);
333      SET_Normal3i(tab, vfmt->Normal3i);
334      SET_Normal3s(tab, vfmt->Normal3s);
335      SET_Normal3bv(tab, vfmt->Normal3bv);
336      SET_Normal3dv(tab, vfmt->Normal3dv);
337      SET_Normal3iv(tab, vfmt->Normal3iv);
338      SET_Normal3sv(tab, vfmt->Normal3sv);
339      SET_TexCoord1d(tab, vfmt->TexCoord1d);
340      SET_TexCoord1i(tab, vfmt->TexCoord1i);
341      SET_TexCoord1s(tab, vfmt->TexCoord1s);
342      SET_TexCoord2d(tab, vfmt->TexCoord2d);
343      SET_TexCoord2s(tab, vfmt->TexCoord2s);
344      SET_TexCoord2i(tab, vfmt->TexCoord2i);
345      SET_TexCoord3d(tab, vfmt->TexCoord3d);
346      SET_TexCoord3i(tab, vfmt->TexCoord3i);
347      SET_TexCoord3s(tab, vfmt->TexCoord3s);
348      SET_TexCoord4d(tab, vfmt->TexCoord4d);
349      SET_TexCoord4i(tab, vfmt->TexCoord4i);
350      SET_TexCoord4s(tab, vfmt->TexCoord4s);
351      SET_TexCoord1dv(tab, vfmt->TexCoord1dv);
352      SET_TexCoord1iv(tab, vfmt->TexCoord1iv);
353      SET_TexCoord1sv(tab, vfmt->TexCoord1sv);
354      SET_TexCoord2dv(tab, vfmt->TexCoord2dv);
355      SET_TexCoord2iv(tab, vfmt->TexCoord2iv);
356      SET_TexCoord2sv(tab, vfmt->TexCoord2sv);
357      SET_TexCoord3dv(tab, vfmt->TexCoord3dv);
358      SET_TexCoord3iv(tab, vfmt->TexCoord3iv);
359      SET_TexCoord3sv(tab, vfmt->TexCoord3sv);
360      SET_TexCoord4dv(tab, vfmt->TexCoord4dv);
361      SET_TexCoord4iv(tab, vfmt->TexCoord4iv);
362      SET_TexCoord4sv(tab, vfmt->TexCoord4sv);
363      SET_Vertex2d(tab, vfmt->Vertex2d);
364      SET_Vertex2i(tab, vfmt->Vertex2i);
365      SET_Vertex2s(tab, vfmt->Vertex2s);
366      SET_Vertex3d(tab, vfmt->Vertex3d);
367      SET_Vertex3i(tab, vfmt->Vertex3i);
368      SET_Vertex3s(tab, vfmt->Vertex3s);
369      SET_Vertex4d(tab, vfmt->Vertex4d);
370      SET_Vertex4i(tab, vfmt->Vertex4i);
371      SET_Vertex4s(tab, vfmt->Vertex4s);
372      SET_Vertex2dv(tab, vfmt->Vertex2dv);
373      SET_Vertex2iv(tab, vfmt->Vertex2iv);
374      SET_Vertex2sv(tab, vfmt->Vertex2sv);
375      SET_Vertex3dv(tab, vfmt->Vertex3dv);
376      SET_Vertex3iv(tab, vfmt->Vertex3iv);
377      SET_Vertex3sv(tab, vfmt->Vertex3sv);
378      SET_Vertex4dv(tab, vfmt->Vertex4dv);
379      SET_Vertex4iv(tab, vfmt->Vertex4iv);
380      SET_Vertex4sv(tab, vfmt->Vertex4sv);
381      SET_MultiTexCoord1d(tab, vfmt->MultiTexCoord1d);
382      SET_MultiTexCoord1dv(tab, vfmt->MultiTexCoord1dv);
383      SET_MultiTexCoord1i(tab, vfmt->MultiTexCoord1i);
384      SET_MultiTexCoord1iv(tab, vfmt->MultiTexCoord1iv);
385      SET_MultiTexCoord1s(tab, vfmt->MultiTexCoord1s);
386      SET_MultiTexCoord1sv(tab, vfmt->MultiTexCoord1sv);
387      SET_MultiTexCoord2d(tab, vfmt->MultiTexCoord2d);
388      SET_MultiTexCoord2dv(tab, vfmt->MultiTexCoord2dv);
389      SET_MultiTexCoord2i(tab, vfmt->MultiTexCoord2i);
390      SET_MultiTexCoord2iv(tab, vfmt->MultiTexCoord2iv);
391      SET_MultiTexCoord2s(tab, vfmt->MultiTexCoord2s);
392      SET_MultiTexCoord2sv(tab, vfmt->MultiTexCoord2sv);
393      SET_MultiTexCoord3d(tab, vfmt->MultiTexCoord3d);
394      SET_MultiTexCoord3dv(tab, vfmt->MultiTexCoord3dv);
395      SET_MultiTexCoord3i(tab, vfmt->MultiTexCoord3i);
396      SET_MultiTexCoord3iv(tab, vfmt->MultiTexCoord3iv);
397      SET_MultiTexCoord3s(tab, vfmt->MultiTexCoord3s);
398      SET_MultiTexCoord3sv(tab, vfmt->MultiTexCoord3sv);
399      SET_MultiTexCoord4d(tab, vfmt->MultiTexCoord4d);
400      SET_MultiTexCoord4dv(tab, vfmt->MultiTexCoord4dv);
401      SET_MultiTexCoord4i(tab, vfmt->MultiTexCoord4i);
402      SET_MultiTexCoord4iv(tab, vfmt->MultiTexCoord4iv);
403      SET_MultiTexCoord4s(tab, vfmt->MultiTexCoord4s);
404      SET_MultiTexCoord4sv(tab, vfmt->MultiTexCoord4sv);
405      SET_EvalCoord2dv(tab, vfmt->EvalCoord2dv);
406      SET_EvalCoord2d(tab, vfmt->EvalCoord2d);
407      SET_EvalCoord1dv(tab, vfmt->EvalCoord1dv);
408      SET_EvalCoord1d(tab, vfmt->EvalCoord1d);
409      SET_Materiali(tab, vfmt->Materiali);
410      SET_Materialiv(tab, vfmt->Materialiv);
411      SET_FogCoordd(tab, vfmt->FogCoordd);
412      SET_FogCoorddv(tab, vfmt->FogCoorddv);
413
414      SET_VertexAttrib1sNV(tab, vfmt->VertexAttrib1sNV);
415      SET_VertexAttrib1dNV(tab, vfmt->VertexAttrib1dNV);
416      SET_VertexAttrib2sNV(tab, vfmt->VertexAttrib2sNV);
417      SET_VertexAttrib2dNV(tab, vfmt->VertexAttrib2dNV);
418      SET_VertexAttrib3sNV(tab, vfmt->VertexAttrib3sNV);
419      SET_VertexAttrib3dNV(tab, vfmt->VertexAttrib3dNV);
420      SET_VertexAttrib4sNV(tab, vfmt->VertexAttrib4sNV);
421      SET_VertexAttrib4dNV(tab, vfmt->VertexAttrib4dNV);
422      SET_VertexAttrib4ubNV(tab, vfmt->VertexAttrib4ubNV);
423      SET_VertexAttrib1svNV(tab, vfmt->VertexAttrib1svNV);
424      SET_VertexAttrib1dvNV(tab, vfmt->VertexAttrib1dvNV);
425      SET_VertexAttrib2svNV(tab, vfmt->VertexAttrib2svNV);
426      SET_VertexAttrib2dvNV(tab, vfmt->VertexAttrib2dvNV);
427      SET_VertexAttrib3svNV(tab, vfmt->VertexAttrib3svNV);
428      SET_VertexAttrib3dvNV(tab, vfmt->VertexAttrib3dvNV);
429      SET_VertexAttrib4svNV(tab, vfmt->VertexAttrib4svNV);
430      SET_VertexAttrib4dvNV(tab, vfmt->VertexAttrib4dvNV);
431      SET_VertexAttrib4ubvNV(tab, vfmt->VertexAttrib4ubvNV);
432      SET_VertexAttribs1svNV(tab, vfmt->VertexAttribs1svNV);
433      SET_VertexAttribs1fvNV(tab, vfmt->VertexAttribs1fvNV);
434      SET_VertexAttribs1dvNV(tab, vfmt->VertexAttribs1dvNV);
435      SET_VertexAttribs2svNV(tab, vfmt->VertexAttribs2svNV);
436      SET_VertexAttribs2fvNV(tab, vfmt->VertexAttribs2fvNV);
437      SET_VertexAttribs2dvNV(tab, vfmt->VertexAttribs2dvNV);
438      SET_VertexAttribs3svNV(tab, vfmt->VertexAttribs3svNV);
439      SET_VertexAttribs3fvNV(tab, vfmt->VertexAttribs3fvNV);
440      SET_VertexAttribs3dvNV(tab, vfmt->VertexAttribs3dvNV);
441      SET_VertexAttribs4svNV(tab, vfmt->VertexAttribs4svNV);
442      SET_VertexAttribs4fvNV(tab, vfmt->VertexAttribs4fvNV);
443      SET_VertexAttribs4dvNV(tab, vfmt->VertexAttribs4dvNV);
444      SET_VertexAttribs4ubvNV(tab, vfmt->VertexAttribs4ubvNV);
445   }
446
447   if (_mesa_is_desktop_gl(ctx)) {
448      SET_VertexAttrib1s(tab, vfmt->VertexAttrib1s);
449      SET_VertexAttrib1d(tab, vfmt->VertexAttrib1d);
450      SET_VertexAttrib2s(tab, vfmt->VertexAttrib2s);
451      SET_VertexAttrib2d(tab, vfmt->VertexAttrib2d);
452      SET_VertexAttrib3s(tab, vfmt->VertexAttrib3s);
453      SET_VertexAttrib3d(tab, vfmt->VertexAttrib3d);
454      SET_VertexAttrib4s(tab, vfmt->VertexAttrib4s);
455      SET_VertexAttrib4d(tab, vfmt->VertexAttrib4d);
456      SET_VertexAttrib1sv(tab, vfmt->VertexAttrib1sv);
457      SET_VertexAttrib1dv(tab, vfmt->VertexAttrib1dv);
458      SET_VertexAttrib2sv(tab, vfmt->VertexAttrib2sv);
459      SET_VertexAttrib2dv(tab, vfmt->VertexAttrib2dv);
460      SET_VertexAttrib3sv(tab, vfmt->VertexAttrib3sv);
461      SET_VertexAttrib3dv(tab, vfmt->VertexAttrib3dv);
462      SET_VertexAttrib4sv(tab, vfmt->VertexAttrib4sv);
463      SET_VertexAttrib4dv(tab, vfmt->VertexAttrib4dv);
464      SET_VertexAttrib4Nub(tab, vfmt->VertexAttrib4Nub);
465      SET_VertexAttrib4Nubv(tab, vfmt->VertexAttrib4Nubv);
466      SET_VertexAttrib4bv(tab, vfmt->VertexAttrib4bv);
467      SET_VertexAttrib4iv(tab, vfmt->VertexAttrib4iv);
468      SET_VertexAttrib4ubv(tab, vfmt->VertexAttrib4ubv);
469      SET_VertexAttrib4usv(tab, vfmt->VertexAttrib4usv);
470      SET_VertexAttrib4uiv(tab, vfmt->VertexAttrib4uiv);
471      SET_VertexAttrib4Nbv(tab, vfmt->VertexAttrib4Nbv);
472      SET_VertexAttrib4Nsv(tab, vfmt->VertexAttrib4Nsv);
473      SET_VertexAttrib4Nusv(tab, vfmt->VertexAttrib4Nusv);
474      SET_VertexAttrib4Niv(tab, vfmt->VertexAttrib4Niv);
475      SET_VertexAttrib4Nuiv(tab, vfmt->VertexAttrib4Nuiv);
476
477      /* GL_EXT_gpu_shader4, GL 3.0 */
478      SET_VertexAttribI1iv(tab, vfmt->VertexAttribI1iv);
479      SET_VertexAttribI1uiv(tab, vfmt->VertexAttribI1uiv);
480      SET_VertexAttribI4bv(tab, vfmt->VertexAttribI4bv);
481      SET_VertexAttribI4sv(tab, vfmt->VertexAttribI4sv);
482      SET_VertexAttribI4ubv(tab, vfmt->VertexAttribI4ubv);
483      SET_VertexAttribI4usv(tab, vfmt->VertexAttribI4usv);
484   }
485}
486
487
488/**
489 * Install per-vertex functions into the API dispatch table for execution.
490 */
491void
492_mesa_install_exec_vtxfmt(struct gl_context *ctx, const GLvertexformat *vfmt)
493{
494   install_vtxfmt(ctx, ctx->Exec, vfmt);
495   if (ctx->BeginEnd)
496      install_vtxfmt(ctx, ctx->BeginEnd, vfmt);
497}
498
499
500/**
501 * Install per-vertex functions into the API dispatch table for display
502 * list compilation.
503 */
504void
505_mesa_install_save_vtxfmt(struct gl_context *ctx, const GLvertexformat *vfmt)
506{
507   if (_mesa_is_desktop_gl(ctx))
508      install_vtxfmt(ctx, ctx->Save, vfmt);
509}
510
511
512/**
513 * Install VBO vtxfmt functions.
514 *
515 * This function depends on ctx->Version.
516 */
517void
518_mesa_initialize_vbo_vtxfmt(struct gl_context *ctx)
519{
520   _vbo_install_exec_vtxfmt(ctx);
521   if (ctx->API == API_OPENGL_COMPAT) {
522      _mesa_install_save_vtxfmt(ctx, &ctx->ListState.ListVtxfmt);
523   }
524}
525
526