mesa/tests: Sanity check the ES2 dispatch table
[mesa.git] / src / mesa / vbo / vbo_noop.c
1 /*
2 * Mesa 3-D graphics library
3 *
4 * Copyright (C) 1999-2006 Brian Paul All Rights Reserved.
5 * Copyright (C) 2011 VMware, Inc. All Rights Reserved.
6 *
7 * Permission is hereby granted, free of charge, to any person obtaining a
8 * copy of this software and associated documentation files (the "Software"),
9 * to deal in the Software without restriction, including without limitation
10 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
11 * and/or sell copies of the Software, and to permit persons to whom the
12 * Software is furnished to do so, subject to the following conditions:
13 *
14 * The above copyright notice and this permission notice shall be included
15 * in all copies or substantial portions of the Software.
16 *
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20 * THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
21 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 */
24
25
26 /**
27 * GLvertexformat no-op functions. Used in out-of-memory situations.
28 */
29
30
31 #include "main/glheader.h"
32 #include "main/api_arrayelt.h"
33 #include "main/context.h"
34 #include "main/dispatch.h"
35 #include "main/dlist.h"
36 #include "main/eval.h"
37 #include "main/mfeatures.h"
38 #include "vbo/vbo_noop.h"
39
40 static void GLAPIENTRY
41 _mesa_noop_EdgeFlag(GLboolean b)
42 {
43 }
44
45 static void GLAPIENTRY
46 _mesa_noop_Indexf(GLfloat f)
47 {
48 }
49
50 static void GLAPIENTRY
51 _mesa_noop_Indexfv(const GLfloat * v)
52 {
53 }
54
55 static void GLAPIENTRY
56 _mesa_noop_FogCoordfEXT(GLfloat a)
57 {
58 }
59
60 static void GLAPIENTRY
61 _mesa_noop_FogCoordfvEXT(const GLfloat * v)
62 {
63 }
64
65 static void GLAPIENTRY
66 _mesa_noop_Normal3f(GLfloat a, GLfloat b, GLfloat c)
67 {
68 }
69
70 static void GLAPIENTRY
71 _mesa_noop_Normal3fv(const GLfloat * v)
72 {
73 }
74
75 static void GLAPIENTRY
76 _mesa_noop_Color4f(GLfloat a, GLfloat b, GLfloat c, GLfloat d)
77 {
78 }
79
80 static void GLAPIENTRY
81 _mesa_noop_Color4fv(const GLfloat * v)
82 {
83 }
84
85 static void GLAPIENTRY
86 _mesa_noop_Color3f(GLfloat a, GLfloat b, GLfloat c)
87 {
88 }
89
90 static void GLAPIENTRY
91 _mesa_noop_Color3fv(const GLfloat * v)
92 {
93 }
94
95 static void GLAPIENTRY
96 _mesa_noop_MultiTexCoord1fARB(GLenum target, GLfloat a)
97 {
98 }
99
100 static void GLAPIENTRY
101 _mesa_noop_MultiTexCoord1fvARB(GLenum target, const GLfloat * v)
102 {
103 }
104
105 static void GLAPIENTRY
106 _mesa_noop_MultiTexCoord2fARB(GLenum target, GLfloat a, GLfloat b)
107 {
108 }
109
110 static void GLAPIENTRY
111 _mesa_noop_MultiTexCoord2fvARB(GLenum target, const GLfloat * v)
112 {
113 }
114
115 static void GLAPIENTRY
116 _mesa_noop_MultiTexCoord3fARB(GLenum target, GLfloat a, GLfloat b, GLfloat c)
117 {
118 }
119
120 static void GLAPIENTRY
121 _mesa_noop_MultiTexCoord3fvARB(GLenum target, const GLfloat * v)
122 {
123 }
124
125 static void GLAPIENTRY
126 _mesa_noop_MultiTexCoord4fARB(GLenum target, GLfloat a, GLfloat b,
127 GLfloat c, GLfloat d)
128 {
129 }
130
131 static void GLAPIENTRY
132 _mesa_noop_MultiTexCoord4fvARB(GLenum target, const GLfloat * v)
133 {
134 }
135
136 static void GLAPIENTRY
137 _mesa_noop_SecondaryColor3fEXT(GLfloat a, GLfloat b, GLfloat c)
138 {
139 }
140
141 static void GLAPIENTRY
142 _mesa_noop_SecondaryColor3fvEXT(const GLfloat * v)
143 {
144 }
145
146 static void GLAPIENTRY
147 _mesa_noop_TexCoord1f(GLfloat a)
148 {
149 }
150
151 static void GLAPIENTRY
152 _mesa_noop_TexCoord1fv(const GLfloat * v)
153 {
154 }
155
156 static void GLAPIENTRY
157 _mesa_noop_TexCoord2f(GLfloat a, GLfloat b)
158 {
159 }
160
161 static void GLAPIENTRY
162 _mesa_noop_TexCoord2fv(const GLfloat * v)
163 {
164 }
165
166 static void GLAPIENTRY
167 _mesa_noop_TexCoord3f(GLfloat a, GLfloat b, GLfloat c)
168 {
169 }
170
171 static void GLAPIENTRY
172 _mesa_noop_TexCoord3fv(const GLfloat * v)
173 {
174 }
175
176 static void GLAPIENTRY
177 _mesa_noop_TexCoord4f(GLfloat a, GLfloat b, GLfloat c, GLfloat d)
178 {
179 }
180
181 static void GLAPIENTRY
182 _mesa_noop_TexCoord4fv(const GLfloat * v)
183 {
184 }
185
186 static void GLAPIENTRY
187 _mesa_noop_VertexAttrib1fNV(GLuint index, GLfloat x)
188 {
189 }
190
191 static void GLAPIENTRY
192 _mesa_noop_VertexAttrib1fvNV(GLuint index, const GLfloat * v)
193 {
194 }
195
196 static void GLAPIENTRY
197 _mesa_noop_VertexAttrib2fNV(GLuint index, GLfloat x, GLfloat y)
198 {
199 }
200
201 static void GLAPIENTRY
202 _mesa_noop_VertexAttrib2fvNV(GLuint index, const GLfloat * v)
203 {
204 }
205
206 static void GLAPIENTRY
207 _mesa_noop_VertexAttrib3fNV(GLuint index, GLfloat x, GLfloat y, GLfloat z)
208 {
209 }
210
211 static void GLAPIENTRY
212 _mesa_noop_VertexAttrib3fvNV(GLuint index, const GLfloat * v)
213 {
214 }
215
216 static void GLAPIENTRY
217 _mesa_noop_VertexAttrib4fNV(GLuint index, GLfloat x,
218 GLfloat y, GLfloat z, GLfloat w)
219 {
220 }
221
222 static void GLAPIENTRY
223 _mesa_noop_VertexAttrib4fvNV(GLuint index, const GLfloat * v)
224 {
225 }
226
227
228 static void GLAPIENTRY
229 _mesa_noop_VertexAttrib1fARB(GLuint index, GLfloat x)
230 {
231 }
232
233 static void GLAPIENTRY
234 _mesa_noop_VertexAttrib1fvARB(GLuint index, const GLfloat * v)
235 {
236 }
237
238 static void GLAPIENTRY
239 _mesa_noop_VertexAttrib2fARB(GLuint index, GLfloat x, GLfloat y)
240 {
241 }
242
243 static void GLAPIENTRY
244 _mesa_noop_VertexAttrib2fvARB(GLuint index, const GLfloat * v)
245 {
246 }
247
248 static void GLAPIENTRY
249 _mesa_noop_VertexAttrib3fARB(GLuint index, GLfloat x, GLfloat y, GLfloat z)
250 {
251 }
252
253 static void GLAPIENTRY
254 _mesa_noop_VertexAttrib3fvARB(GLuint index, const GLfloat * v)
255 {
256 }
257
258 static void GLAPIENTRY
259 _mesa_noop_VertexAttrib4fARB(GLuint index, GLfloat x,
260 GLfloat y, GLfloat z, GLfloat w)
261 {
262 }
263
264 static void GLAPIENTRY
265 _mesa_noop_VertexAttrib4fvARB(GLuint index, const GLfloat * v)
266 {
267 }
268
269 static void GLAPIENTRY
270 _mesa_noop_Materialfv(GLenum face, GLenum pname, const GLfloat * params)
271 {
272 }
273
274 static void GLAPIENTRY
275 _mesa_noop_Vertex2fv(const GLfloat * v)
276 {
277 }
278
279 static void GLAPIENTRY
280 _mesa_noop_Vertex3fv(const GLfloat * v)
281 {
282 }
283
284 static void GLAPIENTRY
285 _mesa_noop_Vertex4fv(const GLfloat * v)
286 {
287 }
288
289 static void GLAPIENTRY
290 _mesa_noop_Vertex2f(GLfloat a, GLfloat b)
291 {
292 }
293
294 static void GLAPIENTRY
295 _mesa_noop_Vertex3f(GLfloat a, GLfloat b, GLfloat c)
296 {
297 }
298
299 static void GLAPIENTRY
300 _mesa_noop_Vertex4f(GLfloat a, GLfloat b, GLfloat c, GLfloat d)
301 {
302 }
303
304 static void GLAPIENTRY
305 _mesa_noop_EvalCoord1f(GLfloat a)
306 {
307 }
308
309 static void GLAPIENTRY
310 _mesa_noop_EvalCoord1fv(const GLfloat * v)
311 {
312 }
313
314 static void GLAPIENTRY
315 _mesa_noop_EvalCoord2f(GLfloat a, GLfloat b)
316 {
317 }
318
319 static void GLAPIENTRY
320 _mesa_noop_EvalCoord2fv(const GLfloat * v)
321 {
322 }
323
324 static void GLAPIENTRY
325 _mesa_noop_EvalPoint1(GLint a)
326 {
327 }
328
329 static void GLAPIENTRY
330 _mesa_noop_EvalPoint2(GLint a, GLint b)
331 {
332 }
333
334 static void GLAPIENTRY
335 _mesa_noop_Begin(GLenum mode)
336 {
337 }
338
339 static void GLAPIENTRY
340 _mesa_noop_End(void)
341 {
342 }
343
344 static void GLAPIENTRY
345 _mesa_noop_PrimitiveRestartNV(void)
346 {
347 }
348
349
350 static void GLAPIENTRY
351 _mesa_noop_Rectf(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2)
352 {
353 }
354
355
356 static void GLAPIENTRY
357 _mesa_noop_DrawArrays(GLenum mode, GLint start, GLsizei count)
358 {
359 }
360
361 static void GLAPIENTRY
362 _mesa_noop_DrawElements(GLenum mode, GLsizei count, GLenum type,
363 const GLvoid * indices)
364 {
365 }
366
367 static void GLAPIENTRY
368 _mesa_noop_DrawElementsBaseVertex(GLenum mode, GLsizei count, GLenum type,
369 const GLvoid * indices, GLint basevertex)
370 {
371 }
372
373
374 static void GLAPIENTRY
375 _mesa_noop_DrawRangeElements(GLenum mode,
376 GLuint start, GLuint end,
377 GLsizei count, GLenum type,
378 const GLvoid * indices)
379 {
380 }
381
382 static void GLAPIENTRY
383 _mesa_noop_MultiDrawElements(GLenum mode, const GLsizei * count, GLenum type,
384 const GLvoid ** indices, GLsizei primcount)
385 {
386 }
387
388 static void GLAPIENTRY
389 _mesa_noop_DrawRangeElementsBaseVertex(GLenum mode,
390 GLuint start, GLuint end,
391 GLsizei count, GLenum type,
392 const GLvoid * indices,
393 GLint basevertex)
394 {
395 }
396
397 static void GLAPIENTRY
398 _mesa_noop_MultiDrawElementsBaseVertex(GLenum mode, const GLsizei * count,
399 GLenum type,
400 const GLvoid * const *indices,
401 GLsizei primcount,
402 const GLint * basevertex)
403 {
404 }
405
406 static void GLAPIENTRY
407 _mesa_noop_EvalMesh1(GLenum mode, GLint i1, GLint i2)
408 {
409 }
410
411 static void GLAPIENTRY
412 _mesa_noop_EvalMesh2(GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2)
413 {
414 }
415
416
417 /**
418 * Build a vertexformat of functions that are no-ops.
419 * These are used in out-of-memory situations when we have no VBO
420 * to put the vertex data into.
421 */
422 void
423 _mesa_noop_vtxfmt_init(GLvertexformat * vfmt)
424 {
425 _MESA_INIT_ARRAYELT_VTXFMT(vfmt, _ae_);
426
427 vfmt->Begin = _mesa_noop_Begin;
428
429 _MESA_INIT_DLIST_VTXFMT(vfmt, _mesa_);
430
431 vfmt->Color3f = _mesa_noop_Color3f;
432 vfmt->Color3fv = _mesa_noop_Color3fv;
433 vfmt->Color4f = _mesa_noop_Color4f;
434 vfmt->Color4fv = _mesa_noop_Color4fv;
435 vfmt->EdgeFlag = _mesa_noop_EdgeFlag;
436 vfmt->End = _mesa_noop_End;
437
438 vfmt->PrimitiveRestartNV = _mesa_noop_PrimitiveRestartNV;
439
440 _MESA_INIT_EVAL_VTXFMT(vfmt, _mesa_noop_);
441
442 vfmt->FogCoordfEXT = _mesa_noop_FogCoordfEXT;
443 vfmt->FogCoordfvEXT = _mesa_noop_FogCoordfvEXT;
444 vfmt->Indexf = _mesa_noop_Indexf;
445 vfmt->Indexfv = _mesa_noop_Indexfv;
446 vfmt->Materialfv = _mesa_noop_Materialfv;
447 vfmt->MultiTexCoord1fARB = _mesa_noop_MultiTexCoord1fARB;
448 vfmt->MultiTexCoord1fvARB = _mesa_noop_MultiTexCoord1fvARB;
449 vfmt->MultiTexCoord2fARB = _mesa_noop_MultiTexCoord2fARB;
450 vfmt->MultiTexCoord2fvARB = _mesa_noop_MultiTexCoord2fvARB;
451 vfmt->MultiTexCoord3fARB = _mesa_noop_MultiTexCoord3fARB;
452 vfmt->MultiTexCoord3fvARB = _mesa_noop_MultiTexCoord3fvARB;
453 vfmt->MultiTexCoord4fARB = _mesa_noop_MultiTexCoord4fARB;
454 vfmt->MultiTexCoord4fvARB = _mesa_noop_MultiTexCoord4fvARB;
455 vfmt->Normal3f = _mesa_noop_Normal3f;
456 vfmt->Normal3fv = _mesa_noop_Normal3fv;
457 vfmt->SecondaryColor3fEXT = _mesa_noop_SecondaryColor3fEXT;
458 vfmt->SecondaryColor3fvEXT = _mesa_noop_SecondaryColor3fvEXT;
459 vfmt->TexCoord1f = _mesa_noop_TexCoord1f;
460 vfmt->TexCoord1fv = _mesa_noop_TexCoord1fv;
461 vfmt->TexCoord2f = _mesa_noop_TexCoord2f;
462 vfmt->TexCoord2fv = _mesa_noop_TexCoord2fv;
463 vfmt->TexCoord3f = _mesa_noop_TexCoord3f;
464 vfmt->TexCoord3fv = _mesa_noop_TexCoord3fv;
465 vfmt->TexCoord4f = _mesa_noop_TexCoord4f;
466 vfmt->TexCoord4fv = _mesa_noop_TexCoord4fv;
467 vfmt->Vertex2f = _mesa_noop_Vertex2f;
468 vfmt->Vertex2fv = _mesa_noop_Vertex2fv;
469 vfmt->Vertex3f = _mesa_noop_Vertex3f;
470 vfmt->Vertex3fv = _mesa_noop_Vertex3fv;
471 vfmt->Vertex4f = _mesa_noop_Vertex4f;
472 vfmt->Vertex4fv = _mesa_noop_Vertex4fv;
473 vfmt->VertexAttrib1fNV = _mesa_noop_VertexAttrib1fNV;
474 vfmt->VertexAttrib1fvNV = _mesa_noop_VertexAttrib1fvNV;
475 vfmt->VertexAttrib2fNV = _mesa_noop_VertexAttrib2fNV;
476 vfmt->VertexAttrib2fvNV = _mesa_noop_VertexAttrib2fvNV;
477 vfmt->VertexAttrib3fNV = _mesa_noop_VertexAttrib3fNV;
478 vfmt->VertexAttrib3fvNV = _mesa_noop_VertexAttrib3fvNV;
479 vfmt->VertexAttrib4fNV = _mesa_noop_VertexAttrib4fNV;
480 vfmt->VertexAttrib4fvNV = _mesa_noop_VertexAttrib4fvNV;
481 vfmt->VertexAttrib1fARB = _mesa_noop_VertexAttrib1fARB;
482 vfmt->VertexAttrib1fvARB = _mesa_noop_VertexAttrib1fvARB;
483 vfmt->VertexAttrib2fARB = _mesa_noop_VertexAttrib2fARB;
484 vfmt->VertexAttrib2fvARB = _mesa_noop_VertexAttrib2fvARB;
485 vfmt->VertexAttrib3fARB = _mesa_noop_VertexAttrib3fARB;
486 vfmt->VertexAttrib3fvARB = _mesa_noop_VertexAttrib3fvARB;
487 vfmt->VertexAttrib4fARB = _mesa_noop_VertexAttrib4fARB;
488 vfmt->VertexAttrib4fvARB = _mesa_noop_VertexAttrib4fvARB;
489
490 vfmt->Rectf = _mesa_noop_Rectf;
491
492 vfmt->DrawArrays = _mesa_noop_DrawArrays;
493 vfmt->DrawElements = _mesa_noop_DrawElements;
494 vfmt->DrawRangeElements = _mesa_noop_DrawRangeElements;
495 vfmt->MultiDrawElementsEXT = _mesa_noop_MultiDrawElements;
496 vfmt->DrawElementsBaseVertex = _mesa_noop_DrawElementsBaseVertex;
497 vfmt->DrawRangeElementsBaseVertex = _mesa_noop_DrawRangeElementsBaseVertex;
498 vfmt->MultiDrawElementsBaseVertex = _mesa_noop_MultiDrawElementsBaseVertex;
499 }
500
501
502 /**
503 * Is the given dispatch table using the no-op functions?
504 */
505 GLboolean
506 _mesa_using_noop_vtxfmt(const struct _glapi_table *dispatch)
507 {
508 return GET_Begin((struct _glapi_table *) dispatch) == _mesa_noop_Begin;
509 }