Fixed MsiDatabaseImportA, MsiDatabaseImportW, and
[wine] / dlls / opengl32 / wgl_ext.c
1 /* Support for window-specific OpenGL extensions.
2  *
3  * Copyright (c) 2004 Lionel Ulmer
4  * Copyright (c) 2005 Alex Woods
5  * Copyright (c) 2005 Raphael Junqueira
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with this library; if not, write to the Free Software
19  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
20  */
21
22 #include "config.h"
23 #include "wine/port.h"
24
25 #include <stdarg.h>
26 #include <stdlib.h>
27 #include <string.h>
28
29 #include "windef.h"
30 #include "winbase.h"
31 #include "winuser.h"
32 #include "winerror.h"
33
34 #include "wgl.h"
35 #include "wgl_ext.h"
36 #include "opengl_ext.h"
37 #include "wine/library.h"
38 #include "wine/debug.h"
39
40 WINE_DEFAULT_DEBUG_CHANNEL(opengl);
41
42
43 /* x11drv GDI escapes */
44 #define X11DRV_ESCAPE 6789
45 enum x11drv_escape_codes
46 {
47     X11DRV_GET_DISPLAY,   /* get X11 display for a DC */
48     X11DRV_GET_DRAWABLE,  /* get current drawable for a DC */
49     X11DRV_GET_FONT,      /* get current X font for a DC */
50     X11DRV_SET_DRAWABLE,     /* set current drawable for a DC */
51 };
52 struct x11drv_escape_set_drawable
53 {
54     enum x11drv_escape_codes code;         /* escape code (X11DRV_SET_DRAWABLE) */
55     Drawable                 drawable;     /* X drawable */
56     int                      mode;         /* ClipByChildren or IncludeInferiors */
57     POINT                    org;          /* origin of DC relative to drawable */
58     POINT                    drawable_org; /* origin of drawable relative to screen */
59 };
60
61 /* retrieve the X display to use on a given DC */
62 inline static Display *get_display( HDC hdc )
63 {
64     Display *display;
65     enum x11drv_escape_codes escape = X11DRV_GET_DISPLAY;
66
67     if (!ExtEscape( hdc, X11DRV_ESCAPE, sizeof(escape), (LPCSTR)&escape,
68                     sizeof(display), (LPSTR)&display )) display = NULL;
69     return display;
70 }
71 inline static void set_drawable( HDC hdc, Drawable drawable )
72 {
73     struct x11drv_escape_set_drawable escape;
74
75     escape.code = X11DRV_SET_DRAWABLE;
76     escape.drawable = drawable;
77     escape.mode = IncludeInferiors;
78     escape.org.x = escape.org.y = 0;
79     escape.drawable_org.x = escape.drawable_org.y = 0;
80
81     ExtEscape( hdc, X11DRV_ESCAPE, sizeof(escape), (LPCSTR)&escape, 0, NULL );
82 }
83
84 /* Some WGL extensions... */
85 static const char *WGL_extensions_base = "WGL_ARB_extensions_string WGL_EXT_extensions_string";
86 static char *WGL_extensions = NULL;
87
88 /**
89  * Extensions-query functions 
90  *
91  * @TODO: use a struct to handle parameters 
92  */
93 BOOL query_function_multisample(glXGetProcAddressARB_t proc, const char *gl_version, const char *gl_extensions, 
94                                 const char* glx_version, const char *glx_extensions,
95                                 const char *server_glx_extensions, const char *client_glx_extensions)
96 {
97   return NULL != strstr("GLX_ARB_multisample", glx_extensions);
98 }
99
100 BOOL query_function_pbuffer(glXGetProcAddressARB_t proc, const char *gl_version, const char *gl_extensions, 
101                             const char* glx_version, const char *glx_extensions,
102                             const char *server_glx_extensions, const char *client_glx_extensions)
103 {
104   FIXME("gl_version is: \"%s\"\n", gl_version);
105   FIXME("glx_exts is: \"%s\"\n", glx_extensions);
106
107   return 0 <= strcmp("1.3", glx_version) || NULL != strstr(glx_extensions, "GLX_SGIX_pbuffer");
108 }
109
110 BOOL query_function_pixel_format(glXGetProcAddressARB_t proc, const char *gl_version, const char *gl_extensions, 
111                                  const char* glx_version, const char *glx_extensions,
112                                  const char *server_glx_extensions, const char *client_glx_extensions)
113 {
114   return TRUE;
115 }
116
117 /** GLX_ARB_render_texture */
118 Bool (*p_glXBindTexImageARB)(Display *dpy, GLXPbuffer pbuffer, int buffer);
119 Bool (*p_glXReleaseTexImageARB)(Display *dpy, GLXPbuffer pbuffer, int buffer);
120 Bool (*p_glXDrawableAttribARB)(Display *dpy, GLXDrawable draw, const int *attribList);
121
122 BOOL query_function_render_texture(glXGetProcAddressARB_t proc, const char *gl_version, const char *gl_extensions, 
123                                    const char* glx_version, const char *glx_extensions,
124                                    const char *server_glx_extensions, const char *client_glx_extensions)
125 {
126   BOOL bTest = (0 <= strcmp("1.3", glx_version) || NULL != strstr(glx_extensions, "GLX_SGIX_pbuffer") || NULL != strstr(glx_extensions, "GLX_ARB_render_texture"));
127   if (bTest) {
128     p_glXBindTexImageARB = proc("glXBindTexImageARB");
129     p_glXReleaseTexImageARB = proc("glXReleaseTexImageARB");
130     p_glXDrawableAttribARB = proc("glXDrawableAttribARB");
131     bTest = (NULL != p_glXBindTexImageARB && NULL != p_glXReleaseTexImageARB && NULL != p_glXDrawableAttribARB);
132   }
133   return bTest;
134 }
135
136 /***********************************************************************
137  *              wglGetExtensionsStringEXT(OPENGL32.@)
138  */
139 const char * WINAPI wglGetExtensionsStringEXT(void) {
140     TRACE("() returning \"%s\"\n", WGL_extensions);
141
142     return WGL_extensions;
143 }
144
145 /***********************************************************************
146  *              wglGetExtensionsStringARB(OPENGL32.@)
147  */
148 const char * WINAPI wglGetExtensionsStringARB(HDC hdc) {
149     TRACE("() returning \"%s\"\n", WGL_extensions);
150
151     return WGL_extensions;    
152 }
153
154 static int swap_interval = 1;
155
156 /***********************************************************************
157  *              wglSwapIntervalEXT(OPENGL32.@)
158  */
159 BOOL WINAPI wglSwapIntervalEXT(int interval) {
160     FIXME("(%d),stub!\n", interval);
161
162     swap_interval = interval;
163     return TRUE;
164 }
165
166 /***********************************************************************
167  *              wglGetSwapIntervalEXT(OPENGL32.@)
168  */
169 int WINAPI wglGetSwapIntervalEXT(VOID) {
170     FIXME("(),stub!\n");
171     return swap_interval;
172 }
173
174 typedef struct wine_glpbuffer {
175   Drawable   drawable;
176   Display*   display;
177   int        pixelFormat;
178   int        width;
179   int        height;
180   int*       attribList;
181   HDC        hdc;
182 } Wine_GLPBuffer;
183
184 #define PUSH1(attribs,att)        attribs[nAttribs++] = (att); 
185 #define PUSH2(attribs,att,value)  attribs[nAttribs++] = (att); attribs[nAttribs++] = (value);
186
187 #define WGL_NUMBER_PIXEL_FORMATS_ARB            0x2000
188 #define WGL_DRAW_TO_WINDOW_ARB                  0x2001
189 #define WGL_DRAW_TO_BITMAP_ARB                  0x2002
190 #define WGL_ACCELERATION_ARB                    0x2003
191 #define WGL_NEED_PALETTE_ARB                    0x2004
192 #define WGL_NEED_SYSTEM_PALETTE_ARB             0x2005
193 #define WGL_SWAP_LAYER_BUFFERS_ARB              0x2006
194 #define WGL_SWAP_METHOD_ARB                     0x2007
195 #define WGL_NUMBER_OVERLAYS_ARB                 0x2008
196 #define WGL_NUMBER_UNDERLAYS_ARB                0x2009
197 #define WGL_TRANSPARENT_ARB                     0x200A
198 #define WGL_TRANSPARENT_RED_VALUE_ARB           0x2037
199 #define WGL_TRANSPARENT_GREEN_VALUE_ARB         0x2038
200 #define WGL_TRANSPARENT_BLUE_VALUE_ARB          0x2039
201 #define WGL_TRANSPARENT_ALPHA_VALUE_ARB         0x203A
202 #define WGL_TRANSPARENT_INDEX_VALUE_ARB         0x203B
203 #define WGL_SHARE_DEPTH_ARB                     0x200C
204 #define WGL_SHARE_STENCIL_ARB                   0x200D
205 #define WGL_SHARE_ACCUM_ARB                     0x200E
206 #define WGL_SUPPORT_GDI_ARB                     0x200F
207 #define WGL_SUPPORT_OPENGL_ARB                  0x2010
208 #define WGL_DOUBLE_BUFFER_ARB                   0x2011
209 #define WGL_STEREO_ARB                          0x2012
210 #define WGL_PIXEL_TYPE_ARB                      0x2013
211 #define WGL_COLOR_BITS_ARB                      0x2014
212 #define WGL_RED_BITS_ARB                        0x2015
213 #define WGL_RED_SHIFT_ARB                       0x2016
214 #define WGL_GREEN_BITS_ARB                      0x2017
215 #define WGL_GREEN_SHIFT_ARB                     0x2018
216 #define WGL_BLUE_BITS_ARB                       0x2019
217 #define WGL_BLUE_SHIFT_ARB                      0x201A
218 #define WGL_ALPHA_BITS_ARB                      0x201B
219 #define WGL_ALPHA_SHIFT_ARB                     0x201C
220 #define WGL_ACCUM_BITS_ARB                      0x201D
221 #define WGL_ACCUM_RED_BITS_ARB                  0x201E
222 #define WGL_ACCUM_GREEN_BITS_ARB                0x201F
223 #define WGL_ACCUM_BLUE_BITS_ARB                 0x2020
224 #define WGL_ACCUM_ALPHA_BITS_ARB                0x2021
225 #define WGL_DEPTH_BITS_ARB                      0x2022
226 #define WGL_STENCIL_BITS_ARB                    0x2023
227 #define WGL_AUX_BUFFERS_ARB                     0x2024
228
229 #define WGL_PBUFFER_WIDTH_ARB                0x2034
230 #define WGL_PBUFFER_HEIGHT_ARB               0x2035
231 #define WGL_PBUFFER_LOST_ARB                 0x2036
232
233 #if 0 /* not used yet */
234 static unsigned ConvertAttribGLXtoWGL(const int* iWGLAttr, int* oGLXAttr) {
235   unsigned nAttribs = 0;
236   FIXME("not yet implemented!\n");
237   return nAttribs;
238 }
239 #endif
240
241 static unsigned ConvertAttribWGLtoGLX(const int* iWGLAttr, int* oGLXAttr) {
242   unsigned nAttribs = 0;
243   unsigned cur = 0; 
244   int pop;
245
246   while (0 != iWGLAttr[cur]) {
247     switch (iWGLAttr[cur]) {
248     case WGL_COLOR_BITS_ARB:
249       pop = iWGLAttr[++cur];
250       PUSH2(oGLXAttr, GLX_BUFFER_SIZE, pop);
251       break;
252     case WGL_ALPHA_BITS_ARB:
253       pop = iWGLAttr[++cur];
254       PUSH2(oGLXAttr, GLX_ALPHA_SIZE, pop);
255       break;
256     case WGL_DEPTH_BITS_ARB:
257       pop = iWGLAttr[++cur];
258       PUSH2(oGLXAttr, GLX_DEPTH_SIZE, pop);
259       break;
260     case WGL_STENCIL_BITS_ARB:
261       pop = iWGLAttr[++cur];
262       PUSH2(oGLXAttr, GLX_STENCIL_SIZE, pop);
263       break;
264     case WGL_DOUBLE_BUFFER_ARB:
265       pop = iWGLAttr[++cur];
266       PUSH2(oGLXAttr, GLX_DOUBLEBUFFER, pop);
267       break;
268     case WGL_DRAW_TO_WINDOW_ARB:
269     case WGL_SUPPORT_OPENGL_ARB:
270     case WGL_ACCELERATION_ARB:
271     /*
272     case WGL_SAMPLE_BUFFERS_ARB:
273     case WGL_SAMPLES_ARB:
274     */
275     default:
276       break;
277     }
278     ++cur;
279   }
280   return nAttribs;
281 }
282
283 GLboolean WINAPI wglGetPixelFormatAttribivARB(HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, int *piValues)
284 {
285     TRACE("(%p, %d, %d, %d, %p, %p)\n", hdc, iPixelFormat, iLayerPlane, nAttributes, piAttributes, piValues);
286     return GL_TRUE;
287 }
288
289 GLboolean WINAPI wglGetPixelFormatAttribfvARB(HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, FLOAT *pfValues)
290 {
291     TRACE("(%p, %d, %d, %d, %p, %p)\n", hdc, iPixelFormat, iLayerPlane, nAttributes, piAttributes, pfValues);
292     return GL_TRUE;
293 }
294
295 GLboolean WINAPI wglChoosePixelFormatARB(HDC hdc, const int *piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats)
296 {
297   Display* display = get_display( hdc );
298   GLXFBConfig* cfgs = NULL;
299   int nCfgs = 0;
300   int attribs[256];
301   unsigned nAttribs;
302   UINT it;
303
304   TRACE("(%p, %p, %p, %d, %p, %p): hackish\n", hdc, piAttribIList, pfAttribFList, nMaxFormats, piFormats, nNumFormats);
305   if (NULL != pfAttribFList) {
306     FIXME("unused pfAttribFList\n");
307   }
308
309   nAttribs = ConvertAttribWGLtoGLX(piAttribIList, attribs);
310   PUSH1(attribs, None);
311
312   cfgs = glXChooseFBConfig(display, DefaultScreen(display), attribs, &nCfgs);
313   for (it = 0; it < nMaxFormats && it < nCfgs; ++it) {
314     piFormats[it] = it;
315   }
316   *nNumFormats = it;
317   return GL_TRUE;
318 }
319
320 #define HPBUFFERARB void *
321 HPBUFFERARB WINAPI wglCreatePbufferARB(HDC hdc, int iPixelFormat, int iWidth, int iHeight, const int *piAttribList)
322 {
323   Wine_GLPBuffer* object = NULL;
324   Display* display = get_display( hdc );
325   GLXFBConfig* cfgs = NULL;
326   int nCfgs = 0;
327   int attribs[256];
328   unsigned nAttribs;
329
330   TRACE("(%p, %d, %d, %d, %p)\n", hdc, iPixelFormat, iWidth, iHeight, piAttribList);
331
332   object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(Wine_GLPBuffer));
333   object->hdc = hdc;
334   object->display = display;
335   object->width = iWidth;
336   object->height = iHeight;
337   object->pixelFormat = iPixelFormat;
338
339   nAttribs = ConvertAttribWGLtoGLX(piAttribList, attribs);
340   PUSH1(attribs, None);
341
342   cfgs = glXChooseFBConfig(display, DefaultScreen(display), attribs, &nCfgs);
343   if (nCfgs < iPixelFormat) return NULL; /* unespected error */
344
345   --nAttribs; /** append more to attribs now we have fbConfig */
346   PUSH2(attribs, GLX_PBUFFER_WIDTH,  iWidth);
347   PUSH2(attribs, GLX_PBUFFER_HEIGHT, iHeight);
348   PUSH1(attribs, None);
349
350   object->drawable = glXCreatePbuffer(display, cfgs[iPixelFormat], attribs);
351   TRACE("drawable as %p\n", (void*) object->drawable);
352
353   TRACE("->(%p)\n", object);
354   return (HPBUFFERARB) object;
355 }
356
357 HDC WINAPI wglGetPbufferDCARB(HPBUFFERARB hPbuffer)
358 {
359   Wine_GLPBuffer* object = (Wine_GLPBuffer*) hPbuffer;
360   HDC hDC;
361   hDC = CreateCompatibleDC(object->hdc);
362   set_drawable(hDC, object->drawable); /* works ?? */
363   TRACE("(%p)\n", hPbuffer);
364   return hDC;
365 }
366
367 int WINAPI wglReleasePbufferDCARB(HPBUFFERARB hPbuffer, HDC hdc)
368 {
369   TRACE("(%p, %p)\n", hPbuffer, hdc);
370   DeleteDC(hdc);
371   return 0;
372 }
373
374 GLboolean WINAPI wglDestroyPbufferARB(HPBUFFERARB hPbuffer)
375 {
376   Wine_GLPBuffer* object = (Wine_GLPBuffer*) hPbuffer;
377   TRACE("(%p)\n", hPbuffer);
378
379   glXDestroyPbuffer(object->display, object->drawable);
380   HeapFree(GetProcessHeap(), 0, object);
381
382   return GL_TRUE;
383 }
384
385 GLboolean WINAPI wglQueryPbufferARB(HPBUFFERARB hPbuffer, int iAttribute, int *piValue)
386 {
387   Wine_GLPBuffer* object = (Wine_GLPBuffer*) hPbuffer;
388   TRACE("(%p, %d, %p)\n", hPbuffer, iAttribute, piValue);
389
390   /*glXQueryDrawable(object->display, object->drawable);*/
391
392   switch (iAttribute) {
393   case WGL_PBUFFER_WIDTH_ARB:
394     glXQueryDrawable(object->display, object->drawable, GLX_WIDTH, piValue);
395     break;
396   case WGL_PBUFFER_HEIGHT_ARB:
397     glXQueryDrawable(object->display, object->drawable, GLX_HEIGHT, piValue);
398     break;
399
400   default:
401     break;
402   }
403
404   return GL_TRUE;
405 }
406
407 GLboolean WINAPI wglBindTexImageARB(HPBUFFERARB hPbuffer, int iBuffer)
408 {
409   Wine_GLPBuffer* object = (Wine_GLPBuffer*) hPbuffer;
410   TRACE("(%p, %d)\n", hPbuffer, iBuffer);
411   return p_glXBindTexImageARB(object->display, object->drawable, iBuffer);
412 }
413
414 GLboolean WINAPI wglReleaseTexImageARB(HPBUFFERARB hPbuffer, int iBuffer)
415 {
416   Wine_GLPBuffer* object = (Wine_GLPBuffer*) hPbuffer;
417   TRACE("(%p, %d)\n", hPbuffer, iBuffer);
418   return p_glXReleaseTexImageARB(object->display, object->drawable, iBuffer);
419 }
420
421 GLboolean WINAPI wglSetPbufferAttribARB(HPBUFFERARB hPbuffer, const int *piAttribList)
422 {
423   Wine_GLPBuffer* object = (Wine_GLPBuffer*) hPbuffer;
424   WARN("(%p, %p): alpha-testing, report any problem\n", hPbuffer, piAttribList);
425   return p_glXDrawableAttribARB(object->display, object->drawable, piAttribList);
426 }
427
428 static const struct {
429     const char *name;
430     BOOL (*query_function)(glXGetProcAddressARB_t proc, const char *gl_version, const char *gl_extensions,
431                            const char *glx_version, const char *glx_extensions,
432                            const char *server_glx_extensions, const char *client_glx_extensions);
433 } extension_list[] = {
434   { "WGL_ARB_multisample", query_function_multisample },
435   { "WGL_ARB_pbuffer", query_function_pbuffer },
436   { "WGL_ARB_pixel_format" , query_function_pixel_format },
437   { "WGL_ARB_render_texture", query_function_render_texture }
438 };
439
440 /* Used to initialize the WGL extension string at DLL loading */
441 void wgl_ext_initialize_extensions(Display *display, int screen, glXGetProcAddressARB_t proc)
442 {
443     int size = strlen(WGL_extensions_base);
444     const char *glx_extensions = glXQueryExtensionsString(display, screen);
445     const char *server_glx_extensions = glXQueryServerString(display, screen, GLX_EXTENSIONS);
446     const char *client_glx_extensions = glXGetClientString(display, GLX_EXTENSIONS);
447     const char *gl_extensions = (const char *) glGetString(GL_EXTENSIONS);
448     const char *gl_version = (const char *) glGetString(GL_VERSION);
449     const char *glx_version = glXGetClientString(display, GLX_VERSION);
450     int i;
451
452     TRACE("GL version      : %s.\n", debugstr_a(gl_version));
453     TRACE("GL exts         : %s.\n", debugstr_a(gl_extensions));
454     TRACE("GLX exts        : %s.\n", debugstr_a(glx_extensions));
455     TRACE("Server GLX exts : %s.\n", debugstr_a(server_glx_extensions));
456     TRACE("Client GLX exts : %s.\n", debugstr_a(client_glx_extensions));
457
458     for (i = 0; i < (sizeof(extension_list) / sizeof(extension_list[0])); i++) {
459         if (extension_list[i].query_function(proc, gl_version, gl_extensions, 
460                                              glx_version, glx_extensions,
461                                              server_glx_extensions, client_glx_extensions)) {
462             size += strlen(extension_list[i].name) + 1;
463         }
464     }
465
466     /* For the moment, only 'base' extensions are supported. */
467     WGL_extensions = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, size + 1);
468     if (WGL_extensions == NULL) {
469         WGL_extensions = (char *) WGL_extensions_base;
470     } else {
471         strcpy(WGL_extensions, WGL_extensions_base);
472         for (i = 0; i < (sizeof(extension_list) / sizeof(extension_list[0])); i++) {
473             if (extension_list[i].query_function(proc, gl_version, gl_extensions, 
474                                                  glx_version, glx_extensions,
475                                                  server_glx_extensions, client_glx_extensions)) {
476                 strcat(WGL_extensions, " ");
477                 strcat(WGL_extensions, extension_list[i].name);
478             }
479         }
480     }
481
482     TRACE("Supporting following WGL extensions : %s.\n", debugstr_a(WGL_extensions));
483 }
484
485 void wgl_ext_finalize_extensions(void)
486 {
487     if (WGL_extensions != WGL_extensions_base) {
488         HeapFree(GetProcessHeap(), 0, WGL_extensions);
489     }
490 }
491
492 /*
493  * Putting this at the end to prevent having to write the prototypes :-) 
494  *
495  * @WARNING: this list must be ordered by name
496  */
497 WGL_extension wgl_extension_registry[] = {
498     { "wglBindTexImageARB", (void *) wglBindTexImageARB, NULL, NULL},
499     { "wglChoosePixelFormatARB", (void *) wglChoosePixelFormatARB, NULL, NULL},
500     { "wglCreatePbufferARB", (void *) wglCreatePbufferARB, NULL, NULL},
501     { "wglDestroyPbufferARB", (void *) wglDestroyPbufferARB, NULL, NULL},
502     { "wglGetExtensionsStringARB", (void *) wglGetExtensionsStringARB, NULL, NULL},
503     { "wglGetExtensionsStringEXT", (void *) wglGetExtensionsStringEXT, NULL, NULL},
504     { "wglGetPbufferDCARB", (void *) wglGetPbufferDCARB, NULL, NULL},
505     { "wglGetPixelFormatAttribfvARB", (void *) wglGetPixelFormatAttribfvARB, NULL, NULL},
506     { "wglGetPixelFormatAttribivARB", (void *) wglGetPixelFormatAttribivARB, NULL, NULL},
507     { "wglGetSwapIntervalEXT", (void *) wglGetSwapIntervalEXT, NULL, NULL},
508     { "wglQueryPbufferARB", (void *) wglQueryPbufferARB, NULL, NULL},
509     { "wglReleasePbufferDCARB", (void *) wglReleasePbufferDCARB, NULL, NULL},
510     { "wglReleaseTexImageARB", (void *) wglReleaseTexImageARB, NULL, NULL},
511     { "wglSetPbufferAttribARB", (void *) wglSetPbufferAttribARB, NULL, NULL},
512     { "wglSwapIntervalEXT", (void *) wglSwapIntervalEXT, NULL, NULL}
513 };
514 int wgl_extension_registry_size = sizeof(wgl_extension_registry) / sizeof(wgl_extension_registry[0]);