Atlas - internal.h

Home / ext / glfw / src Lines: 1 | Size: 36455 bytes [Download] [Show on GitHub] [Search similar files] [Raw] [Raw (proxy)]
[FILE BEGIN]
1//======================================================================== 2// GLFW 3.5 - www.glfw.org 3//------------------------------------------------------------------------ 4// Copyright (c) 2002-2006 Marcus Geelnard 5// Copyright (c) 2006-2019 Camilla Löwy <[email protected]> 6// 7// This software is provided 'as-is', without any express or implied 8// warranty. In no event will the authors be held liable for any damages 9// arising from the use of this software. 10// 11// Permission is granted to anyone to use this software for any purpose, 12// including commercial applications, and to alter it and redistribute it 13// freely, subject to the following restrictions: 14// 15// 1. The origin of this software must not be misrepresented; you must not 16// claim that you wrote the original software. If you use this software 17// in a product, an acknowledgment in the product documentation would 18// be appreciated but is not required. 19// 20// 2. Altered source versions must be plainly marked as such, and must not 21// be misrepresented as being the original software. 22// 23// 3. This notice may not be removed or altered from any source 24// distribution. 25// 26//======================================================================== 27 28#pragma once 29 30#if defined(_GLFW_USE_CONFIG_H) 31 #include "glfw_config.h" 32#endif 33 34#if defined(GLFW_INCLUDE_GLCOREARB) || \ 35 defined(GLFW_INCLUDE_ES1) || \ 36 defined(GLFW_INCLUDE_ES2) || \ 37 defined(GLFW_INCLUDE_ES3) || \ 38 defined(GLFW_INCLUDE_ES31) || \ 39 defined(GLFW_INCLUDE_ES32) || \ 40 defined(GLFW_INCLUDE_NONE) || \ 41 defined(GLFW_INCLUDE_GLEXT) || \ 42 defined(GLFW_INCLUDE_GLU) || \ 43 defined(GLFW_INCLUDE_VULKAN) || \ 44 defined(GLFW_DLL) 45 #error "You must not define any header option macros when compiling GLFW" 46#endif 47 48#define GLFW_INCLUDE_NONE 49#include "../include/GLFW/glfw3.h" 50 51#include <stdbool.h> 52 53#define _GLFW_INSERT_FIRST 0 54#define _GLFW_INSERT_LAST 1 55 56#define _GLFW_POLL_PRESENCE 0 57#define _GLFW_POLL_AXES 1 58#define _GLFW_POLL_BUTTONS 2 59#define _GLFW_POLL_ALL (_GLFW_POLL_AXES | _GLFW_POLL_BUTTONS) 60 61#define _GLFW_MESSAGE_SIZE 1024 62 63typedef int GLFWbool; 64typedef void (*GLFWproc)(void); 65 66typedef struct _GLFWerror _GLFWerror; 67typedef struct _GLFWinitconfig _GLFWinitconfig; 68typedef struct _GLFWwndconfig _GLFWwndconfig; 69typedef struct _GLFWctxconfig _GLFWctxconfig; 70typedef struct _GLFWfbconfig _GLFWfbconfig; 71typedef struct _GLFWcontext _GLFWcontext; 72typedef struct _GLFWwindow _GLFWwindow; 73typedef struct _GLFWplatform _GLFWplatform; 74typedef struct _GLFWlibrary _GLFWlibrary; 75typedef struct _GLFWmonitor _GLFWmonitor; 76typedef struct _GLFWcursor _GLFWcursor; 77typedef struct _GLFWmapelement _GLFWmapelement; 78typedef struct _GLFWmapping _GLFWmapping; 79typedef struct _GLFWjoystick _GLFWjoystick; 80typedef struct _GLFWtls _GLFWtls; 81typedef struct _GLFWmutex _GLFWmutex; 82 83#define GL_VERSION 0x1f02 84#define GL_NONE 0 85#define GL_COLOR_BUFFER_BIT 0x00004000 86#define GL_UNSIGNED_BYTE 0x1401 87#define GL_EXTENSIONS 0x1f03 88#define GL_NUM_EXTENSIONS 0x821d 89#define GL_CONTEXT_FLAGS 0x821e 90#define GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT 0x00000001 91#define GL_CONTEXT_FLAG_DEBUG_BIT 0x00000002 92#define GL_CONTEXT_PROFILE_MASK 0x9126 93#define GL_CONTEXT_COMPATIBILITY_PROFILE_BIT 0x00000002 94#define GL_CONTEXT_CORE_PROFILE_BIT 0x00000001 95#define GL_RESET_NOTIFICATION_STRATEGY_ARB 0x8256 96#define GL_LOSE_CONTEXT_ON_RESET_ARB 0x8252 97#define GL_NO_RESET_NOTIFICATION_ARB 0x8261 98#define GL_CONTEXT_RELEASE_BEHAVIOR 0x82fb 99#define GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH 0x82fc 100#define GL_CONTEXT_FLAG_NO_ERROR_BIT_KHR 0x00000008 101 102typedef int GLint; 103typedef unsigned int GLuint; 104typedef unsigned int GLenum; 105typedef unsigned int GLbitfield; 106typedef unsigned char GLubyte; 107 108typedef void (APIENTRY * PFNGLCLEARPROC)(GLbitfield); 109typedef const GLubyte* (APIENTRY * PFNGLGETSTRINGPROC)(GLenum); 110typedef void (APIENTRY * PFNGLGETINTEGERVPROC)(GLenum,GLint*); 111typedef const GLubyte* (APIENTRY * PFNGLGETSTRINGIPROC)(GLenum,GLuint); 112typedef void (APIENTRY * PFNGLFLUSHPROC)(void); 113 114#define EGL_SUCCESS 0x3000 115#define EGL_NOT_INITIALIZED 0x3001 116#define EGL_BAD_ACCESS 0x3002 117#define EGL_BAD_ALLOC 0x3003 118#define EGL_BAD_ATTRIBUTE 0x3004 119#define EGL_BAD_CONFIG 0x3005 120#define EGL_BAD_CONTEXT 0x3006 121#define EGL_BAD_CURRENT_SURFACE 0x3007 122#define EGL_BAD_DISPLAY 0x3008 123#define EGL_BAD_MATCH 0x3009 124#define EGL_BAD_NATIVE_PIXMAP 0x300a 125#define EGL_BAD_NATIVE_WINDOW 0x300b 126#define EGL_BAD_PARAMETER 0x300c 127#define EGL_BAD_SURFACE 0x300d 128#define EGL_CONTEXT_LOST 0x300e 129#define EGL_COLOR_BUFFER_TYPE 0x303f 130#define EGL_RGB_BUFFER 0x308e 131#define EGL_SURFACE_TYPE 0x3033 132#define EGL_WINDOW_BIT 0x0004 133#define EGL_RENDERABLE_TYPE 0x3040 134#define EGL_OPENGL_ES_BIT 0x0001 135#define EGL_OPENGL_ES2_BIT 0x0004 136#define EGL_OPENGL_BIT 0x0008 137#define EGL_ALPHA_SIZE 0x3021 138#define EGL_BLUE_SIZE 0x3022 139#define EGL_GREEN_SIZE 0x3023 140#define EGL_RED_SIZE 0x3024 141#define EGL_DEPTH_SIZE 0x3025 142#define EGL_STENCIL_SIZE 0x3026 143#define EGL_SAMPLES 0x3031 144#define EGL_OPENGL_ES_API 0x30a0 145#define EGL_OPENGL_API 0x30a2 146#define EGL_NONE 0x3038 147#define EGL_RENDER_BUFFER 0x3086 148#define EGL_SINGLE_BUFFER 0x3085 149#define EGL_EXTENSIONS 0x3055 150#define EGL_CONTEXT_CLIENT_VERSION 0x3098 151#define EGL_NATIVE_VISUAL_ID 0x302e 152#define EGL_NO_SURFACE ((EGLSurface) 0) 153#define EGL_NO_DISPLAY ((EGLDisplay) 0) 154#define EGL_NO_CONTEXT ((EGLContext) 0) 155#define EGL_DEFAULT_DISPLAY ((EGLNativeDisplayType) 0) 156#define EGL_PBUFFER_BIT 0x0001 157#define EGL_WIDTH 0x3057 158#define EGL_HEIGHT 0x3056 159 160#define EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR 0x00000002 161#define EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR 0x00000001 162#define EGL_CONTEXT_OPENGL_COMPATIBILITY_PROFILE_BIT_KHR 0x00000002 163#define EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR 0x00000001 164#define EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_KHR 0x31bd 165#define EGL_NO_RESET_NOTIFICATION_KHR 0x31be 166#define EGL_LOSE_CONTEXT_ON_RESET_KHR 0x31bf 167#define EGL_CONTEXT_OPENGL_ROBUST_ACCESS_BIT_KHR 0x00000004 168#define EGL_CONTEXT_MAJOR_VERSION_KHR 0x3098 169#define EGL_CONTEXT_MINOR_VERSION_KHR 0x30fb 170#define EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR 0x30fd 171#define EGL_CONTEXT_FLAGS_KHR 0x30fc 172#define EGL_CONTEXT_OPENGL_NO_ERROR_KHR 0x31b3 173#define EGL_GL_COLORSPACE_KHR 0x309d 174#define EGL_GL_COLORSPACE_SRGB_KHR 0x3089 175#define EGL_CONTEXT_RELEASE_BEHAVIOR_KHR 0x2097 176#define EGL_CONTEXT_RELEASE_BEHAVIOR_NONE_KHR 0 177#define EGL_CONTEXT_RELEASE_BEHAVIOR_FLUSH_KHR 0x2098 178#define EGL_PLATFORM_X11_EXT 0x31d5 179#define EGL_PLATFORM_WAYLAND_EXT 0x31d8 180#define EGL_PRESENT_OPAQUE_EXT 0x31df 181#define EGL_PLATFORM_ANGLE_ANGLE 0x3202 182#define EGL_PLATFORM_ANGLE_TYPE_ANGLE 0x3203 183#define EGL_PLATFORM_ANGLE_TYPE_OPENGL_ANGLE 0x320d 184#define EGL_PLATFORM_ANGLE_TYPE_OPENGLES_ANGLE 0x320e 185#define EGL_PLATFORM_ANGLE_TYPE_D3D9_ANGLE 0x3207 186#define EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE 0x3208 187#define EGL_PLATFORM_ANGLE_TYPE_VULKAN_ANGLE 0x3450 188#define EGL_PLATFORM_ANGLE_TYPE_METAL_ANGLE 0x3489 189#define EGL_PLATFORM_ANGLE_NATIVE_PLATFORM_TYPE_ANGLE 0x348f 190#define EGL_PLATFORM_SURFACELESS_MESA 0x31dd 191 192typedef int EGLint; 193typedef unsigned int EGLBoolean; 194typedef unsigned int EGLenum; 195typedef void* EGLConfig; 196typedef void* EGLContext; 197typedef void* EGLDisplay; 198typedef void* EGLSurface; 199 200typedef void* EGLNativeDisplayType; 201typedef void* EGLNativeWindowType; 202 203// EGL function pointer typedefs 204typedef EGLBoolean (APIENTRY * PFN_eglGetConfigAttrib)(EGLDisplay,EGLConfig,EGLint,EGLint*); 205typedef EGLBoolean (APIENTRY * PFN_eglGetConfigs)(EGLDisplay,EGLConfig*,EGLint,EGLint*); 206typedef EGLDisplay (APIENTRY * PFN_eglGetDisplay)(EGLNativeDisplayType); 207typedef EGLint (APIENTRY * PFN_eglGetError)(void); 208typedef EGLBoolean (APIENTRY * PFN_eglInitialize)(EGLDisplay,EGLint*,EGLint*); 209typedef EGLBoolean (APIENTRY * PFN_eglTerminate)(EGLDisplay); 210typedef EGLBoolean (APIENTRY * PFN_eglBindAPI)(EGLenum); 211typedef EGLContext (APIENTRY * PFN_eglCreateContext)(EGLDisplay,EGLConfig,EGLContext,const EGLint*); 212typedef EGLBoolean (APIENTRY * PFN_eglDestroySurface)(EGLDisplay,EGLSurface); 213typedef EGLBoolean (APIENTRY * PFN_eglDestroyContext)(EGLDisplay,EGLContext); 214typedef EGLSurface (APIENTRY * PFN_eglCreateWindowSurface)(EGLDisplay,EGLConfig,EGLNativeWindowType,const EGLint*); 215typedef EGLSurface (APIENTRY * PFN_eglCreatePbufferSurface)(EGLDisplay,EGLContext,const EGLint*); 216typedef EGLBoolean (APIENTRY * PFN_eglMakeCurrent)(EGLDisplay,EGLSurface,EGLSurface,EGLContext); 217typedef EGLBoolean (APIENTRY * PFN_eglSwapBuffers)(EGLDisplay,EGLSurface); 218typedef EGLBoolean (APIENTRY * PFN_eglSwapInterval)(EGLDisplay,EGLint); 219typedef const char* (APIENTRY * PFN_eglQueryString)(EGLDisplay,EGLint); 220typedef GLFWglproc (APIENTRY * PFN_eglGetProcAddress)(const char*); 221#define eglGetConfigAttrib _glfw.egl.GetConfigAttrib 222#define eglGetConfigs _glfw.egl.GetConfigs 223#define eglGetDisplay _glfw.egl.GetDisplay 224#define eglGetError _glfw.egl.GetError 225#define eglInitialize _glfw.egl.Initialize 226#define eglTerminate _glfw.egl.Terminate 227#define eglBindAPI _glfw.egl.BindAPI 228#define eglCreateContext _glfw.egl.CreateContext 229#define eglDestroySurface _glfw.egl.DestroySurface 230#define eglDestroyContext _glfw.egl.DestroyContext 231#define eglCreateWindowSurface _glfw.egl.CreateWindowSurface 232#define eglCreatePbufferSurface _glfw.egl.CreatePbufferSurface 233#define eglMakeCurrent _glfw.egl.MakeCurrent 234#define eglSwapBuffers _glfw.egl.SwapBuffers 235#define eglSwapInterval _glfw.egl.SwapInterval 236#define eglQueryString _glfw.egl.QueryString 237#define eglGetProcAddress _glfw.egl.GetProcAddress 238 239typedef EGLDisplay (APIENTRY * PFNEGLGETPLATFORMDISPLAYEXTPROC)(EGLenum,void*,const EGLint*); 240typedef EGLSurface (APIENTRY * PFNEGLCREATEPLATFORMWINDOWSURFACEEXTPROC)(EGLDisplay,EGLConfig,void*,const EGLint*); 241#define eglGetPlatformDisplayEXT _glfw.egl.GetPlatformDisplayEXT 242#define eglCreatePlatformWindowSurfaceEXT _glfw.egl.CreatePlatformWindowSurfaceEXT 243 244#define OSMESA_RGBA 0x1908 245#define OSMESA_FORMAT 0x22 246#define OSMESA_DEPTH_BITS 0x30 247#define OSMESA_STENCIL_BITS 0x31 248#define OSMESA_ACCUM_BITS 0x32 249#define OSMESA_PROFILE 0x33 250#define OSMESA_CORE_PROFILE 0x34 251#define OSMESA_COMPAT_PROFILE 0x35 252#define OSMESA_CONTEXT_MAJOR_VERSION 0x36 253#define OSMESA_CONTEXT_MINOR_VERSION 0x37 254 255typedef void* OSMesaContext; 256typedef void (*OSMESAproc)(void); 257 258typedef OSMesaContext (GLAPIENTRY * PFN_OSMesaCreateContextExt)(GLenum,GLint,GLint,GLint,OSMesaContext); 259typedef OSMesaContext (GLAPIENTRY * PFN_OSMesaCreateContextAttribs)(const int*,OSMesaContext); 260typedef void (GLAPIENTRY * PFN_OSMesaDestroyContext)(OSMesaContext); 261typedef int (GLAPIENTRY * PFN_OSMesaMakeCurrent)(OSMesaContext,void*,int,int,int); 262typedef int (GLAPIENTRY * PFN_OSMesaGetColorBuffer)(OSMesaContext,int*,int*,int*,void**); 263typedef int (GLAPIENTRY * PFN_OSMesaGetDepthBuffer)(OSMesaContext,int*,int*,int*,void**); 264typedef GLFWglproc (GLAPIENTRY * PFN_OSMesaGetProcAddress)(const char*); 265#define OSMesaCreateContextExt _glfw.osmesa.CreateContextExt 266#define OSMesaCreateContextAttribs _glfw.osmesa.CreateContextAttribs 267#define OSMesaDestroyContext _glfw.osmesa.DestroyContext 268#define OSMesaMakeCurrent _glfw.osmesa.MakeCurrent 269#define OSMesaGetColorBuffer _glfw.osmesa.GetColorBuffer 270#define OSMesaGetDepthBuffer _glfw.osmesa.GetDepthBuffer 271#define OSMesaGetProcAddress _glfw.osmesa.GetProcAddress 272 273#define VK_NULL_HANDLE 0 274 275typedef void* VkInstance; 276typedef void* VkPhysicalDevice; 277typedef uint64_t VkSurfaceKHR; 278typedef uint32_t VkFlags; 279typedef uint32_t VkBool32; 280 281typedef enum VkStructureType 282{ 283 VK_STRUCTURE_TYPE_XLIB_SURFACE_CREATE_INFO_KHR = 1000004000, 284 VK_STRUCTURE_TYPE_XCB_SURFACE_CREATE_INFO_KHR = 1000005000, 285 VK_STRUCTURE_TYPE_WAYLAND_SURFACE_CREATE_INFO_KHR = 1000006000, 286 VK_STRUCTURE_TYPE_WIN32_SURFACE_CREATE_INFO_KHR = 1000009000, 287 VK_STRUCTURE_TYPE_MACOS_SURFACE_CREATE_INFO_MVK = 1000123000, 288 VK_STRUCTURE_TYPE_METAL_SURFACE_CREATE_INFO_EXT = 1000217000, 289 VK_STRUCTURE_TYPE_HEADLESS_SURFACE_CREATE_INFO_EXT = 1000256000, 290 VK_STRUCTURE_TYPE_MAX_ENUM = 0x7FFFFFFF 291} VkStructureType; 292 293typedef enum VkResult 294{ 295 VK_SUCCESS = 0, 296 VK_NOT_READY = 1, 297 VK_TIMEOUT = 2, 298 VK_EVENT_SET = 3, 299 VK_EVENT_RESET = 4, 300 VK_INCOMPLETE = 5, 301 VK_ERROR_OUT_OF_HOST_MEMORY = -1, 302 VK_ERROR_OUT_OF_DEVICE_MEMORY = -2, 303 VK_ERROR_INITIALIZATION_FAILED = -3, 304 VK_ERROR_DEVICE_LOST = -4, 305 VK_ERROR_MEMORY_MAP_FAILED = -5, 306 VK_ERROR_LAYER_NOT_PRESENT = -6, 307 VK_ERROR_EXTENSION_NOT_PRESENT = -7, 308 VK_ERROR_FEATURE_NOT_PRESENT = -8, 309 VK_ERROR_INCOMPATIBLE_DRIVER = -9, 310 VK_ERROR_TOO_MANY_OBJECTS = -10, 311 VK_ERROR_FORMAT_NOT_SUPPORTED = -11, 312 VK_ERROR_SURFACE_LOST_KHR = -1000000000, 313 VK_SUBOPTIMAL_KHR = 1000001003, 314 VK_ERROR_OUT_OF_DATE_KHR = -1000001004, 315 VK_ERROR_INCOMPATIBLE_DISPLAY_KHR = -1000003001, 316 VK_ERROR_NATIVE_WINDOW_IN_USE_KHR = -1000000001, 317 VK_ERROR_VALIDATION_FAILED_EXT = -1000011001, 318 VK_RESULT_MAX_ENUM = 0x7FFFFFFF 319} VkResult; 320 321typedef struct VkAllocationCallbacks VkAllocationCallbacks; 322 323typedef struct VkExtensionProperties 324{ 325 char extensionName[256]; 326 uint32_t specVersion; 327} VkExtensionProperties; 328 329typedef void (APIENTRY * PFN_vkVoidFunction)(void); 330 331typedef PFN_vkVoidFunction (APIENTRY * PFN_vkGetInstanceProcAddr)(VkInstance,const char*); 332typedef VkResult (APIENTRY * PFN_vkEnumerateInstanceExtensionProperties)(const char*,uint32_t*,VkExtensionProperties*); 333#define vkGetInstanceProcAddr _glfw.vk.GetInstanceProcAddr 334 335#include "platform.h" 336 337#define GLFW_NATIVE_INCLUDE_NONE 338#include "../include/GLFW/glfw3native.h" 339 340// Checks for whether the library has been initialized 341#define _GLFW_REQUIRE_INIT() \ 342 if (!_glfw.initialized) \ 343 { \ 344 _glfwInputError(GLFW_NOT_INITIALIZED, NULL); \ 345 return; \ 346 } 347#define _GLFW_REQUIRE_INIT_OR_RETURN(x) \ 348 if (!_glfw.initialized) \ 349 { \ 350 _glfwInputError(GLFW_NOT_INITIALIZED, NULL); \ 351 return x; \ 352 } 353 354// Swaps the provided pointers 355#define _GLFW_SWAP(type, x, y) \ 356 { \ 357 type t; \ 358 t = x; \ 359 x = y; \ 360 y = t; \ 361 } 362 363// Per-thread error structure 364// 365struct _GLFWerror 366{ 367 _GLFWerror* next; 368 int code; 369 char description[_GLFW_MESSAGE_SIZE]; 370}; 371 372// Initialization configuration 373// 374// Parameters relating to the initialization of the library 375// 376struct _GLFWinitconfig 377{ 378 bool hatButtons; 379 int angleType; 380 int platformID; 381 PFN_vkGetInstanceProcAddr vulkanLoader; 382 struct { 383 bool menubar; 384 bool chdir; 385 } ns; 386 struct { 387 bool xcbVulkanSurface; 388 } x11; 389 struct { 390 int libdecorMode; 391 } wl; 392}; 393 394// Window configuration 395// 396// Parameters relating to the creation of the window but not directly related 397// to the framebuffer. This is used to pass window creation parameters from 398// shared code to the platform API. 399// 400struct _GLFWwndconfig 401{ 402 int xpos; 403 int ypos; 404 int width; 405 int height; 406 bool resizable; 407 bool visible; 408 bool decorated; 409 bool focused; 410 bool autoIconify; 411 bool floating; 412 bool maximized; 413 bool centerCursor; 414 bool focusOnShow; 415 bool mousePassthrough; 416 bool scaleToMonitor; 417 bool scaleFramebuffer; 418 struct { 419 char frameName[256]; 420 } ns; 421 struct { 422 char className[256]; 423 char instanceName[256]; 424 } x11; 425 struct { 426 bool keymenu; 427 bool showDefault; 428 } win32; 429 struct { 430 char appId[256]; 431 } wl; 432}; 433 434// Context configuration 435// 436// Parameters relating to the creation of the context but not directly related 437// to the framebuffer. This is used to pass context creation parameters from 438// shared code to the platform API. 439// 440struct _GLFWctxconfig 441{ 442 int client; 443 int source; 444 int major; 445 int minor; 446 bool forward; 447 bool debug; 448 bool noerror; 449 int profile; 450 int robustness; 451 int release; 452 _GLFWwindow* share; 453 struct { 454 bool offline; 455 } nsgl; 456}; 457 458// Framebuffer configuration 459// 460// This describes buffers and their sizes. It also contains 461// a platform-specific ID used to map back to the backend API object. 462// 463// It is used to pass framebuffer parameters from shared code to the platform 464// API and also to enumerate and select available framebuffer configs. 465// 466struct _GLFWfbconfig 467{ 468 int redBits; 469 int greenBits; 470 int blueBits; 471 int alphaBits; 472 int depthBits; 473 int stencilBits; 474 int accumRedBits; 475 int accumGreenBits; 476 int accumBlueBits; 477 int accumAlphaBits; 478 int auxBuffers; 479 bool stereo; 480 int samples; 481 bool sRGB; 482 bool doublebuffer; 483 bool transparent; 484 uintptr_t handle; 485}; 486 487// Context structure 488// 489struct _GLFWcontext 490{ 491 int client; 492 int source; 493 int major, minor, revision; 494 GLFWbool forward, debug, noerror; 495 int profile; 496 int robustness; 497 int release; 498 499 PFNGLGETSTRINGIPROC GetStringi; 500 PFNGLGETINTEGERVPROC GetIntegerv; 501 PFNGLGETSTRINGPROC GetString; 502 PFNGLFLUSHPROC Flush; 503 504 void (*makeCurrent)(_GLFWwindow*); 505 void (*swapBuffers)(_GLFWwindow*); 506 void (*swapInterval)(int); 507 int (*extensionSupported)(const char*); 508 GLFWglproc (*getProcAddress)(const char*); 509 void (*destroy)(_GLFWwindow*); 510 511 struct { 512 EGLConfig config; 513 EGLContext handle; 514 EGLSurface surface; 515 void* client; 516 } egl; 517 518 struct { 519 OSMesaContext handle; 520 int width; 521 int height; 522 void* buffer; 523 } osmesa; 524 525 // This is defined in platform.h 526 GLFW_PLATFORM_CONTEXT_STATE 527}; 528 529// Window and context structure 530// 531struct _GLFWwindow 532{ 533 struct _GLFWwindow* next; 534 535 // Window settings and state 536 GLFWbool resizable; 537 GLFWbool decorated; 538 GLFWbool autoIconify; 539 GLFWbool floating; 540 GLFWbool focusOnShow; 541 GLFWbool mousePassthrough; 542 GLFWbool shouldClose; 543 void* userPointer; 544 GLFWbool doublebuffer; 545 GLFWvidmode videoMode; 546 _GLFWmonitor* monitor; 547 _GLFWcursor* cursor; 548 char* title; 549 550 int minwidth, minheight; 551 int maxwidth, maxheight; 552 int numer, denom; 553 554 GLFWbool stickyKeys; 555 GLFWbool stickyMouseButtons; 556 GLFWbool lockKeyMods; 557 GLFWbool disableMouseButtonLimit; 558 int cursorMode; 559 char mouseButtons[GLFW_MOUSE_BUTTON_LAST + 1]; 560 char keys[GLFW_KEY_LAST + 1]; 561 // Virtual cursor position when cursor is disabled 562 double virtualCursorPosX, virtualCursorPosY; 563 GLFWbool rawMouseMotion; 564 565 _GLFWcontext context; 566 567 struct { 568 GLFWwindowposfun pos; 569 GLFWwindowsizefun size; 570 GLFWwindowclosefun close; 571 GLFWwindowrefreshfun refresh; 572 GLFWwindowfocusfun focus; 573 GLFWwindowiconifyfun iconify; 574 GLFWwindowmaximizefun maximize; 575 GLFWframebuffersizefun fbsize; 576 GLFWwindowcontentscalefun scale; 577 GLFWmousebuttonfun mouseButton; 578 GLFWcursorposfun cursorPos; 579 GLFWcursorenterfun cursorEnter; 580 GLFWscrollfun scroll; 581 GLFWkeyfun key; 582 GLFWcharfun character; 583 GLFWcharmodsfun charmods; 584 GLFWdropfun drop; 585 } callbacks; 586 587 // This is defined in platform.h 588 GLFW_PLATFORM_WINDOW_STATE 589}; 590 591// Monitor structure 592// 593struct _GLFWmonitor 594{ 595 char name[128]; 596 void* userPointer; 597 598 // Physical dimensions in millimeters. 599 int widthMM, heightMM; 600 601 // The window whose video mode is current on this monitor 602 _GLFWwindow* window; 603 604 GLFWvidmode* modes; 605 int modeCount; 606 GLFWvidmode currentMode; 607 608 GLFWgammaramp originalRamp; 609 GLFWgammaramp currentRamp; 610 611 // This is defined in platform.h 612 GLFW_PLATFORM_MONITOR_STATE 613}; 614 615// Cursor structure 616// 617struct _GLFWcursor 618{ 619 _GLFWcursor* next; 620 // This is defined in platform.h 621 GLFW_PLATFORM_CURSOR_STATE 622}; 623 624// Gamepad mapping element structure 625// 626struct _GLFWmapelement 627{ 628 uint8_t type; 629 uint8_t index; 630 int8_t axisScale; 631 int8_t axisOffset; 632}; 633 634// Gamepad mapping structure 635// 636struct _GLFWmapping 637{ 638 char name[128]; 639 char guid[33]; 640 _GLFWmapelement buttons[15]; 641 _GLFWmapelement axes[6]; 642}; 643 644// Joystick structure 645// 646struct _GLFWjoystick 647{ 648 GLFWbool allocated; 649 GLFWbool connected; 650 float* axes; 651 int axisCount; 652 unsigned char* buttons; 653 int buttonCount; 654 unsigned char* hats; 655 int hatCount; 656 char name[128]; 657 void* userPointer; 658 char guid[33]; 659 _GLFWmapping* mapping; 660 661 // This is defined in platform.h 662 GLFW_PLATFORM_JOYSTICK_STATE 663}; 664 665// Thread local storage structure 666// 667struct _GLFWtls 668{ 669 // This is defined in platform.h 670 GLFW_PLATFORM_TLS_STATE 671}; 672 673// Mutex structure 674// 675struct _GLFWmutex 676{ 677 // This is defined in platform.h 678 GLFW_PLATFORM_MUTEX_STATE 679}; 680 681// Platform API structure 682// 683struct _GLFWplatform 684{ 685 int platformID; 686 // init 687 GLFWbool (*init)(void); 688 void (*terminate)(void); 689 // input 690 void (*getCursorPos)(_GLFWwindow*,double*,double*); 691 void (*setCursorPos)(_GLFWwindow*,double,double); 692 void (*setCursorMode)(_GLFWwindow*,int); 693 void (*setRawMouseMotion)(_GLFWwindow*,GLFWbool); 694 GLFWbool (*rawMouseMotionSupported)(void); 695 GLFWbool (*createCursor)(_GLFWcursor*,const GLFWimage*,int,int); 696 GLFWbool (*createStandardCursor)(_GLFWcursor*,int); 697 void (*destroyCursor)(_GLFWcursor*); 698 void (*setCursor)(_GLFWwindow*,_GLFWcursor*); 699 const char* (*getScancodeName)(int); 700 int (*getKeyScancode)(int); 701 void (*setClipboardString)(const char*); 702 const char* (*getClipboardString)(void); 703 GLFWbool (*initJoysticks)(void); 704 void (*terminateJoysticks)(void); 705 GLFWbool (*pollJoystick)(_GLFWjoystick*,int); 706 const char* (*getMappingName)(void); 707 void (*updateGamepadGUID)(char*); 708 // monitor 709 void (*freeMonitor)(_GLFWmonitor*); 710 void (*getMonitorPos)(_GLFWmonitor*,int*,int*); 711 void (*getMonitorContentScale)(_GLFWmonitor*,float*,float*); 712 void (*getMonitorWorkarea)(_GLFWmonitor*,int*,int*,int*,int*); 713 GLFWvidmode* (*getVideoModes)(_GLFWmonitor*,int*); 714 GLFWbool (*getVideoMode)(_GLFWmonitor*,GLFWvidmode*); 715 GLFWbool (*getGammaRamp)(_GLFWmonitor*,GLFWgammaramp*); 716 void (*setGammaRamp)(_GLFWmonitor*,const GLFWgammaramp*); 717 // window 718 GLFWbool (*createWindow)(_GLFWwindow*,const _GLFWwndconfig*,const _GLFWctxconfig*,const _GLFWfbconfig*); 719 void (*destroyWindow)(_GLFWwindow*); 720 void (*setWindowTitle)(_GLFWwindow*,const char*); 721 void (*setWindowIcon)(_GLFWwindow*,int,const GLFWimage*); 722 void (*getWindowPos)(_GLFWwindow*,int*,int*); 723 void (*setWindowPos)(_GLFWwindow*,int,int); 724 void (*getWindowSize)(_GLFWwindow*,int*,int*); 725 void (*setWindowSize)(_GLFWwindow*,int,int); 726 void (*setWindowSizeLimits)(_GLFWwindow*,int,int,int,int); 727 void (*setWindowAspectRatio)(_GLFWwindow*,int,int); 728 void (*getFramebufferSize)(_GLFWwindow*,int*,int*); 729 void (*getWindowFrameSize)(_GLFWwindow*,int*,int*,int*,int*); 730 void (*getWindowContentScale)(_GLFWwindow*,float*,float*); 731 void (*iconifyWindow)(_GLFWwindow*); 732 void (*restoreWindow)(_GLFWwindow*); 733 void (*maximizeWindow)(_GLFWwindow*); 734 void (*showWindow)(_GLFWwindow*); 735 void (*hideWindow)(_GLFWwindow*); 736 void (*requestWindowAttention)(_GLFWwindow*); 737 void (*focusWindow)(_GLFWwindow*); 738 void (*setWindowMonitor)(_GLFWwindow*,_GLFWmonitor*,int,int,int,int,int); 739 GLFWbool (*windowFocused)(_GLFWwindow*); 740 GLFWbool (*windowIconified)(_GLFWwindow*); 741 GLFWbool (*windowVisible)(_GLFWwindow*); 742 GLFWbool (*windowMaximized)(_GLFWwindow*); 743 GLFWbool (*windowHovered)(_GLFWwindow*); 744 GLFWbool (*framebufferTransparent)(_GLFWwindow*); 745 float (*getWindowOpacity)(_GLFWwindow*); 746 void (*setWindowResizable)(_GLFWwindow*,GLFWbool); 747 void (*setWindowDecorated)(_GLFWwindow*,GLFWbool); 748 void (*setWindowFloating)(_GLFWwindow*,GLFWbool); 749 void (*setWindowOpacity)(_GLFWwindow*,float); 750 void (*setWindowMousePassthrough)(_GLFWwindow*,GLFWbool); 751 void (*pollEvents)(void); 752 void (*waitEvents)(void); 753 void (*waitEventsTimeout)(double); 754 void (*postEmptyEvent)(void); 755 // EGL 756 EGLenum (*getEGLPlatform)(EGLint**); 757 EGLNativeDisplayType (*getEGLNativeDisplay)(void); 758 EGLNativeWindowType (*getEGLNativeWindow)(_GLFWwindow*); 759 // vulkan 760 void (*getRequiredInstanceExtensions)(char**); 761 GLFWbool (*getPhysicalDevicePresentationSupport)(VkInstance,VkPhysicalDevice,uint32_t); 762 VkResult (*createWindowSurface)(VkInstance,_GLFWwindow*,const VkAllocationCallbacks*,VkSurfaceKHR*); 763}; 764 765// Library global data 766// 767struct _GLFWlibrary 768{ 769 GLFWbool initialized; 770 GLFWallocator allocator; 771 772 _GLFWplatform platform; 773 774 struct { 775 _GLFWinitconfig init; 776 _GLFWfbconfig framebuffer; 777 _GLFWwndconfig window; 778 _GLFWctxconfig context; 779 int refreshRate; 780 } hints; 781 782 _GLFWerror* errorListHead; 783 _GLFWcursor* cursorListHead; 784 _GLFWwindow* windowListHead; 785 786 _GLFWmonitor** monitors; 787 int monitorCount; 788 789 GLFWbool joysticksInitialized; 790 _GLFWjoystick joysticks[GLFW_JOYSTICK_LAST + 1]; 791 _GLFWmapping* mappings; 792 int mappingCount; 793 794 _GLFWtls errorSlot; 795 _GLFWtls contextSlot; 796 _GLFWmutex errorLock; 797 798 struct { 799 uint64_t offset; 800 // This is defined in platform.h 801 GLFW_PLATFORM_LIBRARY_TIMER_STATE 802 } timer; 803 804 struct { 805 EGLenum platform; 806 EGLDisplay display; 807 EGLint major, minor; 808 GLFWbool prefix; 809 810 GLFWbool KHR_create_context; 811 GLFWbool KHR_create_context_no_error; 812 GLFWbool KHR_gl_colorspace; 813 GLFWbool KHR_get_all_proc_addresses; 814 GLFWbool KHR_context_flush_control; 815 GLFWbool EXT_client_extensions; 816 GLFWbool EXT_platform_base; 817 GLFWbool EXT_platform_x11; 818 GLFWbool EXT_platform_wayland; 819 GLFWbool EXT_present_opaque; 820 GLFWbool ANGLE_platform_angle; 821 GLFWbool ANGLE_platform_angle_opengl; 822 GLFWbool ANGLE_platform_angle_d3d; 823 GLFWbool ANGLE_platform_angle_vulkan; 824 GLFWbool ANGLE_platform_angle_metal; 825 GLFWbool MESA_platform_surfaceless; 826 827 void* handle; 828 829 PFN_eglGetConfigAttrib GetConfigAttrib; 830 PFN_eglGetConfigs GetConfigs; 831 PFN_eglGetDisplay GetDisplay; 832 PFN_eglGetError GetError; 833 PFN_eglInitialize Initialize; 834 PFN_eglTerminate Terminate; 835 PFN_eglBindAPI BindAPI; 836 PFN_eglCreateContext CreateContext; 837 PFN_eglDestroySurface DestroySurface; 838 PFN_eglDestroyContext DestroyContext; 839 PFN_eglCreateWindowSurface CreateWindowSurface; 840 PFN_eglCreatePbufferSurface CreatePbufferSurface; 841 PFN_eglMakeCurrent MakeCurrent; 842 PFN_eglSwapBuffers SwapBuffers; 843 PFN_eglSwapInterval SwapInterval; 844 PFN_eglQueryString QueryString; 845 PFN_eglGetProcAddress GetProcAddress; 846 847 PFNEGLGETPLATFORMDISPLAYEXTPROC GetPlatformDisplayEXT; 848 PFNEGLCREATEPLATFORMWINDOWSURFACEEXTPROC CreatePlatformWindowSurfaceEXT; 849 } egl; 850 851 struct { 852 void* handle; 853 854 PFN_OSMesaCreateContextExt CreateContextExt; 855 PFN_OSMesaCreateContextAttribs CreateContextAttribs; 856 PFN_OSMesaDestroyContext DestroyContext; 857 PFN_OSMesaMakeCurrent MakeCurrent; 858 PFN_OSMesaGetColorBuffer GetColorBuffer; 859 PFN_OSMesaGetDepthBuffer GetDepthBuffer; 860 PFN_OSMesaGetProcAddress GetProcAddress; 861 862 } osmesa; 863 864 struct { 865 GLFWbool available; 866 void* handle; 867 char* extensions[2]; 868 PFN_vkGetInstanceProcAddr GetInstanceProcAddr; 869 GLFWbool KHR_surface; 870 GLFWbool KHR_win32_surface; 871 GLFWbool MVK_macos_surface; 872 GLFWbool EXT_metal_surface; 873 GLFWbool KHR_xlib_surface; 874 GLFWbool KHR_xcb_surface; 875 GLFWbool KHR_wayland_surface; 876 GLFWbool EXT_headless_surface; 877 } vk; 878 879 struct { 880 GLFWmonitorfun monitor; 881 GLFWjoystickfun joystick; 882 } callbacks; 883 884 // These are defined in platform.h 885 GLFW_PLATFORM_LIBRARY_WINDOW_STATE 886 GLFW_PLATFORM_LIBRARY_CONTEXT_STATE 887 GLFW_PLATFORM_LIBRARY_JOYSTICK_STATE 888}; 889 890// Global state shared between compilation units of GLFW 891// 892extern _GLFWlibrary _glfw; 893 894 895////////////////////////////////////////////////////////////////////////// 896////// GLFW platform API ////// 897////////////////////////////////////////////////////////////////////////// 898 899void _glfwPlatformInitTimer(void); 900uint64_t _glfwPlatformGetTimerValue(void); 901uint64_t _glfwPlatformGetTimerFrequency(void); 902 903GLFWbool _glfwPlatformCreateTls(_GLFWtls* tls); 904void _glfwPlatformDestroyTls(_GLFWtls* tls); 905void* _glfwPlatformGetTls(_GLFWtls* tls); 906void _glfwPlatformSetTls(_GLFWtls* tls, void* value); 907 908GLFWbool _glfwPlatformCreateMutex(_GLFWmutex* mutex); 909void _glfwPlatformDestroyMutex(_GLFWmutex* mutex); 910void _glfwPlatformLockMutex(_GLFWmutex* mutex); 911void _glfwPlatformUnlockMutex(_GLFWmutex* mutex); 912 913void* _glfwPlatformLoadModule(const char* path); 914void _glfwPlatformFreeModule(void* module); 915GLFWproc _glfwPlatformGetModuleSymbol(void* module, const char* name); 916 917 918////////////////////////////////////////////////////////////////////////// 919////// GLFW event API ////// 920////////////////////////////////////////////////////////////////////////// 921 922void _glfwInputWindowFocus(_GLFWwindow* window, GLFWbool focused); 923void _glfwInputWindowPos(_GLFWwindow* window, int xpos, int ypos); 924void _glfwInputWindowSize(_GLFWwindow* window, int width, int height); 925void _glfwInputFramebufferSize(_GLFWwindow* window, int width, int height); 926void _glfwInputWindowContentScale(_GLFWwindow* window, 927 float xscale, float yscale); 928void _glfwInputWindowIconify(_GLFWwindow* window, GLFWbool iconified); 929void _glfwInputWindowMaximize(_GLFWwindow* window, GLFWbool maximized); 930void _glfwInputWindowDamage(_GLFWwindow* window); 931void _glfwInputWindowCloseRequest(_GLFWwindow* window); 932void _glfwInputWindowMonitor(_GLFWwindow* window, _GLFWmonitor* monitor); 933 934void _glfwInputKey(_GLFWwindow* window, 935 int key, int scancode, int action, int mods); 936void _glfwInputChar(_GLFWwindow* window, 937 uint32_t codepoint, int mods, GLFWbool plain); 938void _glfwInputScroll(_GLFWwindow* window, double xoffset, double yoffset); 939void _glfwInputMouseClick(_GLFWwindow* window, int button, int action, int mods); 940void _glfwInputCursorPos(_GLFWwindow* window, double xpos, double ypos); 941void _glfwInputCursorEnter(_GLFWwindow* window, GLFWbool entered); 942void _glfwInputDrop(_GLFWwindow* window, int count, const char** names); 943void _glfwInputJoystick(_GLFWjoystick* js, int event); 944void _glfwInputJoystickAxis(_GLFWjoystick* js, int axis, float value); 945void _glfwInputJoystickButton(_GLFWjoystick* js, int button, char value); 946void _glfwInputJoystickHat(_GLFWjoystick* js, int hat, char value); 947 948void _glfwInputMonitor(_GLFWmonitor* monitor, int action, int placement); 949void _glfwInputMonitorWindow(_GLFWmonitor* monitor, _GLFWwindow* window); 950 951#if defined(__GNUC__) 952void _glfwInputError(int code, const char* format, ...) 953 __attribute__((format(printf, 2, 3))); 954#else 955void _glfwInputError(int code, const char* format, ...); 956#endif 957 958 959////////////////////////////////////////////////////////////////////////// 960////// GLFW internal API ////// 961////////////////////////////////////////////////////////////////////////// 962 963GLFWbool _glfwSelectPlatform(int platformID, _GLFWplatform* platform); 964 965GLFWbool _glfwStringInExtensionString(const char* string, const char* extensions); 966const _GLFWfbconfig* _glfwChooseFBConfig(const _GLFWfbconfig* desired, 967 const _GLFWfbconfig* alternatives, 968 unsigned int count); 969GLFWbool _glfwRefreshContextAttribs(_GLFWwindow* window, 970 const _GLFWctxconfig* ctxconfig); 971GLFWbool _glfwIsValidContextConfig(const _GLFWctxconfig* ctxconfig); 972 973const GLFWvidmode* _glfwChooseVideoMode(_GLFWmonitor* monitor, 974 const GLFWvidmode* desired); 975int _glfwCompareVideoModes(const GLFWvidmode* first, const GLFWvidmode* second); 976_GLFWmonitor* _glfwAllocMonitor(const char* name, int widthMM, int heightMM); 977void _glfwFreeMonitor(_GLFWmonitor* monitor); 978void _glfwAllocGammaArrays(GLFWgammaramp* ramp, unsigned int size); 979void _glfwFreeGammaArrays(GLFWgammaramp* ramp); 980void _glfwSplitBPP(int bpp, int* red, int* green, int* blue); 981 982void _glfwInitGamepadMappings(void); 983_GLFWjoystick* _glfwAllocJoystick(const char* name, 984 const char* guid, 985 int axisCount, 986 int buttonCount, 987 int hatCount); 988void _glfwFreeJoystick(_GLFWjoystick* js); 989void _glfwCenterCursorInContentArea(_GLFWwindow* window); 990 991GLFWbool _glfwInitEGL(void); 992void _glfwTerminateEGL(void); 993GLFWbool _glfwCreateContextEGL(_GLFWwindow* window, 994 const _GLFWctxconfig* ctxconfig, 995 const _GLFWfbconfig* fbconfig); 996#if defined(_GLFW_X11) 997GLFWbool _glfwChooseVisualEGL(const _GLFWwndconfig* wndconfig, 998 const _GLFWctxconfig* ctxconfig, 999 const _GLFWfbconfig* fbconfig, 1000 Visual** visual, int* depth); 1001#endif /*_GLFW_X11*/ 1002 1003GLFWbool _glfwInitOSMesa(void); 1004void _glfwTerminateOSMesa(void); 1005GLFWbool _glfwCreateContextOSMesa(_GLFWwindow* window, 1006 const _GLFWctxconfig* ctxconfig, 1007 const _GLFWfbconfig* fbconfig); 1008 1009GLFWbool _glfwInitVulkan(int mode); 1010void _glfwTerminateVulkan(void); 1011const char* _glfwGetVulkanResultString(VkResult result); 1012 1013size_t _glfwEncodeUTF8(char* s, uint32_t codepoint); 1014char** _glfwParseUriList(char* text, int* count); 1015 1016char* _glfw_strdup(const char* source); 1017int _glfw_min(int a, int b); 1018int _glfw_max(int a, int b); 1019 1020void* _glfw_calloc(size_t count, size_t size); 1021void* _glfw_realloc(void* pointer, size_t size); 1022void _glfw_free(void* pointer); 1023 1024
[FILE END]
(C) 2025 0x4248 (C) 2025 4248 Media and 4248 Systems, All part of 0x4248 See LICENCE files for more information. Not all files are by 0x4248 always check Licencing.