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 */
44 static void
install_vtxfmt(struct gl_context * ctx,struct _glapi_table * tab,const GLvertexformat * vfmt)45 install_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_FogCoordhNV(tab, vfmt->FogCoordhNV);
227 SET_FogCoordhvNV(tab, vfmt->FogCoordhvNV);
228 SET_SecondaryColor3hNV(tab, vfmt->SecondaryColor3hNV);
229 SET_SecondaryColor3hvNV(tab, vfmt->SecondaryColor3hvNV);
230 }
231
232 if (_mesa_is_desktop_gl(ctx)) {
233 SET_VertexAttribP1ui(tab, vfmt->VertexAttribP1ui);
234 SET_VertexAttribP2ui(tab, vfmt->VertexAttribP2ui);
235 SET_VertexAttribP3ui(tab, vfmt->VertexAttribP3ui);
236 SET_VertexAttribP4ui(tab, vfmt->VertexAttribP4ui);
237
238 SET_VertexAttribP1uiv(tab, vfmt->VertexAttribP1uiv);
239 SET_VertexAttribP2uiv(tab, vfmt->VertexAttribP2uiv);
240 SET_VertexAttribP3uiv(tab, vfmt->VertexAttribP3uiv);
241 SET_VertexAttribP4uiv(tab, vfmt->VertexAttribP4uiv);
242
243 /* GL_ARB_bindless_texture */
244 SET_VertexAttribL1ui64ARB(tab, vfmt->VertexAttribL1ui64ARB);
245 SET_VertexAttribL1ui64vARB(tab, vfmt->VertexAttribL1ui64vARB);
246 }
247
248 if (_mesa_is_desktop_gl(ctx)) {
249 /* GL_ARB_vertex_attrib_64bit */
250 SET_VertexAttribL1d(tab, vfmt->VertexAttribL1d);
251 SET_VertexAttribL2d(tab, vfmt->VertexAttribL2d);
252 SET_VertexAttribL3d(tab, vfmt->VertexAttribL3d);
253 SET_VertexAttribL4d(tab, vfmt->VertexAttribL4d);
254
255 SET_VertexAttribL1dv(tab, vfmt->VertexAttribL1dv);
256 SET_VertexAttribL2dv(tab, vfmt->VertexAttribL2dv);
257 SET_VertexAttribL3dv(tab, vfmt->VertexAttribL3dv);
258 SET_VertexAttribL4dv(tab, vfmt->VertexAttribL4dv);
259 }
260
261 if (ctx->API != API_OPENGL_CORE && ctx->API != API_OPENGLES2) {
262 SET_Color4ub(tab, vfmt->Color4ub);
263 SET_Materialf(tab, vfmt->Materialf);
264 }
265 if (ctx->API == API_OPENGL_COMPAT) {
266 SET_Color3b(tab, vfmt->Color3b);
267 SET_Color3d(tab, vfmt->Color3d);
268 SET_Color3i(tab, vfmt->Color3i);
269 SET_Color3s(tab, vfmt->Color3s);
270 SET_Color3ui(tab, vfmt->Color3ui);
271 SET_Color3us(tab, vfmt->Color3us);
272 SET_Color3ub(tab, vfmt->Color3ub);
273 SET_Color4b(tab, vfmt->Color4b);
274 SET_Color4d(tab, vfmt->Color4d);
275 SET_Color4i(tab, vfmt->Color4i);
276 SET_Color4s(tab, vfmt->Color4s);
277 SET_Color4ui(tab, vfmt->Color4ui);
278 SET_Color4us(tab, vfmt->Color4us);
279 SET_Color3bv(tab, vfmt->Color3bv);
280 SET_Color3dv(tab, vfmt->Color3dv);
281 SET_Color3iv(tab, vfmt->Color3iv);
282 SET_Color3sv(tab, vfmt->Color3sv);
283 SET_Color3uiv(tab, vfmt->Color3uiv);
284 SET_Color3usv(tab, vfmt->Color3usv);
285 SET_Color3ubv(tab, vfmt->Color3ubv);
286 SET_Color4bv(tab, vfmt->Color4bv);
287 SET_Color4dv(tab, vfmt->Color4dv);
288 SET_Color4iv(tab, vfmt->Color4iv);
289 SET_Color4sv(tab, vfmt->Color4sv);
290 SET_Color4uiv(tab, vfmt->Color4uiv);
291 SET_Color4usv(tab, vfmt->Color4usv);
292 SET_Color4ubv(tab, vfmt->Color4ubv);
293
294 SET_SecondaryColor3b(tab, vfmt->SecondaryColor3b);
295 SET_SecondaryColor3d(tab, vfmt->SecondaryColor3d);
296 SET_SecondaryColor3i(tab, vfmt->SecondaryColor3i);
297 SET_SecondaryColor3s(tab, vfmt->SecondaryColor3s);
298 SET_SecondaryColor3ui(tab, vfmt->SecondaryColor3ui);
299 SET_SecondaryColor3us(tab, vfmt->SecondaryColor3us);
300 SET_SecondaryColor3ub(tab, vfmt->SecondaryColor3ub);
301 SET_SecondaryColor3bv(tab, vfmt->SecondaryColor3bv);
302 SET_SecondaryColor3dv(tab, vfmt->SecondaryColor3dv);
303 SET_SecondaryColor3iv(tab, vfmt->SecondaryColor3iv);
304 SET_SecondaryColor3sv(tab, vfmt->SecondaryColor3sv);
305 SET_SecondaryColor3uiv(tab, vfmt->SecondaryColor3uiv);
306 SET_SecondaryColor3usv(tab, vfmt->SecondaryColor3usv);
307 SET_SecondaryColor3ubv(tab, vfmt->SecondaryColor3ubv);
308
309 SET_EdgeFlagv(tab, vfmt->EdgeFlagv);
310
311 SET_Indexd(tab, vfmt->Indexd);
312 SET_Indexi(tab, vfmt->Indexi);
313 SET_Indexs(tab, vfmt->Indexs);
314 SET_Indexub(tab, vfmt->Indexub);
315 SET_Indexdv(tab, vfmt->Indexdv);
316 SET_Indexiv(tab, vfmt->Indexiv);
317 SET_Indexsv(tab, vfmt->Indexsv);
318 SET_Indexubv(tab, vfmt->Indexubv);
319 SET_Normal3b(tab, vfmt->Normal3b);
320 SET_Normal3d(tab, vfmt->Normal3d);
321 SET_Normal3i(tab, vfmt->Normal3i);
322 SET_Normal3s(tab, vfmt->Normal3s);
323 SET_Normal3bv(tab, vfmt->Normal3bv);
324 SET_Normal3dv(tab, vfmt->Normal3dv);
325 SET_Normal3iv(tab, vfmt->Normal3iv);
326 SET_Normal3sv(tab, vfmt->Normal3sv);
327 SET_TexCoord1d(tab, vfmt->TexCoord1d);
328 SET_TexCoord1i(tab, vfmt->TexCoord1i);
329 SET_TexCoord1s(tab, vfmt->TexCoord1s);
330 SET_TexCoord2d(tab, vfmt->TexCoord2d);
331 SET_TexCoord2s(tab, vfmt->TexCoord2s);
332 SET_TexCoord2i(tab, vfmt->TexCoord2i);
333 SET_TexCoord3d(tab, vfmt->TexCoord3d);
334 SET_TexCoord3i(tab, vfmt->TexCoord3i);
335 SET_TexCoord3s(tab, vfmt->TexCoord3s);
336 SET_TexCoord4d(tab, vfmt->TexCoord4d);
337 SET_TexCoord4i(tab, vfmt->TexCoord4i);
338 SET_TexCoord4s(tab, vfmt->TexCoord4s);
339 SET_TexCoord1dv(tab, vfmt->TexCoord1dv);
340 SET_TexCoord1iv(tab, vfmt->TexCoord1iv);
341 SET_TexCoord1sv(tab, vfmt->TexCoord1sv);
342 SET_TexCoord2dv(tab, vfmt->TexCoord2dv);
343 SET_TexCoord2iv(tab, vfmt->TexCoord2iv);
344 SET_TexCoord2sv(tab, vfmt->TexCoord2sv);
345 SET_TexCoord3dv(tab, vfmt->TexCoord3dv);
346 SET_TexCoord3iv(tab, vfmt->TexCoord3iv);
347 SET_TexCoord3sv(tab, vfmt->TexCoord3sv);
348 SET_TexCoord4dv(tab, vfmt->TexCoord4dv);
349 SET_TexCoord4iv(tab, vfmt->TexCoord4iv);
350 SET_TexCoord4sv(tab, vfmt->TexCoord4sv);
351 SET_Vertex2d(tab, vfmt->Vertex2d);
352 SET_Vertex2i(tab, vfmt->Vertex2i);
353 SET_Vertex2s(tab, vfmt->Vertex2s);
354 SET_Vertex3d(tab, vfmt->Vertex3d);
355 SET_Vertex3i(tab, vfmt->Vertex3i);
356 SET_Vertex3s(tab, vfmt->Vertex3s);
357 SET_Vertex4d(tab, vfmt->Vertex4d);
358 SET_Vertex4i(tab, vfmt->Vertex4i);
359 SET_Vertex4s(tab, vfmt->Vertex4s);
360 SET_Vertex2dv(tab, vfmt->Vertex2dv);
361 SET_Vertex2iv(tab, vfmt->Vertex2iv);
362 SET_Vertex2sv(tab, vfmt->Vertex2sv);
363 SET_Vertex3dv(tab, vfmt->Vertex3dv);
364 SET_Vertex3iv(tab, vfmt->Vertex3iv);
365 SET_Vertex3sv(tab, vfmt->Vertex3sv);
366 SET_Vertex4dv(tab, vfmt->Vertex4dv);
367 SET_Vertex4iv(tab, vfmt->Vertex4iv);
368 SET_Vertex4sv(tab, vfmt->Vertex4sv);
369 SET_MultiTexCoord1d(tab, vfmt->MultiTexCoord1d);
370 SET_MultiTexCoord1dv(tab, vfmt->MultiTexCoord1dv);
371 SET_MultiTexCoord1i(tab, vfmt->MultiTexCoord1i);
372 SET_MultiTexCoord1iv(tab, vfmt->MultiTexCoord1iv);
373 SET_MultiTexCoord1s(tab, vfmt->MultiTexCoord1s);
374 SET_MultiTexCoord1sv(tab, vfmt->MultiTexCoord1sv);
375 SET_MultiTexCoord2d(tab, vfmt->MultiTexCoord2d);
376 SET_MultiTexCoord2dv(tab, vfmt->MultiTexCoord2dv);
377 SET_MultiTexCoord2i(tab, vfmt->MultiTexCoord2i);
378 SET_MultiTexCoord2iv(tab, vfmt->MultiTexCoord2iv);
379 SET_MultiTexCoord2s(tab, vfmt->MultiTexCoord2s);
380 SET_MultiTexCoord2sv(tab, vfmt->MultiTexCoord2sv);
381 SET_MultiTexCoord3d(tab, vfmt->MultiTexCoord3d);
382 SET_MultiTexCoord3dv(tab, vfmt->MultiTexCoord3dv);
383 SET_MultiTexCoord3i(tab, vfmt->MultiTexCoord3i);
384 SET_MultiTexCoord3iv(tab, vfmt->MultiTexCoord3iv);
385 SET_MultiTexCoord3s(tab, vfmt->MultiTexCoord3s);
386 SET_MultiTexCoord3sv(tab, vfmt->MultiTexCoord3sv);
387 SET_MultiTexCoord4d(tab, vfmt->MultiTexCoord4d);
388 SET_MultiTexCoord4dv(tab, vfmt->MultiTexCoord4dv);
389 SET_MultiTexCoord4i(tab, vfmt->MultiTexCoord4i);
390 SET_MultiTexCoord4iv(tab, vfmt->MultiTexCoord4iv);
391 SET_MultiTexCoord4s(tab, vfmt->MultiTexCoord4s);
392 SET_MultiTexCoord4sv(tab, vfmt->MultiTexCoord4sv);
393 SET_EvalCoord2dv(tab, vfmt->EvalCoord2dv);
394 SET_EvalCoord2d(tab, vfmt->EvalCoord2d);
395 SET_EvalCoord1dv(tab, vfmt->EvalCoord1dv);
396 SET_EvalCoord1d(tab, vfmt->EvalCoord1d);
397 SET_Materiali(tab, vfmt->Materiali);
398 SET_Materialiv(tab, vfmt->Materialiv);
399 SET_FogCoordd(tab, vfmt->FogCoordd);
400 SET_FogCoorddv(tab, vfmt->FogCoorddv);
401
402 SET_VertexAttrib1sNV(tab, vfmt->VertexAttrib1sNV);
403 SET_VertexAttrib1dNV(tab, vfmt->VertexAttrib1dNV);
404 SET_VertexAttrib2sNV(tab, vfmt->VertexAttrib2sNV);
405 SET_VertexAttrib2dNV(tab, vfmt->VertexAttrib2dNV);
406 SET_VertexAttrib3sNV(tab, vfmt->VertexAttrib3sNV);
407 SET_VertexAttrib3dNV(tab, vfmt->VertexAttrib3dNV);
408 SET_VertexAttrib4sNV(tab, vfmt->VertexAttrib4sNV);
409 SET_VertexAttrib4dNV(tab, vfmt->VertexAttrib4dNV);
410 SET_VertexAttrib4ubNV(tab, vfmt->VertexAttrib4ubNV);
411 SET_VertexAttrib1svNV(tab, vfmt->VertexAttrib1svNV);
412 SET_VertexAttrib1dvNV(tab, vfmt->VertexAttrib1dvNV);
413 SET_VertexAttrib2svNV(tab, vfmt->VertexAttrib2svNV);
414 SET_VertexAttrib2dvNV(tab, vfmt->VertexAttrib2dvNV);
415 SET_VertexAttrib3svNV(tab, vfmt->VertexAttrib3svNV);
416 SET_VertexAttrib3dvNV(tab, vfmt->VertexAttrib3dvNV);
417 SET_VertexAttrib4svNV(tab, vfmt->VertexAttrib4svNV);
418 SET_VertexAttrib4dvNV(tab, vfmt->VertexAttrib4dvNV);
419 SET_VertexAttrib4ubvNV(tab, vfmt->VertexAttrib4ubvNV);
420 SET_VertexAttribs1svNV(tab, vfmt->VertexAttribs1svNV);
421 SET_VertexAttribs1fvNV(tab, vfmt->VertexAttribs1fvNV);
422 SET_VertexAttribs1dvNV(tab, vfmt->VertexAttribs1dvNV);
423 SET_VertexAttribs2svNV(tab, vfmt->VertexAttribs2svNV);
424 SET_VertexAttribs2fvNV(tab, vfmt->VertexAttribs2fvNV);
425 SET_VertexAttribs2dvNV(tab, vfmt->VertexAttribs2dvNV);
426 SET_VertexAttribs3svNV(tab, vfmt->VertexAttribs3svNV);
427 SET_VertexAttribs3fvNV(tab, vfmt->VertexAttribs3fvNV);
428 SET_VertexAttribs3dvNV(tab, vfmt->VertexAttribs3dvNV);
429 SET_VertexAttribs4svNV(tab, vfmt->VertexAttribs4svNV);
430 SET_VertexAttribs4fvNV(tab, vfmt->VertexAttribs4fvNV);
431 SET_VertexAttribs4dvNV(tab, vfmt->VertexAttribs4dvNV);
432 SET_VertexAttribs4ubvNV(tab, vfmt->VertexAttribs4ubvNV);
433 }
434
435 if (_mesa_is_desktop_gl(ctx)) {
436 SET_VertexAttrib1s(tab, vfmt->VertexAttrib1s);
437 SET_VertexAttrib1d(tab, vfmt->VertexAttrib1d);
438 SET_VertexAttrib2s(tab, vfmt->VertexAttrib2s);
439 SET_VertexAttrib2d(tab, vfmt->VertexAttrib2d);
440 SET_VertexAttrib3s(tab, vfmt->VertexAttrib3s);
441 SET_VertexAttrib3d(tab, vfmt->VertexAttrib3d);
442 SET_VertexAttrib4s(tab, vfmt->VertexAttrib4s);
443 SET_VertexAttrib4d(tab, vfmt->VertexAttrib4d);
444 SET_VertexAttrib1sv(tab, vfmt->VertexAttrib1sv);
445 SET_VertexAttrib1dv(tab, vfmt->VertexAttrib1dv);
446 SET_VertexAttrib2sv(tab, vfmt->VertexAttrib2sv);
447 SET_VertexAttrib2dv(tab, vfmt->VertexAttrib2dv);
448 SET_VertexAttrib3sv(tab, vfmt->VertexAttrib3sv);
449 SET_VertexAttrib3dv(tab, vfmt->VertexAttrib3dv);
450 SET_VertexAttrib4sv(tab, vfmt->VertexAttrib4sv);
451 SET_VertexAttrib4dv(tab, vfmt->VertexAttrib4dv);
452 SET_VertexAttrib4Nub(tab, vfmt->VertexAttrib4Nub);
453 SET_VertexAttrib4Nubv(tab, vfmt->VertexAttrib4Nubv);
454 SET_VertexAttrib4bv(tab, vfmt->VertexAttrib4bv);
455 SET_VertexAttrib4iv(tab, vfmt->VertexAttrib4iv);
456 SET_VertexAttrib4ubv(tab, vfmt->VertexAttrib4ubv);
457 SET_VertexAttrib4usv(tab, vfmt->VertexAttrib4usv);
458 SET_VertexAttrib4uiv(tab, vfmt->VertexAttrib4uiv);
459 SET_VertexAttrib4Nbv(tab, vfmt->VertexAttrib4Nbv);
460 SET_VertexAttrib4Nsv(tab, vfmt->VertexAttrib4Nsv);
461 SET_VertexAttrib4Nusv(tab, vfmt->VertexAttrib4Nusv);
462 SET_VertexAttrib4Niv(tab, vfmt->VertexAttrib4Niv);
463 SET_VertexAttrib4Nuiv(tab, vfmt->VertexAttrib4Nuiv);
464
465 /* GL_EXT_gpu_shader4, GL 3.0 */
466 SET_VertexAttribI1iv(tab, vfmt->VertexAttribI1iv);
467 SET_VertexAttribI1uiv(tab, vfmt->VertexAttribI1uiv);
468 SET_VertexAttribI4bv(tab, vfmt->VertexAttribI4bv);
469 SET_VertexAttribI4sv(tab, vfmt->VertexAttribI4sv);
470 SET_VertexAttribI4ubv(tab, vfmt->VertexAttribI4ubv);
471 SET_VertexAttribI4usv(tab, vfmt->VertexAttribI4usv);
472 }
473 }
474
475
476 /**
477 * Install per-vertex functions into the API dispatch table for execution.
478 */
479 void
_mesa_install_exec_vtxfmt(struct gl_context * ctx,const GLvertexformat * vfmt)480 _mesa_install_exec_vtxfmt(struct gl_context *ctx, const GLvertexformat *vfmt)
481 {
482 install_vtxfmt(ctx, ctx->Exec, vfmt);
483 if (ctx->BeginEnd)
484 install_vtxfmt(ctx, ctx->BeginEnd, vfmt);
485 }
486
487
488 /**
489 * Install per-vertex functions into the API dispatch table for display
490 * list compilation.
491 */
492 void
_mesa_install_save_vtxfmt(struct gl_context * ctx,const GLvertexformat * vfmt)493 _mesa_install_save_vtxfmt(struct gl_context *ctx, const GLvertexformat *vfmt)
494 {
495 if (_mesa_is_desktop_gl(ctx))
496 install_vtxfmt(ctx, ctx->Save, vfmt);
497 }
498
499
500 /**
501 * Install VBO vtxfmt functions.
502 *
503 * This function depends on ctx->Version.
504 */
505 void
_mesa_initialize_vbo_vtxfmt(struct gl_context * ctx)506 _mesa_initialize_vbo_vtxfmt(struct gl_context *ctx)
507 {
508 _vbo_install_exec_vtxfmt(ctx);
509 if (ctx->API == API_OPENGL_COMPAT) {
510 _mesa_install_save_vtxfmt(ctx, &ctx->ListState.ListVtxfmt);
511 }
512 }
513
514