Debian Codegraph @

common/include/ogl_extensions.h

raw
1 /*
2 * This file is part of the DXX-Rebirth project <https://www.dxx-rebirth.com/>.
3 * It is copyright by its individual contributors, as recorded in the
4 * project's Git history. See COPYING.txt at the top level for license
5 * terms and a link to the Git history.
6 */
7
8 /* OpenGL extensions:
9 * We use global function pointer for any extension function we want to use.
10 */
11
12 #pragma once
13
14 #include <cstdint>
15
16 #if defined(__APPLE__) && defined(__MACH__)
17 #include <OpenGL/gl.h>
18 #else
19 #include <GL/gl.h>
20 #endif
21
22 /* global extension stuff (from glext.h)
23 */
24 #ifndef APIENTRY
25 #define APIENTRY
26 #endif
27 #ifndef APIENTRYP
28 #define APIENTRYP APIENTRY *
29 #endif
30 #ifndef GLAPI
31 #define GLAPI extern
32 #endif
33
34 typedef int64_t GLint64;
35 typedef uint64_t GLuint64;
36
37 /* GL_ARB_sync */
38 typedef struct __GLsync *GLsync;
39
40 typedef GLsync (APIENTRYP PFNGLFENCESYNCPROC) (GLenum condition, GLbitfield flags);
41 typedef GLboolean (APIENTRYP PFNGLISSYNCPROC) (GLsync sync);
42 typedef void (APIENTRYP PFNGLDELETESYNCPROC) (GLsync sync);
43 typedef GLenum (APIENTRYP PFNGLCLIENTWAITSYNCPROC) (GLsync sync, GLbitfield flags, GLuint64 timeout);
44 typedef void (APIENTRYP PFNGLWAITSYNCPROC) (GLsync sync, GLbitfield flags, GLuint64 timeout);
45
46 #define GL_SYNC_FLUSH_COMMANDS_BIT 0x00000001
47 #define GL_SYNC_GPU_COMMANDS_COMPLETE 0x9117
48 #define GL_TIMEOUT_EXPIRED 0x911B
49
50 /* GL_EXT_texture */
51 #ifndef GL_VERSION_1_1
52 #ifdef GL_EXT_texture
53 #define GL_INTENSITY4 GL_INTENSITY4_EXT
54 #define GL_INTENSITY8 GL_INTENSITY8_EXT
55 #endif
56 #endif
57
58 /* GL_EXT_texture_filter_anisotropic */
59 #ifndef GL_TEXTURE_MAX_ANISOTROPY_EXT
60 #define GL_TEXTURE_MAX_ANISOTROPY_EXT 0x84FE
61 #endif
62 #ifndef GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT
63 #define GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT 0x84FF
64 #endif
65
66 namespace dcx {
67
68 extern bool ogl_have_ARB_sync;
69 extern PFNGLFENCESYNCPROC glFenceSyncFunc;
70 extern PFNGLDELETESYNCPROC glDeleteSyncFunc;
71 extern PFNGLCLIENTWAITSYNCPROC glClientWaitSyncFunc;
72 extern GLfloat ogl_maxanisotropy;
73
74 /* Global initialization:
75 * will need an OpenGL context and intialize all function pointers.
76 */
77 void ogl_extensions_init();
78
79 }