José Fonseca | c6b49ce | 2010-11-28 16:43:04 +0000 | [diff] [blame] | 1 | ########################################################################## |
| 2 | # |
| 3 | # Copyright 2010 VMware, Inc. |
| 4 | # All Rights Reserved. |
| 5 | # |
| 6 | # Permission is hereby granted, free of charge, to any person obtaining a copy |
| 7 | # of this software and associated documentation files (the "Software"), to deal |
| 8 | # in the Software without restriction, including without limitation the rights |
| 9 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
| 10 | # copies of the Software, and to permit persons to whom the Software is |
| 11 | # furnished to do so, subject to the following conditions: |
| 12 | # |
| 13 | # The above copyright notice and this permission notice shall be included in |
| 14 | # all copies or substantial portions of the Software. |
| 15 | # |
| 16 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 17 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 18 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 19 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 20 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 21 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
| 22 | # THE SOFTWARE. |
| 23 | # |
| 24 | ##########################################################################/ |
| 25 | |
| 26 | |
José Fonseca | 4a826ed | 2010-11-30 16:58:22 +0000 | [diff] [blame] | 27 | """Generated an header, glproc.hpp, which does pretty much what GLEW does, but |
| 28 | covers all the functions we support. |
| 29 | """ |
| 30 | |
| 31 | |
José Fonseca | e91f5bc | 2014-07-17 20:42:35 +0100 | [diff] [blame^] | 32 | import sys |
| 33 | |
José Fonseca | 669b200 | 2011-02-20 13:32:19 +0000 | [diff] [blame] | 34 | from dispatch import Dispatcher |
José Fonseca | 4f242f4 | 2012-04-14 18:13:25 +0100 | [diff] [blame] | 35 | import specs.stdapi as stdapi |
José Fonseca | bd86a22 | 2011-09-27 09:21:38 +0100 | [diff] [blame] | 36 | from specs.glapi import glapi |
| 37 | from specs.glxapi import glxapi |
| 38 | from specs.wglapi import wglapi |
| 39 | from specs.cglapi import cglapi |
Chia-I Wu | e50c14b | 2011-11-03 12:24:53 +0800 | [diff] [blame] | 40 | from specs.eglapi import eglapi |
Chia-I Wu | e889ac7 | 2011-11-03 12:45:00 +0800 | [diff] [blame] | 41 | from specs.glesapi import glesapi |
José Fonseca | c6b49ce | 2010-11-28 16:43:04 +0000 | [diff] [blame] | 42 | |
| 43 | |
José Fonseca | 68ec412 | 2011-02-20 11:25:25 +0000 | [diff] [blame] | 44 | # See http://www.opengl.org/registry/ABI/ |
José Fonseca | c6b49ce | 2010-11-28 16:43:04 +0000 | [diff] [blame] | 45 | public_symbols = set([ |
José Fonseca | b87c229 | 2011-10-09 14:56:16 +0100 | [diff] [blame] | 46 | # GL 1.2 and ARB_multitexture |
| 47 | "glAccum", |
| 48 | "glAlphaFunc", |
| 49 | "glAreTexturesResident", |
| 50 | "glArrayElement", |
| 51 | "glBegin", |
| 52 | "glBindTexture", |
| 53 | "glBitmap", |
| 54 | "glBlendFunc", |
| 55 | "glCallList", |
| 56 | "glCallLists", |
| 57 | "glClear", |
| 58 | "glClearAccum", |
| 59 | "glClearColor", |
| 60 | "glClearDepth", |
| 61 | "glClearIndex", |
| 62 | "glClearStencil", |
| 63 | "glClipPlane", |
| 64 | "glColor3b", |
| 65 | "glColor3bv", |
| 66 | "glColor3d", |
| 67 | "glColor3dv", |
| 68 | "glColor3f", |
| 69 | "glColor3fv", |
| 70 | "glColor3i", |
| 71 | "glColor3iv", |
| 72 | "glColor3s", |
| 73 | "glColor3sv", |
| 74 | "glColor3ub", |
| 75 | "glColor3ubv", |
| 76 | "glColor3ui", |
| 77 | "glColor3uiv", |
| 78 | "glColor3us", |
| 79 | "glColor3usv", |
| 80 | "glColor4b", |
| 81 | "glColor4bv", |
| 82 | "glColor4d", |
| 83 | "glColor4dv", |
| 84 | "glColor4f", |
| 85 | "glColor4fv", |
| 86 | "glColor4i", |
| 87 | "glColor4iv", |
| 88 | "glColor4s", |
| 89 | "glColor4sv", |
| 90 | "glColor4ub", |
| 91 | "glColor4ubv", |
| 92 | "glColor4ui", |
| 93 | "glColor4uiv", |
| 94 | "glColor4us", |
| 95 | "glColor4usv", |
| 96 | "glColorMask", |
| 97 | "glColorMaterial", |
| 98 | "glColorPointer", |
| 99 | "glCopyPixels", |
| 100 | "glCopyTexImage1D", |
| 101 | "glCopyTexImage2D", |
| 102 | "glCopyTexSubImage1D", |
| 103 | "glCopyTexSubImage2D", |
| 104 | "glCullFace", |
| 105 | "glDeleteLists", |
| 106 | "glDeleteTextures", |
| 107 | "glDepthFunc", |
| 108 | "glDepthMask", |
| 109 | "glDepthRange", |
| 110 | "glDisable", |
| 111 | "glDisableClientState", |
| 112 | "glDrawArrays", |
| 113 | "glDrawBuffer", |
| 114 | "glDrawElements", |
| 115 | "glDrawPixels", |
| 116 | "glEdgeFlag", |
| 117 | "glEdgeFlagPointer", |
| 118 | "glEdgeFlagv", |
| 119 | "glEnable", |
| 120 | "glEnableClientState", |
| 121 | "glEnd", |
| 122 | "glEndList", |
| 123 | "glEvalCoord1d", |
| 124 | "glEvalCoord1dv", |
| 125 | "glEvalCoord1f", |
| 126 | "glEvalCoord1fv", |
| 127 | "glEvalCoord2d", |
| 128 | "glEvalCoord2dv", |
| 129 | "glEvalCoord2f", |
| 130 | "glEvalCoord2fv", |
| 131 | "glEvalMesh1", |
| 132 | "glEvalMesh2", |
| 133 | "glEvalPoint1", |
| 134 | "glEvalPoint2", |
| 135 | "glFeedbackBuffer", |
| 136 | "glFinish", |
| 137 | "glFlush", |
| 138 | "glFogf", |
| 139 | "glFogfv", |
| 140 | "glFogi", |
| 141 | "glFogiv", |
| 142 | "glFrontFace", |
| 143 | "glFrustum", |
| 144 | "glGenLists", |
| 145 | "glGenTextures", |
| 146 | "glGetBooleanv", |
| 147 | "glGetClipPlane", |
| 148 | "glGetDoublev", |
| 149 | "glGetError", |
| 150 | "glGetFloatv", |
| 151 | "glGetIntegerv", |
| 152 | "glGetLightfv", |
| 153 | "glGetLightiv", |
| 154 | "glGetMapdv", |
| 155 | "glGetMapfv", |
| 156 | "glGetMapiv", |
| 157 | "glGetMaterialfv", |
| 158 | "glGetMaterialiv", |
| 159 | "glGetPixelMapfv", |
| 160 | "glGetPixelMapuiv", |
| 161 | "glGetPixelMapusv", |
| 162 | "glGetPointerv", |
| 163 | "glGetPolygonStipple", |
| 164 | "glGetString", |
| 165 | "glGetTexEnvfv", |
| 166 | "glGetTexEnviv", |
| 167 | "glGetTexGendv", |
| 168 | "glGetTexGenfv", |
| 169 | "glGetTexGeniv", |
| 170 | "glGetTexImage", |
| 171 | "glGetTexLevelParameterfv", |
| 172 | "glGetTexLevelParameteriv", |
| 173 | "glGetTexParameterfv", |
| 174 | "glGetTexParameteriv", |
| 175 | "glHint", |
| 176 | "glIndexMask", |
| 177 | "glIndexPointer", |
| 178 | "glIndexd", |
| 179 | "glIndexdv", |
| 180 | "glIndexf", |
| 181 | "glIndexfv", |
| 182 | "glIndexi", |
| 183 | "glIndexiv", |
| 184 | "glIndexs", |
| 185 | "glIndexsv", |
| 186 | "glIndexub", |
| 187 | "glIndexubv", |
| 188 | "glInitNames", |
| 189 | "glInterleavedArrays", |
| 190 | "glIsEnabled", |
| 191 | "glIsList", |
| 192 | "glIsTexture", |
| 193 | "glLightModelf", |
| 194 | "glLightModelfv", |
| 195 | "glLightModeli", |
| 196 | "glLightModeliv", |
| 197 | "glLightf", |
| 198 | "glLightfv", |
| 199 | "glLighti", |
| 200 | "glLightiv", |
| 201 | "glLineStipple", |
| 202 | "glLineWidth", |
| 203 | "glListBase", |
| 204 | "glLoadIdentity", |
| 205 | "glLoadMatrixd", |
| 206 | "glLoadMatrixf", |
| 207 | "glLoadName", |
| 208 | "glLogicOp", |
| 209 | "glMap1d", |
| 210 | "glMap1f", |
| 211 | "glMap2d", |
| 212 | "glMap2f", |
| 213 | "glMapGrid1d", |
| 214 | "glMapGrid1f", |
| 215 | "glMapGrid2d", |
| 216 | "glMapGrid2f", |
| 217 | "glMaterialf", |
| 218 | "glMaterialfv", |
| 219 | "glMateriali", |
| 220 | "glMaterialiv", |
| 221 | "glMatrixMode", |
| 222 | "glMultMatrixd", |
| 223 | "glMultMatrixf", |
| 224 | "glNewList", |
| 225 | "glNormal3b", |
| 226 | "glNormal3bv", |
| 227 | "glNormal3d", |
| 228 | "glNormal3dv", |
| 229 | "glNormal3f", |
| 230 | "glNormal3fv", |
| 231 | "glNormal3i", |
| 232 | "glNormal3iv", |
| 233 | "glNormal3s", |
| 234 | "glNormal3sv", |
| 235 | "glNormalPointer", |
| 236 | "glOrtho", |
| 237 | "glPassThrough", |
| 238 | "glPixelMapfv", |
| 239 | "glPixelMapuiv", |
| 240 | "glPixelMapusv", |
| 241 | "glPixelStoref", |
| 242 | "glPixelStorei", |
| 243 | "glPixelTransferf", |
| 244 | "glPixelTransferi", |
| 245 | "glPixelZoom", |
| 246 | "glPointSize", |
| 247 | "glPolygonMode", |
| 248 | "glPolygonOffset", |
| 249 | "glPolygonStipple", |
| 250 | "glPopAttrib", |
| 251 | "glPopClientAttrib", |
| 252 | "glPopMatrix", |
| 253 | "glPopName", |
| 254 | "glPrioritizeTextures", |
| 255 | "glPushAttrib", |
| 256 | "glPushClientAttrib", |
| 257 | "glPushMatrix", |
| 258 | "glPushName", |
| 259 | "glRasterPos2d", |
| 260 | "glRasterPos2dv", |
| 261 | "glRasterPos2f", |
| 262 | "glRasterPos2fv", |
| 263 | "glRasterPos2i", |
| 264 | "glRasterPos2iv", |
| 265 | "glRasterPos2s", |
| 266 | "glRasterPos2sv", |
| 267 | "glRasterPos3d", |
| 268 | "glRasterPos3dv", |
| 269 | "glRasterPos3f", |
| 270 | "glRasterPos3fv", |
| 271 | "glRasterPos3i", |
| 272 | "glRasterPos3iv", |
| 273 | "glRasterPos3s", |
| 274 | "glRasterPos3sv", |
| 275 | "glRasterPos4d", |
| 276 | "glRasterPos4dv", |
| 277 | "glRasterPos4f", |
| 278 | "glRasterPos4fv", |
| 279 | "glRasterPos4i", |
| 280 | "glRasterPos4iv", |
| 281 | "glRasterPos4s", |
| 282 | "glRasterPos4sv", |
| 283 | "glReadBuffer", |
| 284 | "glReadPixels", |
| 285 | "glRectd", |
| 286 | "glRectdv", |
| 287 | "glRectf", |
| 288 | "glRectfv", |
| 289 | "glRecti", |
| 290 | "glRectiv", |
| 291 | "glRects", |
| 292 | "glRectsv", |
| 293 | "glRenderMode", |
| 294 | "glRotated", |
| 295 | "glRotatef", |
| 296 | "glScaled", |
| 297 | "glScalef", |
| 298 | "glScissor", |
| 299 | "glSelectBuffer", |
| 300 | "glShadeModel", |
| 301 | "glStencilFunc", |
| 302 | "glStencilMask", |
| 303 | "glStencilOp", |
| 304 | "glTexCoord1d", |
| 305 | "glTexCoord1dv", |
| 306 | "glTexCoord1f", |
| 307 | "glTexCoord1fv", |
| 308 | "glTexCoord1i", |
| 309 | "glTexCoord1iv", |
| 310 | "glTexCoord1s", |
| 311 | "glTexCoord1sv", |
| 312 | "glTexCoord2d", |
| 313 | "glTexCoord2dv", |
| 314 | "glTexCoord2f", |
| 315 | "glTexCoord2fv", |
| 316 | "glTexCoord2i", |
| 317 | "glTexCoord2iv", |
| 318 | "glTexCoord2s", |
| 319 | "glTexCoord2sv", |
| 320 | "glTexCoord3d", |
| 321 | "glTexCoord3dv", |
| 322 | "glTexCoord3f", |
| 323 | "glTexCoord3fv", |
| 324 | "glTexCoord3i", |
| 325 | "glTexCoord3iv", |
| 326 | "glTexCoord3s", |
| 327 | "glTexCoord3sv", |
| 328 | "glTexCoord4d", |
| 329 | "glTexCoord4dv", |
| 330 | "glTexCoord4f", |
| 331 | "glTexCoord4fv", |
| 332 | "glTexCoord4i", |
| 333 | "glTexCoord4iv", |
| 334 | "glTexCoord4s", |
| 335 | "glTexCoord4sv", |
| 336 | "glTexCoordPointer", |
| 337 | "glTexEnvf", |
| 338 | "glTexEnvfv", |
| 339 | "glTexEnvi", |
| 340 | "glTexEnviv", |
| 341 | "glTexGend", |
| 342 | "glTexGendv", |
| 343 | "glTexGenf", |
| 344 | "glTexGenfv", |
| 345 | "glTexGeni", |
| 346 | "glTexGeniv", |
| 347 | "glTexImage1D", |
| 348 | "glTexImage2D", |
| 349 | "glTexParameterf", |
| 350 | "glTexParameterfv", |
| 351 | "glTexParameteri", |
| 352 | "glTexParameteriv", |
| 353 | "glTexSubImage1D", |
| 354 | "glTexSubImage2D", |
| 355 | "glTranslated", |
| 356 | "glTranslatef", |
| 357 | "glVertex2d", |
| 358 | "glVertex2dv", |
| 359 | "glVertex2f", |
| 360 | "glVertex2fv", |
| 361 | "glVertex2i", |
| 362 | "glVertex2iv", |
| 363 | "glVertex2s", |
| 364 | "glVertex2sv", |
| 365 | "glVertex3d", |
| 366 | "glVertex3dv", |
| 367 | "glVertex3f", |
| 368 | "glVertex3fv", |
| 369 | "glVertex3i", |
| 370 | "glVertex3iv", |
| 371 | "glVertex3s", |
| 372 | "glVertex3sv", |
| 373 | "glVertex4d", |
| 374 | "glVertex4dv", |
| 375 | "glVertex4f", |
| 376 | "glVertex4fv", |
| 377 | "glVertex4i", |
| 378 | "glVertex4iv", |
| 379 | "glVertex4s", |
| 380 | "glVertex4sv", |
| 381 | "glVertexPointer", |
| 382 | "glViewport", |
José Fonseca | 68ec412 | 2011-02-20 11:25:25 +0000 | [diff] [blame] | 383 | |
José Fonseca | b87c229 | 2011-10-09 14:56:16 +0100 | [diff] [blame] | 384 | # GLX 1.3 and GLX_ARB_get_proc_address |
| 385 | "glXChooseVisual", |
| 386 | "glXCreateContext", |
| 387 | "glXDestroyContext", |
| 388 | "glXMakeCurrent", |
| 389 | "glXCopyContext", |
| 390 | "glXSwapBuffers", |
| 391 | "glXCreateGLXPixmap", |
| 392 | "glXDestroyGLXPixmap", |
| 393 | "glXQueryExtension", |
| 394 | "glXQueryVersion", |
| 395 | "glXIsDirect", |
| 396 | "glXGetConfig", |
| 397 | "glXGetCurrentContext", |
| 398 | "glXGetCurrentDrawable", |
| 399 | "glXWaitGL", |
| 400 | "glXWaitX", |
| 401 | "glXUseXFont", |
| 402 | "glXQueryExtensionsString", |
| 403 | "glXQueryServerString", |
| 404 | "glXGetClientString", |
| 405 | "glXGetCurrentDisplay", |
| 406 | "glXChooseFBConfig", |
| 407 | "glXGetFBConfigAttrib", |
| 408 | "glXGetFBConfigs", |
| 409 | "glXGetVisualFromFBConfig", |
| 410 | "glXCreateWindow", |
| 411 | "glXDestroyWindow", |
| 412 | "glXCreatePixmap", |
| 413 | "glXDestroyPixmap", |
| 414 | "glXCreatePbuffer", |
| 415 | "glXDestroyPbuffer", |
| 416 | "glXQueryDrawable", |
| 417 | "glXCreateNewContext", |
| 418 | "glXMakeContextCurrent", |
| 419 | "glXGetCurrentReadDrawable", |
| 420 | "glXQueryContext", |
| 421 | "glXSelectEvent", |
| 422 | "glXGetSelectedEvent", |
José Fonseca | 68ec412 | 2011-02-20 11:25:25 +0000 | [diff] [blame] | 423 | "glXGetProcAddressARB", |
| 424 | "glXGetProcAddress", |
José Fonseca | b87c229 | 2011-10-09 14:56:16 +0100 | [diff] [blame] | 425 | |
| 426 | # WGL |
| 427 | #"glDebugEntry", |
| 428 | "wglChoosePixelFormat", |
| 429 | "wglCopyContext", |
| 430 | "wglCreateContext", |
| 431 | "wglCreateLayerContext", |
| 432 | "wglDeleteContext", |
| 433 | "wglDescribeLayerPlane", |
| 434 | "wglDescribePixelFormat", |
| 435 | "wglGetCurrentContext", |
| 436 | "wglGetCurrentDC", |
| 437 | "wglGetDefaultProcAddress", |
| 438 | "wglGetLayerPaletteEntries", |
| 439 | "wglGetPixelFormat", |
| 440 | "wglGetProcAddress", |
| 441 | "wglMakeCurrent", |
| 442 | "wglRealizeLayerPalette", |
| 443 | "wglSetLayerPaletteEntries", |
| 444 | "wglSetPixelFormat", |
| 445 | "wglShareLists", |
| 446 | "wglSwapBuffers", |
| 447 | "wglSwapLayerBuffers", |
| 448 | "wglSwapMultipleBuffers", |
| 449 | "wglUseFontBitmapsA", |
| 450 | "wglUseFontBitmapsW", |
| 451 | "wglUseFontOutlinesA", |
| 452 | "wglUseFontOutlinesW", |
| 453 | |
José Fonseca | c6b49ce | 2010-11-28 16:43:04 +0000 | [diff] [blame] | 454 | ]) |
| 455 | |
Chia-I Wu | e50c14b | 2011-11-03 12:24:53 +0800 | [diff] [blame] | 456 | # EGL 1.4 |
| 457 | public_symbols.update([ |
| 458 | "eglBindAPI", |
| 459 | "eglBindTexImage", |
| 460 | "eglChooseConfig", |
| 461 | "eglCopyBuffers", |
| 462 | "eglCreateContext", |
| 463 | "eglCreatePbufferFromClientBuffer", |
| 464 | "eglCreatePbufferSurface", |
| 465 | "eglCreatePixmapSurface", |
| 466 | "eglCreateWindowSurface", |
| 467 | "eglDestroyContext", |
| 468 | "eglDestroySurface", |
| 469 | "eglGetConfigAttrib", |
| 470 | "eglGetConfigs", |
| 471 | "eglGetCurrentContext", |
| 472 | "eglGetCurrentDisplay", |
| 473 | "eglGetCurrentSurface", |
| 474 | "eglGetDisplay", |
| 475 | "eglGetError", |
| 476 | "eglGetProcAddress", |
| 477 | "eglInitialize", |
| 478 | "eglMakeCurrent", |
| 479 | "eglQueryAPI", |
| 480 | "eglQueryContext", |
| 481 | "eglQueryString", |
| 482 | "eglQuerySurface", |
| 483 | "eglReleaseTexImage", |
| 484 | "eglReleaseThread", |
| 485 | "eglSurfaceAttrib", |
| 486 | "eglSwapBuffers", |
| 487 | "eglSwapInterval", |
| 488 | "eglTerminate", |
| 489 | "eglWaitClient", |
| 490 | "eglWaitGL", |
| 491 | "eglWaitNative", |
| 492 | ]) |
José Fonseca | c6b49ce | 2010-11-28 16:43:04 +0000 | [diff] [blame] | 493 | |
José Fonseca | 68ec412 | 2011-02-20 11:25:25 +0000 | [diff] [blame] | 494 | class GlDispatcher(Dispatcher): |
| 495 | |
José Fonseca | 8130193 | 2012-11-11 00:10:20 +0000 | [diff] [blame] | 496 | def isFunctionPublic(self, module, function): |
José Fonseca | 3bcb33c | 2011-05-27 20:14:31 +0100 | [diff] [blame] | 497 | return function.name in public_symbols or function.name.startswith('CGL') |
José Fonseca | c6b49ce | 2010-11-28 16:43:04 +0000 | [diff] [blame] | 498 | |
José Fonseca | 7989f93 | 2014-07-17 19:45:15 +0100 | [diff] [blame] | 499 | def getProcAddressName(self, module, function): |
| 500 | if self.isFunctionPublic(module, function): |
| 501 | return '_getPublicProcAddress' |
| 502 | else: |
| 503 | return '_getPrivateProcAddress' |
| 504 | |
Peter Lohrmann | 9d9eb81 | 2013-07-12 16:15:25 -0400 | [diff] [blame] | 505 | def failFunction(self, function): |
| 506 | # We fake this when they are not available |
José Fonseca | 7ff8241 | 2014-02-04 19:01:22 +0000 | [diff] [blame] | 507 | if function.name in ('glGetObjectLabel', 'glGetObjectPtrLabel', 'glGetObjectLabelEXT'): |
Peter Lohrmann | 9d9eb81 | 2013-07-12 16:15:25 -0400 | [diff] [blame] | 508 | print r' if (length != 0) *length = 0;' |
| 509 | print r' if (label != 0 && bufSize > 0) *label = 0;' |
| 510 | return |
| 511 | if function.name in ('glGetDebugMessageLog', 'glGetDebugMessageLogARB'): |
| 512 | print r' if (sources != 0) *sources = 0;' |
| 513 | print r' if (types != 0) *types = 0;' |
| 514 | print r' if (ids != 0) *ids = 0;' |
| 515 | print r' if (severities != 0) *severities = 0;' |
| 516 | print r' if (lengths != 0) *lengths = 0;' |
| 517 | print r' if (messageLog != 0 && bufsize > 0) *messageLog = 0;' |
José Fonseca | 3121564 | 2014-07-17 20:32:12 +0100 | [diff] [blame] | 518 | print r' return 0;' |
Peter Lohrmann | 9d9eb81 | 2013-07-12 16:15:25 -0400 | [diff] [blame] | 519 | return |
| 520 | if function.name in ('glGetDebugMessageLogAMD'): |
| 521 | print r' if (categories != 0) *categories = 0;' |
| 522 | print r' if (ids != 0) *ids = 0;' |
| 523 | print r' if (severities != 0) *severities = 0;' |
| 524 | print r' if (lengths != 0) *lengths = 0;' |
| 525 | print r' if (message != 0 && bufsize > 0) *message = 0;' |
José Fonseca | 3121564 | 2014-07-17 20:32:12 +0100 | [diff] [blame] | 526 | print r' return 0;' |
Peter Lohrmann | 9d9eb81 | 2013-07-12 16:15:25 -0400 | [diff] [blame] | 527 | return |
| 528 | |
| 529 | Dispatcher.failFunction(self, function) |
| 530 | |
José Fonseca | c6b49ce | 2010-11-28 16:43:04 +0000 | [diff] [blame] | 531 | |
| 532 | if __name__ == '__main__': |
José Fonseca | e91f5bc | 2014-07-17 20:42:35 +0100 | [diff] [blame^] | 533 | decl, impl = sys.argv[1:] |
| 534 | |
| 535 | sys.stdout = open(decl, 'wt') |
José Fonseca | c6b49ce | 2010-11-28 16:43:04 +0000 | [diff] [blame] | 536 | print |
José Fonseca | 669b200 | 2011-02-20 13:32:19 +0000 | [diff] [blame] | 537 | print '#ifndef _GLPROC_HPP_' |
| 538 | print '#define _GLPROC_HPP_' |
José Fonseca | e91f5bc | 2014-07-17 20:42:35 +0100 | [diff] [blame^] | 539 | print |
José Fonseca | c6b49ce | 2010-11-28 16:43:04 +0000 | [diff] [blame] | 540 | print '#include "glimports.hpp"' |
José Fonseca | e91f5bc | 2014-07-17 20:42:35 +0100 | [diff] [blame^] | 541 | print |
| 542 | print '#if defined(_WIN32)' |
| 543 | print 'extern HMODULE _libGlHandle;' |
| 544 | print '#else' |
| 545 | print 'extern void * _libGlHandle;' |
| 546 | print '#endif' |
| 547 | print |
| 548 | print 'void * _getPublicProcAddress(const char *procName);' |
| 549 | print 'void * _getPrivateProcAddress(const char *procName);' |
| 550 | print |
| 551 | dispatcher = GlDispatcher() |
| 552 | print |
| 553 | dispatcher.dispatchModuleDecl(eglapi) |
| 554 | print |
| 555 | print '#if defined(_WIN32)' |
| 556 | print |
| 557 | dispatcher.dispatchModuleDecl(wglapi) |
| 558 | print |
| 559 | print '#elif defined(__APPLE__)' |
| 560 | print |
| 561 | dispatcher.dispatchModuleDecl(cglapi) |
| 562 | print |
| 563 | print '#elif defined(HAVE_X11)' |
| 564 | print |
| 565 | dispatcher.dispatchModuleDecl(glxapi) |
| 566 | print |
| 567 | print '#endif' |
| 568 | print |
| 569 | dispatcher.dispatchModuleDecl(glapi) |
| 570 | print |
| 571 | dispatcher.dispatchModuleDecl(glesapi) |
| 572 | print |
| 573 | print '#endif /* !_GLPROC_HPP_ */' |
| 574 | print |
| 575 | |
| 576 | sys.stdout = open(impl, 'wt') |
| 577 | print |
| 578 | print '#include "glproc.hpp"' |
José Fonseca | c6b49ce | 2010-11-28 16:43:04 +0000 | [diff] [blame] | 579 | print '#include "os.hpp"' |
| 580 | print |
José Fonseca | 68ec412 | 2011-02-20 11:25:25 +0000 | [diff] [blame] | 581 | dispatcher = GlDispatcher() |
José Fonseca | afc32ba | 2012-03-30 00:18:16 +0100 | [diff] [blame] | 582 | print |
José Fonseca | e91f5bc | 2014-07-17 20:42:35 +0100 | [diff] [blame^] | 583 | dispatcher.dispatchModuleImpl(eglapi) |
José Fonseca | afc32ba | 2012-03-30 00:18:16 +0100 | [diff] [blame] | 584 | print |
| 585 | print '#if defined(_WIN32)' |
José Fonseca | 68ec412 | 2011-02-20 11:25:25 +0000 | [diff] [blame] | 586 | print |
José Fonseca | e91f5bc | 2014-07-17 20:42:35 +0100 | [diff] [blame^] | 587 | dispatcher.dispatchModuleImpl(wglapi) |
José Fonseca | afc32ba | 2012-03-30 00:18:16 +0100 | [diff] [blame] | 588 | print |
José Fonseca | 3dabe54 | 2011-05-19 17:57:18 +0100 | [diff] [blame] | 589 | print '#elif defined(__APPLE__)' |
José Fonseca | afc32ba | 2012-03-30 00:18:16 +0100 | [diff] [blame] | 590 | print |
José Fonseca | e91f5bc | 2014-07-17 20:42:35 +0100 | [diff] [blame^] | 591 | dispatcher.dispatchModuleImpl(cglapi) |
José Fonseca | afc32ba | 2012-03-30 00:18:16 +0100 | [diff] [blame] | 592 | print |
José Fonseca | 5409d1e | 2012-03-30 19:58:20 +0100 | [diff] [blame] | 593 | print '#elif defined(HAVE_X11)' |
José Fonseca | 68ec412 | 2011-02-20 11:25:25 +0000 | [diff] [blame] | 594 | print |
José Fonseca | e91f5bc | 2014-07-17 20:42:35 +0100 | [diff] [blame^] | 595 | dispatcher.dispatchModuleImpl(glxapi) |
José Fonseca | afc32ba | 2012-03-30 00:18:16 +0100 | [diff] [blame] | 596 | print |
José Fonseca | 3dabe54 | 2011-05-19 17:57:18 +0100 | [diff] [blame] | 597 | print '#endif' |
José Fonseca | 4364860 | 2011-05-15 12:56:59 +0100 | [diff] [blame] | 598 | print |
José Fonseca | e91f5bc | 2014-07-17 20:42:35 +0100 | [diff] [blame^] | 599 | dispatcher.dispatchModuleImpl(glapi) |
José Fonseca | c6b49ce | 2010-11-28 16:43:04 +0000 | [diff] [blame] | 600 | print |
José Fonseca | e91f5bc | 2014-07-17 20:42:35 +0100 | [diff] [blame^] | 601 | dispatcher.dispatchModuleImpl(glesapi) |
José Fonseca | 669b200 | 2011-02-20 13:32:19 +0000 | [diff] [blame] | 602 | print |