1/************************************************************************** 2 * 3 * Copyright 2015 VMware, Inc. 4 * 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 8 * "Software"), to deal in the Software without restriction, including 9 * without limitation the rights to use, copy, modify, merge, publish, 10 * distribute, sub license, and/or sell copies of the Software, and to 11 * permit persons to whom the Software is furnished to do so, subject to 12 * the following conditions: 13 * 14 * The above copyright notice and this permission notice (including the 15 * next paragraph) shall be included in all copies or substantial portions 16 * of the Software. 17 * 18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 19 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 20 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. 21 * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR 22 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 23 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 24 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 25 * 26 **************************************************************************/ 27 28/** 29 * No-op GL API functions. 30 * 31 * Some OpenGL apps (like Viewperf12) call wglGetProcAddress() to get 32 * a pointer to an extension function, get a NULL pointer, but don't bother 33 * to check for NULL before jumping through the pointer. This causes a 34 * crash. 35 * 36 * As a work-around we provide some no-op functions here to avoid those 37 * crashes. 38 */ 39 40#include <GL/gl.h> 41#include "stw_nopfuncs.h" 42#include "util/u_debug.h" 43 44 45static void 46warning(const char *name) 47{ 48 /* use name+4 to skip "nop_" prefix */ 49 _debug_printf("Application calling unsupported %s function\n", name+4); 50} 51 52static void APIENTRY 53nop_glBindMultiTextureEXT(GLenum texunit, GLenum target, GLuint texture) 54{ 55 warning(__func__); 56} 57 58static void APIENTRY 59nop_glColor3hNV(GLhalfNV red, GLhalfNV green, GLhalfNV blue) 60{ 61 warning(__func__); 62} 63 64static void APIENTRY 65nop_glColor3hvNV(const GLhalfNV *v) 66{ 67 warning(__func__); 68} 69 70static void APIENTRY 71nop_glColor4hNV(GLhalfNV red, GLhalfNV green, GLhalfNV blue, GLhalfNV alpha) 72{ 73 warning(__func__); 74} 75 76static void APIENTRY 77nop_glColor4hvNV(const GLhalfNV *v) 78{ 79 warning(__func__); 80} 81 82static void APIENTRY 83nop_glDisableClientStateIndexedEXT(GLenum array, GLuint index) 84{ 85 warning(__func__); 86} 87 88static void APIENTRY 89nop_glEnableClientStateIndexedEXT(GLenum array, GLuint index) 90{ 91 warning(__func__); 92} 93 94static void APIENTRY 95nop_glFogCoordhNV(GLhalfNV fog) 96{ 97 warning(__func__); 98} 99 100static void APIENTRY 101nop_glFogCoordhvNV(const GLhalfNV *fog) 102{ 103 warning(__func__); 104} 105 106static void APIENTRY 107nop_glGetNamedBufferParameterivEXT(GLuint buffer, GLenum pname, GLint *params) 108{ 109 warning(__func__); 110} 111 112static void APIENTRY 113nop_glGetNamedBufferSubDataEXT(GLuint buffer, GLintptr offset, GLsizeiptr size, void *data) 114{ 115 warning(__func__); 116} 117 118static void *APIENTRY 119nop_glMapNamedBufferEXT(GLuint buffer, GLenum access) 120{ 121 warning(__func__); 122 return NULL; 123} 124 125static void APIENTRY 126nop_glMatrixLoadfEXT(GLenum mode, const GLfloat *m) 127{ 128 warning(__func__); 129} 130 131static void APIENTRY 132nop_glMatrixLoadIdentityEXT(GLenum mode) 133{ 134 warning(__func__); 135} 136 137static void APIENTRY 138nop_glMultiTexCoord1hNV(GLenum target, GLhalfNV s) 139{ 140 warning(__func__); 141} 142 143static void APIENTRY 144nop_glMultiTexCoord1hvNV(GLenum target, const GLhalfNV *v) 145{ 146 warning(__func__); 147} 148 149static void APIENTRY 150nop_glMultiTexCoord2hNV(GLenum target, GLhalfNV s, GLhalfNV t) 151{ 152 warning(__func__); 153} 154 155static void APIENTRY 156nop_glMultiTexCoord2hvNV(GLenum target, const GLhalfNV *v) 157{ 158 warning(__func__); 159} 160 161static void APIENTRY 162nop_glMultiTexCoord3hNV(GLenum target, GLhalfNV s, GLhalfNV t, GLhalfNV r) 163{ 164 warning(__func__); 165} 166 167static void APIENTRY 168nop_glMultiTexCoord3hvNV(GLenum target, const GLhalfNV *v) 169{ 170 warning(__func__); 171} 172 173static void APIENTRY 174nop_glMultiTexCoord4hNV(GLenum target, GLhalfNV s, GLhalfNV t, GLhalfNV r, GLhalfNV q) 175{ 176 warning(__func__); 177} 178 179static void APIENTRY 180nop_glMultiTexCoord4hvNV(GLenum target, const GLhalfNV *v) 181{ 182 warning(__func__); 183} 184 185static void APIENTRY 186nop_glMultiTexCoordPointerEXT(GLenum texunit, GLint size, GLenum type, GLsizei stride, const void *pointer) 187{ 188 warning(__func__); 189} 190 191static void APIENTRY 192nop_glMultiTexEnvfEXT(GLenum texunit, GLenum target, GLenum pname, GLfloat param) 193{ 194 warning(__func__); 195} 196 197static void APIENTRY 198nop_glMultiTexEnvfvEXT(GLenum texunit, GLenum target, GLenum pname, const GLfloat *params) 199{ 200 warning(__func__); 201} 202 203static void APIENTRY 204nop_glMultiTexEnviEXT(GLenum texunit, GLenum target, GLenum pname, GLint param) 205{ 206 warning(__func__); 207} 208 209static void APIENTRY 210nop_glMultiTexGenfvEXT(GLenum texunit, GLenum coord, GLenum pname, const GLfloat *params) 211{ 212 warning(__func__); 213} 214 215static void APIENTRY 216nop_glMultiTexGeniEXT(GLenum texunit, GLenum coord, GLenum pname, GLint param) 217{ 218 warning(__func__); 219} 220 221static void APIENTRY 222nop_glNamedBufferDataEXT(GLuint buffer, GLsizeiptr size, const void *data, GLenum usage) 223{ 224 warning(__func__); 225} 226 227static void APIENTRY 228nop_glNamedBufferSubDataEXT(GLuint buffer, GLintptr offset, GLsizeiptr size, const void *data) 229{ 230 warning(__func__); 231} 232 233static void APIENTRY 234nop_glNamedProgramLocalParameter4fvEXT(GLuint program, GLenum target, GLuint index, const GLfloat *params) 235{ 236 warning(__func__); 237} 238 239static void APIENTRY 240nop_glNamedProgramLocalParameters4fvEXT(GLuint program, GLenum target, GLuint index, GLsizei count, const GLfloat *params) 241{ 242 warning(__func__); 243} 244 245static void APIENTRY 246nop_glNormal3hNV(GLhalfNV nx, GLhalfNV ny, GLhalfNV nz) 247{ 248 warning(__func__); 249} 250 251static void APIENTRY 252nop_glNormal3hvNV(const GLhalfNV *v) 253{ 254 warning(__func__); 255} 256 257static void APIENTRY 258nop_glPatchParameterfv(GLenum pname, const GLfloat *values) 259{ 260 warning(__func__); 261} 262 263static void APIENTRY 264nop_glPatchParameteri(GLenum pname, GLint value) 265{ 266 warning(__func__); 267} 268 269static void APIENTRY 270nop_glSecondaryColor3hNV(GLhalfNV red, GLhalfNV green, GLhalfNV blue) 271{ 272 warning(__func__); 273} 274 275static void APIENTRY 276nop_glSecondaryColor3hvNV(const GLhalfNV *v) 277{ 278 warning(__func__); 279} 280 281static void APIENTRY 282nop_glTexCoord1hNV(GLhalfNV s) 283{ 284 warning(__func__); 285} 286 287static void APIENTRY 288nop_glTexCoord1hvNV(const GLhalfNV *v) 289{ 290 warning(__func__); 291} 292 293static void APIENTRY 294nop_glTexCoord2hNV(GLhalfNV s, GLhalfNV t) 295{ 296 warning(__func__); 297} 298 299static void APIENTRY 300nop_glTexCoord2hvNV(const GLhalfNV *v) 301{ 302 warning(__func__); 303} 304 305static void APIENTRY 306nop_glTexCoord3hNV(GLhalfNV s, GLhalfNV t, GLhalfNV r) 307{ 308 warning(__func__); 309} 310 311static void APIENTRY 312nop_glTexCoord3hvNV(const GLhalfNV *v) 313{ 314 warning(__func__); 315} 316 317static void APIENTRY 318nop_glTexCoord4hNV(GLhalfNV s, GLhalfNV t, GLhalfNV r, GLhalfNV q) 319{ 320 warning(__func__); 321} 322 323static void APIENTRY 324nop_glTexCoord4hvNV(const GLhalfNV *v) 325{ 326 warning(__func__); 327} 328 329static void APIENTRY 330nop_glTextureParameterfEXT(GLuint texture, GLenum target, GLenum pname, GLfloat param) 331{ 332 warning(__func__); 333} 334 335static void APIENTRY 336nop_glTextureParameterfvEXT(GLuint texture, GLenum target, GLenum pname, const GLfloat *params) 337{ 338 warning(__func__); 339} 340 341static void APIENTRY 342nop_glTextureParameteriEXT(GLuint texture, GLenum target, GLenum pname, GLint param) 343{ 344 warning(__func__); 345} 346 347static GLboolean APIENTRY 348nop_glUnmapNamedBufferEXT(GLuint buffer) 349{ 350 warning(__func__); 351 return GL_FALSE; 352} 353 354static void APIENTRY 355nop_glVertex2hNV(GLhalfNV x, GLhalfNV y) 356{ 357 warning(__func__); 358} 359 360static void APIENTRY 361nop_glVertex2hvNV(const GLhalfNV *v) 362{ 363 warning(__func__); 364} 365 366static void APIENTRY 367nop_glVertex3hNV(GLhalfNV x, GLhalfNV y, GLhalfNV z) 368{ 369 warning(__func__); 370} 371 372static void APIENTRY 373nop_glVertex3hvNV(const GLhalfNV *v) 374{ 375 warning(__func__); 376} 377 378static void APIENTRY 379nop_glVertex4hNV(GLhalfNV x, GLhalfNV y, GLhalfNV z, GLhalfNV w) 380{ 381 warning(__func__); 382} 383 384static void APIENTRY 385nop_glVertex4hvNV(const GLhalfNV *v) 386{ 387 warning(__func__); 388} 389 390 391PROC 392stw_get_nop_function(const char *name) 393{ 394 struct { 395 const char *name; 396 PROC p; 397 } table[] = { 398 { "glBindMultiTextureEXT", (PROC) nop_glBindMultiTextureEXT }, 399 { "glColor3hNV", (PROC) nop_glColor3hNV }, 400 { "glColor3hvNV", (PROC) nop_glColor3hvNV }, 401 { "glColor4hNV", (PROC) nop_glColor4hNV }, 402 { "glColor4hvNV", (PROC) nop_glColor4hvNV }, 403 { "glDisableClientStateIndexedEXT", (PROC) nop_glDisableClientStateIndexedEXT }, 404 { "glEnableClientStateIndexedEXT", (PROC) nop_glEnableClientStateIndexedEXT }, 405 { "glFogCoordhNV", (PROC) nop_glFogCoordhNV }, 406 { "glFogCoordhvNV", (PROC) nop_glFogCoordhvNV }, 407 { "glGetNamedBufferParameterivEXT", (PROC) nop_glGetNamedBufferParameterivEXT }, 408 { "glGetNamedBufferSubDataEXT", (PROC) nop_glGetNamedBufferSubDataEXT }, 409 { "glMapNamedBufferEXT", (PROC) nop_glMapNamedBufferEXT }, 410 { "glMatrixLoadfEXT", (PROC) nop_glMatrixLoadfEXT }, 411 { "glMatrixLoadIdentityEXT", (PROC) nop_glMatrixLoadIdentityEXT }, 412 { "glMultiTexCoord1hNV", (PROC) nop_glMultiTexCoord1hNV }, 413 { "glMultiTexCoord1hvNV", (PROC) nop_glMultiTexCoord1hvNV }, 414 { "glMultiTexCoord2hNV", (PROC) nop_glMultiTexCoord2hNV }, 415 { "glMultiTexCoord2hvNV", (PROC) nop_glMultiTexCoord2hvNV }, 416 { "glMultiTexCoord3hNV", (PROC) nop_glMultiTexCoord3hNV }, 417 { "glMultiTexCoord3hvNV", (PROC) nop_glMultiTexCoord3hvNV }, 418 { "glMultiTexCoord4hNV", (PROC) nop_glMultiTexCoord4hNV }, 419 { "glMultiTexCoord4hvNV", (PROC) nop_glMultiTexCoord4hvNV }, 420 { "glMultiTexCoordPointerEXT", (PROC) nop_glMultiTexCoordPointerEXT }, 421 { "glMultiTexEnvfEXT", (PROC) nop_glMultiTexEnvfEXT }, 422 { "glMultiTexEnvfvEXT", (PROC) nop_glMultiTexEnvfvEXT }, 423 { "glMultiTexEnviEXT", (PROC) nop_glMultiTexEnviEXT }, 424 { "glMultiTexGenfvEXT", (PROC) nop_glMultiTexGenfvEXT }, 425 { "glMultiTexGeniEXT", (PROC) nop_glMultiTexGeniEXT }, 426 { "glNamedBufferDataEXT", (PROC) nop_glNamedBufferDataEXT }, 427 { "glNamedBufferSubDataEXT", (PROC) nop_glNamedBufferSubDataEXT }, 428 { "glNamedProgramLocalParameter4fvEXT", (PROC) nop_glNamedProgramLocalParameter4fvEXT }, 429 { "glNamedProgramLocalParameters4fvEXT", (PROC) nop_glNamedProgramLocalParameters4fvEXT }, 430 { "glNormal3hNV", (PROC) nop_glNormal3hNV }, 431 { "glNormal3hvNV", (PROC) nop_glNormal3hvNV }, 432 { "glPatchParameterfv", (PROC) nop_glPatchParameterfv }, 433 { "glPatchParameteri", (PROC) nop_glPatchParameteri }, 434 { "glSecondaryColor3hNV", (PROC) nop_glSecondaryColor3hNV }, 435 { "glSecondaryColor3hvNV", (PROC) nop_glSecondaryColor3hvNV }, 436 { "glTexCoord1hNV", (PROC) nop_glTexCoord1hNV }, 437 { "glTexCoord1hvNV", (PROC) nop_glTexCoord1hvNV }, 438 { "glTexCoord2hNV", (PROC) nop_glTexCoord2hNV }, 439 { "glTexCoord2hvNV", (PROC) nop_glTexCoord2hvNV }, 440 { "glTexCoord3hNV", (PROC) nop_glTexCoord3hNV }, 441 { "glTexCoord3hvNV", (PROC) nop_glTexCoord3hvNV }, 442 { "glTexCoord4hNV", (PROC) nop_glTexCoord4hNV }, 443 { "glTexCoord4hvNV", (PROC) nop_glTexCoord4hvNV }, 444 { "glTextureParameterfEXT", (PROC) nop_glTextureParameterfEXT }, 445 { "glTextureParameterfvEXT", (PROC) nop_glTextureParameterfvEXT }, 446 { "glTextureParameteriEXT", (PROC) nop_glTextureParameteriEXT }, 447 { "glUnmapNamedBufferEXT", (PROC) nop_glUnmapNamedBufferEXT }, 448 { "glVertex2hNV", (PROC) nop_glVertex2hNV }, 449 { "glVertex2hvNV", (PROC) nop_glVertex2hvNV }, 450 { "glVertex3hNV", (PROC) nop_glVertex3hNV }, 451 { "glVertex3hvNV", (PROC) nop_glVertex3hvNV }, 452 { "glVertex4hNV", (PROC) nop_glVertex4hNV }, 453 { "glVertex4hvNV", (PROC) nop_glVertex4hvNV }, 454 { NULL, NULL } 455 }; 456 457 int i; 458 459 for (i = 0; table[i].name; i++) { 460 if (strcmp(table[i].name, name) == 0) 461 return table[i].p; 462 } 463 return NULL; 464} 465