diff options
| author | 3gg <3gg@shellblade.net> | 2025-12-27 12:03:39 -0800 |
|---|---|---|
| committer | 3gg <3gg@shellblade.net> | 2025-12-27 12:03:39 -0800 |
| commit | 5a079a2d114f96d4847d1ee305d5b7c16eeec50e (patch) | |
| tree | 8926ab44f168acf787d8e19608857b3af0f82758 /contrib/SDL-3.2.8/src/video/windows/SDL_windowsopengl.h | |
Initial commit
Diffstat (limited to 'contrib/SDL-3.2.8/src/video/windows/SDL_windowsopengl.h')
| -rw-r--r-- | contrib/SDL-3.2.8/src/video/windows/SDL_windowsopengl.h | 178 |
1 files changed, 178 insertions, 0 deletions
diff --git a/contrib/SDL-3.2.8/src/video/windows/SDL_windowsopengl.h b/contrib/SDL-3.2.8/src/video/windows/SDL_windowsopengl.h new file mode 100644 index 0000000..23e2f3a --- /dev/null +++ b/contrib/SDL-3.2.8/src/video/windows/SDL_windowsopengl.h | |||
| @@ -0,0 +1,178 @@ | |||
| 1 | /* | ||
| 2 | Simple DirectMedia Layer | ||
| 3 | Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> | ||
| 4 | |||
| 5 | This software is provided 'as-is', without any express or implied | ||
| 6 | warranty. In no event will the authors be held liable for any damages | ||
| 7 | arising from the use of this software. | ||
| 8 | |||
| 9 | Permission is granted to anyone to use this software for any purpose, | ||
| 10 | including commercial applications, and to alter it and redistribute it | ||
| 11 | freely, subject to the following restrictions: | ||
| 12 | |||
| 13 | 1. The origin of this software must not be misrepresented; you must not | ||
| 14 | claim that you wrote the original software. If you use this software | ||
| 15 | in a product, an acknowledgment in the product documentation would be | ||
| 16 | appreciated but is not required. | ||
| 17 | 2. Altered source versions must be plainly marked as such, and must not be | ||
| 18 | misrepresented as being the original software. | ||
| 19 | 3. This notice may not be removed or altered from any source distribution. | ||
| 20 | */ | ||
| 21 | #include "SDL_internal.h" | ||
| 22 | |||
| 23 | #ifndef SDL_windowsopengl_h_ | ||
| 24 | #define SDL_windowsopengl_h_ | ||
| 25 | |||
| 26 | #ifdef SDL_VIDEO_OPENGL_WGL | ||
| 27 | |||
| 28 | #if defined(SDL_PLATFORM_XBOXONE) || defined(SDL_PLATFORM_XBOXSERIES) | ||
| 29 | typedef struct tagPIXELFORMATDESCRIPTOR | ||
| 30 | { | ||
| 31 | WORD nSize; | ||
| 32 | WORD nVersion; | ||
| 33 | DWORD dwFlags; | ||
| 34 | BYTE iPixelType; | ||
| 35 | BYTE cColorBits; | ||
| 36 | BYTE cRedBits; | ||
| 37 | BYTE cRedShift; | ||
| 38 | BYTE cGreenBits; | ||
| 39 | BYTE cGreenShift; | ||
| 40 | BYTE cBlueBits; | ||
| 41 | BYTE cBlueShift; | ||
| 42 | BYTE cAlphaBits; | ||
| 43 | BYTE cAlphaShift; | ||
| 44 | BYTE cAccumBits; | ||
| 45 | BYTE cAccumRedBits; | ||
| 46 | BYTE cAccumGreenBits; | ||
| 47 | BYTE cAccumBlueBits; | ||
| 48 | BYTE cAccumAlphaBits; | ||
| 49 | BYTE cDepthBits; | ||
| 50 | BYTE cStencilBits; | ||
| 51 | BYTE cAuxBuffers; | ||
| 52 | BYTE iLayerType; | ||
| 53 | BYTE bReserved; | ||
| 54 | DWORD dwLayerMask; | ||
| 55 | DWORD dwVisibleMask; | ||
| 56 | DWORD dwDamageMask; | ||
| 57 | } PIXELFORMATDESCRIPTOR, *PPIXELFORMATDESCRIPTOR, *LPPIXELFORMATDESCRIPTOR; | ||
| 58 | #endif | ||
| 59 | |||
| 60 | struct SDL_GLDriverData | ||
| 61 | { | ||
| 62 | bool HAS_WGL_ARB_pixel_format; | ||
| 63 | bool HAS_WGL_EXT_swap_control_tear; | ||
| 64 | bool HAS_WGL_ARB_context_flush_control; | ||
| 65 | bool HAS_WGL_ARB_create_context_robustness; | ||
| 66 | bool HAS_WGL_ARB_create_context_no_error; | ||
| 67 | |||
| 68 | /* Max version of OpenGL ES context that can be created if the | ||
| 69 | implementation supports WGL_EXT_create_context_es2_profile. | ||
| 70 | major = minor = 0 when unsupported. | ||
| 71 | */ | ||
| 72 | struct | ||
| 73 | { | ||
| 74 | int major; | ||
| 75 | int minor; | ||
| 76 | } es_profile_max_supported_version; | ||
| 77 | |||
| 78 | /* *INDENT-OFF* */ // clang-format off | ||
| 79 | PROC (WINAPI *wglGetProcAddress)(const char *proc); | ||
| 80 | HGLRC (WINAPI *wglCreateContext)(HDC hdc); | ||
| 81 | BOOL (WINAPI *wglDeleteContext)(HGLRC hglrc); | ||
| 82 | BOOL (WINAPI *wglMakeCurrent)(HDC hdc, HGLRC hglrc); | ||
| 83 | BOOL (WINAPI *wglShareLists)(HGLRC hglrc1, HGLRC hglrc2); | ||
| 84 | BOOL (WINAPI *wglChoosePixelFormatARB)(HDC hdc, const int *piAttribIList, const FLOAT * pfAttribFList, UINT nMaxFormats, int *piFormats, UINT * nNumFormats); | ||
| 85 | BOOL (WINAPI *wglGetPixelFormatAttribivARB)(HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, int *piValues); | ||
| 86 | BOOL (WINAPI *wglSwapIntervalEXT)(int interval); | ||
| 87 | int (WINAPI *wglGetSwapIntervalEXT)(void); | ||
| 88 | #if defined(SDL_PLATFORM_XBOXONE) || defined(SDL_PLATFORM_XBOXSERIES) | ||
| 89 | BOOL (WINAPI *wglSwapBuffers)(HDC hdc); | ||
| 90 | int (WINAPI *wglDescribePixelFormat)(HDC hdc, | ||
| 91 | int iPixelFormat, | ||
| 92 | UINT nBytes, | ||
| 93 | LPPIXELFORMATDESCRIPTOR ppfd); | ||
| 94 | int (WINAPI *wglChoosePixelFormat)(HDC hdc, | ||
| 95 | const PIXELFORMATDESCRIPTOR *ppfd); | ||
| 96 | BOOL (WINAPI *wglSetPixelFormat)(HDC hdc, | ||
| 97 | int format, | ||
| 98 | const PIXELFORMATDESCRIPTOR *ppfd); | ||
| 99 | int (WINAPI *wglGetPixelFormat)(HDC hdc); | ||
| 100 | #endif | ||
| 101 | /* *INDENT-ON* */ // clang-format on | ||
| 102 | }; | ||
| 103 | |||
| 104 | // OpenGL functions | ||
| 105 | extern bool WIN_GL_LoadLibrary(SDL_VideoDevice *_this, const char *path); | ||
| 106 | extern SDL_FunctionPointer WIN_GL_GetProcAddress(SDL_VideoDevice *_this, const char *proc); | ||
| 107 | extern void WIN_GL_UnloadLibrary(SDL_VideoDevice *_this); | ||
| 108 | extern bool WIN_GL_UseEGL(SDL_VideoDevice *_this); | ||
| 109 | extern bool WIN_GL_SetupWindow(SDL_VideoDevice *_this, SDL_Window *window); | ||
| 110 | extern SDL_GLContext WIN_GL_CreateContext(SDL_VideoDevice *_this, SDL_Window *window); | ||
| 111 | extern bool WIN_GL_MakeCurrent(SDL_VideoDevice *_this, SDL_Window *window, | ||
| 112 | SDL_GLContext context); | ||
| 113 | extern bool WIN_GL_SetSwapInterval(SDL_VideoDevice *_this, int interval); | ||
| 114 | extern bool WIN_GL_GetSwapInterval(SDL_VideoDevice *_this, int *interval); | ||
| 115 | extern bool WIN_GL_SwapWindow(SDL_VideoDevice *_this, SDL_Window *window); | ||
| 116 | extern bool WIN_GL_DestroyContext(SDL_VideoDevice *_this, SDL_GLContext context); | ||
| 117 | extern void WIN_GL_InitExtensions(SDL_VideoDevice *_this); | ||
| 118 | |||
| 119 | #ifndef WGL_ARB_pixel_format | ||
| 120 | #define WGL_NUMBER_PIXEL_FORMATS_ARB 0x2000 | ||
| 121 | #define WGL_DRAW_TO_WINDOW_ARB 0x2001 | ||
| 122 | #define WGL_DRAW_TO_BITMAP_ARB 0x2002 | ||
| 123 | #define WGL_ACCELERATION_ARB 0x2003 | ||
| 124 | #define WGL_NEED_PALETTE_ARB 0x2004 | ||
| 125 | #define WGL_NEED_SYSTEM_PALETTE_ARB 0x2005 | ||
| 126 | #define WGL_SWAP_LAYER_BUFFERS_ARB 0x2006 | ||
| 127 | #define WGL_SWAP_METHOD_ARB 0x2007 | ||
| 128 | #define WGL_NUMBER_OVERLAYS_ARB 0x2008 | ||
| 129 | #define WGL_NUMBER_UNDERLAYS_ARB 0x2009 | ||
| 130 | #define WGL_TRANSPARENT_ARB 0x200A | ||
| 131 | #define WGL_TRANSPARENT_RED_VALUE_ARB 0x2037 | ||
| 132 | #define WGL_TRANSPARENT_GREEN_VALUE_ARB 0x2038 | ||
| 133 | #define WGL_TRANSPARENT_BLUE_VALUE_ARB 0x2039 | ||
| 134 | #define WGL_TRANSPARENT_ALPHA_VALUE_ARB 0x203A | ||
| 135 | #define WGL_TRANSPARENT_INDEX_VALUE_ARB 0x203B | ||
| 136 | #define WGL_SHARE_DEPTH_ARB 0x200C | ||
| 137 | #define WGL_SHARE_STENCIL_ARB 0x200D | ||
| 138 | #define WGL_SHARE_ACCUM_ARB 0x200E | ||
| 139 | #define WGL_SUPPORT_GDI_ARB 0x200F | ||
| 140 | #define WGL_SUPPORT_OPENGL_ARB 0x2010 | ||
| 141 | #define WGL_DOUBLE_BUFFER_ARB 0x2011 | ||
| 142 | #define WGL_STEREO_ARB 0x2012 | ||
| 143 | #define WGL_PIXEL_TYPE_ARB 0x2013 | ||
| 144 | #define WGL_COLOR_BITS_ARB 0x2014 | ||
| 145 | #define WGL_RED_BITS_ARB 0x2015 | ||
| 146 | #define WGL_RED_SHIFT_ARB 0x2016 | ||
| 147 | #define WGL_GREEN_BITS_ARB 0x2017 | ||
| 148 | #define WGL_GREEN_SHIFT_ARB 0x2018 | ||
| 149 | #define WGL_BLUE_BITS_ARB 0x2019 | ||
| 150 | #define WGL_BLUE_SHIFT_ARB 0x201A | ||
| 151 | #define WGL_ALPHA_BITS_ARB 0x201B | ||
| 152 | #define WGL_ALPHA_SHIFT_ARB 0x201C | ||
| 153 | #define WGL_ACCUM_BITS_ARB 0x201D | ||
| 154 | #define WGL_ACCUM_RED_BITS_ARB 0x201E | ||
| 155 | #define WGL_ACCUM_GREEN_BITS_ARB 0x201F | ||
| 156 | #define WGL_ACCUM_BLUE_BITS_ARB 0x2020 | ||
| 157 | #define WGL_ACCUM_ALPHA_BITS_ARB 0x2021 | ||
| 158 | #define WGL_DEPTH_BITS_ARB 0x2022 | ||
| 159 | #define WGL_STENCIL_BITS_ARB 0x2023 | ||
| 160 | #define WGL_AUX_BUFFERS_ARB 0x2024 | ||
| 161 | #define WGL_NO_ACCELERATION_ARB 0x2025 | ||
| 162 | #define WGL_GENERIC_ACCELERATION_ARB 0x2026 | ||
| 163 | #define WGL_FULL_ACCELERATION_ARB 0x2027 | ||
| 164 | #define WGL_SWAP_EXCHANGE_ARB 0x2028 | ||
| 165 | #define WGL_SWAP_COPY_ARB 0x2029 | ||
| 166 | #define WGL_SWAP_UNDEFINED_ARB 0x202A | ||
| 167 | #define WGL_TYPE_RGBA_ARB 0x202B | ||
| 168 | #define WGL_TYPE_COLORINDEX_ARB 0x202C | ||
| 169 | #endif | ||
| 170 | |||
| 171 | #ifndef WGL_ARB_multisample | ||
| 172 | #define WGL_SAMPLE_BUFFERS_ARB 0x2041 | ||
| 173 | #define WGL_SAMPLES_ARB 0x2042 | ||
| 174 | #endif | ||
| 175 | |||
| 176 | #endif // SDL_VIDEO_OPENGL_WGL | ||
| 177 | |||
| 178 | #endif // SDL_windowsopengl_h_ | ||
