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#if FEATURE_beginend
41
42
43static void GLAPIENTRY
44_mesa_noop_EdgeFlag(GLboolean b)
45{
46}
47
48static void GLAPIENTRY
49_mesa_noop_Indexf(GLfloat f)
50{
51}
52
53static void GLAPIENTRY
54_mesa_noop_Indexfv(const GLfloat * v)
55{
56}
57
58static void GLAPIENTRY
59_mesa_noop_FogCoordfEXT(GLfloat a)
60{
61}
62
63static void GLAPIENTRY
64_mesa_noop_FogCoordfvEXT(const GLfloat * v)
65{
66}
67
68static void GLAPIENTRY
69_mesa_noop_Normal3f(GLfloat a, GLfloat b, GLfloat c)
70{
71}
72
73static void GLAPIENTRY
74_mesa_noop_Normal3fv(const GLfloat * v)
75{
76}
77
78static void GLAPIENTRY
79_mesa_noop_Color4f(GLfloat a, GLfloat b, GLfloat c, GLfloat d)
80{
81}
82
83static void GLAPIENTRY
84_mesa_noop_Color4fv(const GLfloat * v)
85{
86}
87
88static void GLAPIENTRY
89_mesa_noop_Color3f(GLfloat a, GLfloat b, GLfloat c)
90{
91}
92
93static void GLAPIENTRY
94_mesa_noop_Color3fv(const GLfloat * v)
95{
96}
97
98static void GLAPIENTRY
99_mesa_noop_MultiTexCoord1fARB(GLenum target, GLfloat a)
100{
101}
102
103static void GLAPIENTRY
104_mesa_noop_MultiTexCoord1fvARB(GLenum target, const GLfloat * v)
105{
106}
107
108static void GLAPIENTRY
109_mesa_noop_MultiTexCoord2fARB(GLenum target, GLfloat a, GLfloat b)
110{
111}
112
113static void GLAPIENTRY
114_mesa_noop_MultiTexCoord2fvARB(GLenum target, const GLfloat * v)
115{
116}
117
118static void GLAPIENTRY
119_mesa_noop_MultiTexCoord3fARB(GLenum target, GLfloat a, GLfloat b, GLfloat c)
120{
121}
122
123static void GLAPIENTRY
124_mesa_noop_MultiTexCoord3fvARB(GLenum target, const GLfloat * v)
125{
126}
127
128static void GLAPIENTRY
129_mesa_noop_MultiTexCoord4fARB(GLenum target, GLfloat a, GLfloat b,
130                              GLfloat c, GLfloat d)
131{
132}
133
134static void GLAPIENTRY
135_mesa_noop_MultiTexCoord4fvARB(GLenum target, const GLfloat * v)
136{
137}
138
139static void GLAPIENTRY
140_mesa_noop_SecondaryColor3fEXT(GLfloat a, GLfloat b, GLfloat c)
141{
142}
143
144static void GLAPIENTRY
145_mesa_noop_SecondaryColor3fvEXT(const GLfloat * v)
146{
147}
148
149static void GLAPIENTRY
150_mesa_noop_TexCoord1f(GLfloat a)
151{
152}
153
154static void GLAPIENTRY
155_mesa_noop_TexCoord1fv(const GLfloat * v)
156{
157}
158
159static void GLAPIENTRY
160_mesa_noop_TexCoord2f(GLfloat a, GLfloat b)
161{
162}
163
164static void GLAPIENTRY
165_mesa_noop_TexCoord2fv(const GLfloat * v)
166{
167}
168
169static void GLAPIENTRY
170_mesa_noop_TexCoord3f(GLfloat a, GLfloat b, GLfloat c)
171{
172}
173
174static void GLAPIENTRY
175_mesa_noop_TexCoord3fv(const GLfloat * v)
176{
177}
178
179static void GLAPIENTRY
180_mesa_noop_TexCoord4f(GLfloat a, GLfloat b, GLfloat c, GLfloat d)
181{
182}
183
184static void GLAPIENTRY
185_mesa_noop_TexCoord4fv(const GLfloat * v)
186{
187}
188
189static void GLAPIENTRY
190_mesa_noop_VertexAttrib1fNV(GLuint index, GLfloat x)
191{
192}
193
194static void GLAPIENTRY
195_mesa_noop_VertexAttrib1fvNV(GLuint index, const GLfloat * v)
196{
197}
198
199static void GLAPIENTRY
200_mesa_noop_VertexAttrib2fNV(GLuint index, GLfloat x, GLfloat y)
201{
202}
203
204static void GLAPIENTRY
205_mesa_noop_VertexAttrib2fvNV(GLuint index, const GLfloat * v)
206{
207}
208
209static void GLAPIENTRY
210_mesa_noop_VertexAttrib3fNV(GLuint index, GLfloat x, GLfloat y, GLfloat z)
211{
212}
213
214static void GLAPIENTRY
215_mesa_noop_VertexAttrib3fvNV(GLuint index, const GLfloat * v)
216{
217}
218
219static void GLAPIENTRY
220_mesa_noop_VertexAttrib4fNV(GLuint index, GLfloat x,
221                            GLfloat y, GLfloat z, GLfloat w)
222{
223}
224
225static void GLAPIENTRY
226_mesa_noop_VertexAttrib4fvNV(GLuint index, const GLfloat * v)
227{
228}
229
230
231static void GLAPIENTRY
232_mesa_noop_VertexAttrib1fARB(GLuint index, GLfloat x)
233{
234}
235
236static void GLAPIENTRY
237_mesa_noop_VertexAttrib1fvARB(GLuint index, const GLfloat * v)
238{
239}
240
241static void GLAPIENTRY
242_mesa_noop_VertexAttrib2fARB(GLuint index, GLfloat x, GLfloat y)
243{
244}
245
246static void GLAPIENTRY
247_mesa_noop_VertexAttrib2fvARB(GLuint index, const GLfloat * v)
248{
249}
250
251static void GLAPIENTRY
252_mesa_noop_VertexAttrib3fARB(GLuint index, GLfloat x, GLfloat y, GLfloat z)
253{
254}
255
256static void GLAPIENTRY
257_mesa_noop_VertexAttrib3fvARB(GLuint index, const GLfloat * v)
258{
259}
260
261static void GLAPIENTRY
262_mesa_noop_VertexAttrib4fARB(GLuint index, GLfloat x,
263                             GLfloat y, GLfloat z, GLfloat w)
264{
265}
266
267static void GLAPIENTRY
268_mesa_noop_VertexAttrib4fvARB(GLuint index, const GLfloat * v)
269{
270}
271
272static void GLAPIENTRY
273_mesa_noop_Materialfv(GLenum face, GLenum pname, const GLfloat * params)
274{
275}
276
277static void GLAPIENTRY
278_mesa_noop_Vertex2fv(const GLfloat * v)
279{
280}
281
282static void GLAPIENTRY
283_mesa_noop_Vertex3fv(const GLfloat * v)
284{
285}
286
287static void GLAPIENTRY
288_mesa_noop_Vertex4fv(const GLfloat * v)
289{
290}
291
292static void GLAPIENTRY
293_mesa_noop_Vertex2f(GLfloat a, GLfloat b)
294{
295}
296
297static void GLAPIENTRY
298_mesa_noop_Vertex3f(GLfloat a, GLfloat b, GLfloat c)
299{
300}
301
302static void GLAPIENTRY
303_mesa_noop_Vertex4f(GLfloat a, GLfloat b, GLfloat c, GLfloat d)
304{
305}
306
307
308#if FEATURE_evaluators
309static void GLAPIENTRY
310_mesa_noop_EvalCoord1f(GLfloat a)
311{
312}
313
314static void GLAPIENTRY
315_mesa_noop_EvalCoord1fv(const GLfloat * v)
316{
317}
318
319static void GLAPIENTRY
320_mesa_noop_EvalCoord2f(GLfloat a, GLfloat b)
321{
322}
323
324static void GLAPIENTRY
325_mesa_noop_EvalCoord2fv(const GLfloat * v)
326{
327}
328
329static void GLAPIENTRY
330_mesa_noop_EvalPoint1(GLint a)
331{
332}
333
334static void GLAPIENTRY
335_mesa_noop_EvalPoint2(GLint a, GLint b)
336{
337}
338#endif /* FEATURE_evaluators */
339
340
341static void GLAPIENTRY
342_mesa_noop_Begin(GLenum mode)
343{
344}
345
346static void GLAPIENTRY
347_mesa_noop_End(void)
348{
349}
350
351static void GLAPIENTRY
352_mesa_noop_PrimitiveRestartNV(void)
353{
354}
355
356
357static void GLAPIENTRY
358_mesa_noop_Rectf(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2)
359{
360}
361
362
363static void GLAPIENTRY
364_mesa_noop_DrawArrays(GLenum mode, GLint start, GLsizei count)
365{
366}
367
368static void GLAPIENTRY
369_mesa_noop_DrawElements(GLenum mode, GLsizei count, GLenum type,
370                        const GLvoid * indices)
371{
372}
373
374static void GLAPIENTRY
375_mesa_noop_DrawElementsBaseVertex(GLenum mode, GLsizei count, GLenum type,
376                                  const GLvoid * indices, GLint basevertex)
377{
378}
379
380
381static void GLAPIENTRY
382_mesa_noop_DrawRangeElements(GLenum mode,
383                             GLuint start, GLuint end,
384                             GLsizei count, GLenum type,
385                             const GLvoid * indices)
386{
387}
388
389static void GLAPIENTRY
390_mesa_noop_MultiDrawElements(GLenum mode, const GLsizei * count, GLenum type,
391                             const GLvoid ** indices, GLsizei primcount)
392{
393}
394
395static void GLAPIENTRY
396_mesa_noop_DrawRangeElementsBaseVertex(GLenum mode,
397                                       GLuint start, GLuint end,
398                                       GLsizei count, GLenum type,
399                                       const GLvoid * indices,
400                                       GLint basevertex)
401{
402}
403
404static void GLAPIENTRY
405_mesa_noop_MultiDrawElementsBaseVertex(GLenum mode, const GLsizei * count,
406                                       GLenum type,
407                                       const GLvoid * const *indices,
408                                       GLsizei primcount,
409                                       const GLint * basevertex)
410{
411}
412
413static void GLAPIENTRY
414_mesa_noop_EvalMesh1(GLenum mode, GLint i1, GLint i2)
415{
416}
417
418static void GLAPIENTRY
419_mesa_noop_EvalMesh2(GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2)
420{
421}
422
423
424/**
425 * Build a vertexformat of functions that are no-ops.
426 * These are used in out-of-memory situations when we have no VBO
427 * to put the vertex data into.
428 */
429void
430_mesa_noop_vtxfmt_init(GLvertexformat * vfmt)
431{
432   _MESA_INIT_ARRAYELT_VTXFMT(vfmt, _ae_);
433
434   vfmt->Begin = _mesa_noop_Begin;
435
436   _MESA_INIT_DLIST_VTXFMT(vfmt, _mesa_);
437
438   vfmt->Color3f = _mesa_noop_Color3f;
439   vfmt->Color3fv = _mesa_noop_Color3fv;
440   vfmt->Color4f = _mesa_noop_Color4f;
441   vfmt->Color4fv = _mesa_noop_Color4fv;
442   vfmt->EdgeFlag = _mesa_noop_EdgeFlag;
443   vfmt->End = _mesa_noop_End;
444
445   vfmt->PrimitiveRestartNV = _mesa_noop_PrimitiveRestartNV;
446
447   _MESA_INIT_EVAL_VTXFMT(vfmt, _mesa_noop_);
448
449   vfmt->FogCoordfEXT = _mesa_noop_FogCoordfEXT;
450   vfmt->FogCoordfvEXT = _mesa_noop_FogCoordfvEXT;
451   vfmt->Indexf = _mesa_noop_Indexf;
452   vfmt->Indexfv = _mesa_noop_Indexfv;
453   vfmt->Materialfv = _mesa_noop_Materialfv;
454   vfmt->MultiTexCoord1fARB = _mesa_noop_MultiTexCoord1fARB;
455   vfmt->MultiTexCoord1fvARB = _mesa_noop_MultiTexCoord1fvARB;
456   vfmt->MultiTexCoord2fARB = _mesa_noop_MultiTexCoord2fARB;
457   vfmt->MultiTexCoord2fvARB = _mesa_noop_MultiTexCoord2fvARB;
458   vfmt->MultiTexCoord3fARB = _mesa_noop_MultiTexCoord3fARB;
459   vfmt->MultiTexCoord3fvARB = _mesa_noop_MultiTexCoord3fvARB;
460   vfmt->MultiTexCoord4fARB = _mesa_noop_MultiTexCoord4fARB;
461   vfmt->MultiTexCoord4fvARB = _mesa_noop_MultiTexCoord4fvARB;
462   vfmt->Normal3f = _mesa_noop_Normal3f;
463   vfmt->Normal3fv = _mesa_noop_Normal3fv;
464   vfmt->SecondaryColor3fEXT = _mesa_noop_SecondaryColor3fEXT;
465   vfmt->SecondaryColor3fvEXT = _mesa_noop_SecondaryColor3fvEXT;
466   vfmt->TexCoord1f = _mesa_noop_TexCoord1f;
467   vfmt->TexCoord1fv = _mesa_noop_TexCoord1fv;
468   vfmt->TexCoord2f = _mesa_noop_TexCoord2f;
469   vfmt->TexCoord2fv = _mesa_noop_TexCoord2fv;
470   vfmt->TexCoord3f = _mesa_noop_TexCoord3f;
471   vfmt->TexCoord3fv = _mesa_noop_TexCoord3fv;
472   vfmt->TexCoord4f = _mesa_noop_TexCoord4f;
473   vfmt->TexCoord4fv = _mesa_noop_TexCoord4fv;
474   vfmt->Vertex2f = _mesa_noop_Vertex2f;
475   vfmt->Vertex2fv = _mesa_noop_Vertex2fv;
476   vfmt->Vertex3f = _mesa_noop_Vertex3f;
477   vfmt->Vertex3fv = _mesa_noop_Vertex3fv;
478   vfmt->Vertex4f = _mesa_noop_Vertex4f;
479   vfmt->Vertex4fv = _mesa_noop_Vertex4fv;
480   vfmt->VertexAttrib1fNV = _mesa_noop_VertexAttrib1fNV;
481   vfmt->VertexAttrib1fvNV = _mesa_noop_VertexAttrib1fvNV;
482   vfmt->VertexAttrib2fNV = _mesa_noop_VertexAttrib2fNV;
483   vfmt->VertexAttrib2fvNV = _mesa_noop_VertexAttrib2fvNV;
484   vfmt->VertexAttrib3fNV = _mesa_noop_VertexAttrib3fNV;
485   vfmt->VertexAttrib3fvNV = _mesa_noop_VertexAttrib3fvNV;
486   vfmt->VertexAttrib4fNV = _mesa_noop_VertexAttrib4fNV;
487   vfmt->VertexAttrib4fvNV = _mesa_noop_VertexAttrib4fvNV;
488   vfmt->VertexAttrib1fARB = _mesa_noop_VertexAttrib1fARB;
489   vfmt->VertexAttrib1fvARB = _mesa_noop_VertexAttrib1fvARB;
490   vfmt->VertexAttrib2fARB = _mesa_noop_VertexAttrib2fARB;
491   vfmt->VertexAttrib2fvARB = _mesa_noop_VertexAttrib2fvARB;
492   vfmt->VertexAttrib3fARB = _mesa_noop_VertexAttrib3fARB;
493   vfmt->VertexAttrib3fvARB = _mesa_noop_VertexAttrib3fvARB;
494   vfmt->VertexAttrib4fARB = _mesa_noop_VertexAttrib4fARB;
495   vfmt->VertexAttrib4fvARB = _mesa_noop_VertexAttrib4fvARB;
496
497   vfmt->Rectf = _mesa_noop_Rectf;
498
499   vfmt->DrawArrays = _mesa_noop_DrawArrays;
500   vfmt->DrawElements = _mesa_noop_DrawElements;
501   vfmt->DrawRangeElements = _mesa_noop_DrawRangeElements;
502   vfmt->MultiDrawElementsEXT = _mesa_noop_MultiDrawElements;
503   vfmt->DrawElementsBaseVertex = _mesa_noop_DrawElementsBaseVertex;
504   vfmt->DrawRangeElementsBaseVertex = _mesa_noop_DrawRangeElementsBaseVertex;
505   vfmt->MultiDrawElementsBaseVertex = _mesa_noop_MultiDrawElementsBaseVertex;
506}
507
508
509/**
510 * Is the given dispatch table using the no-op functions?
511 */
512GLboolean
513_mesa_using_noop_vtxfmt(const struct _glapi_table *dispatch)
514{
515   return GET_Begin((struct _glapi_table *) dispatch) == _mesa_noop_Begin;
516}
517
518
519#endif /* FEATURE_beginend */
520