1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
#pragma once
// This is likely ill-defined overall. For example, WGL has confusing behavior defined here.
// https://registry.khronos.org/OpenGL/extensions/ARB/WGL_ARB_create_context.txt
// Under "Additions to the WGL specification".
// This also seems to behave different under Wine vs Native Windows. Requesting GL 3.0 Compatibility
// on Wine still forces a Core context but works according to the specification on Windows.
#ifdef NAUNET_WIN32_COMPAT_MODE
#define STELA_FORCE_COMPATABILITY
#endif
#define STELA_LOG_GL_CONTEXT_CREATION(ver) \
log_debug("Attempting to create a %s context of version %d.%d (GLSL %d).", \
(ver).api == STELA_GL_API ? "GL" : "GLES", (ver).major, (ver).minor, (ver).glsl_ver)
// https://github.com/haasn/libplacebo/blob/795600a44b03fcd52c055981a403ad60ee5d027a/demos/window_glfw.c#L194
#ifdef STELA_USE_GLES
#define PASTE_GL_VERSIONS() static struct { \
s32 api; \
s32 type; \
s32 major, minor; \
s32 glsl_ver; \
s32 profile; \
} stl_gl_vers[] = { \
{ STELA_GLES_API, STELA_GLES3_BIT, 3, 2, 320, 0 }, \
{ STELA_GLES_API, STELA_GLES3_BIT, 3, 1, 310, 0 }, \
{ STELA_GLES_API, STELA_GLES3_BIT, 3, 0, 300, 0 }, \
{ STELA_GLES_API, STELA_GLES2_BIT, 2, 0, 100, 0 } \
};
#else
#ifdef STELA_FORCE_COMPATABILITY
#define PASTE_GL_VERSIONS() static struct { \
s32 api; \
s32 type; \
s32 major, minor; \
s32 glsl_ver; \
s32 profile; \
} stl_gl_vers[] = { \
{ STELA_GL_API, STELA_GL_BIT, 2, 1, 120, 0 }, \
{ STELA_GL_API, STELA_GL_BIT, 2, 0, 110, 0 } \
};
#else
#define PASTE_GL_VERSIONS() static struct { \
s32 api; \
s32 type; \
s32 major, minor; \
s32 glsl_ver; \
s32 profile; \
} stl_gl_vers[] = { \
{ STELA_GL_API, STELA_GL_BIT, 4, 6, 460, STELA_GL_CORE_PROFILE_BIT }, \
{ STELA_GL_API, STELA_GL_BIT, 4, 5, 450, STELA_GL_CORE_PROFILE_BIT }, \
{ STELA_GL_API, STELA_GL_BIT, 4, 4, 440, STELA_GL_CORE_PROFILE_BIT }, \
{ STELA_GL_API, STELA_GL_BIT, 4, 0, 400, STELA_GL_CORE_PROFILE_BIT }, \
{ STELA_GL_API, STELA_GL_BIT, 3, 3, 330, STELA_GL_CORE_PROFILE_BIT }, \
{ STELA_GL_API, STELA_GL_BIT, 3, 2, 150, STELA_GL_CORE_PROFILE_BIT }, \
{ STELA_GL_API, STELA_GL_BIT, 3, 1, 140, 0 }, \
{ STELA_GL_API, STELA_GL_BIT, 3, 0, 130, 0 }, \
{ STELA_GL_API, STELA_GL_BIT, 2, 1, 120, 0 }, \
{ STELA_GL_API, STELA_GL_BIT, 2, 0, 110, 0 } \
};
#endif
#endif
|