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 43 static void GLAPIENTRY 44 _mesa_noop_EdgeFlag(GLboolean b) 45 { 46 } 47 48 static void GLAPIENTRY 49 _mesa_noop_Indexf(GLfloat f) 50 { 51 } 52 53 static void GLAPIENTRY 54 _mesa_noop_Indexfv(const GLfloat * v) 55 { 56 } 57 58 static void GLAPIENTRY 59 _mesa_noop_FogCoordfEXT(GLfloat a) 60 { 61 } 62 63 static void GLAPIENTRY 64 _mesa_noop_FogCoordfvEXT(const GLfloat * v) 65 { 66 } 67 68 static void GLAPIENTRY 69 _mesa_noop_Normal3f(GLfloat a, GLfloat b, GLfloat c) 70 { 71 } 72 73 static void GLAPIENTRY 74 _mesa_noop_Normal3fv(const GLfloat * v) 75 { 76 } 77 78 static void GLAPIENTRY 79 _mesa_noop_Color4f(GLfloat a, GLfloat b, GLfloat c, GLfloat d) 80 { 81 } 82 83 static void GLAPIENTRY 84 _mesa_noop_Color4fv(const GLfloat * v) 85 { 86 } 87 88 static void GLAPIENTRY 89 _mesa_noop_Color3f(GLfloat a, GLfloat b, GLfloat c) 90 { 91 } 92 93 static void GLAPIENTRY 94 _mesa_noop_Color3fv(const GLfloat * v) 95 { 96 } 97 98 static void GLAPIENTRY 99 _mesa_noop_MultiTexCoord1fARB(GLenum target, GLfloat a) 100 { 101 } 102 103 static void GLAPIENTRY 104 _mesa_noop_MultiTexCoord1fvARB(GLenum target, const GLfloat * v) 105 { 106 } 107 108 static void GLAPIENTRY 109 _mesa_noop_MultiTexCoord2fARB(GLenum target, GLfloat a, GLfloat b) 110 { 111 } 112 113 static void GLAPIENTRY 114 _mesa_noop_MultiTexCoord2fvARB(GLenum target, const GLfloat * v) 115 { 116 } 117 118 static void GLAPIENTRY 119 _mesa_noop_MultiTexCoord3fARB(GLenum target, GLfloat a, GLfloat b, GLfloat c) 120 { 121 } 122 123 static void GLAPIENTRY 124 _mesa_noop_MultiTexCoord3fvARB(GLenum target, const GLfloat * v) 125 { 126 } 127 128 static void GLAPIENTRY 129 _mesa_noop_MultiTexCoord4fARB(GLenum target, GLfloat a, GLfloat b, 130 GLfloat c, GLfloat d) 131 { 132 } 133 134 static void GLAPIENTRY 135 _mesa_noop_MultiTexCoord4fvARB(GLenum target, const GLfloat * v) 136 { 137 } 138 139 static void GLAPIENTRY 140 _mesa_noop_SecondaryColor3fEXT(GLfloat a, GLfloat b, GLfloat c) 141 { 142 } 143 144 static void GLAPIENTRY 145 _mesa_noop_SecondaryColor3fvEXT(const GLfloat * v) 146 { 147 } 148 149 static void GLAPIENTRY 150 _mesa_noop_TexCoord1f(GLfloat a) 151 { 152 } 153 154 static void GLAPIENTRY 155 _mesa_noop_TexCoord1fv(const GLfloat * v) 156 { 157 } 158 159 static void GLAPIENTRY 160 _mesa_noop_TexCoord2f(GLfloat a, GLfloat b) 161 { 162 } 163 164 static void GLAPIENTRY 165 _mesa_noop_TexCoord2fv(const GLfloat * v) 166 { 167 } 168 169 static void GLAPIENTRY 170 _mesa_noop_TexCoord3f(GLfloat a, GLfloat b, GLfloat c) 171 { 172 } 173 174 static void GLAPIENTRY 175 _mesa_noop_TexCoord3fv(const GLfloat * v) 176 { 177 } 178 179 static void GLAPIENTRY 180 _mesa_noop_TexCoord4f(GLfloat a, GLfloat b, GLfloat c, GLfloat d) 181 { 182 } 183 184 static void GLAPIENTRY 185 _mesa_noop_TexCoord4fv(const GLfloat * v) 186 { 187 } 188 189 static void GLAPIENTRY 190 _mesa_noop_VertexAttrib1fNV(GLuint index, GLfloat x) 191 { 192 } 193 194 static void GLAPIENTRY 195 _mesa_noop_VertexAttrib1fvNV(GLuint index, const GLfloat * v) 196 { 197 } 198 199 static void GLAPIENTRY 200 _mesa_noop_VertexAttrib2fNV(GLuint index, GLfloat x, GLfloat y) 201 { 202 } 203 204 static void GLAPIENTRY 205 _mesa_noop_VertexAttrib2fvNV(GLuint index, const GLfloat * v) 206 { 207 } 208 209 static void GLAPIENTRY 210 _mesa_noop_VertexAttrib3fNV(GLuint index, GLfloat x, GLfloat y, GLfloat z) 211 { 212 } 213 214 static void GLAPIENTRY 215 _mesa_noop_VertexAttrib3fvNV(GLuint index, const GLfloat * v) 216 { 217 } 218 219 static void GLAPIENTRY 220 _mesa_noop_VertexAttrib4fNV(GLuint index, GLfloat x, 221 GLfloat y, GLfloat z, GLfloat w) 222 { 223 } 224 225 static void GLAPIENTRY 226 _mesa_noop_VertexAttrib4fvNV(GLuint index, const GLfloat * v) 227 { 228 } 229 230 231 static void GLAPIENTRY 232 _mesa_noop_VertexAttrib1fARB(GLuint index, GLfloat x) 233 { 234 } 235 236 static void GLAPIENTRY 237 _mesa_noop_VertexAttrib1fvARB(GLuint index, const GLfloat * v) 238 { 239 } 240 241 static void GLAPIENTRY 242 _mesa_noop_VertexAttrib2fARB(GLuint index, GLfloat x, GLfloat y) 243 { 244 } 245 246 static void GLAPIENTRY 247 _mesa_noop_VertexAttrib2fvARB(GLuint index, const GLfloat * v) 248 { 249 } 250 251 static void GLAPIENTRY 252 _mesa_noop_VertexAttrib3fARB(GLuint index, GLfloat x, GLfloat y, GLfloat z) 253 { 254 } 255 256 static void GLAPIENTRY 257 _mesa_noop_VertexAttrib3fvARB(GLuint index, const GLfloat * v) 258 { 259 } 260 261 static void GLAPIENTRY 262 _mesa_noop_VertexAttrib4fARB(GLuint index, GLfloat x, 263 GLfloat y, GLfloat z, GLfloat w) 264 { 265 } 266 267 static void GLAPIENTRY 268 _mesa_noop_VertexAttrib4fvARB(GLuint index, const GLfloat * v) 269 { 270 } 271 272 static void GLAPIENTRY 273 _mesa_noop_Materialfv(GLenum face, GLenum pname, const GLfloat * params) 274 { 275 } 276 277 static void GLAPIENTRY 278 _mesa_noop_Vertex2fv(const GLfloat * v) 279 { 280 } 281 282 static void GLAPIENTRY 283 _mesa_noop_Vertex3fv(const GLfloat * v) 284 { 285 } 286 287 static void GLAPIENTRY 288 _mesa_noop_Vertex4fv(const GLfloat * v) 289 { 290 } 291 292 static void GLAPIENTRY 293 _mesa_noop_Vertex2f(GLfloat a, GLfloat b) 294 { 295 } 296 297 static void GLAPIENTRY 298 _mesa_noop_Vertex3f(GLfloat a, GLfloat b, GLfloat c) 299 { 300 } 301 302 static void GLAPIENTRY 303 _mesa_noop_Vertex4f(GLfloat a, GLfloat b, GLfloat c, GLfloat d) 304 { 305 } 306 307 308 #if FEATURE_evaluators 309 static void GLAPIENTRY 310 _mesa_noop_EvalCoord1f(GLfloat a) 311 { 312 } 313 314 static void GLAPIENTRY 315 _mesa_noop_EvalCoord1fv(const GLfloat * v) 316 { 317 } 318 319 static void GLAPIENTRY 320 _mesa_noop_EvalCoord2f(GLfloat a, GLfloat b) 321 { 322 } 323 324 static void GLAPIENTRY 325 _mesa_noop_EvalCoord2fv(const GLfloat * v) 326 { 327 } 328 329 static void GLAPIENTRY 330 _mesa_noop_EvalPoint1(GLint a) 331 { 332 } 333 334 static void GLAPIENTRY 335 _mesa_noop_EvalPoint2(GLint a, GLint b) 336 { 337 } 338 #endif /* FEATURE_evaluators */ 339 340 341 static void GLAPIENTRY 342 _mesa_noop_Begin(GLenum mode) 343 { 344 } 345 346 static void GLAPIENTRY 347 _mesa_noop_End(void) 348 { 349 } 350 351 static void GLAPIENTRY 352 _mesa_noop_PrimitiveRestartNV(void) 353 { 354 } 355 356 357 static void GLAPIENTRY 358 _mesa_noop_Rectf(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2) 359 { 360 } 361 362 363 static void GLAPIENTRY 364 _mesa_noop_DrawArrays(GLenum mode, GLint start, GLsizei count) 365 { 366 } 367 368 static void GLAPIENTRY 369 _mesa_noop_DrawElements(GLenum mode, GLsizei count, GLenum type, 370 const GLvoid * indices) 371 { 372 } 373 374 static void GLAPIENTRY 375 _mesa_noop_DrawElementsBaseVertex(GLenum mode, GLsizei count, GLenum type, 376 const GLvoid * indices, GLint basevertex) 377 { 378 } 379 380 381 static 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 389 static void GLAPIENTRY 390 _mesa_noop_MultiDrawElements(GLenum mode, const GLsizei * count, GLenum type, 391 const GLvoid ** indices, GLsizei primcount) 392 { 393 } 394 395 static 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 404 static 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 413 static void GLAPIENTRY 414 _mesa_noop_EvalMesh1(GLenum mode, GLint i1, GLint i2) 415 { 416 } 417 418 static 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 */ 429 void 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 */ 512 GLboolean 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