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