1 /*
2  * Copyright © 2013 Intel Corporation
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining a
5  * copy of this software and associated documentation files (the "Software"),
6  * to deal in the Software without restriction, including without limitation
7  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8  * and/or sell copies of the Software, and to permit persons to whom the
9  * Software is furnished to do so, subject to the following conditions:
10  *
11  * The above copyright notice and this permission notice (including the next
12  * paragraph) shall be included in all copies or substantial portions of the
13  * Software.
14  *
15  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
18  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
21  * IN THE SOFTWARE.
22  */
23 
24 /** @file gl.h
25  *
26  * Provides an implementation of a GL dispatch layer using either
27  * global function pointers or a hidden vtable.
28  *
29  * You should include `<epoxy/gl.h>` instead of `<GL/gl.h>` and `<GL/glext.h>`.
30  */
31 
32 #ifndef EPOXY_GL_H
33 #define EPOXY_GL_H
34 
35 #include "epoxy/common.h"
36 
37 #if defined(__gl_h_) || defined(__glext_h_)
38 #error epoxy/gl.h must be included before (or in place of) GL/gl.h
39 #else
40 #define __gl_h_
41 #define __glext_h_
42 #endif
43 
44 #define KHRONOS_SUPPORT_INT64   1
45 #define KHRONOS_SUPPORT_FLOAT   1
46 #define KHRONOS_APIATTRIBUTES
47 
48 #ifndef _WIN32
49 /* APIENTRY and GLAPIENTRY are not used on Linux or Mac. */
50 #define APIENTRY
51 #define GLAPIENTRY
52 #define EPOXY_CALLSPEC
53 #define GLAPI
54 #define KHRONOS_APIENTRY
55 #define KHRONOS_APICALL
56 
57 #else
58 #ifndef APIENTRY
59 #define APIENTRY __stdcall
60 #endif
61 
62 #ifndef GLAPIENTRY
63 #define GLAPIENTRY APIENTRY
64 #endif
65 
66 #ifndef EPOXY_CALLSPEC
67 #define EPOXY_CALLSPEC __stdcall
68 #endif
69 
70 #ifndef GLAPI
71 #define GLAPI extern
72 #endif
73 
74 #define KHRONOS_APIENTRY __stdcall
75 #define KHRONOS_APICALL __declspec(dllimport) __stdcall
76 
77 #endif /* _WIN32 */
78 
79 #ifndef APIENTRYP
80 #define APIENTRYP APIENTRY *
81 #endif
82 
83 #ifndef GLAPIENTRYP
84 #define GLAPIENTRYP GLAPIENTRY *
85 #endif
86 
87 EPOXY_BEGIN_DECLS
88 
89 #include "epoxy/gl_generated.h"
90 
91 EPOXY_PUBLIC bool epoxy_has_gl_extension(const char *extension);
92 EPOXY_PUBLIC bool epoxy_is_desktop_gl(void);
93 EPOXY_PUBLIC int epoxy_gl_version(void);
94 EPOXY_PUBLIC int epoxy_glsl_version(void);
95 
96 /*
97  * the type of the stub function that the failure handler must return;
98  * this function will be called on subsequent calls to the same bogus
99  * function name
100  */
101 typedef void (*epoxy_resolver_stub_t)(void);
102 
103 /* the type of the failure handler itself */
104 typedef epoxy_resolver_stub_t
105 (*epoxy_resolver_failure_handler_t)(const char *name);
106 
107 EPOXY_PUBLIC epoxy_resolver_failure_handler_t
108 epoxy_set_resolver_failure_handler(epoxy_resolver_failure_handler_t handler);
109 
110 EPOXY_END_DECLS
111 
112 #endif /* EPOXY_GL_H */
113