Imported Upstream version 1.15.1
[deb_xorg-server.git] / hw / xwin / glx / wgl_ext_api.c
1 /*
2 * File: wgl_ext_api.c
3 * Purpose: Wrapper functions for Win32 OpenGL wgl extension functions
4 *
5 * Authors: Jon TURNEY
6 *
7 * Copyright (c) Jon TURNEY 2009
8 *
9 *
10 * Permission is hereby granted, free of charge, to any person obtaining a
11 * copy of this software and associated documentation files (the "Software"),
12 * to deal in the Software without restriction, including without limitation
13 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
14 * and/or sell copies of the Software, and to permit persons to whom the
15 * Software is furnished to do so, subject to the following conditions:
16 *
17 * The above copyright notice and this permission notice shall be included in
18 * all copies or substantial portions of the Software.
19 *
20 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
23 * THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
24 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
25 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
26 * DEALINGS IN THE SOFTWARE.
27 */
28
29 #ifdef HAVE_XWIN_CONFIG_H
30 #include <xwin-config.h>
31 #endif
32
33 #include <X11/Xwindows.h>
34 #include <GL/gl.h>
35 #include <GL/glext.h>
36 #include <glx/glxserver.h>
37 #include <glx/glxext.h>
38 #include <GL/wglext.h>
39 #include <wgl_ext_api.h>
40 #include "glwindows.h"
41
42 #define RESOLVE_DECL(type) \
43 static type type##proc = NULL;
44
45 #define PRERESOLVE(type, symbol) \
46 type##proc = (type)wglGetProcAddress(symbol);
47
48 #define RESOLVE_RET(type, symbol, retval) \
49 if (type##proc == NULL) { \
50 ErrorF("wglwrap: Can't resolve \"%s\"\n", symbol); \
51 __glXErrorCallBack(0); \
52 return retval; \
53 }
54
55 #define RESOLVE(procname, symbol) RESOLVE_RET(procname, symbol,)
56
57 #define RESOLVED_PROC(type) type##proc
58
59 /*
60 * Include generated cdecl wrappers for stdcall WGL functions
61 *
62 * There are extensions to the wgl*() API as well; again we call
63 * these functions by using wglGetProcAddress() to get a pointer
64 * to the function, and wrapping it for cdecl/stdcall conversion
65 *
66 * We arrange to resolve the functions up front, as they need a
67 * context to work, as we like to use them to be able to select
68 * a context. Again, this assumption fails badly on multimontor
69 * systems...
70 */
71
72 #include "generated_wgl_wrappers.c"