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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
21  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
22  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
23  * OTHER DEALINGS IN THE SOFTWARE.
24  */
25 
26 
27 /**
28  * GLvertexformat no-op functions.  Used in out-of-memory situations.
29  */
30 
31 
32 #include "main/glheader.h"
33 #include "main/context.h"
34 #include "main/dispatch.h"
35 #include "main/dlist.h"
36 #include "main/eval.h"
37 #include "vbo/vbo_noop.h"
38 
39 static void GLAPIENTRY
_mesa_noop_EdgeFlag(GLboolean b)40 _mesa_noop_EdgeFlag(GLboolean b)
41 {
42 }
43 
44 static void GLAPIENTRY
_mesa_noop_Indexf(GLfloat f)45 _mesa_noop_Indexf(GLfloat f)
46 {
47 }
48 
49 static void GLAPIENTRY
_mesa_noop_Indexfv(const GLfloat * v)50 _mesa_noop_Indexfv(const GLfloat * v)
51 {
52 }
53 
54 static void GLAPIENTRY
_mesa_noop_FogCoordfEXT(GLfloat a)55 _mesa_noop_FogCoordfEXT(GLfloat a)
56 {
57 }
58 
59 static void GLAPIENTRY
_mesa_noop_FogCoordfvEXT(const GLfloat * v)60 _mesa_noop_FogCoordfvEXT(const GLfloat * v)
61 {
62 }
63 
64 static void GLAPIENTRY
_mesa_noop_Normal3f(GLfloat a,GLfloat b,GLfloat c)65 _mesa_noop_Normal3f(GLfloat a, GLfloat b, GLfloat c)
66 {
67 }
68 
69 static void GLAPIENTRY
_mesa_noop_Normal3fv(const GLfloat * v)70 _mesa_noop_Normal3fv(const GLfloat * v)
71 {
72 }
73 
74 static void GLAPIENTRY
_mesa_noop_Color4f(GLfloat a,GLfloat b,GLfloat c,GLfloat d)75 _mesa_noop_Color4f(GLfloat a, GLfloat b, GLfloat c, GLfloat d)
76 {
77 }
78 
79 static void GLAPIENTRY
_mesa_noop_Color4fv(const GLfloat * v)80 _mesa_noop_Color4fv(const GLfloat * v)
81 {
82 }
83 
84 static void GLAPIENTRY
_mesa_noop_Color3f(GLfloat a,GLfloat b,GLfloat c)85 _mesa_noop_Color3f(GLfloat a, GLfloat b, GLfloat c)
86 {
87 }
88 
89 static void GLAPIENTRY
_mesa_noop_Color3fv(const GLfloat * v)90 _mesa_noop_Color3fv(const GLfloat * v)
91 {
92 }
93 
94 static void GLAPIENTRY
_mesa_noop_MultiTexCoord1fARB(GLenum target,GLfloat a)95 _mesa_noop_MultiTexCoord1fARB(GLenum target, GLfloat a)
96 {
97 }
98 
99 static void GLAPIENTRY
_mesa_noop_MultiTexCoord1fvARB(GLenum target,const GLfloat * v)100 _mesa_noop_MultiTexCoord1fvARB(GLenum target, const GLfloat * v)
101 {
102 }
103 
104 static void GLAPIENTRY
_mesa_noop_MultiTexCoord2fARB(GLenum target,GLfloat a,GLfloat b)105 _mesa_noop_MultiTexCoord2fARB(GLenum target, GLfloat a, GLfloat b)
106 {
107 }
108 
109 static void GLAPIENTRY
_mesa_noop_MultiTexCoord2fvARB(GLenum target,const GLfloat * v)110 _mesa_noop_MultiTexCoord2fvARB(GLenum target, const GLfloat * v)
111 {
112 }
113 
114 static void GLAPIENTRY
_mesa_noop_MultiTexCoord3fARB(GLenum target,GLfloat a,GLfloat b,GLfloat c)115 _mesa_noop_MultiTexCoord3fARB(GLenum target, GLfloat a, GLfloat b, GLfloat c)
116 {
117 }
118 
119 static void GLAPIENTRY
_mesa_noop_MultiTexCoord3fvARB(GLenum target,const GLfloat * v)120 _mesa_noop_MultiTexCoord3fvARB(GLenum target, const GLfloat * v)
121 {
122 }
123 
124 static void GLAPIENTRY
_mesa_noop_MultiTexCoord4fARB(GLenum target,GLfloat a,GLfloat b,GLfloat c,GLfloat d)125 _mesa_noop_MultiTexCoord4fARB(GLenum target, GLfloat a, GLfloat b,
126                               GLfloat c, GLfloat d)
127 {
128 }
129 
130 static void GLAPIENTRY
_mesa_noop_MultiTexCoord4fvARB(GLenum target,const GLfloat * v)131 _mesa_noop_MultiTexCoord4fvARB(GLenum target, const GLfloat * v)
132 {
133 }
134 
135 static void GLAPIENTRY
_mesa_noop_SecondaryColor3fEXT(GLfloat a,GLfloat b,GLfloat c)136 _mesa_noop_SecondaryColor3fEXT(GLfloat a, GLfloat b, GLfloat c)
137 {
138 }
139 
140 static void GLAPIENTRY
_mesa_noop_SecondaryColor3fvEXT(const GLfloat * v)141 _mesa_noop_SecondaryColor3fvEXT(const GLfloat * v)
142 {
143 }
144 
145 static void GLAPIENTRY
_mesa_noop_TexCoord1f(GLfloat a)146 _mesa_noop_TexCoord1f(GLfloat a)
147 {
148 }
149 
150 static void GLAPIENTRY
_mesa_noop_TexCoord1fv(const GLfloat * v)151 _mesa_noop_TexCoord1fv(const GLfloat * v)
152 {
153 }
154 
155 static void GLAPIENTRY
_mesa_noop_TexCoord2f(GLfloat a,GLfloat b)156 _mesa_noop_TexCoord2f(GLfloat a, GLfloat b)
157 {
158 }
159 
160 static void GLAPIENTRY
_mesa_noop_TexCoord2fv(const GLfloat * v)161 _mesa_noop_TexCoord2fv(const GLfloat * v)
162 {
163 }
164 
165 static void GLAPIENTRY
_mesa_noop_TexCoord3f(GLfloat a,GLfloat b,GLfloat c)166 _mesa_noop_TexCoord3f(GLfloat a, GLfloat b, GLfloat c)
167 {
168 }
169 
170 static void GLAPIENTRY
_mesa_noop_TexCoord3fv(const GLfloat * v)171 _mesa_noop_TexCoord3fv(const GLfloat * v)
172 {
173 }
174 
175 static void GLAPIENTRY
_mesa_noop_TexCoord4f(GLfloat a,GLfloat b,GLfloat c,GLfloat d)176 _mesa_noop_TexCoord4f(GLfloat a, GLfloat b, GLfloat c, GLfloat d)
177 {
178 }
179 
180 static void GLAPIENTRY
_mesa_noop_TexCoord4fv(const GLfloat * v)181 _mesa_noop_TexCoord4fv(const GLfloat * v)
182 {
183 }
184 
185 static void GLAPIENTRY
_mesa_noop_VertexAttrib1fNV(GLuint index,GLfloat x)186 _mesa_noop_VertexAttrib1fNV(GLuint index, GLfloat x)
187 {
188 }
189 
190 static void GLAPIENTRY
_mesa_noop_VertexAttrib1fvNV(GLuint index,const GLfloat * v)191 _mesa_noop_VertexAttrib1fvNV(GLuint index, const GLfloat * v)
192 {
193 }
194 
195 static void GLAPIENTRY
_mesa_noop_VertexAttrib2fNV(GLuint index,GLfloat x,GLfloat y)196 _mesa_noop_VertexAttrib2fNV(GLuint index, GLfloat x, GLfloat y)
197 {
198 }
199 
200 static void GLAPIENTRY
_mesa_noop_VertexAttrib2fvNV(GLuint index,const GLfloat * v)201 _mesa_noop_VertexAttrib2fvNV(GLuint index, const GLfloat * v)
202 {
203 }
204 
205 static void GLAPIENTRY
_mesa_noop_VertexAttrib3fNV(GLuint index,GLfloat x,GLfloat y,GLfloat z)206 _mesa_noop_VertexAttrib3fNV(GLuint index, GLfloat x, GLfloat y, GLfloat z)
207 {
208 }
209 
210 static void GLAPIENTRY
_mesa_noop_VertexAttrib3fvNV(GLuint index,const GLfloat * v)211 _mesa_noop_VertexAttrib3fvNV(GLuint index, const GLfloat * v)
212 {
213 }
214 
215 static void GLAPIENTRY
_mesa_noop_VertexAttrib4fNV(GLuint index,GLfloat x,GLfloat y,GLfloat z,GLfloat w)216 _mesa_noop_VertexAttrib4fNV(GLuint index, GLfloat x,
217                             GLfloat y, GLfloat z, GLfloat w)
218 {
219 }
220 
221 static void GLAPIENTRY
_mesa_noop_VertexAttrib4fvNV(GLuint index,const GLfloat * v)222 _mesa_noop_VertexAttrib4fvNV(GLuint index, const GLfloat * v)
223 {
224 }
225 
226 
227 static void GLAPIENTRY
_mesa_noop_VertexAttrib1fARB(GLuint index,GLfloat x)228 _mesa_noop_VertexAttrib1fARB(GLuint index, GLfloat x)
229 {
230 }
231 
232 static void GLAPIENTRY
_mesa_noop_VertexAttrib1fvARB(GLuint index,const GLfloat * v)233 _mesa_noop_VertexAttrib1fvARB(GLuint index, const GLfloat * v)
234 {
235 }
236 
237 static void GLAPIENTRY
_mesa_noop_VertexAttrib2fARB(GLuint index,GLfloat x,GLfloat y)238 _mesa_noop_VertexAttrib2fARB(GLuint index, GLfloat x, GLfloat y)
239 {
240 }
241 
242 static void GLAPIENTRY
_mesa_noop_VertexAttrib2fvARB(GLuint index,const GLfloat * v)243 _mesa_noop_VertexAttrib2fvARB(GLuint index, const GLfloat * v)
244 {
245 }
246 
247 static void GLAPIENTRY
_mesa_noop_VertexAttrib3fARB(GLuint index,GLfloat x,GLfloat y,GLfloat z)248 _mesa_noop_VertexAttrib3fARB(GLuint index, GLfloat x, GLfloat y, GLfloat z)
249 {
250 }
251 
252 static void GLAPIENTRY
_mesa_noop_VertexAttrib3fvARB(GLuint index,const GLfloat * v)253 _mesa_noop_VertexAttrib3fvARB(GLuint index, const GLfloat * v)
254 {
255 }
256 
257 static void GLAPIENTRY
_mesa_noop_VertexAttrib4fARB(GLuint index,GLfloat x,GLfloat y,GLfloat z,GLfloat w)258 _mesa_noop_VertexAttrib4fARB(GLuint index, GLfloat x,
259                              GLfloat y, GLfloat z, GLfloat w)
260 {
261 }
262 
263 static void GLAPIENTRY
_mesa_noop_VertexAttrib4fvARB(GLuint index,const GLfloat * v)264 _mesa_noop_VertexAttrib4fvARB(GLuint index, const GLfloat * v)
265 {
266 }
267 
268 static void GLAPIENTRY
_mesa_noop_Materialfv(GLenum face,GLenum pname,const GLfloat * params)269 _mesa_noop_Materialfv(GLenum face, GLenum pname, const GLfloat * params)
270 {
271 }
272 
273 static void GLAPIENTRY
_mesa_noop_Vertex2fv(const GLfloat * v)274 _mesa_noop_Vertex2fv(const GLfloat * v)
275 {
276 }
277 
278 static void GLAPIENTRY
_mesa_noop_Vertex3fv(const GLfloat * v)279 _mesa_noop_Vertex3fv(const GLfloat * v)
280 {
281 }
282 
283 static void GLAPIENTRY
_mesa_noop_Vertex4fv(const GLfloat * v)284 _mesa_noop_Vertex4fv(const GLfloat * v)
285 {
286 }
287 
288 static void GLAPIENTRY
_mesa_noop_Vertex2f(GLfloat a,GLfloat b)289 _mesa_noop_Vertex2f(GLfloat a, GLfloat b)
290 {
291 }
292 
293 static void GLAPIENTRY
_mesa_noop_Vertex3f(GLfloat a,GLfloat b,GLfloat c)294 _mesa_noop_Vertex3f(GLfloat a, GLfloat b, GLfloat c)
295 {
296 }
297 
298 static void GLAPIENTRY
_mesa_noop_Vertex4f(GLfloat a,GLfloat b,GLfloat c,GLfloat d)299 _mesa_noop_Vertex4f(GLfloat a, GLfloat b, GLfloat c, GLfloat d)
300 {
301 }
302 
303 static void GLAPIENTRY
_mesa_noop_EvalCoord1f(GLfloat a)304 _mesa_noop_EvalCoord1f(GLfloat a)
305 {
306 }
307 
308 static void GLAPIENTRY
_mesa_noop_EvalCoord1fv(const GLfloat * v)309 _mesa_noop_EvalCoord1fv(const GLfloat * v)
310 {
311 }
312 
313 static void GLAPIENTRY
_mesa_noop_EvalCoord2f(GLfloat a,GLfloat b)314 _mesa_noop_EvalCoord2f(GLfloat a, GLfloat b)
315 {
316 }
317 
318 static void GLAPIENTRY
_mesa_noop_EvalCoord2fv(const GLfloat * v)319 _mesa_noop_EvalCoord2fv(const GLfloat * v)
320 {
321 }
322 
323 static void GLAPIENTRY
_mesa_noop_EvalPoint1(GLint a)324 _mesa_noop_EvalPoint1(GLint a)
325 {
326 }
327 
328 static void GLAPIENTRY
_mesa_noop_EvalPoint2(GLint a,GLint b)329 _mesa_noop_EvalPoint2(GLint a, GLint b)
330 {
331 }
332 
333 static void GLAPIENTRY
_mesa_noop_ArrayElement(GLint elem)334 _mesa_noop_ArrayElement(GLint elem)
335 {
336 }
337 
338 
339 static void GLAPIENTRY
_mesa_noop_Begin(GLenum mode)340 _mesa_noop_Begin(GLenum mode)
341 {
342 }
343 
344 static void GLAPIENTRY
_mesa_noop_End(void)345 _mesa_noop_End(void)
346 {
347 }
348 
349 static void GLAPIENTRY
_mesa_noop_PrimitiveRestartNV(void)350 _mesa_noop_PrimitiveRestartNV(void)
351 {
352 }
353 
354 
355 /**
356  * Build a vertexformat of functions that are no-ops.
357  * These are used in out-of-memory situations when we have no VBO
358  * to put the vertex data into.
359  */
360 void
_mesa_noop_vtxfmt_init(GLvertexformat * vfmt)361 _mesa_noop_vtxfmt_init(GLvertexformat * vfmt)
362 {
363    vfmt->ArrayElement = _mesa_noop_ArrayElement;
364 
365    vfmt->Begin = _mesa_noop_Begin;
366 
367    vfmt->CallList = _mesa_CallList;
368    vfmt->CallLists = _mesa_CallLists;
369 
370    vfmt->Color3f = _mesa_noop_Color3f;
371    vfmt->Color3fv = _mesa_noop_Color3fv;
372    vfmt->Color4f = _mesa_noop_Color4f;
373    vfmt->Color4fv = _mesa_noop_Color4fv;
374    vfmt->EdgeFlag = _mesa_noop_EdgeFlag;
375    vfmt->End = _mesa_noop_End;
376 
377    vfmt->PrimitiveRestartNV = _mesa_noop_PrimitiveRestartNV;
378 
379    vfmt->EvalCoord1f = _mesa_noop_EvalCoord1f;
380    vfmt->EvalCoord1fv = _mesa_noop_EvalCoord1fv;
381    vfmt->EvalCoord2f = _mesa_noop_EvalCoord2f;
382    vfmt->EvalCoord2fv = _mesa_noop_EvalCoord2fv;
383    vfmt->EvalPoint1 = _mesa_noop_EvalPoint1;
384    vfmt->EvalPoint2 = _mesa_noop_EvalPoint2;
385 
386    vfmt->FogCoordfEXT = _mesa_noop_FogCoordfEXT;
387    vfmt->FogCoordfvEXT = _mesa_noop_FogCoordfvEXT;
388    vfmt->Indexf = _mesa_noop_Indexf;
389    vfmt->Indexfv = _mesa_noop_Indexfv;
390    vfmt->Materialfv = _mesa_noop_Materialfv;
391    vfmt->MultiTexCoord1fARB = _mesa_noop_MultiTexCoord1fARB;
392    vfmt->MultiTexCoord1fvARB = _mesa_noop_MultiTexCoord1fvARB;
393    vfmt->MultiTexCoord2fARB = _mesa_noop_MultiTexCoord2fARB;
394    vfmt->MultiTexCoord2fvARB = _mesa_noop_MultiTexCoord2fvARB;
395    vfmt->MultiTexCoord3fARB = _mesa_noop_MultiTexCoord3fARB;
396    vfmt->MultiTexCoord3fvARB = _mesa_noop_MultiTexCoord3fvARB;
397    vfmt->MultiTexCoord4fARB = _mesa_noop_MultiTexCoord4fARB;
398    vfmt->MultiTexCoord4fvARB = _mesa_noop_MultiTexCoord4fvARB;
399    vfmt->Normal3f = _mesa_noop_Normal3f;
400    vfmt->Normal3fv = _mesa_noop_Normal3fv;
401    vfmt->SecondaryColor3fEXT = _mesa_noop_SecondaryColor3fEXT;
402    vfmt->SecondaryColor3fvEXT = _mesa_noop_SecondaryColor3fvEXT;
403    vfmt->TexCoord1f = _mesa_noop_TexCoord1f;
404    vfmt->TexCoord1fv = _mesa_noop_TexCoord1fv;
405    vfmt->TexCoord2f = _mesa_noop_TexCoord2f;
406    vfmt->TexCoord2fv = _mesa_noop_TexCoord2fv;
407    vfmt->TexCoord3f = _mesa_noop_TexCoord3f;
408    vfmt->TexCoord3fv = _mesa_noop_TexCoord3fv;
409    vfmt->TexCoord4f = _mesa_noop_TexCoord4f;
410    vfmt->TexCoord4fv = _mesa_noop_TexCoord4fv;
411    vfmt->Vertex2f = _mesa_noop_Vertex2f;
412    vfmt->Vertex2fv = _mesa_noop_Vertex2fv;
413    vfmt->Vertex3f = _mesa_noop_Vertex3f;
414    vfmt->Vertex3fv = _mesa_noop_Vertex3fv;
415    vfmt->Vertex4f = _mesa_noop_Vertex4f;
416    vfmt->Vertex4fv = _mesa_noop_Vertex4fv;
417    vfmt->VertexAttrib1fNV = _mesa_noop_VertexAttrib1fNV;
418    vfmt->VertexAttrib1fvNV = _mesa_noop_VertexAttrib1fvNV;
419    vfmt->VertexAttrib2fNV = _mesa_noop_VertexAttrib2fNV;
420    vfmt->VertexAttrib2fvNV = _mesa_noop_VertexAttrib2fvNV;
421    vfmt->VertexAttrib3fNV = _mesa_noop_VertexAttrib3fNV;
422    vfmt->VertexAttrib3fvNV = _mesa_noop_VertexAttrib3fvNV;
423    vfmt->VertexAttrib4fNV = _mesa_noop_VertexAttrib4fNV;
424    vfmt->VertexAttrib4fvNV = _mesa_noop_VertexAttrib4fvNV;
425    vfmt->VertexAttrib1fARB = _mesa_noop_VertexAttrib1fARB;
426    vfmt->VertexAttrib1fvARB = _mesa_noop_VertexAttrib1fvARB;
427    vfmt->VertexAttrib2fARB = _mesa_noop_VertexAttrib2fARB;
428    vfmt->VertexAttrib2fvARB = _mesa_noop_VertexAttrib2fvARB;
429    vfmt->VertexAttrib3fARB = _mesa_noop_VertexAttrib3fARB;
430    vfmt->VertexAttrib3fvARB = _mesa_noop_VertexAttrib3fvARB;
431    vfmt->VertexAttrib4fARB = _mesa_noop_VertexAttrib4fARB;
432    vfmt->VertexAttrib4fvARB = _mesa_noop_VertexAttrib4fvARB;
433 }
434 
435 
436 /**
437  * Is the given dispatch table using the no-op functions?
438  */
439 GLboolean
_mesa_using_noop_vtxfmt(const struct _glapi_table * dispatch)440 _mesa_using_noop_vtxfmt(const struct _glapi_table *dispatch)
441 {
442    return GET_Begin((struct _glapi_table *) dispatch) == _mesa_noop_Begin;
443 }
444