From e9c58bc1815656403b736000469f2ae5d2f0303a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Wed, 8 Jun 2022 19:14:13 +0200 Subject: [PATCH 001/117] Wayland: Fix missing lock key modifier bits The modifier bits for lock keys were only set when the corresponding key was reported as held down or latched, but not when it was released and locked. --- README.md | 1 + src/wl_init.c | 4 +-- src/wl_platform.h | 18 ++++++------- src/wl_window.c | 66 +++++++++++++++++++++++++++++------------------ 4 files changed, 53 insertions(+), 36 deletions(-) diff --git a/README.md b/README.md index 72cbef36..033f1bf2 100644 --- a/README.md +++ b/README.md @@ -326,6 +326,7 @@ information on what to include when reporting a bug. - [Wayland] Bugfix: MIME type matching was not performed for clipboard string - [Wayland] Bugfix: The OSMesa library was not unloaded on termination - [Wayland] Bugfix: `glfwCreateWindow` could emit `GLFW_FEATURE_UNAVAILABLE` + - [Wayland] Bugfix: Lock key modifier bits were only set when lock keys were pressed - [POSIX] Removed use of deprecated function `gettimeofday` - [POSIX] Bugfix: `CLOCK_MONOTONIC` was not correctly tested for or enabled - [WGL] Disabled the DWM swap interval hack for Windows 8 and later (#1072) diff --git a/src/wl_init.c b/src/wl_init.c index c232ce79..2e3a0573 100644 --- a/src/wl_init.c +++ b/src/wl_init.c @@ -597,10 +597,10 @@ int _glfwInitWayland(void) _glfwPlatformGetModuleSymbol(_glfw.wl.xkb.handle, "xkb_state_key_get_syms"); _glfw.wl.xkb.state_update_mask = (PFN_xkb_state_update_mask) _glfwPlatformGetModuleSymbol(_glfw.wl.xkb.handle, "xkb_state_update_mask"); - _glfw.wl.xkb.state_serialize_mods = (PFN_xkb_state_serialize_mods) - _glfwPlatformGetModuleSymbol(_glfw.wl.xkb.handle, "xkb_state_serialize_mods"); _glfw.wl.xkb.state_key_get_layout = (PFN_xkb_state_key_get_layout) _glfwPlatformGetModuleSymbol(_glfw.wl.xkb.handle, "xkb_state_key_get_layout"); + _glfw.wl.xkb.state_mod_index_is_active = (PFN_xkb_state_mod_index_is_active) + _glfwPlatformGetModuleSymbol(_glfw.wl.xkb.handle, "xkb_state_mod_index_is_active"); _glfw.wl.xkb.compose_table_new_from_locale = (PFN_xkb_compose_table_new_from_locale) _glfwPlatformGetModuleSymbol(_glfw.wl.xkb.handle, "xkb_compose_table_new_from_locale"); _glfw.wl.xkb.compose_table_unref = (PFN_xkb_compose_table_unref) diff --git a/src/wl_platform.h b/src/wl_platform.h index d6c8c4da..c361f923 100644 --- a/src/wl_platform.h +++ b/src/wl_platform.h @@ -167,8 +167,8 @@ typedef struct xkb_state* (* PFN_xkb_state_new)(struct xkb_keymap*); typedef void (* PFN_xkb_state_unref)(struct xkb_state*); typedef int (* PFN_xkb_state_key_get_syms)(struct xkb_state*, xkb_keycode_t, const xkb_keysym_t**); typedef enum xkb_state_component (* PFN_xkb_state_update_mask)(struct xkb_state*, xkb_mod_mask_t, xkb_mod_mask_t, xkb_mod_mask_t, xkb_layout_index_t, xkb_layout_index_t, xkb_layout_index_t); -typedef xkb_mod_mask_t (* PFN_xkb_state_serialize_mods)(struct xkb_state*, enum xkb_state_component); typedef xkb_layout_index_t (* PFN_xkb_state_key_get_layout)(struct xkb_state*,xkb_keycode_t); +typedef int (* PFN_xkb_state_mod_index_is_active)(struct xkb_state*,xkb_mod_index_t,enum xkb_state_component); #define xkb_context_new _glfw.wl.xkb.context_new #define xkb_context_unref _glfw.wl.xkb.context_unref #define xkb_keymap_new_from_string _glfw.wl.xkb.keymap_new_from_string @@ -180,8 +180,8 @@ typedef xkb_layout_index_t (* PFN_xkb_state_key_get_layout)(struct xkb_state*,xk #define xkb_state_unref _glfw.wl.xkb.state_unref #define xkb_state_key_get_syms _glfw.wl.xkb.state_key_get_syms #define xkb_state_update_mask _glfw.wl.xkb.state_update_mask -#define xkb_state_serialize_mods _glfw.wl.xkb.state_serialize_mods #define xkb_state_key_get_layout _glfw.wl.xkb.state_key_get_layout +#define xkb_state_mod_index_is_active _glfw.wl.xkb.state_mod_index_is_active typedef struct xkb_compose_table* (* PFN_xkb_compose_table_new_from_locale)(struct xkb_context*, const char*, enum xkb_compose_compile_flags); typedef void (* PFN_xkb_compose_table_unref)(struct xkb_compose_table*); @@ -334,12 +334,12 @@ typedef struct _GLFWlibraryWayland struct xkb_compose_state* composeState; - xkb_mod_mask_t controlMask; - xkb_mod_mask_t altMask; - xkb_mod_mask_t shiftMask; - xkb_mod_mask_t superMask; - xkb_mod_mask_t capsLockMask; - xkb_mod_mask_t numLockMask; + xkb_mod_index_t controlIndex; + xkb_mod_index_t altIndex; + xkb_mod_index_t shiftIndex; + xkb_mod_index_t superIndex; + xkb_mod_index_t capsLockIndex; + xkb_mod_index_t numLockIndex; unsigned int modifiers; PFN_xkb_context_new context_new; @@ -353,8 +353,8 @@ typedef struct _GLFWlibraryWayland PFN_xkb_state_unref state_unref; PFN_xkb_state_key_get_syms state_key_get_syms; PFN_xkb_state_update_mask state_update_mask; - PFN_xkb_state_serialize_mods state_serialize_mods; PFN_xkb_state_key_get_layout state_key_get_layout; + PFN_xkb_state_mod_index_is_active state_mod_index_is_active; PFN_xkb_compose_table_new_from_locale compose_table_new_from_locale; PFN_xkb_compose_table_unref compose_table_unref; diff --git a/src/wl_window.c b/src/wl_window.c index a1f93185..d9e58363 100644 --- a/src/wl_window.c +++ b/src/wl_window.c @@ -1269,18 +1269,12 @@ static void keyboardHandleKeymap(void* userData, _glfw.wl.xkb.keymap = keymap; _glfw.wl.xkb.state = state; - _glfw.wl.xkb.controlMask = - 1 << xkb_keymap_mod_get_index(_glfw.wl.xkb.keymap, "Control"); - _glfw.wl.xkb.altMask = - 1 << xkb_keymap_mod_get_index(_glfw.wl.xkb.keymap, "Mod1"); - _glfw.wl.xkb.shiftMask = - 1 << xkb_keymap_mod_get_index(_glfw.wl.xkb.keymap, "Shift"); - _glfw.wl.xkb.superMask = - 1 << xkb_keymap_mod_get_index(_glfw.wl.xkb.keymap, "Mod4"); - _glfw.wl.xkb.capsLockMask = - 1 << xkb_keymap_mod_get_index(_glfw.wl.xkb.keymap, "Lock"); - _glfw.wl.xkb.numLockMask = - 1 << xkb_keymap_mod_get_index(_glfw.wl.xkb.keymap, "Mod2"); + _glfw.wl.xkb.controlIndex = xkb_keymap_mod_get_index(_glfw.wl.xkb.keymap, "Control"); + _glfw.wl.xkb.altIndex = xkb_keymap_mod_get_index(_glfw.wl.xkb.keymap, "Mod1"); + _glfw.wl.xkb.shiftIndex = xkb_keymap_mod_get_index(_glfw.wl.xkb.keymap, "Shift"); + _glfw.wl.xkb.superIndex = xkb_keymap_mod_get_index(_glfw.wl.xkb.keymap, "Mod4"); + _glfw.wl.xkb.capsLockIndex = xkb_keymap_mod_get_index(_glfw.wl.xkb.keymap, "Lock"); + _glfw.wl.xkb.numLockIndex = xkb_keymap_mod_get_index(_glfw.wl.xkb.keymap, "Mod2"); } static void keyboardHandleEnter(void* userData, @@ -1434,27 +1428,49 @@ static void keyboardHandleModifiers(void* userData, 0, group); - const xkb_mod_mask_t mask = - xkb_state_serialize_mods(_glfw.wl.xkb.state, - XKB_STATE_MODS_DEPRESSED | - XKB_STATE_LAYOUT_DEPRESSED | - XKB_STATE_MODS_LATCHED | - XKB_STATE_LAYOUT_LATCHED); - unsigned int mods = 0; - if (mask & _glfw.wl.xkb.controlMask) + if (xkb_state_mod_index_is_active(_glfw.wl.xkb.state, + _glfw.wl.xkb.controlIndex, + XKB_STATE_MODS_EFFECTIVE) == 1) + { mods |= GLFW_MOD_CONTROL; - if (mask & _glfw.wl.xkb.altMask) + } + + if (xkb_state_mod_index_is_active(_glfw.wl.xkb.state, + _glfw.wl.xkb.altIndex, + XKB_STATE_MODS_EFFECTIVE) == 1) + { mods |= GLFW_MOD_ALT; - if (mask & _glfw.wl.xkb.shiftMask) + } + + if (xkb_state_mod_index_is_active(_glfw.wl.xkb.state, + _glfw.wl.xkb.shiftIndex, + XKB_STATE_MODS_EFFECTIVE) == 1) + { mods |= GLFW_MOD_SHIFT; - if (mask & _glfw.wl.xkb.superMask) + } + + if (xkb_state_mod_index_is_active(_glfw.wl.xkb.state, + _glfw.wl.xkb.superIndex, + XKB_STATE_MODS_EFFECTIVE) == 1) + { mods |= GLFW_MOD_SUPER; - if (mask & _glfw.wl.xkb.capsLockMask) + } + + if (xkb_state_mod_index_is_active(_glfw.wl.xkb.state, + _glfw.wl.xkb.capsLockIndex, + XKB_STATE_MODS_EFFECTIVE) == 1) + { mods |= GLFW_MOD_CAPS_LOCK; - if (mask & _glfw.wl.xkb.numLockMask) + } + + if (xkb_state_mod_index_is_active(_glfw.wl.xkb.state, + _glfw.wl.xkb.numLockIndex, + XKB_STATE_MODS_EFFECTIVE) == 1) + { mods |= GLFW_MOD_NUM_LOCK; + } _glfw.wl.xkb.modifiers = mods; } From 2c204ab52ecaa51bfd32b777aef715dae937f009 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Thu, 5 May 2022 22:23:12 +0200 Subject: [PATCH 002/117] Fix joystick user pointer NULL during disconnect The joystick code did not distinguish between the allocation status of the GLFW joystick object and whether it is connection to an OS level joystick object. These are now tracked separately. Fixes #2092 --- CONTRIBUTORS.md | 1 + README.md | 1 + src/cocoa_joystick.m | 15 ++++++++------- src/input.c | 33 +++++++++++++++++++-------------- src/internal.h | 3 ++- src/linux_joystick.c | 8 ++++---- src/win32_joystick.c | 10 +++++----- 7 files changed, 40 insertions(+), 31 deletions(-) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 030abf7c..23d1418e 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -137,6 +137,7 @@ video tutorials. - Kenneth Miller - Bruce Mitchener - Jack Moffitt + - Ravi Mohan - Jeff Molofee - Alexander Monakov - Pierre Morel diff --git a/README.md b/README.md index 033f1bf2..f189ba20 100644 --- a/README.md +++ b/README.md @@ -174,6 +174,7 @@ information on what to include when reporting a bug. - Bugfix: Native access functions for context handles did not check that the API matched - Bugfix: `glfwMakeContextCurrent` would access TLS slot before initialization - Bugfix: `glfwSetGammaRamp` could emit `GLFW_INVALID_VALUE` before initialization + - Bugfix: `glfwGetJoystickUserPointer` returned `NULL` during disconnection (#2092) - [Win32] Added the `GLFW_WIN32_KEYBOARD_MENU` window hint for enabling access to the window menu - [Win32] Added a version info resource to the GLFW DLL diff --git a/src/cocoa_joystick.m b/src/cocoa_joystick.m index e09e1efa..7c90b4c1 100644 --- a/src/cocoa_joystick.m +++ b/src/cocoa_joystick.m @@ -96,8 +96,7 @@ static CFComparisonResult compareElements(const void* fp, // static void closeJoystick(_GLFWjoystick* js) { - if (!js->present) - return; + _glfwInputJoystick(js, GLFW_DISCONNECTED); for (int i = 0; i < CFArrayGetCount(js->ns.axes); i++) _glfw_free((void*) CFArrayGetValueAtIndex(js->ns.axes, i)); @@ -112,7 +111,6 @@ static void closeJoystick(_GLFWjoystick* js) CFRelease(js->ns.hats); _glfwFreeJoystick(js); - _glfwInputJoystick(js, GLFW_DISCONNECTED); } // Callback for user-initiated joystick addition @@ -289,9 +287,9 @@ static void removeCallback(void* context, { for (int jid = 0; jid <= GLFW_JOYSTICK_LAST; jid++) { - if (_glfw.joysticks[jid].ns.device == device) + if (_glfw.joysticks[jid].connected && _glfw.joysticks[jid].ns.device == device) { - closeJoystick(_glfw.joysticks + jid); + closeJoystick(&_glfw.joysticks[jid]); break; } } @@ -382,7 +380,10 @@ GLFWbool _glfwInitJoysticksCocoa(void) void _glfwTerminateJoysticksCocoa(void) { for (int jid = 0; jid <= GLFW_JOYSTICK_LAST; jid++) - closeJoystick(_glfw.joysticks + jid); + { + if (_glfw.joysticks[jid].connected) + closeJoystick(&_glfw.joysticks[jid]); + } if (_glfw.ns.hidManager) { @@ -455,7 +456,7 @@ int _glfwPollJoystickCocoa(_GLFWjoystick* js, int mode) } } - return js->present; + return js->connected; } const char* _glfwGetMappingNameCocoa(void) diff --git a/src/input.c b/src/input.c index e0a12cce..01da7d65 100644 --- a/src/input.c +++ b/src/input.c @@ -377,6 +377,11 @@ void _glfwInputJoystick(_GLFWjoystick* js, int event) { const int jid = (int) (js - _glfw.joysticks); + if (event == GLFW_CONNECTED) + js->connected = GLFW_TRUE; + else if (event == GLFW_DISCONNECTED) + js->connected = GLFW_FALSE; + if (_glfw.callbacks.joystick) _glfw.callbacks.joystick(jid, event); } @@ -442,7 +447,7 @@ _GLFWjoystick* _glfwAllocJoystick(const char* name, for (jid = 0; jid <= GLFW_JOYSTICK_LAST; jid++) { - if (!_glfw.joysticks[jid].present) + if (!_glfw.joysticks[jid].allocated) break; } @@ -450,7 +455,7 @@ _GLFWjoystick* _glfwAllocJoystick(const char* name, return NULL; js = _glfw.joysticks + jid; - js->present = GLFW_TRUE; + js->allocated = GLFW_TRUE; js->axes = _glfw_calloc(axisCount, sizeof(float)); js->buttons = _glfw_calloc(buttonCount + (size_t) hatCount * 4, 1); js->hats = _glfw_calloc(hatCount, 1); @@ -972,7 +977,7 @@ GLFWAPI int glfwJoystickPresent(int jid) return GLFW_FALSE; js = _glfw.joysticks + jid; - if (!js->present) + if (!js->connected) return GLFW_FALSE; return _glfw.platform.pollJoystick(js, _GLFW_POLL_PRESENCE); @@ -1000,7 +1005,7 @@ GLFWAPI const float* glfwGetJoystickAxes(int jid, int* count) return NULL; js = _glfw.joysticks + jid; - if (!js->present) + if (!js->connected) return NULL; if (!_glfw.platform.pollJoystick(js, _GLFW_POLL_AXES)) @@ -1032,7 +1037,7 @@ GLFWAPI const unsigned char* glfwGetJoystickButtons(int jid, int* count) return NULL; js = _glfw.joysticks + jid; - if (!js->present) + if (!js->connected) return NULL; if (!_glfw.platform.pollJoystick(js, _GLFW_POLL_BUTTONS)) @@ -1068,7 +1073,7 @@ GLFWAPI const unsigned char* glfwGetJoystickHats(int jid, int* count) return NULL; js = _glfw.joysticks + jid; - if (!js->present) + if (!js->connected) return NULL; if (!_glfw.platform.pollJoystick(js, _GLFW_POLL_BUTTONS)) @@ -1097,7 +1102,7 @@ GLFWAPI const char* glfwGetJoystickName(int jid) return NULL; js = _glfw.joysticks + jid; - if (!js->present) + if (!js->connected) return NULL; if (!_glfw.platform.pollJoystick(js, _GLFW_POLL_PRESENCE)) @@ -1125,7 +1130,7 @@ GLFWAPI const char* glfwGetJoystickGUID(int jid) return NULL; js = _glfw.joysticks + jid; - if (!js->present) + if (!js->connected) return NULL; if (!_glfw.platform.pollJoystick(js, _GLFW_POLL_PRESENCE)) @@ -1144,7 +1149,7 @@ GLFWAPI void glfwSetJoystickUserPointer(int jid, void* pointer) _GLFW_REQUIRE_INIT(); js = _glfw.joysticks + jid; - if (!js->present) + if (!js->allocated) return; js->userPointer = pointer; @@ -1160,7 +1165,7 @@ GLFWAPI void* glfwGetJoystickUserPointer(int jid) _GLFW_REQUIRE_INIT_OR_RETURN(NULL); js = _glfw.joysticks + jid; - if (!js->present) + if (!js->allocated) return NULL; return js->userPointer; @@ -1230,7 +1235,7 @@ GLFWAPI int glfwUpdateGamepadMappings(const char* string) for (jid = 0; jid <= GLFW_JOYSTICK_LAST; jid++) { _GLFWjoystick* js = _glfw.joysticks + jid; - if (js->present) + if (js->connected) js->mapping = findValidMapping(js); } @@ -1256,7 +1261,7 @@ GLFWAPI int glfwJoystickIsGamepad(int jid) return GLFW_FALSE; js = _glfw.joysticks + jid; - if (!js->present) + if (!js->connected) return GLFW_FALSE; if (!_glfw.platform.pollJoystick(js, _GLFW_POLL_PRESENCE)) @@ -1284,7 +1289,7 @@ GLFWAPI const char* glfwGetGamepadName(int jid) return NULL; js = _glfw.joysticks + jid; - if (!js->present) + if (!js->connected) return NULL; if (!_glfw.platform.pollJoystick(js, _GLFW_POLL_PRESENCE)) @@ -1319,7 +1324,7 @@ GLFWAPI int glfwGetGamepadState(int jid, GLFWgamepadstate* state) return GLFW_FALSE; js = _glfw.joysticks + jid; - if (!js->present) + if (!js->connected) return GLFW_FALSE; if (!_glfw.platform.pollJoystick(js, _GLFW_POLL_ALL)) diff --git a/src/internal.h b/src/internal.h index 7babe7e8..be92b03a 100644 --- a/src/internal.h +++ b/src/internal.h @@ -634,7 +634,8 @@ struct _GLFWmapping // struct _GLFWjoystick { - GLFWbool present; + GLFWbool allocated; + GLFWbool connected; float* axes; int axisCount; unsigned char* buttons; diff --git a/src/linux_joystick.c b/src/linux_joystick.c index da04e9c3..2fbd689e 100644 --- a/src/linux_joystick.c +++ b/src/linux_joystick.c @@ -128,7 +128,7 @@ static GLFWbool openJoystickDevice(const char* path) { for (int jid = 0; jid <= GLFW_JOYSTICK_LAST; jid++) { - if (!_glfw.joysticks[jid].present) + if (_glfw.joysticks[jid].connected) continue; if (strcmp(_glfw.joysticks[jid].linjs.path, path) == 0) return GLFW_FALSE; @@ -245,9 +245,9 @@ static GLFWbool openJoystickDevice(const char* path) // static void closeJoystick(_GLFWjoystick* js) { + _glfwInputJoystick(js, GLFW_DISCONNECTED); close(js->linjs.fd); _glfwFreeJoystick(js); - _glfwInputJoystick(js, GLFW_DISCONNECTED); } // Lexically compare joysticks by name; used by qsort @@ -366,7 +366,7 @@ void _glfwTerminateJoysticksLinux(void) for (int jid = 0; jid <= GLFW_JOYSTICK_LAST; jid++) { _GLFWjoystick* js = _glfw.joysticks + jid; - if (js->present) + if (js->connected) closeJoystick(js); } @@ -417,7 +417,7 @@ int _glfwPollJoystickLinux(_GLFWjoystick* js, int mode) handleAbsEvent(js, e.code, e.value); } - return js->present; + return js->connected; } const char* _glfwGetMappingNameLinux(void) diff --git a/src/win32_joystick.c b/src/win32_joystick.c index 7eb9b203..bac53ab3 100644 --- a/src/win32_joystick.c +++ b/src/win32_joystick.c @@ -256,6 +256,8 @@ static GLFWbool supportsXInput(const GUID* guid) // static void closeJoystick(_GLFWjoystick* js) { + _glfwInputJoystick(js, GLFW_DISCONNECTED); + if (js->win32.device) { IDirectInputDevice8_Unacquire(js->win32.device); @@ -263,9 +265,7 @@ static void closeJoystick(_GLFWjoystick* js) } _glfw_free(js->win32.objects); - _glfwFreeJoystick(js); - _glfwInputJoystick(js, GLFW_DISCONNECTED); } // DirectInput device object enumeration callback @@ -357,7 +357,7 @@ static BOOL CALLBACK deviceCallback(const DIDEVICEINSTANCE* di, void* user) for (jid = 0; jid <= GLFW_JOYSTICK_LAST; jid++) { js = _glfw.joysticks + jid; - if (js->present) + if (js->connected) { if (memcmp(&js->win32.guid, &di->guidInstance, sizeof(GUID)) == 0) return DIENUM_CONTINUE; @@ -508,7 +508,7 @@ void _glfwDetectJoystickConnectionWin32(void) for (jid = 0; jid <= GLFW_JOYSTICK_LAST; jid++) { - if (_glfw.joysticks[jid].present && + if (_glfw.joysticks[jid].connected && _glfw.joysticks[jid].win32.device == NULL && _glfw.joysticks[jid].win32.index == index) { @@ -560,7 +560,7 @@ void _glfwDetectJoystickDisconnectionWin32(void) for (jid = 0; jid <= GLFW_JOYSTICK_LAST; jid++) { _GLFWjoystick* js = _glfw.joysticks + jid; - if (js->present) + if (js->connected) _glfwPollJoystickWin32(js, _GLFW_POLL_PRESENCE); } } From 736a88b0672a8a616d109da73bef6d1e44eb063b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Sun, 22 May 2022 14:40:00 +0200 Subject: [PATCH 003/117] Fix return type of functions returning bool values --- src/cocoa_joystick.h | 2 +- src/cocoa_joystick.m | 2 +- src/cocoa_platform.h | 20 ++++++++++---------- src/cocoa_window.m | 34 +++++++++++++++++----------------- src/internal.h | 22 +++++++++++----------- src/linux_joystick.c | 2 +- src/linux_joystick.h | 2 +- src/null_joystick.c | 2 +- src/null_joystick.h | 2 +- src/null_platform.h | 20 ++++++++++---------- src/null_window.c | 34 +++++++++++++++++----------------- src/win32_joystick.c | 2 +- src/win32_platform.h | 22 +++++++++++----------- src/win32_window.c | 34 +++++++++++++++++----------------- src/wl_platform.h | 20 ++++++++++---------- src/wl_window.c | 34 +++++++++++++++++----------------- src/x11_platform.h | 20 ++++++++++---------- src/x11_window.c | 34 +++++++++++++++++----------------- 18 files changed, 154 insertions(+), 154 deletions(-) diff --git a/src/cocoa_joystick.h b/src/cocoa_joystick.h index 756911a2..fc7ba7a2 100644 --- a/src/cocoa_joystick.h +++ b/src/cocoa_joystick.h @@ -45,7 +45,7 @@ typedef struct _GLFWjoystickNS GLFWbool _glfwInitJoysticksCocoa(void); void _glfwTerminateJoysticksCocoa(void); -int _glfwPollJoystickCocoa(_GLFWjoystick* js, int mode); +GLFWbool _glfwPollJoystickCocoa(_GLFWjoystick* js, int mode); const char* _glfwGetMappingNameCocoa(void); void _glfwUpdateGamepadGUIDCocoa(char* guid); diff --git a/src/cocoa_joystick.m b/src/cocoa_joystick.m index 7c90b4c1..ebcf5fdb 100644 --- a/src/cocoa_joystick.m +++ b/src/cocoa_joystick.m @@ -393,7 +393,7 @@ void _glfwTerminateJoysticksCocoa(void) } -int _glfwPollJoystickCocoa(_GLFWjoystick* js, int mode) +GLFWbool _glfwPollJoystickCocoa(_GLFWjoystick* js, int mode) { if (mode & _GLFW_POLL_AXES) { diff --git a/src/cocoa_platform.h b/src/cocoa_platform.h index 9259b195..9f7d191d 100644 --- a/src/cocoa_platform.h +++ b/src/cocoa_platform.h @@ -214,7 +214,7 @@ GLFWbool _glfwConnectCocoa(int platformID, _GLFWplatform* platform); int _glfwInitCocoa(void); void _glfwTerminateCocoa(void); -int _glfwCreateWindowCocoa(_GLFWwindow* window, const _GLFWwndconfig* wndconfig, const _GLFWctxconfig* ctxconfig, const _GLFWfbconfig* fbconfig); +GLFWbool _glfwCreateWindowCocoa(_GLFWwindow* window, const _GLFWwndconfig* wndconfig, const _GLFWctxconfig* ctxconfig, const _GLFWfbconfig* fbconfig); void _glfwDestroyWindowCocoa(_GLFWwindow* window); void _glfwSetWindowTitleCocoa(_GLFWwindow* window, const char* title); void _glfwSetWindowIconCocoa(_GLFWwindow* window, int count, const GLFWimage* images); @@ -235,12 +235,12 @@ void _glfwHideWindowCocoa(_GLFWwindow* window); void _glfwRequestWindowAttentionCocoa(_GLFWwindow* window); void _glfwFocusWindowCocoa(_GLFWwindow* window); void _glfwSetWindowMonitorCocoa(_GLFWwindow* window, _GLFWmonitor* monitor, int xpos, int ypos, int width, int height, int refreshRate); -int _glfwWindowFocusedCocoa(_GLFWwindow* window); -int _glfwWindowIconifiedCocoa(_GLFWwindow* window); -int _glfwWindowVisibleCocoa(_GLFWwindow* window); -int _glfwWindowMaximizedCocoa(_GLFWwindow* window); -int _glfwWindowHoveredCocoa(_GLFWwindow* window); -int _glfwFramebufferTransparentCocoa(_GLFWwindow* window); +GLFWbool _glfwWindowFocusedCocoa(_GLFWwindow* window); +GLFWbool _glfwWindowIconifiedCocoa(_GLFWwindow* window); +GLFWbool _glfwWindowVisibleCocoa(_GLFWwindow* window); +GLFWbool _glfwWindowMaximizedCocoa(_GLFWwindow* window); +GLFWbool _glfwWindowHoveredCocoa(_GLFWwindow* window); +GLFWbool _glfwFramebufferTransparentCocoa(_GLFWwindow* window); void _glfwSetWindowResizableCocoa(_GLFWwindow* window, GLFWbool enabled); void _glfwSetWindowDecoratedCocoa(_GLFWwindow* window, GLFWbool enabled); void _glfwSetWindowFloatingCocoa(_GLFWwindow* window, GLFWbool enabled); @@ -261,8 +261,8 @@ void _glfwSetCursorPosCocoa(_GLFWwindow* window, double xpos, double ypos); void _glfwSetCursorModeCocoa(_GLFWwindow* window, int mode); const char* _glfwGetScancodeNameCocoa(int scancode); int _glfwGetKeyScancodeCocoa(int key); -int _glfwCreateCursorCocoa(_GLFWcursor* cursor, const GLFWimage* image, int xhot, int yhot); -int _glfwCreateStandardCursorCocoa(_GLFWcursor* cursor, int shape); +GLFWbool _glfwCreateCursorCocoa(_GLFWcursor* cursor, const GLFWimage* image, int xhot, int yhot); +GLFWbool _glfwCreateStandardCursorCocoa(_GLFWcursor* cursor, int shape); void _glfwDestroyCursorCocoa(_GLFWcursor* cursor); void _glfwSetCursorCocoa(_GLFWwindow* window, _GLFWcursor* cursor); void _glfwSetClipboardStringCocoa(const char* string); @@ -273,7 +273,7 @@ EGLNativeDisplayType _glfwGetEGLNativeDisplayCocoa(void); EGLNativeWindowType _glfwGetEGLNativeWindowCocoa(_GLFWwindow* window); void _glfwGetRequiredInstanceExtensionsCocoa(char** extensions); -int _glfwGetPhysicalDevicePresentationSupportCocoa(VkInstance instance, VkPhysicalDevice device, uint32_t queuefamily); +GLFWbool _glfwGetPhysicalDevicePresentationSupportCocoa(VkInstance instance, VkPhysicalDevice device, uint32_t queuefamily); VkResult _glfwCreateWindowSurfaceCocoa(VkInstance instance, _GLFWwindow* window, const VkAllocationCallbacks* allocator, VkSurfaceKHR* surface); void _glfwFreeMonitorCocoa(_GLFWmonitor* monitor); diff --git a/src/cocoa_window.m b/src/cocoa_window.m index 444bd563..3726f782 100644 --- a/src/cocoa_window.m +++ b/src/cocoa_window.m @@ -893,10 +893,10 @@ float _glfwTransformYCocoa(float y) ////// GLFW platform API ////// ////////////////////////////////////////////////////////////////////////// -int _glfwCreateWindowCocoa(_GLFWwindow* window, - const _GLFWwndconfig* wndconfig, - const _GLFWctxconfig* ctxconfig, - const _GLFWfbconfig* fbconfig) +GLFWbool _glfwCreateWindowCocoa(_GLFWwindow* window, + const _GLFWwndconfig* wndconfig, + const _GLFWctxconfig* ctxconfig, + const _GLFWfbconfig* fbconfig) { @autoreleasepool { @@ -1309,35 +1309,35 @@ void _glfwSetWindowMonitorCocoa(_GLFWwindow* window, } // autoreleasepool } -int _glfwWindowFocusedCocoa(_GLFWwindow* window) +GLFWbool _glfwWindowFocusedCocoa(_GLFWwindow* window) { @autoreleasepool { return [window->ns.object isKeyWindow]; } // autoreleasepool } -int _glfwWindowIconifiedCocoa(_GLFWwindow* window) +GLFWbool _glfwWindowIconifiedCocoa(_GLFWwindow* window) { @autoreleasepool { return [window->ns.object isMiniaturized]; } // autoreleasepool } -int _glfwWindowVisibleCocoa(_GLFWwindow* window) +GLFWbool _glfwWindowVisibleCocoa(_GLFWwindow* window) { @autoreleasepool { return [window->ns.object isVisible]; } // autoreleasepool } -int _glfwWindowMaximizedCocoa(_GLFWwindow* window) +GLFWbool _glfwWindowMaximizedCocoa(_GLFWwindow* window) { @autoreleasepool { return [window->ns.object isZoomed]; } // autoreleasepool } -int _glfwWindowHoveredCocoa(_GLFWwindow* window) +GLFWbool _glfwWindowHoveredCocoa(_GLFWwindow* window) { @autoreleasepool { @@ -1355,7 +1355,7 @@ int _glfwWindowHoveredCocoa(_GLFWwindow* window) } // autoreleasepool } -int _glfwFramebufferTransparentCocoa(_GLFWwindow* window) +GLFWbool _glfwFramebufferTransparentCocoa(_GLFWwindow* window) { @autoreleasepool { return ![window->ns.object isOpaque] && ![window->ns.view isOpaque]; @@ -1605,9 +1605,9 @@ int _glfwGetKeyScancodeCocoa(int key) return _glfw.ns.scancodes[key]; } -int _glfwCreateCursorCocoa(_GLFWcursor* cursor, - const GLFWimage* image, - int xhot, int yhot) +GLFWbool _glfwCreateCursorCocoa(_GLFWcursor* cursor, + const GLFWimage* image, + int xhot, int yhot) { @autoreleasepool { @@ -1649,7 +1649,7 @@ int _glfwCreateCursorCocoa(_GLFWcursor* cursor, } // autoreleasepool } -int _glfwCreateStandardCursorCocoa(_GLFWcursor* cursor, int shape) +GLFWbool _glfwCreateStandardCursorCocoa(_GLFWcursor* cursor, int shape) { @autoreleasepool { @@ -1832,9 +1832,9 @@ void _glfwGetRequiredInstanceExtensionsCocoa(char** extensions) } } -int _glfwGetPhysicalDevicePresentationSupportCocoa(VkInstance instance, - VkPhysicalDevice device, - uint32_t queuefamily) +GLFWbool _glfwGetPhysicalDevicePresentationSupportCocoa(VkInstance instance, + VkPhysicalDevice device, + uint32_t queuefamily) { return GLFW_TRUE; } diff --git a/src/internal.h b/src/internal.h index be92b03a..89a18628 100644 --- a/src/internal.h +++ b/src/internal.h @@ -681,8 +681,8 @@ struct _GLFWplatform void (*setCursorMode)(_GLFWwindow*,int); void (*setRawMouseMotion)(_GLFWwindow*,GLFWbool); GLFWbool (*rawMouseMotionSupported)(void); - int (*createCursor)(_GLFWcursor*,const GLFWimage*,int,int); - int (*createStandardCursor)(_GLFWcursor*,int); + GLFWbool (*createCursor)(_GLFWcursor*,const GLFWimage*,int,int); + GLFWbool (*createStandardCursor)(_GLFWcursor*,int); void (*destroyCursor)(_GLFWcursor*); void (*setCursor)(_GLFWwindow*,_GLFWcursor*); const char* (*getScancodeName)(int); @@ -691,7 +691,7 @@ struct _GLFWplatform const char* (*getClipboardString)(void); GLFWbool (*initJoysticks)(void); void (*terminateJoysticks)(void); - int (*pollJoystick)(_GLFWjoystick*,int); + GLFWbool (*pollJoystick)(_GLFWjoystick*,int); const char* (*getMappingName)(void); void (*updateGamepadGUID)(char*); // monitor @@ -704,7 +704,7 @@ struct _GLFWplatform GLFWbool (*getGammaRamp)(_GLFWmonitor*,GLFWgammaramp*); void (*setGammaRamp)(_GLFWmonitor*,const GLFWgammaramp*); // window - int (*createWindow)(_GLFWwindow*,const _GLFWwndconfig*,const _GLFWctxconfig*,const _GLFWfbconfig*); + GLFWbool (*createWindow)(_GLFWwindow*,const _GLFWwndconfig*,const _GLFWctxconfig*,const _GLFWfbconfig*); void (*destroyWindow)(_GLFWwindow*); void (*setWindowTitle)(_GLFWwindow*,const char*); void (*setWindowIcon)(_GLFWwindow*,int,const GLFWimage*); @@ -725,12 +725,12 @@ struct _GLFWplatform void (*requestWindowAttention)(_GLFWwindow*); void (*focusWindow)(_GLFWwindow*); void (*setWindowMonitor)(_GLFWwindow*,_GLFWmonitor*,int,int,int,int,int); - int (*windowFocused)(_GLFWwindow*); - int (*windowIconified)(_GLFWwindow*); - int (*windowVisible)(_GLFWwindow*); - int (*windowMaximized)(_GLFWwindow*); - int (*windowHovered)(_GLFWwindow*); - int (*framebufferTransparent)(_GLFWwindow*); + GLFWbool (*windowFocused)(_GLFWwindow*); + GLFWbool (*windowIconified)(_GLFWwindow*); + GLFWbool (*windowVisible)(_GLFWwindow*); + GLFWbool (*windowMaximized)(_GLFWwindow*); + GLFWbool (*windowHovered)(_GLFWwindow*); + GLFWbool (*framebufferTransparent)(_GLFWwindow*); float (*getWindowOpacity)(_GLFWwindow*); void (*setWindowResizable)(_GLFWwindow*,GLFWbool); void (*setWindowDecorated)(_GLFWwindow*,GLFWbool); @@ -747,7 +747,7 @@ struct _GLFWplatform EGLNativeWindowType (*getEGLNativeWindow)(_GLFWwindow*); // vulkan void (*getRequiredInstanceExtensions)(char**); - int (*getPhysicalDevicePresentationSupport)(VkInstance,VkPhysicalDevice,uint32_t); + GLFWbool (*getPhysicalDevicePresentationSupport)(VkInstance,VkPhysicalDevice,uint32_t); VkResult (*createWindowSurface)(VkInstance,_GLFWwindow*,const VkAllocationCallbacks*,VkSurfaceKHR*); }; diff --git a/src/linux_joystick.c b/src/linux_joystick.c index 2fbd689e..b8b5778e 100644 --- a/src/linux_joystick.c +++ b/src/linux_joystick.c @@ -380,7 +380,7 @@ void _glfwTerminateJoysticksLinux(void) } } -int _glfwPollJoystickLinux(_GLFWjoystick* js, int mode) +GLFWbool _glfwPollJoystickLinux(_GLFWjoystick* js, int mode) { // Read all queued events (non-blocking) for (;;) diff --git a/src/linux_joystick.h b/src/linux_joystick.h index 37e5d1ae..f898b2b9 100644 --- a/src/linux_joystick.h +++ b/src/linux_joystick.h @@ -59,7 +59,7 @@ void _glfwDetectJoystickConnectionLinux(void); GLFWbool _glfwInitJoysticksLinux(void); void _glfwTerminateJoysticksLinux(void); -int _glfwPollJoystickLinux(_GLFWjoystick* js, int mode); +GLFWbool _glfwPollJoystickLinux(_GLFWjoystick* js, int mode); const char* _glfwGetMappingNameLinux(void); void _glfwUpdateGamepadGUIDLinux(char* guid); diff --git a/src/null_joystick.c b/src/null_joystick.c index e2770dd8..1fe50721 100644 --- a/src/null_joystick.c +++ b/src/null_joystick.c @@ -42,7 +42,7 @@ void _glfwTerminateJoysticksNull(void) { } -int _glfwPollJoystickNull(_GLFWjoystick* js, int mode) +GLFWbool _glfwPollJoystickNull(_GLFWjoystick* js, int mode) { return GLFW_FALSE; } diff --git a/src/null_joystick.h b/src/null_joystick.h index ec223ecd..a2199c56 100644 --- a/src/null_joystick.h +++ b/src/null_joystick.h @@ -26,7 +26,7 @@ GLFWbool _glfwInitJoysticksNull(void); void _glfwTerminateJoysticksNull(void); -int _glfwPollJoystickNull(_GLFWjoystick* js, int mode); +GLFWbool _glfwPollJoystickNull(_GLFWjoystick* js, int mode); const char* _glfwGetMappingNameNull(void); void _glfwUpdateGamepadGUIDNull(char* guid); diff --git a/src/null_platform.h b/src/null_platform.h index fca7c11f..b646acb3 100644 --- a/src/null_platform.h +++ b/src/null_platform.h @@ -85,7 +85,7 @@ void _glfwGetVideoModeNull(_GLFWmonitor* monitor, GLFWvidmode* mode); GLFWbool _glfwGetGammaRampNull(_GLFWmonitor* monitor, GLFWgammaramp* ramp); void _glfwSetGammaRampNull(_GLFWmonitor* monitor, const GLFWgammaramp* ramp); -int _glfwCreateWindowNull(_GLFWwindow* window, const _GLFWwndconfig* wndconfig, const _GLFWctxconfig* ctxconfig, const _GLFWfbconfig* fbconfig); +GLFWbool _glfwCreateWindowNull(_GLFWwindow* window, const _GLFWwndconfig* wndconfig, const _GLFWctxconfig* ctxconfig, const _GLFWfbconfig* fbconfig); void _glfwDestroyWindowNull(_GLFWwindow* window); void _glfwSetWindowTitleNull(_GLFWwindow* window, const char* title); void _glfwSetWindowIconNull(_GLFWwindow* window, int count, const GLFWimage* images); @@ -102,9 +102,9 @@ void _glfwGetWindowContentScaleNull(_GLFWwindow* window, float* xscale, float* y void _glfwIconifyWindowNull(_GLFWwindow* window); void _glfwRestoreWindowNull(_GLFWwindow* window); void _glfwMaximizeWindowNull(_GLFWwindow* window); -int _glfwWindowMaximizedNull(_GLFWwindow* window); -int _glfwWindowHoveredNull(_GLFWwindow* window); -int _glfwFramebufferTransparentNull(_GLFWwindow* window); +GLFWbool _glfwWindowMaximizedNull(_GLFWwindow* window); +GLFWbool _glfwWindowHoveredNull(_GLFWwindow* window); +GLFWbool _glfwFramebufferTransparentNull(_GLFWwindow* window); void _glfwSetWindowResizableNull(_GLFWwindow* window, GLFWbool enabled); void _glfwSetWindowDecoratedNull(_GLFWwindow* window, GLFWbool enabled); void _glfwSetWindowFloatingNull(_GLFWwindow* window, GLFWbool enabled); @@ -118,9 +118,9 @@ void _glfwRequestWindowAttentionNull(_GLFWwindow* window); void _glfwRequestWindowAttentionNull(_GLFWwindow* window); void _glfwHideWindowNull(_GLFWwindow* window); void _glfwFocusWindowNull(_GLFWwindow* window); -int _glfwWindowFocusedNull(_GLFWwindow* window); -int _glfwWindowIconifiedNull(_GLFWwindow* window); -int _glfwWindowVisibleNull(_GLFWwindow* window); +GLFWbool _glfwWindowFocusedNull(_GLFWwindow* window); +GLFWbool _glfwWindowIconifiedNull(_GLFWwindow* window); +GLFWbool _glfwWindowVisibleNull(_GLFWwindow* window); void _glfwPollEventsNull(void); void _glfwWaitEventsNull(void); void _glfwWaitEventsTimeoutNull(double timeout); @@ -128,8 +128,8 @@ void _glfwPostEmptyEventNull(void); void _glfwGetCursorPosNull(_GLFWwindow* window, double* xpos, double* ypos); void _glfwSetCursorPosNull(_GLFWwindow* window, double x, double y); void _glfwSetCursorModeNull(_GLFWwindow* window, int mode); -int _glfwCreateCursorNull(_GLFWcursor* cursor, const GLFWimage* image, int xhot, int yhot); -int _glfwCreateStandardCursorNull(_GLFWcursor* cursor, int shape); +GLFWbool _glfwCreateCursorNull(_GLFWcursor* cursor, const GLFWimage* image, int xhot, int yhot); +GLFWbool _glfwCreateStandardCursorNull(_GLFWcursor* cursor, int shape); void _glfwDestroyCursorNull(_GLFWcursor* cursor); void _glfwSetCursorNull(_GLFWwindow* window, _GLFWcursor* cursor); void _glfwSetClipboardStringNull(const char* string); @@ -142,7 +142,7 @@ EGLNativeDisplayType _glfwGetEGLNativeDisplayNull(void); EGLNativeWindowType _glfwGetEGLNativeWindowNull(_GLFWwindow* window); void _glfwGetRequiredInstanceExtensionsNull(char** extensions); -int _glfwGetPhysicalDevicePresentationSupportNull(VkInstance instance, VkPhysicalDevice device, uint32_t queuefamily); +GLFWbool _glfwGetPhysicalDevicePresentationSupportNull(VkInstance instance, VkPhysicalDevice device, uint32_t queuefamily); VkResult _glfwCreateWindowSurfaceNull(VkInstance instance, _GLFWwindow* window, const VkAllocationCallbacks* allocator, VkSurfaceKHR* surface); void _glfwPollMonitorsNull(void); diff --git a/src/null_window.c b/src/null_window.c index b40110b8..8a7cae41 100644 --- a/src/null_window.c +++ b/src/null_window.c @@ -103,10 +103,10 @@ static int createNativeWindow(_GLFWwindow* window, ////// GLFW platform API ////// ////////////////////////////////////////////////////////////////////////// -int _glfwCreateWindowNull(_GLFWwindow* window, - const _GLFWwndconfig* wndconfig, - const _GLFWctxconfig* ctxconfig, - const _GLFWfbconfig* fbconfig) +GLFWbool _glfwCreateWindowNull(_GLFWwindow* window, + const _GLFWwndconfig* wndconfig, + const _GLFWctxconfig* ctxconfig, + const _GLFWfbconfig* fbconfig) { if (!createNativeWindow(window, wndconfig, fbconfig)) return GLFW_FALSE; @@ -362,12 +362,12 @@ void _glfwMaximizeWindowNull(_GLFWwindow* window) } } -int _glfwWindowMaximizedNull(_GLFWwindow* window) +GLFWbool _glfwWindowMaximizedNull(_GLFWwindow* window) { return window->null.maximized; } -int _glfwWindowHoveredNull(_GLFWwindow* window) +GLFWbool _glfwWindowHoveredNull(_GLFWwindow* window) { return _glfw.null.xcursor >= window->null.xpos && _glfw.null.ycursor >= window->null.ypos && @@ -375,7 +375,7 @@ int _glfwWindowHoveredNull(_GLFWwindow* window) _glfw.null.ycursor <= window->null.ypos + window->null.height - 1; } -int _glfwFramebufferTransparentNull(_GLFWwindow* window) +GLFWbool _glfwFramebufferTransparentNull(_GLFWwindow* window) { return window->null.transparent; } @@ -461,17 +461,17 @@ void _glfwFocusWindowNull(_GLFWwindow* window) _glfwInputWindowFocus(window, GLFW_TRUE); } -int _glfwWindowFocusedNull(_GLFWwindow* window) +GLFWbool _glfwWindowFocusedNull(_GLFWwindow* window) { return _glfw.null.focusedWindow == window; } -int _glfwWindowIconifiedNull(_GLFWwindow* window) +GLFWbool _glfwWindowIconifiedNull(_GLFWwindow* window) { return window->null.iconified; } -int _glfwWindowVisibleNull(_GLFWwindow* window) +GLFWbool _glfwWindowVisibleNull(_GLFWwindow* window) { return window->null.visible; } @@ -510,14 +510,14 @@ void _glfwSetCursorModeNull(_GLFWwindow* window, int mode) { } -int _glfwCreateCursorNull(_GLFWcursor* cursor, - const GLFWimage* image, - int xhot, int yhot) +GLFWbool _glfwCreateCursorNull(_GLFWcursor* cursor, + const GLFWimage* image, + int xhot, int yhot) { return GLFW_TRUE; } -int _glfwCreateStandardCursorNull(_GLFWcursor* cursor, int shape) +GLFWbool _glfwCreateStandardCursorNull(_GLFWcursor* cursor, int shape) { return GLFW_TRUE; } @@ -693,9 +693,9 @@ void _glfwGetRequiredInstanceExtensionsNull(char** extensions) { } -int _glfwGetPhysicalDevicePresentationSupportNull(VkInstance instance, - VkPhysicalDevice device, - uint32_t queuefamily) +GLFWbool _glfwGetPhysicalDevicePresentationSupportNull(VkInstance instance, + VkPhysicalDevice device, + uint32_t queuefamily) { return GLFW_FALSE; } diff --git a/src/win32_joystick.c b/src/win32_joystick.c index bac53ab3..3a28943b 100644 --- a/src/win32_joystick.c +++ b/src/win32_joystick.c @@ -601,7 +601,7 @@ void _glfwTerminateJoysticksWin32(void) IDirectInput8_Release(_glfw.win32.dinput8.api); } -int _glfwPollJoystickWin32(_GLFWjoystick* js, int mode) +GLFWbool _glfwPollJoystickWin32(_GLFWjoystick* js, int mode) { if (js->win32.device) { diff --git a/src/win32_platform.h b/src/win32_platform.h index c3dc262f..c9d96cd0 100644 --- a/src/win32_platform.h +++ b/src/win32_platform.h @@ -542,7 +542,7 @@ void _glfwSetVideoModeWin32(_GLFWmonitor* monitor, const GLFWvidmode* desired); void _glfwRestoreVideoModeWin32(_GLFWmonitor* monitor); void _glfwGetHMONITORContentScaleWin32(HMONITOR handle, float* xscale, float* yscale); -int _glfwCreateWindowWin32(_GLFWwindow* window, const _GLFWwndconfig* wndconfig, const _GLFWctxconfig* ctxconfig, const _GLFWfbconfig* fbconfig); +GLFWbool _glfwCreateWindowWin32(_GLFWwindow* window, const _GLFWwndconfig* wndconfig, const _GLFWctxconfig* ctxconfig, const _GLFWfbconfig* fbconfig); void _glfwDestroyWindowWin32(_GLFWwindow* window); void _glfwSetWindowTitleWin32(_GLFWwindow* window, const char* title); void _glfwSetWindowIconWin32(_GLFWwindow* window, int count, const GLFWimage* images); @@ -563,12 +563,12 @@ void _glfwHideWindowWin32(_GLFWwindow* window); void _glfwRequestWindowAttentionWin32(_GLFWwindow* window); void _glfwFocusWindowWin32(_GLFWwindow* window); void _glfwSetWindowMonitorWin32(_GLFWwindow* window, _GLFWmonitor* monitor, int xpos, int ypos, int width, int height, int refreshRate); -int _glfwWindowFocusedWin32(_GLFWwindow* window); -int _glfwWindowIconifiedWin32(_GLFWwindow* window); -int _glfwWindowVisibleWin32(_GLFWwindow* window); -int _glfwWindowMaximizedWin32(_GLFWwindow* window); -int _glfwWindowHoveredWin32(_GLFWwindow* window); -int _glfwFramebufferTransparentWin32(_GLFWwindow* window); +GLFWbool _glfwWindowFocusedWin32(_GLFWwindow* window); +GLFWbool _glfwWindowIconifiedWin32(_GLFWwindow* window); +GLFWbool _glfwWindowVisibleWin32(_GLFWwindow* window); +GLFWbool _glfwWindowMaximizedWin32(_GLFWwindow* window); +GLFWbool _glfwWindowHoveredWin32(_GLFWwindow* window); +GLFWbool _glfwFramebufferTransparentWin32(_GLFWwindow* window); void _glfwSetWindowResizableWin32(_GLFWwindow* window, GLFWbool enabled); void _glfwSetWindowDecoratedWin32(_GLFWwindow* window, GLFWbool enabled); void _glfwSetWindowFloatingWin32(_GLFWwindow* window, GLFWbool enabled); @@ -589,8 +589,8 @@ void _glfwSetCursorPosWin32(_GLFWwindow* window, double xpos, double ypos); void _glfwSetCursorModeWin32(_GLFWwindow* window, int mode); const char* _glfwGetScancodeNameWin32(int scancode); int _glfwGetKeyScancodeWin32(int key); -int _glfwCreateCursorWin32(_GLFWcursor* cursor, const GLFWimage* image, int xhot, int yhot); -int _glfwCreateStandardCursorWin32(_GLFWcursor* cursor, int shape); +GLFWbool _glfwCreateCursorWin32(_GLFWcursor* cursor, const GLFWimage* image, int xhot, int yhot); +GLFWbool _glfwCreateStandardCursorWin32(_GLFWcursor* cursor, int shape); void _glfwDestroyCursorWin32(_GLFWcursor* cursor); void _glfwSetCursorWin32(_GLFWwindow* window, _GLFWcursor* cursor); void _glfwSetClipboardStringWin32(const char* string); @@ -601,7 +601,7 @@ EGLNativeDisplayType _glfwGetEGLNativeDisplayWin32(void); EGLNativeWindowType _glfwGetEGLNativeWindowWin32(_GLFWwindow* window); void _glfwGetRequiredInstanceExtensionsWin32(char** extensions); -int _glfwGetPhysicalDevicePresentationSupportWin32(VkInstance instance, VkPhysicalDevice device, uint32_t queuefamily); +GLFWbool _glfwGetPhysicalDevicePresentationSupportWin32(VkInstance instance, VkPhysicalDevice device, uint32_t queuefamily); VkResult _glfwCreateWindowSurfaceWin32(VkInstance instance, _GLFWwindow* window, const VkAllocationCallbacks* allocator, VkSurfaceKHR* surface); void _glfwFreeMonitorWin32(_GLFWmonitor* monitor); @@ -615,7 +615,7 @@ void _glfwSetGammaRampWin32(_GLFWmonitor* monitor, const GLFWgammaramp* ramp); GLFWbool _glfwInitJoysticksWin32(void); void _glfwTerminateJoysticksWin32(void); -int _glfwPollJoystickWin32(_GLFWjoystick* js, int mode); +GLFWbool _glfwPollJoystickWin32(_GLFWjoystick* js, int mode); const char* _glfwGetMappingNameWin32(void); void _glfwUpdateGamepadGUIDWin32(char* guid); diff --git a/src/win32_window.c b/src/win32_window.c index 333cef1b..95174497 100644 --- a/src/win32_window.c +++ b/src/win32_window.c @@ -1463,10 +1463,10 @@ void _glfwUnregisterWindowClassWin32(void) UnregisterClassW(_GLFW_WNDCLASSNAME, _glfw.win32.instance); } -int _glfwCreateWindowWin32(_GLFWwindow* window, - const _GLFWwndconfig* wndconfig, - const _GLFWctxconfig* ctxconfig, - const _GLFWfbconfig* fbconfig) +GLFWbool _glfwCreateWindowWin32(_GLFWwindow* window, + const _GLFWwndconfig* wndconfig, + const _GLFWctxconfig* ctxconfig, + const _GLFWfbconfig* fbconfig) { if (!createNativeWindow(window, wndconfig, fbconfig)) return GLFW_FALSE; @@ -1900,32 +1900,32 @@ void _glfwSetWindowMonitorWin32(_GLFWwindow* window, } } -int _glfwWindowFocusedWin32(_GLFWwindow* window) +GLFWbool _glfwWindowFocusedWin32(_GLFWwindow* window) { return window->win32.handle == GetActiveWindow(); } -int _glfwWindowIconifiedWin32(_GLFWwindow* window) +GLFWbool _glfwWindowIconifiedWin32(_GLFWwindow* window) { return IsIconic(window->win32.handle); } -int _glfwWindowVisibleWin32(_GLFWwindow* window) +GLFWbool _glfwWindowVisibleWin32(_GLFWwindow* window) { return IsWindowVisible(window->win32.handle); } -int _glfwWindowMaximizedWin32(_GLFWwindow* window) +GLFWbool _glfwWindowMaximizedWin32(_GLFWwindow* window) { return IsZoomed(window->win32.handle); } -int _glfwWindowHoveredWin32(_GLFWwindow* window) +GLFWbool _glfwWindowHoveredWin32(_GLFWwindow* window) { return cursorInContentArea(window); } -int _glfwFramebufferTransparentWin32(_GLFWwindow* window) +GLFWbool _glfwFramebufferTransparentWin32(_GLFWwindow* window) { BOOL composition, opaque; DWORD color; @@ -2209,9 +2209,9 @@ int _glfwGetKeyScancodeWin32(int key) return _glfw.win32.scancodes[key]; } -int _glfwCreateCursorWin32(_GLFWcursor* cursor, - const GLFWimage* image, - int xhot, int yhot) +GLFWbool _glfwCreateCursorWin32(_GLFWcursor* cursor, + const GLFWimage* image, + int xhot, int yhot) { cursor->win32.handle = (HCURSOR) createIcon(image, xhot, yhot, GLFW_FALSE); if (!cursor->win32.handle) @@ -2220,7 +2220,7 @@ int _glfwCreateCursorWin32(_GLFWcursor* cursor, return GLFW_TRUE; } -int _glfwCreateStandardCursorWin32(_GLFWcursor* cursor, int shape) +GLFWbool _glfwCreateStandardCursorWin32(_GLFWcursor* cursor, int shape) { int id = 0; @@ -2428,9 +2428,9 @@ void _glfwGetRequiredInstanceExtensionsWin32(char** extensions) extensions[1] = "VK_KHR_win32_surface"; } -int _glfwGetPhysicalDevicePresentationSupportWin32(VkInstance instance, - VkPhysicalDevice device, - uint32_t queuefamily) +GLFWbool _glfwGetPhysicalDevicePresentationSupportWin32(VkInstance instance, + VkPhysicalDevice device, + uint32_t queuefamily) { PFN_vkGetPhysicalDeviceWin32PresentationSupportKHR vkGetPhysicalDeviceWin32PresentationSupportKHR = diff --git a/src/wl_platform.h b/src/wl_platform.h index c361f923..98858bc5 100644 --- a/src/wl_platform.h +++ b/src/wl_platform.h @@ -436,7 +436,7 @@ GLFWbool _glfwConnectWayland(int platformID, _GLFWplatform* platform); int _glfwInitWayland(void); void _glfwTerminateWayland(void); -int _glfwCreateWindowWayland(_GLFWwindow* window, const _GLFWwndconfig* wndconfig, const _GLFWctxconfig* ctxconfig, const _GLFWfbconfig* fbconfig); +GLFWbool _glfwCreateWindowWayland(_GLFWwindow* window, const _GLFWwndconfig* wndconfig, const _GLFWctxconfig* ctxconfig, const _GLFWfbconfig* fbconfig); void _glfwDestroyWindowWayland(_GLFWwindow* window); void _glfwSetWindowTitleWayland(_GLFWwindow* window, const char* title); void _glfwSetWindowIconWayland(_GLFWwindow* window, int count, const GLFWimage* images); @@ -457,12 +457,12 @@ void _glfwHideWindowWayland(_GLFWwindow* window); void _glfwRequestWindowAttentionWayland(_GLFWwindow* window); void _glfwFocusWindowWayland(_GLFWwindow* window); void _glfwSetWindowMonitorWayland(_GLFWwindow* window, _GLFWmonitor* monitor, int xpos, int ypos, int width, int height, int refreshRate); -int _glfwWindowFocusedWayland(_GLFWwindow* window); -int _glfwWindowIconifiedWayland(_GLFWwindow* window); -int _glfwWindowVisibleWayland(_GLFWwindow* window); -int _glfwWindowMaximizedWayland(_GLFWwindow* window); -int _glfwWindowHoveredWayland(_GLFWwindow* window); -int _glfwFramebufferTransparentWayland(_GLFWwindow* window); +GLFWbool _glfwWindowFocusedWayland(_GLFWwindow* window); +GLFWbool _glfwWindowIconifiedWayland(_GLFWwindow* window); +GLFWbool _glfwWindowVisibleWayland(_GLFWwindow* window); +GLFWbool _glfwWindowMaximizedWayland(_GLFWwindow* window); +GLFWbool _glfwWindowHoveredWayland(_GLFWwindow* window); +GLFWbool _glfwFramebufferTransparentWayland(_GLFWwindow* window); void _glfwSetWindowResizableWayland(_GLFWwindow* window, GLFWbool enabled); void _glfwSetWindowDecoratedWayland(_GLFWwindow* window, GLFWbool enabled); void _glfwSetWindowFloatingWayland(_GLFWwindow* window, GLFWbool enabled); @@ -483,8 +483,8 @@ void _glfwSetCursorPosWayland(_GLFWwindow* window, double xpos, double ypos); void _glfwSetCursorModeWayland(_GLFWwindow* window, int mode); const char* _glfwGetScancodeNameWayland(int scancode); int _glfwGetKeyScancodeWayland(int key); -int _glfwCreateCursorWayland(_GLFWcursor* cursor, const GLFWimage* image, int xhot, int yhot); -int _glfwCreateStandardCursorWayland(_GLFWcursor* cursor, int shape); +GLFWbool _glfwCreateCursorWayland(_GLFWcursor* cursor, const GLFWimage* image, int xhot, int yhot); +GLFWbool _glfwCreateStandardCursorWayland(_GLFWcursor* cursor, int shape); void _glfwDestroyCursorWayland(_GLFWcursor* cursor); void _glfwSetCursorWayland(_GLFWwindow* window, _GLFWcursor* cursor); void _glfwSetClipboardStringWayland(const char* string); @@ -495,7 +495,7 @@ EGLNativeDisplayType _glfwGetEGLNativeDisplayWayland(void); EGLNativeWindowType _glfwGetEGLNativeWindowWayland(_GLFWwindow* window); void _glfwGetRequiredInstanceExtensionsWayland(char** extensions); -int _glfwGetPhysicalDevicePresentationSupportWayland(VkInstance instance, VkPhysicalDevice device, uint32_t queuefamily); +GLFWbool _glfwGetPhysicalDevicePresentationSupportWayland(VkInstance instance, VkPhysicalDevice device, uint32_t queuefamily); VkResult _glfwCreateWindowSurfaceWayland(VkInstance instance, _GLFWwindow* window, const VkAllocationCallbacks* allocator, VkSurfaceKHR* surface); void _glfwFreeMonitorWayland(_GLFWmonitor* monitor); diff --git a/src/wl_window.c b/src/wl_window.c index d9e58363..34abddf5 100644 --- a/src/wl_window.c +++ b/src/wl_window.c @@ -1721,10 +1721,10 @@ void _glfwAddDataDeviceListenerWayland(struct wl_data_device* device) ////// GLFW platform API ////// ////////////////////////////////////////////////////////////////////////// -int _glfwCreateWindowWayland(_GLFWwindow* window, - const _GLFWwndconfig* wndconfig, - const _GLFWctxconfig* ctxconfig, - const _GLFWfbconfig* fbconfig) +GLFWbool _glfwCreateWindowWayland(_GLFWwindow* window, + const _GLFWwndconfig* wndconfig, + const _GLFWctxconfig* ctxconfig, + const _GLFWfbconfig* fbconfig) { if (!createSurface(window, wndconfig, fbconfig)) return GLFW_FALSE; @@ -1994,34 +1994,34 @@ void _glfwSetWindowMonitorWayland(_GLFWwindow* window, _glfwInputWindowMonitor(window, monitor); } -int _glfwWindowFocusedWayland(_GLFWwindow* window) +GLFWbool _glfwWindowFocusedWayland(_GLFWwindow* window) { return _glfw.wl.keyboardFocus == window; } -int _glfwWindowIconifiedWayland(_GLFWwindow* window) +GLFWbool _glfwWindowIconifiedWayland(_GLFWwindow* window) { // xdg-shell doesn’t give any way to request whether a surface is // iconified. return GLFW_FALSE; } -int _glfwWindowVisibleWayland(_GLFWwindow* window) +GLFWbool _glfwWindowVisibleWayland(_GLFWwindow* window) { return window->wl.visible; } -int _glfwWindowMaximizedWayland(_GLFWwindow* window) +GLFWbool _glfwWindowMaximizedWayland(_GLFWwindow* window) { return window->wl.maximized; } -int _glfwWindowHoveredWayland(_GLFWwindow* window) +GLFWbool _glfwWindowHoveredWayland(_GLFWwindow* window) { return window->wl.hovered; } -int _glfwFramebufferTransparentWayland(_GLFWwindow* window) +GLFWbool _glfwFramebufferTransparentWayland(_GLFWwindow* window) { return window->wl.transparent; } @@ -2193,9 +2193,9 @@ int _glfwGetKeyScancodeWayland(int key) return _glfw.wl.scancodes[key]; } -int _glfwCreateCursorWayland(_GLFWcursor* cursor, - const GLFWimage* image, - int xhot, int yhot) +GLFWbool _glfwCreateCursorWayland(_GLFWcursor* cursor, + const GLFWimage* image, + int xhot, int yhot) { cursor->wl.buffer = createShmBuffer(image); if (!cursor->wl.buffer) @@ -2208,7 +2208,7 @@ int _glfwCreateCursorWayland(_GLFWcursor* cursor, return GLFW_TRUE; } -int _glfwCreateStandardCursorWayland(_GLFWcursor* cursor, int shape) +GLFWbool _glfwCreateStandardCursorWayland(_GLFWcursor* cursor, int shape) { const char* name = NULL; @@ -2635,9 +2635,9 @@ void _glfwGetRequiredInstanceExtensionsWayland(char** extensions) extensions[1] = "VK_KHR_wayland_surface"; } -int _glfwGetPhysicalDevicePresentationSupportWayland(VkInstance instance, - VkPhysicalDevice device, - uint32_t queuefamily) +GLFWbool _glfwGetPhysicalDevicePresentationSupportWayland(VkInstance instance, + VkPhysicalDevice device, + uint32_t queuefamily) { PFN_vkGetPhysicalDeviceWaylandPresentationSupportKHR vkGetPhysicalDeviceWaylandPresentationSupportKHR = diff --git a/src/x11_platform.h b/src/x11_platform.h index 956104fa..ff0676dd 100644 --- a/src/x11_platform.h +++ b/src/x11_platform.h @@ -900,7 +900,7 @@ GLFWbool _glfwConnectX11(int platformID, _GLFWplatform* platform); int _glfwInitX11(void); void _glfwTerminateX11(void); -int _glfwCreateWindowX11(_GLFWwindow* window, const _GLFWwndconfig* wndconfig, const _GLFWctxconfig* ctxconfig, const _GLFWfbconfig* fbconfig); +GLFWbool _glfwCreateWindowX11(_GLFWwindow* window, const _GLFWwndconfig* wndconfig, const _GLFWctxconfig* ctxconfig, const _GLFWfbconfig* fbconfig); void _glfwDestroyWindowX11(_GLFWwindow* window); void _glfwSetWindowTitleX11(_GLFWwindow* window, const char* title); void _glfwSetWindowIconX11(_GLFWwindow* window, int count, const GLFWimage* images); @@ -921,12 +921,12 @@ void _glfwHideWindowX11(_GLFWwindow* window); void _glfwRequestWindowAttentionX11(_GLFWwindow* window); void _glfwFocusWindowX11(_GLFWwindow* window); void _glfwSetWindowMonitorX11(_GLFWwindow* window, _GLFWmonitor* monitor, int xpos, int ypos, int width, int height, int refreshRate); -int _glfwWindowFocusedX11(_GLFWwindow* window); -int _glfwWindowIconifiedX11(_GLFWwindow* window); -int _glfwWindowVisibleX11(_GLFWwindow* window); -int _glfwWindowMaximizedX11(_GLFWwindow* window); -int _glfwWindowHoveredX11(_GLFWwindow* window); -int _glfwFramebufferTransparentX11(_GLFWwindow* window); +GLFWbool _glfwWindowFocusedX11(_GLFWwindow* window); +GLFWbool _glfwWindowIconifiedX11(_GLFWwindow* window); +GLFWbool _glfwWindowVisibleX11(_GLFWwindow* window); +GLFWbool _glfwWindowMaximizedX11(_GLFWwindow* window); +GLFWbool _glfwWindowHoveredX11(_GLFWwindow* window); +GLFWbool _glfwFramebufferTransparentX11(_GLFWwindow* window); void _glfwSetWindowResizableX11(_GLFWwindow* window, GLFWbool enabled); void _glfwSetWindowDecoratedX11(_GLFWwindow* window, GLFWbool enabled); void _glfwSetWindowFloatingX11(_GLFWwindow* window, GLFWbool enabled); @@ -947,8 +947,8 @@ void _glfwSetCursorPosX11(_GLFWwindow* window, double xpos, double ypos); void _glfwSetCursorModeX11(_GLFWwindow* window, int mode); const char* _glfwGetScancodeNameX11(int scancode); int _glfwGetKeyScancodeX11(int key); -int _glfwCreateCursorX11(_GLFWcursor* cursor, const GLFWimage* image, int xhot, int yhot); -int _glfwCreateStandardCursorX11(_GLFWcursor* cursor, int shape); +GLFWbool _glfwCreateCursorX11(_GLFWcursor* cursor, const GLFWimage* image, int xhot, int yhot); +GLFWbool _glfwCreateStandardCursorX11(_GLFWcursor* cursor, int shape); void _glfwDestroyCursorX11(_GLFWcursor* cursor); void _glfwSetCursorX11(_GLFWwindow* window, _GLFWcursor* cursor); void _glfwSetClipboardStringX11(const char* string); @@ -959,7 +959,7 @@ EGLNativeDisplayType _glfwGetEGLNativeDisplayX11(void); EGLNativeWindowType _glfwGetEGLNativeWindowX11(_GLFWwindow* window); void _glfwGetRequiredInstanceExtensionsX11(char** extensions); -int _glfwGetPhysicalDevicePresentationSupportX11(VkInstance instance, VkPhysicalDevice device, uint32_t queuefamily); +GLFWbool _glfwGetPhysicalDevicePresentationSupportX11(VkInstance instance, VkPhysicalDevice device, uint32_t queuefamily); VkResult _glfwCreateWindowSurfaceX11(VkInstance instance, _GLFWwindow* window, const VkAllocationCallbacks* allocator, VkSurfaceKHR* surface); void _glfwFreeMonitorX11(_GLFWmonitor* monitor); diff --git a/src/x11_window.c b/src/x11_window.c index 280dc986..98f990b2 100644 --- a/src/x11_window.c +++ b/src/x11_window.c @@ -1895,10 +1895,10 @@ void _glfwCreateInputContextX11(_GLFWwindow* window) ////// GLFW platform API ////// ////////////////////////////////////////////////////////////////////////// -int _glfwCreateWindowX11(_GLFWwindow* window, - const _GLFWwndconfig* wndconfig, - const _GLFWctxconfig* ctxconfig, - const _GLFWfbconfig* fbconfig) +GLFWbool _glfwCreateWindowX11(_GLFWwindow* window, + const _GLFWwndconfig* wndconfig, + const _GLFWctxconfig* ctxconfig, + const _GLFWfbconfig* fbconfig) { Visual* visual = NULL; int depth; @@ -2462,7 +2462,7 @@ void _glfwSetWindowMonitorX11(_GLFWwindow* window, XFlush(_glfw.x11.display); } -int _glfwWindowFocusedX11(_GLFWwindow* window) +GLFWbool _glfwWindowFocusedX11(_GLFWwindow* window) { Window focused; int state; @@ -2471,19 +2471,19 @@ int _glfwWindowFocusedX11(_GLFWwindow* window) return window->x11.handle == focused; } -int _glfwWindowIconifiedX11(_GLFWwindow* window) +GLFWbool _glfwWindowIconifiedX11(_GLFWwindow* window) { return getWindowState(window) == IconicState; } -int _glfwWindowVisibleX11(_GLFWwindow* window) +GLFWbool _glfwWindowVisibleX11(_GLFWwindow* window) { XWindowAttributes wa; XGetWindowAttributes(_glfw.x11.display, window->x11.handle, &wa); return wa.map_state == IsViewable; } -int _glfwWindowMaximizedX11(_GLFWwindow* window) +GLFWbool _glfwWindowMaximizedX11(_GLFWwindow* window) { Atom* states; GLFWbool maximized = GLFW_FALSE; @@ -2517,7 +2517,7 @@ int _glfwWindowMaximizedX11(_GLFWwindow* window) return maximized; } -int _glfwWindowHoveredX11(_GLFWwindow* window) +GLFWbool _glfwWindowHoveredX11(_GLFWwindow* window) { Window w = _glfw.x11.root; while (w) @@ -2545,7 +2545,7 @@ int _glfwWindowHoveredX11(_GLFWwindow* window) return GLFW_FALSE; } -int _glfwFramebufferTransparentX11(_GLFWwindow* window) +GLFWbool _glfwFramebufferTransparentX11(_GLFWwindow* window) { if (!window->x11.transparent) return GLFW_FALSE; @@ -2848,9 +2848,9 @@ int _glfwGetKeyScancodeX11(int key) return _glfw.x11.scancodes[key]; } -int _glfwCreateCursorX11(_GLFWcursor* cursor, - const GLFWimage* image, - int xhot, int yhot) +GLFWbool _glfwCreateCursorX11(_GLFWcursor* cursor, + const GLFWimage* image, + int xhot, int yhot) { cursor->x11.handle = _glfwCreateNativeCursorX11(image, xhot, yhot); if (!cursor->x11.handle) @@ -2859,7 +2859,7 @@ int _glfwCreateCursorX11(_GLFWcursor* cursor, return GLFW_TRUE; } -int _glfwCreateStandardCursorX11(_GLFWcursor* cursor, int shape) +GLFWbool _glfwCreateStandardCursorX11(_GLFWcursor* cursor, int shape) { if (_glfw.x11.xcursor.handle) { @@ -3066,9 +3066,9 @@ void _glfwGetRequiredInstanceExtensionsX11(char** extensions) extensions[1] = "VK_KHR_xlib_surface"; } -int _glfwGetPhysicalDevicePresentationSupportX11(VkInstance instance, - VkPhysicalDevice device, - uint32_t queuefamily) +GLFWbool _glfwGetPhysicalDevicePresentationSupportX11(VkInstance instance, + VkPhysicalDevice device, + uint32_t queuefamily) { VisualID visualID = XVisualIDFromVisual(DefaultVisual(_glfw.x11.display, _glfw.x11.screen)); From 26920a1a38d7c4c5b7908cf2e04b750d941f1faa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Wed, 25 May 2022 19:43:55 +0200 Subject: [PATCH 004/117] X11: Fix previous error handler not being restored GLFW did not restore the previous Xlib error handler when removing its own, instead resetting to the default handler. This commit saves and restores the previous error handler. None of this is thread-safe or could ever be. Fixes #2108 --- README.md | 1 + src/x11_init.c | 7 +++++-- src/x11_platform.h | 2 ++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index f189ba20..71ee73f0 100644 --- a/README.md +++ b/README.md @@ -292,6 +292,7 @@ information on what to include when reporting a bug. - [X11] Bugfix: Left shift of int constant relied on undefined behavior (#1951) - [X11] Bugfix: The OSMesa libray was not unloaded on termination - [X11] Bugfix: A malformed response during selection transfer could cause a segfault + - [X11] Bugfix: Some calls would reset Xlib to the default error handler (#2108) - [Wayland] Added dynamic loading of all Wayland libraries - [Wayland] Added support for key names via xkbcommon - [Wayland] Added support for file path drop events (#2040) diff --git a/src/x11_init.c b/src/x11_init.c index aefa82db..11aeb9e5 100644 --- a/src/x11_init.c +++ b/src/x11_init.c @@ -37,6 +37,7 @@ #include #include #include +#include // Translate the X11 KeySyms for a key to a GLFW key code @@ -1095,8 +1096,9 @@ static int errorHandler(Display *display, XErrorEvent* event) // void _glfwGrabErrorHandlerX11(void) { + assert(_glfw.x11.errorHandler == NULL); _glfw.x11.errorCode = Success; - XSetErrorHandler(errorHandler); + _glfw.x11.errorHandler = XSetErrorHandler(errorHandler); } // Clears the X error handler callback @@ -1105,7 +1107,8 @@ void _glfwReleaseErrorHandlerX11(void) { // Synchronize to make sure all commands are processed XSync(_glfw.x11.display, False); - XSetErrorHandler(NULL); + XSetErrorHandler(_glfw.x11.errorHandler); + _glfw.x11.errorHandler = NULL; } // Reports the specified error, appending information about the last X error diff --git a/src/x11_platform.h b/src/x11_platform.h index ff0676dd..ecaa0fa4 100644 --- a/src/x11_platform.h +++ b/src/x11_platform.h @@ -567,6 +567,8 @@ typedef struct _GLFWlibraryX11 XContext context; // XIM input method XIM im; + // The previous X error handler, to be restored later + XErrorHandler errorHandler; // Most recent error code received by X error handler int errorCode; // Primary selection string (while the primary selection is owned) From edec334b32458df9ced9d84a39c3cd4b757597bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Thu, 2 Jun 2022 21:25:15 +0200 Subject: [PATCH 005/117] Cocoa: Use system header to declare id type Related to #1348 --- include/GLFW/glfw3native.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/GLFW/glfw3native.h b/include/GLFW/glfw3native.h index 6d090778..8e1c7fde 100644 --- a/include/GLFW/glfw3native.h +++ b/include/GLFW/glfw3native.h @@ -96,7 +96,7 @@ extern "C" { #import #else #include - typedef void* id; + #include #endif #elif defined(GLFW_EXPOSE_NATIVE_X11) || defined(GLFW_EXPOSE_NATIVE_GLX) #include From 05f6c13d119ea2662c97527d2421fb4cffd3dbfc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Mon, 18 Apr 2022 23:09:47 +0200 Subject: [PATCH 006/117] Add support for GLFW_NATIVE_INCLUDE_NONE macro By default, the glfw3native.h header will include the platform-specific headers necessary for the return types of GLFW native access functions. Sometimes it is preferrable to declare those types This commit adds support for the GLFW_NATIVE_INCLUDE_NONE macro, which when defined disables the inclusion of all platform-specific headers. Fixes #1348 --- README.md | 1 + include/GLFW/glfw3native.h | 118 +++++++++++++++++++++---------------- 2 files changed, 67 insertions(+), 52 deletions(-) diff --git a/README.md b/README.md index 71ee73f0..b805e787 100644 --- a/README.md +++ b/README.md @@ -146,6 +146,7 @@ information on what to include when reporting a bug. values to select ANGLE backend (#1380) - Added `GLFW_X11_XCB_VULKAN_SURFACE` init hint for selecting X11 Vulkan surface extension (#1793) + - Added `GLFW_NATIVE_INCLUDE_NONE` for disabling inclusion of native headers (#1348) - Added `GLFW_BUILD_WIN32` CMake option for enabling Win32 support (#1958) - Added `GLFW_BUILD_COCOA` CMake option for enabling Cocoa support (#1958) - Added `GLFW_BUILD_X11` CMake option for enabling X11 support (#1958) diff --git a/include/GLFW/glfw3native.h b/include/GLFW/glfw3native.h index 8e1c7fde..36934120 100644 --- a/include/GLFW/glfw3native.h +++ b/include/GLFW/glfw3native.h @@ -74,6 +74,16 @@ extern "C" { * and which platform-specific headers to include. It is then up your (by * definition platform-specific) code to handle which of these should be * defined. + * + * If you do not want the platform-specific headers to be included, define + * `GLFW_NATIVE_INCLUDE_NONE` before including the @ref glfw3native.h header. + * + * @code + * #define GLFW_EXPOSE_NATIVE_WIN32 + * #define GLFW_EXPOSE_NATIVE_WGL + * #define GLFW_NATIVE_INCLUDE_NONE + * #include + * @endcode */ @@ -81,61 +91,65 @@ extern "C" { * System headers and types *************************************************************************/ -#if defined(GLFW_EXPOSE_NATIVE_WIN32) || defined(GLFW_EXPOSE_NATIVE_WGL) - /* This is a workaround for the fact that glfw3.h needs to export APIENTRY (for - * example to allow applications to correctly declare a GL_KHR_debug callback) - * but windows.h assumes no one will define APIENTRY before it does - */ - #if defined(GLFW_APIENTRY_DEFINED) - #undef APIENTRY - #undef GLFW_APIENTRY_DEFINED - #endif - #include -#elif defined(GLFW_EXPOSE_NATIVE_COCOA) || defined(GLFW_EXPOSE_NATIVE_NSGL) - #if defined(__OBJC__) - #import - #else - #include - #include - #endif -#elif defined(GLFW_EXPOSE_NATIVE_X11) || defined(GLFW_EXPOSE_NATIVE_GLX) - #include - #include -#elif defined(GLFW_EXPOSE_NATIVE_WAYLAND) - #include -#endif +#if !defined(GLFW_NATIVE_INCLUDE_NONE) -#if defined(GLFW_EXPOSE_NATIVE_WGL) - /* WGL is declared by windows.h */ -#endif -#if defined(GLFW_EXPOSE_NATIVE_NSGL) - /* NSGL is declared by Cocoa.h */ -#endif -#if defined(GLFW_EXPOSE_NATIVE_GLX) - /* This is a workaround for the fact that glfw3.h defines GLAPIENTRY because by - * default it also acts as an OpenGL header - * However, glx.h will include gl.h, which will define it unconditionally - */ - #if defined(GLFW_GLAPIENTRY_DEFINED) - #undef GLAPIENTRY - #undef GLFW_GLAPIENTRY_DEFINED + #if defined(GLFW_EXPOSE_NATIVE_WIN32) || defined(GLFW_EXPOSE_NATIVE_WGL) + /* This is a workaround for the fact that glfw3.h needs to export APIENTRY (for + * example to allow applications to correctly declare a GL_KHR_debug callback) + * but windows.h assumes no one will define APIENTRY before it does + */ + #if defined(GLFW_APIENTRY_DEFINED) + #undef APIENTRY + #undef GLFW_APIENTRY_DEFINED + #endif + #include + #elif defined(GLFW_EXPOSE_NATIVE_COCOA) || defined(GLFW_EXPOSE_NATIVE_NSGL) + #if defined(__OBJC__) + #import + #else + #include + #include + #endif + #elif defined(GLFW_EXPOSE_NATIVE_X11) || defined(GLFW_EXPOSE_NATIVE_GLX) + #include + #include + #elif defined(GLFW_EXPOSE_NATIVE_WAYLAND) + #include #endif - #include -#endif -#if defined(GLFW_EXPOSE_NATIVE_EGL) - #include -#endif -#if defined(GLFW_EXPOSE_NATIVE_OSMESA) - /* This is a workaround for the fact that glfw3.h defines GLAPIENTRY because by - * default it also acts as an OpenGL header - * However, osmesa.h will include gl.h, which will define it unconditionally - */ - #if defined(GLFW_GLAPIENTRY_DEFINED) - #undef GLAPIENTRY - #undef GLFW_GLAPIENTRY_DEFINED + + #if defined(GLFW_EXPOSE_NATIVE_WGL) + /* WGL is declared by windows.h */ #endif - #include -#endif + #if defined(GLFW_EXPOSE_NATIVE_NSGL) + /* NSGL is declared by Cocoa.h */ + #endif + #if defined(GLFW_EXPOSE_NATIVE_GLX) + /* This is a workaround for the fact that glfw3.h defines GLAPIENTRY because by + * default it also acts as an OpenGL header + * However, glx.h will include gl.h, which will define it unconditionally + */ + #if defined(GLFW_GLAPIENTRY_DEFINED) + #undef GLAPIENTRY + #undef GLFW_GLAPIENTRY_DEFINED + #endif + #include + #endif + #if defined(GLFW_EXPOSE_NATIVE_EGL) + #include + #endif + #if defined(GLFW_EXPOSE_NATIVE_OSMESA) + /* This is a workaround for the fact that glfw3.h defines GLAPIENTRY because by + * default it also acts as an OpenGL header + * However, osmesa.h will include gl.h, which will define it unconditionally + */ + #if defined(GLFW_GLAPIENTRY_DEFINED) + #undef GLAPIENTRY + #undef GLFW_GLAPIENTRY_DEFINED + #endif + #include + #endif + +#endif /*GLFW_NATIVE_INCLUDE_NONE*/ /************************************************************************* From ad3dbeb65feaba28f1b3df9d5788c35735809f8b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Wed, 22 Dec 2021 14:14:24 +0100 Subject: [PATCH 007/117] Add basic assertions for event API arguments --- src/input.c | 69 ++++++++++++++++++++++++++++++++++++++++++++++++--- src/monitor.c | 5 ++++ src/window.c | 30 ++++++++++++++++++++++ 3 files changed, 101 insertions(+), 3 deletions(-) diff --git a/src/input.c b/src/input.c index 01da7d65..c2a7a86d 100644 --- a/src/input.c +++ b/src/input.c @@ -44,6 +44,13 @@ #define _GLFW_JOYSTICK_BUTTON 2 #define _GLFW_JOYSTICK_HATBIT 3 +#define GLFW_MOD_MASK (GLFW_MOD_SHIFT | \ + GLFW_MOD_CONTROL | \ + GLFW_MOD_ALT | \ + GLFW_MOD_SUPER | \ + GLFW_MOD_CAPS_LOCK | \ + GLFW_MOD_NUM_LOCK) + // Initializes the platform joystick API if it has not been already // static GLFWbool initJoysticks(void) @@ -266,6 +273,12 @@ static GLFWbool parseMapping(_GLFWmapping* mapping, const char* string) // void _glfwInputKey(_GLFWwindow* window, int key, int scancode, int action, int mods) { + assert(window != NULL); + assert(key >= 0 || key == GLFW_KEY_UNKNOWN); + assert(key <= GLFW_KEY_LAST); + assert(action == GLFW_PRESS || action == GLFW_RELEASE); + assert(mods == (mods & GLFW_MOD_MASK)); + if (key >= 0 && key <= GLFW_KEY_LAST) { GLFWbool repeated = GLFW_FALSE; @@ -297,6 +310,10 @@ void _glfwInputKey(_GLFWwindow* window, int key, int scancode, int action, int m // void _glfwInputChar(_GLFWwindow* window, uint32_t codepoint, int mods, GLFWbool plain) { + assert(window != NULL); + assert(mods == (mods & GLFW_MOD_MASK)); + assert(plain == GLFW_TRUE || plain == GLFW_FALSE); + if (codepoint < 32 || (codepoint > 126 && codepoint < 160)) return; @@ -317,6 +334,12 @@ void _glfwInputChar(_GLFWwindow* window, uint32_t codepoint, int mods, GLFWbool // void _glfwInputScroll(_GLFWwindow* window, double xoffset, double yoffset) { + assert(window != NULL); + assert(xoffset > -FLT_MAX); + assert(xoffset < FLT_MAX); + assert(yoffset > -FLT_MAX); + assert(yoffset < FLT_MAX); + if (window->callbacks.scroll) window->callbacks.scroll((GLFWwindow*) window, xoffset, yoffset); } @@ -325,6 +348,12 @@ void _glfwInputScroll(_GLFWwindow* window, double xoffset, double yoffset) // void _glfwInputMouseClick(_GLFWwindow* window, int button, int action, int mods) { + assert(window != NULL); + assert(button >= 0); + assert(button <= GLFW_MOUSE_BUTTON_LAST); + assert(action == GLFW_PRESS || action == GLFW_RELEASE); + assert(mods == (mods & GLFW_MOD_MASK)); + if (button < 0 || button > GLFW_MOUSE_BUTTON_LAST) return; @@ -345,6 +374,12 @@ void _glfwInputMouseClick(_GLFWwindow* window, int button, int action, int mods) // void _glfwInputCursorPos(_GLFWwindow* window, double xpos, double ypos) { + assert(window != NULL); + assert(xpos > -FLT_MAX); + assert(xpos < FLT_MAX); + assert(ypos > -FLT_MAX); + assert(ypos < FLT_MAX); + if (window->virtualCursorPosX == xpos && window->virtualCursorPosY == ypos) return; @@ -359,6 +394,9 @@ void _glfwInputCursorPos(_GLFWwindow* window, double xpos, double ypos) // void _glfwInputCursorEnter(_GLFWwindow* window, GLFWbool entered) { + assert(window != NULL); + assert(entered == GLFW_TRUE || entered == GLFW_FALSE); + if (window->callbacks.cursorEnter) window->callbacks.cursorEnter((GLFWwindow*) window, entered); } @@ -367,6 +405,10 @@ void _glfwInputCursorEnter(_GLFWwindow* window, GLFWbool entered) // void _glfwInputDrop(_GLFWwindow* window, int count, const char** paths) { + assert(window != NULL); + assert(count > 0); + assert(paths != NULL); + if (window->callbacks.drop) window->callbacks.drop((GLFWwindow*) window, count, paths); } @@ -375,7 +417,8 @@ void _glfwInputDrop(_GLFWwindow* window, int count, const char** paths) // void _glfwInputJoystick(_GLFWjoystick* js, int event) { - const int jid = (int) (js - _glfw.joysticks); + assert(js != NULL); + assert(event == GLFW_CONNECTED || event == GLFW_DISCONNECTED); if (event == GLFW_CONNECTED) js->connected = GLFW_TRUE; @@ -383,13 +426,17 @@ void _glfwInputJoystick(_GLFWjoystick* js, int event) js->connected = GLFW_FALSE; if (_glfw.callbacks.joystick) - _glfw.callbacks.joystick(jid, event); + _glfw.callbacks.joystick((int) (js - _glfw.joysticks), event); } // Notifies shared code of the new value of a joystick axis // void _glfwInputJoystickAxis(_GLFWjoystick* js, int axis, float value) { + assert(js != NULL); + assert(axis >= 0); + assert(axis < js->axisCount); + js->axes[axis] = value; } @@ -397,6 +444,11 @@ void _glfwInputJoystickAxis(_GLFWjoystick* js, int axis, float value) // void _glfwInputJoystickButton(_GLFWjoystick* js, int button, char value) { + assert(js != NULL); + assert(button >= 0); + assert(button < js->buttonCount); + assert(value == GLFW_PRESS || value == GLFW_RELEASE); + js->buttons[button] = value; } @@ -404,7 +456,18 @@ void _glfwInputJoystickButton(_GLFWjoystick* js, int button, char value) // void _glfwInputJoystickHat(_GLFWjoystick* js, int hat, char value) { - const int base = js->buttonCount + hat * 4; + int base; + + assert(js != NULL); + assert(hat >= 0); + assert(hat < js->hatCount); + + // Valid hat values only use the least significant nibble and have at most two bits + // set, which can be considered adjacent plus an arbitrary rotation within the nibble + assert((value & 0xf0) == 0); + assert((value & ((value << 2) | (value >> 2))) == 0); + + base = js->buttonCount + hat * 4; js->buttons[base + 0] = (value & 0x01) ? GLFW_PRESS : GLFW_RELEASE; js->buttons[base + 1] = (value & 0x02) ? GLFW_PRESS : GLFW_RELEASE; diff --git a/src/monitor.c b/src/monitor.c index 082140ad..6429493b 100644 --- a/src/monitor.c +++ b/src/monitor.c @@ -96,6 +96,10 @@ static GLFWbool refreshVideoModes(_GLFWmonitor* monitor) // void _glfwInputMonitor(_GLFWmonitor* monitor, int action, int placement) { + assert(monitor != NULL); + assert(action == GLFW_CONNECTED || action == GLFW_DISCONNECTED); + assert(placement == _GLFW_INSERT_FIRST || placement == _GLFW_INSERT_LAST); + if (action == GLFW_CONNECTED) { _glfw.monitorCount++; @@ -155,6 +159,7 @@ void _glfwInputMonitor(_GLFWmonitor* monitor, int action, int placement) // void _glfwInputMonitorWindow(_GLFWmonitor* monitor, _GLFWwindow* window) { + assert(monitor != NULL); monitor->window = window; } diff --git a/src/window.c b/src/window.c index 621e2e64..ebbc6dca 100644 --- a/src/window.c +++ b/src/window.c @@ -44,6 +44,9 @@ // void _glfwInputWindowFocus(_GLFWwindow* window, GLFWbool focused) { + assert(window != NULL); + assert(focused == GLFW_TRUE || focused == GLFW_FALSE); + if (window->callbacks.focus) window->callbacks.focus((GLFWwindow*) window, focused); @@ -73,6 +76,8 @@ void _glfwInputWindowFocus(_GLFWwindow* window, GLFWbool focused) // void _glfwInputWindowPos(_GLFWwindow* window, int x, int y) { + assert(window != NULL); + if (window->callbacks.pos) window->callbacks.pos((GLFWwindow*) window, x, y); } @@ -82,6 +87,10 @@ void _glfwInputWindowPos(_GLFWwindow* window, int x, int y) // void _glfwInputWindowSize(_GLFWwindow* window, int width, int height) { + assert(window != NULL); + assert(width >= 0); + assert(height >= 0); + if (window->callbacks.size) window->callbacks.size((GLFWwindow*) window, width, height); } @@ -90,6 +99,9 @@ void _glfwInputWindowSize(_GLFWwindow* window, int width, int height) // void _glfwInputWindowIconify(_GLFWwindow* window, GLFWbool iconified) { + assert(window != NULL); + assert(iconified == GLFW_TRUE || iconified == GLFW_FALSE); + if (window->callbacks.iconify) window->callbacks.iconify((GLFWwindow*) window, iconified); } @@ -98,6 +110,9 @@ void _glfwInputWindowIconify(_GLFWwindow* window, GLFWbool iconified) // void _glfwInputWindowMaximize(_GLFWwindow* window, GLFWbool maximized) { + assert(window != NULL); + assert(maximized == GLFW_TRUE || maximized == GLFW_FALSE); + if (window->callbacks.maximize) window->callbacks.maximize((GLFWwindow*) window, maximized); } @@ -107,6 +122,10 @@ void _glfwInputWindowMaximize(_GLFWwindow* window, GLFWbool maximized) // void _glfwInputFramebufferSize(_GLFWwindow* window, int width, int height) { + assert(window != NULL); + assert(width >= 0); + assert(height >= 0); + if (window->callbacks.fbsize) window->callbacks.fbsize((GLFWwindow*) window, width, height); } @@ -116,6 +135,12 @@ void _glfwInputFramebufferSize(_GLFWwindow* window, int width, int height) // void _glfwInputWindowContentScale(_GLFWwindow* window, float xscale, float yscale) { + assert(window != NULL); + assert(xscale > 0.f); + assert(xscale < FLT_MAX); + assert(yscale > 0.f); + assert(yscale < FLT_MAX); + if (window->callbacks.scale) window->callbacks.scale((GLFWwindow*) window, xscale, yscale); } @@ -124,6 +149,8 @@ void _glfwInputWindowContentScale(_GLFWwindow* window, float xscale, float yscal // void _glfwInputWindowDamage(_GLFWwindow* window) { + assert(window != NULL); + if (window->callbacks.refresh) window->callbacks.refresh((GLFWwindow*) window); } @@ -132,6 +159,8 @@ void _glfwInputWindowDamage(_GLFWwindow* window) // void _glfwInputWindowCloseRequest(_GLFWwindow* window) { + assert(window != NULL); + window->shouldClose = GLFW_TRUE; if (window->callbacks.close) @@ -142,6 +171,7 @@ void _glfwInputWindowCloseRequest(_GLFWwindow* window) // void _glfwInputWindowMonitor(_GLFWwindow* window, _GLFWmonitor* monitor) { + assert(window != NULL); window->monitor = monitor; } From 2ae3e0c8d7d237523cf7ec8c4ce95a7fdb40114f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Sun, 27 Mar 2022 19:40:35 +0200 Subject: [PATCH 008/117] Win32: Add separate window class for helper window The current window procedure needs to deal with messages both for user created windows and the hidden helper window. This commit separates out the device message handling of the helper window, allowing both window procedures to be less complicated. --- README.md | 1 + src/win32_init.c | 53 +++++++++++++++++++++++++++++++++++++++++++- src/win32_window.c | 55 ++++++++++------------------------------------ 3 files changed, 64 insertions(+), 45 deletions(-) diff --git a/README.md b/README.md index b805e787..fe5a2c76 100644 --- a/README.md +++ b/README.md @@ -179,6 +179,7 @@ information on what to include when reporting a bug. - [Win32] Added the `GLFW_WIN32_KEYBOARD_MENU` window hint for enabling access to the window menu - [Win32] Added a version info resource to the GLFW DLL + - [Win32] Made hidden helper window use its own window class - [Win32] Disabled framebuffer transparency on Windows 7 when DWM windows are opaque (#1512) - [Win32] Bugfix: `GLFW_INCLUDE_VULKAN` plus `VK_USE_PLATFORM_WIN32_KHR` caused diff --git a/src/win32_init.c b/src/win32_init.c index 1cdc5b98..c2dc1322 100644 --- a/src/win32_init.c +++ b/src/win32_init.c @@ -331,15 +331,63 @@ static void createKeyTables(void) } } +// Window procedure for the hidden helper window +// +static LRESULT CALLBACK helperWindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) +{ + switch (uMsg) + { + case WM_DISPLAYCHANGE: + _glfwPollMonitorsWin32(); + break; + + case WM_DEVICECHANGE: + { + if (!_glfw.joysticksInitialized) + break; + + if (wParam == DBT_DEVICEARRIVAL) + { + DEV_BROADCAST_HDR* dbh = (DEV_BROADCAST_HDR*) lParam; + if (dbh && dbh->dbch_devicetype == DBT_DEVTYP_DEVICEINTERFACE) + _glfwDetectJoystickConnectionWin32(); + } + else if (wParam == DBT_DEVICEREMOVECOMPLETE) + { + DEV_BROADCAST_HDR* dbh = (DEV_BROADCAST_HDR*) lParam; + if (dbh && dbh->dbch_devicetype == DBT_DEVTYP_DEVICEINTERFACE) + _glfwDetectJoystickDisconnectionWin32(); + } + + break; + } + } + + return DefWindowProcW(hWnd, uMsg, wParam, lParam); +} + // Creates a dummy window for behind-the-scenes work // static GLFWbool createHelperWindow(void) { MSG msg; + WNDCLASSEXW wc = { sizeof(wc) }; + + wc.style = CS_OWNDC; + wc.lpfnWndProc = (WNDPROC) helperWindowProc; + wc.hInstance = _glfw.win32.instance; + wc.lpszClassName = L"GLFW3 Helper"; + + if (!RegisterClassExW(&wc)) + { + _glfwInputErrorWin32(GLFW_PLATFORM_ERROR, + "WIn32: Failed to register helper window class"); + return GLFW_FALSE; + } _glfw.win32.helperWindowHandle = CreateWindowExW(WS_EX_OVERLAPPEDWINDOW, - _GLFW_WNDCLASSNAME, + L"GLFW3 Helper", L"GLFW message window", WS_CLIPSIBLINGS | WS_CLIPCHILDREN, 0, 0, 1, 1, @@ -663,7 +711,10 @@ void _glfwTerminateWin32(void) UnregisterDeviceNotification(_glfw.win32.deviceNotificationHandle); if (_glfw.win32.helperWindowHandle) + { DestroyWindow(_glfw.win32.helperWindowHandle); + UnregisterClassW(L"GLFW3 Helper", _glfw.win32.instance); + } _glfwUnregisterWindowClassWin32(); diff --git a/src/win32_window.c b/src/win32_window.c index 95174497..cefb2cf6 100644 --- a/src/win32_window.c +++ b/src/win32_window.c @@ -533,59 +533,26 @@ static void maximizeWindowManually(_GLFWwindow* window) SWP_NOACTIVATE | SWP_NOZORDER | SWP_FRAMECHANGED); } -// Window callback function (handles window messages) +// Window procedure for user-created windows // static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { _GLFWwindow* window = GetPropW(hWnd, L"GLFW"); if (!window) { - // This is the message handling for the hidden helper window - // and for a regular window during its initial creation - - switch (uMsg) + if (uMsg == WM_NCCREATE) { - case WM_NCCREATE: + if (_glfwIsWindows10Version1607OrGreaterWin32()) { - if (_glfwIsWindows10Version1607OrGreaterWin32()) - { - const CREATESTRUCTW* cs = (const CREATESTRUCTW*) lParam; - const _GLFWwndconfig* wndconfig = cs->lpCreateParams; + const CREATESTRUCTW* cs = (const CREATESTRUCTW*) lParam; + const _GLFWwndconfig* wndconfig = cs->lpCreateParams; - // On per-monitor DPI aware V1 systems, only enable - // non-client scaling for windows that scale the client area - // We need WM_GETDPISCALEDSIZE from V2 to keep the client - // area static when the non-client area is scaled - if (wndconfig && wndconfig->scaleToMonitor) - EnableNonClientDpiScaling(hWnd); - } - - break; - } - - case WM_DISPLAYCHANGE: - _glfwPollMonitorsWin32(); - break; - - case WM_DEVICECHANGE: - { - if (!_glfw.joysticksInitialized) - break; - - if (wParam == DBT_DEVICEARRIVAL) - { - DEV_BROADCAST_HDR* dbh = (DEV_BROADCAST_HDR*) lParam; - if (dbh && dbh->dbch_devicetype == DBT_DEVTYP_DEVICEINTERFACE) - _glfwDetectJoystickConnectionWin32(); - } - else if (wParam == DBT_DEVICEREMOVECOMPLETE) - { - DEV_BROADCAST_HDR* dbh = (DEV_BROADCAST_HDR*) lParam; - if (dbh && dbh->dbch_devicetype == DBT_DEVTYP_DEVICEINTERFACE) - _glfwDetectJoystickDisconnectionWin32(); - } - - break; + // On per-monitor DPI aware V1 systems, only enable + // non-client scaling for windows that scale the client area + // We need WM_GETDPISCALEDSIZE from V2 to keep the client + // area static when the non-client area is scaled + if (wndconfig && wndconfig->scaleToMonitor) + EnableNonClientDpiScaling(hWnd); } } From a465c1c32e0754d3de56e01c59a0fef33202f04c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Fri, 6 May 2022 17:58:42 +0200 Subject: [PATCH 009/117] Win32: Simplify window class handling By using window class atoms, we only need to mention each window class name once, also removing the need to define _GLFW_WNDCLASSNAME. It can still be defined by the user as before. --- src/win32_init.c | 17 ++++------ src/win32_platform.h | 9 ++--- src/win32_window.c | 78 +++++++++++++++++++------------------------- 3 files changed, 43 insertions(+), 61 deletions(-) diff --git a/src/win32_init.c b/src/win32_init.c index c2dc1322..8704150c 100644 --- a/src/win32_init.c +++ b/src/win32_init.c @@ -378,7 +378,8 @@ static GLFWbool createHelperWindow(void) wc.hInstance = _glfw.win32.instance; wc.lpszClassName = L"GLFW3 Helper"; - if (!RegisterClassExW(&wc)) + _glfw.win32.helperWindowClass = RegisterClassExW(&wc); + if (!_glfw.win32.helperWindowClass) { _glfwInputErrorWin32(GLFW_PLATFORM_ERROR, "WIn32: Failed to register helper window class"); @@ -387,7 +388,7 @@ static GLFWbool createHelperWindow(void) _glfw.win32.helperWindowHandle = CreateWindowExW(WS_EX_OVERLAPPEDWINDOW, - L"GLFW3 Helper", + MAKEINTATOM(_glfw.win32.helperWindowClass), L"GLFW message window", WS_CLIPSIBLINGS | WS_CLIPCHILDREN, 0, 0, 1, 1, @@ -695,9 +696,6 @@ int _glfwInitWin32(void) else if (IsWindowsVistaOrGreater()) SetProcessDPIAware(); - if (!_glfwRegisterWindowClassWin32()) - return GLFW_FALSE; - if (!createHelperWindow()) return GLFW_FALSE; @@ -711,12 +709,11 @@ void _glfwTerminateWin32(void) UnregisterDeviceNotification(_glfw.win32.deviceNotificationHandle); if (_glfw.win32.helperWindowHandle) - { DestroyWindow(_glfw.win32.helperWindowHandle); - UnregisterClassW(L"GLFW3 Helper", _glfw.win32.instance); - } - - _glfwUnregisterWindowClassWin32(); + if (_glfw.win32.helperWindowClass) + UnregisterClassW(MAKEINTATOM(_glfw.win32.helperWindowClass), _glfw.win32.instance); + if (_glfw.win32.mainWindowClass) + UnregisterClassW(MAKEINTATOM(_glfw.win32.mainWindowClass), _glfw.win32.instance); _glfw_free(_glfw.win32.clipboardString); _glfw_free(_glfw.win32.rawInput); diff --git a/src/win32_platform.h b/src/win32_platform.h index c9d96cd0..c2158943 100644 --- a/src/win32_platform.h +++ b/src/win32_platform.h @@ -358,10 +358,6 @@ typedef struct VkWin32SurfaceCreateInfoKHR typedef VkResult (APIENTRY *PFN_vkCreateWin32SurfaceKHR)(VkInstance,const VkWin32SurfaceCreateInfoKHR*,const VkAllocationCallbacks*,VkSurfaceKHR*); typedef VkBool32 (APIENTRY *PFN_vkGetPhysicalDeviceWin32PresentationSupportKHR)(VkPhysicalDevice,uint32_t); -#if !defined(_GLFW_WNDCLASSNAME) - #define _GLFW_WNDCLASSNAME L"GLFW30" -#endif - #define GLFW_WIN32_WINDOW_STATE _GLFWwindowWin32 win32; #define GLFW_WIN32_LIBRARY_WINDOW_STATE _GLFWlibraryWin32 win32; #define GLFW_WIN32_MONITOR_STATE _GLFWmonitorWin32 win32; @@ -444,6 +440,8 @@ typedef struct _GLFWlibraryWin32 { HINSTANCE instance; HWND helperWindowHandle; + ATOM helperWindowClass; + ATOM mainWindowClass; HDEVNOTIFY deviceNotificationHandle; int acquiredMonitorCount; char* clipboardString; @@ -527,9 +525,6 @@ GLFWbool _glfwConnectWin32(int platformID, _GLFWplatform* platform); int _glfwInitWin32(void); void _glfwTerminateWin32(void); -GLFWbool _glfwRegisterWindowClassWin32(void); -void _glfwUnregisterWindowClassWin32(void); - WCHAR* _glfwCreateWideStringFromUTF8Win32(const char* source); char* _glfwCreateUTF8FromWideStringWin32(const WCHAR* source); BOOL _glfwIsWindowsVersionOrGreaterWin32(WORD major, WORD minor, WORD sp); diff --git a/src/win32_window.c b/src/win32_window.c index cefb2cf6..8d9c95e7 100644 --- a/src/win32_window.c +++ b/src/win32_window.c @@ -1249,6 +1249,39 @@ static int createNativeWindow(_GLFWwindow* window, DWORD style = getWindowStyle(window); DWORD exStyle = getWindowExStyle(window); + if (!_glfw.win32.mainWindowClass) + { + WNDCLASSEXW wc = { sizeof(wc) }; + wc.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC; + wc.lpfnWndProc = windowProc; + wc.hInstance = _glfw.win32.instance; + wc.hCursor = LoadCursorW(NULL, IDC_ARROW); +#if defined(_GLFW_WNDCLASSNAME) + wc.lpszClassName = _GLFW_WNDCLASSNAME; +#else + wc.lpszClassName = L"GLFW30"; +#endif + // Load user-provided icon if available + wc.hIcon = LoadImageW(GetModuleHandleW(NULL), + L"GLFW_ICON", IMAGE_ICON, + 0, 0, LR_DEFAULTSIZE | LR_SHARED); + if (!wc.hIcon) + { + // No user-provided icon found, load default icon + wc.hIcon = LoadImageW(NULL, + IDI_APPLICATION, IMAGE_ICON, + 0, 0, LR_DEFAULTSIZE | LR_SHARED); + } + + _glfw.win32.mainWindowClass = RegisterClassExW(&wc); + if (!_glfw.win32.mainWindowClass) + { + _glfwInputErrorWin32(GLFW_PLATFORM_ERROR, + "Win32: Failed to register window class"); + return GLFW_FALSE; + } + } + if (window->monitor) { MONITORINFO mi = { sizeof(mi) }; @@ -1282,7 +1315,7 @@ static int createNativeWindow(_GLFWwindow* window, return GLFW_FALSE; window->win32.handle = CreateWindowExW(exStyle, - _GLFW_WNDCLASSNAME, + MAKEINTATOM(_glfw.win32.mainWindowClass), wideTitle, style, xpos, ypos, @@ -1387,49 +1420,6 @@ static int createNativeWindow(_GLFWwindow* window, return GLFW_TRUE; } -// Registers the GLFW window class -// -GLFWbool _glfwRegisterWindowClassWin32(void) -{ - WNDCLASSEXW wc; - - ZeroMemory(&wc, sizeof(wc)); - wc.cbSize = sizeof(wc); - wc.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC; - wc.lpfnWndProc = windowProc; - wc.hInstance = _glfw.win32.instance; - wc.hCursor = LoadCursorW(NULL, IDC_ARROW); - wc.lpszClassName = _GLFW_WNDCLASSNAME; - - // Load user-provided icon if available - wc.hIcon = LoadImageW(GetModuleHandleW(NULL), - L"GLFW_ICON", IMAGE_ICON, - 0, 0, LR_DEFAULTSIZE | LR_SHARED); - if (!wc.hIcon) - { - // No user-provided icon found, load default icon - wc.hIcon = LoadImageW(NULL, - IDI_APPLICATION, IMAGE_ICON, - 0, 0, LR_DEFAULTSIZE | LR_SHARED); - } - - if (!RegisterClassExW(&wc)) - { - _glfwInputErrorWin32(GLFW_PLATFORM_ERROR, - "Win32: Failed to register window class"); - return GLFW_FALSE; - } - - return GLFW_TRUE; -} - -// Unregisters the GLFW window class -// -void _glfwUnregisterWindowClassWin32(void) -{ - UnregisterClassW(_GLFW_WNDCLASSNAME, _glfw.win32.instance); -} - GLFWbool _glfwCreateWindowWin32(_GLFWwindow* window, const _GLFWwndconfig* wndconfig, const _GLFWctxconfig* ctxconfig, From d3ede7b6847b66cf30b067214b2b4b126d4c729b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Fri, 10 Jun 2022 00:14:05 +0200 Subject: [PATCH 010/117] Add credit Related to #2108 --- CONTRIBUTORS.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 23d1418e..43c37ac9 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -173,6 +173,7 @@ video tutorials. - Pablo Prietz - przemekmirek - pthom + - Martin Pulec - Guillaume Racicot - Philip Rideout - Eddie Ringle From 523fdf50c14210e03434648ee45bade9067fd41c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Thu, 16 Jun 2022 13:32:31 +0200 Subject: [PATCH 011/117] Wayland: Cleanup --- src/wl_window.c | 58 ++++++++++++++++--------------------------------- 1 file changed, 19 insertions(+), 39 deletions(-) diff --git a/src/wl_window.c b/src/wl_window.c index 34abddf5..5c390a05 100644 --- a/src/wl_window.c +++ b/src/wl_window.c @@ -1428,51 +1428,31 @@ static void keyboardHandleModifiers(void* userData, 0, group); - unsigned int mods = 0; + _glfw.wl.xkb.modifiers = 0; - if (xkb_state_mod_index_is_active(_glfw.wl.xkb.state, - _glfw.wl.xkb.controlIndex, - XKB_STATE_MODS_EFFECTIVE) == 1) + struct { - mods |= GLFW_MOD_CONTROL; - } - - if (xkb_state_mod_index_is_active(_glfw.wl.xkb.state, - _glfw.wl.xkb.altIndex, - XKB_STATE_MODS_EFFECTIVE) == 1) + xkb_mod_index_t index; + unsigned int bit; + } modifiers[] = { - mods |= GLFW_MOD_ALT; - } + { _glfw.wl.xkb.controlIndex, GLFW_MOD_CONTROL }, + { _glfw.wl.xkb.altIndex, GLFW_MOD_ALT }, + { _glfw.wl.xkb.shiftIndex, GLFW_MOD_SHIFT }, + { _glfw.wl.xkb.superIndex, GLFW_MOD_SUPER }, + { _glfw.wl.xkb.capsLockIndex, GLFW_MOD_CAPS_LOCK }, + { _glfw.wl.xkb.numLockIndex, GLFW_MOD_NUM_LOCK } + }; - if (xkb_state_mod_index_is_active(_glfw.wl.xkb.state, - _glfw.wl.xkb.shiftIndex, - XKB_STATE_MODS_EFFECTIVE) == 1) + for (size_t i = 0; i < sizeof(modifiers) / sizeof(modifiers[0]); i++) { - mods |= GLFW_MOD_SHIFT; + if (xkb_state_mod_index_is_active(_glfw.wl.xkb.state, + modifiers[i].index, + XKB_STATE_MODS_EFFECTIVE) == 1) + { + _glfw.wl.xkb.modifiers |= modifiers[i].bit; + } } - - if (xkb_state_mod_index_is_active(_glfw.wl.xkb.state, - _glfw.wl.xkb.superIndex, - XKB_STATE_MODS_EFFECTIVE) == 1) - { - mods |= GLFW_MOD_SUPER; - } - - if (xkb_state_mod_index_is_active(_glfw.wl.xkb.state, - _glfw.wl.xkb.capsLockIndex, - XKB_STATE_MODS_EFFECTIVE) == 1) - { - mods |= GLFW_MOD_CAPS_LOCK; - } - - if (xkb_state_mod_index_is_active(_glfw.wl.xkb.state, - _glfw.wl.xkb.numLockIndex, - XKB_STATE_MODS_EFFECTIVE) == 1) - { - mods |= GLFW_MOD_NUM_LOCK; - } - - _glfw.wl.xkb.modifiers = mods; } #ifdef WL_KEYBOARD_REPEAT_INFO_SINCE_VERSION From ddd087d6627d19655d78196b5836c1d090b59506 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Thu, 9 Jun 2022 21:31:44 +0200 Subject: [PATCH 012/117] Wayland: Fix behavior of leaving full screen mode These changes make GLFW fullscreen more consistent, but unfortunately also make GLFW even more oblivious to user-initiated XDG shell fullscreen changes. Fixes #1995 --- CONTRIBUTORS.md | 1 + README.md | 4 +++ src/wl_platform.h | 3 +-- src/wl_window.c | 64 +++++++++++++++++++++++++++++------------------ 4 files changed, 45 insertions(+), 27 deletions(-) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 43c37ac9..50f77fa5 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -160,6 +160,7 @@ video tutorials. - Christopher Pelloux - Arturo J. Pérez - Vladimir Perminov + - Olivier Perret - Anthony Pesch - Orson Peters - Emmanuel Gil Peyrot diff --git a/README.md b/README.md index fe5a2c76..28e26261 100644 --- a/README.md +++ b/README.md @@ -331,6 +331,10 @@ information on what to include when reporting a bug. - [Wayland] Bugfix: The OSMesa library was not unloaded on termination - [Wayland] Bugfix: `glfwCreateWindow` could emit `GLFW_FEATURE_UNAVAILABLE` - [Wayland] Bugfix: Lock key modifier bits were only set when lock keys were pressed + - [Wayland] Bugfix: A window leaving full screen mode would be iconified (#1995) + - [Wayland] Bugfix: A window leaving full screen mode ignored its desired size + - [Wayland] Bugfix: `glfwSetWindowMonitor` did not update windowed mode size + - [Wayland] Bugfix: `glfwRestoreWindow` would make a full screen window windowed - [POSIX] Removed use of deprecated function `gettimeofday` - [POSIX] Bugfix: `CLOCK_MONOTONIC` was not correctly tested for or enabled - [WGL] Disabled the DWM swap interval hack for Windows 8 and later (#1072) diff --git a/src/wl_platform.h b/src/wl_platform.h index 98858bc5..1036fb5e 100644 --- a/src/wl_platform.h +++ b/src/wl_platform.h @@ -233,6 +233,7 @@ typedef struct _GLFWwindowWayland int width, height; GLFWbool visible; GLFWbool maximized; + GLFWbool activated; GLFWbool hovered; GLFWbool transparent; struct wl_surface* surface; @@ -264,8 +265,6 @@ typedef struct _GLFWwindowWayland struct zwp_idle_inhibitor_v1* idleInhibitor; - GLFWbool wasFullscreen; - struct { GLFWbool serverSide; struct wl_buffer* buffer; diff --git a/src/wl_window.c b/src/wl_window.c index 5c390a05..7e086461 100644 --- a/src/wl_window.c +++ b/src/wl_window.c @@ -429,20 +429,35 @@ static void setIdleInhibitor(_GLFWwindow* window, GLFWbool enable) } } -static void setFullscreen(_GLFWwindow* window, _GLFWmonitor* monitor, - int refreshRate) +// Make the specified window and its video mode active on its monitor +// +static void acquireMonitor(_GLFWwindow* window) { if (window->wl.xdg.toplevel) { - xdg_toplevel_set_fullscreen( - window->wl.xdg.toplevel, - monitor->wl.output); + xdg_toplevel_set_fullscreen(window->wl.xdg.toplevel, + window->monitor->wl.output); } + setIdleInhibitor(window, GLFW_TRUE); + if (!window->wl.decorations.serverSide) destroyDecorations(window); } +// Remove the window and restore the original video mode +// +static void releaseMonitor(_GLFWwindow* window) +{ + if (window->wl.xdg.toplevel) + xdg_toplevel_unset_fullscreen(window->wl.xdg.toplevel); + + setIdleInhibitor(window, GLFW_FALSE); + + if (!_glfw.wl.decorationManager) + createDecorations(window); +} + static void xdgToplevelHandleConfigure(void* userData, struct xdg_toplevel* toplevel, int32_t width, @@ -495,16 +510,13 @@ static void xdgToplevelHandleConfigure(void* userData, _glfwInputWindowDamage(window); } - if (window->wl.wasFullscreen && window->autoIconify) + if (window->wl.activated && !activated) { - if (!activated || !fullscreen) - { + if (window->monitor && window->autoIconify) _glfwIconifyWindowWayland(window); - window->wl.wasFullscreen = GLFW_FALSE; - } } - if (fullscreen && activated) - window->wl.wasFullscreen = GLFW_TRUE; + + window->wl.activated = activated; } static void xdgToplevelHandleClose(void* userData, @@ -1896,14 +1908,12 @@ void _glfwRestoreWindowWayland(_GLFWwindow* window) { if (window->wl.xdg.toplevel) { - if (window->monitor) - xdg_toplevel_unset_fullscreen(window->wl.xdg.toplevel); if (window->wl.maximized) xdg_toplevel_unset_maximized(window->wl.xdg.toplevel); // There is no way to unset minimized, or even to know if we are // minimized, so there is nothing to do in this case. } - _glfwInputWindowMonitor(window, NULL); + window->wl.maximized = GLFW_FALSE; } @@ -1959,19 +1969,23 @@ void _glfwSetWindowMonitorWayland(_GLFWwindow* window, int width, int height, int refreshRate) { - if (monitor) + if (window->monitor == monitor) { - setFullscreen(window, monitor, refreshRate); - } - else - { - if (window->wl.xdg.toplevel) - xdg_toplevel_unset_fullscreen(window->wl.xdg.toplevel); - setIdleInhibitor(window, GLFW_FALSE); - if (!_glfw.wl.decorationManager) - createDecorations(window); + if (!monitor) + _glfwSetWindowSizeWayland(window, width, height); + + return; } + + if (window->monitor) + releaseMonitor(window); + _glfwInputWindowMonitor(window, monitor); + + if (window->monitor) + acquireMonitor(window); + else + _glfwSetWindowSizeWayland(window, width, height); } GLFWbool _glfwWindowFocusedWayland(_GLFWwindow* window) From f39ffefb6a754677305efab556216f99f90c778a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Fri, 10 Jun 2022 13:29:24 +0200 Subject: [PATCH 013/117] Wayland: Fix maximization by user being ignored The internal maximization state was not updated when an event was received that the user had changed the maximization state of a window, and no maximization events were emitted. This affected both the GLFW_MAXIMIZED attribute and glfwRestoreWindow. --- README.md | 3 +++ src/wl_window.c | 11 ++++++----- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 28e26261..df7cfa47 100644 --- a/README.md +++ b/README.md @@ -335,6 +335,9 @@ information on what to include when reporting a bug. - [Wayland] Bugfix: A window leaving full screen mode ignored its desired size - [Wayland] Bugfix: `glfwSetWindowMonitor` did not update windowed mode size - [Wayland] Bugfix: `glfwRestoreWindow` would make a full screen window windowed + - [Wayland] Bugfix: A window maximized or restored by the user would enter an + inconsistent state + - [Wayland] Bugfix: Window maximization events were not emitted - [POSIX] Removed use of deprecated function `gettimeofday` - [POSIX] Bugfix: `CLOCK_MONOTONIC` was not correctly tested for or enabled - [WGL] Disabled the DWM swap interval hack for Windows 8 and later (#1072) diff --git a/src/wl_window.c b/src/wl_window.c index 7e086461..06a922cf 100644 --- a/src/wl_window.c +++ b/src/wl_window.c @@ -516,7 +516,13 @@ static void xdgToplevelHandleConfigure(void* userData, _glfwIconifyWindowWayland(window); } + if (window->wl.maximized && !maximized) + _glfwInputWindowMaximize(window, GLFW_FALSE); + else if (maximized && !window->wl.maximized) + _glfwInputWindowMaximize(window, GLFW_TRUE); + window->wl.activated = activated; + window->wl.maximized = maximized; } static void xdgToplevelHandleClose(void* userData, @@ -1913,17 +1919,12 @@ void _glfwRestoreWindowWayland(_GLFWwindow* window) // There is no way to unset minimized, or even to know if we are // minimized, so there is nothing to do in this case. } - - window->wl.maximized = GLFW_FALSE; } void _glfwMaximizeWindowWayland(_GLFWwindow* window) { if (window->wl.xdg.toplevel) - { xdg_toplevel_set_maximized(window->wl.xdg.toplevel); - } - window->wl.maximized = GLFW_TRUE; } void _glfwShowWindowWayland(_GLFWwindow* window) From fdc72edf8177f74b9565094559ebd0a717af93a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Sun, 19 Jun 2022 18:30:03 +0200 Subject: [PATCH 014/117] Wayland: Fix missing fullscreen code path glfwRestoreWindow assumed it was only called in windowed mode. --- README.md | 1 + src/wl_window.c | 14 +++++++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index df7cfa47..fd97d9bf 100644 --- a/README.md +++ b/README.md @@ -338,6 +338,7 @@ information on what to include when reporting a bug. - [Wayland] Bugfix: A window maximized or restored by the user would enter an inconsistent state - [Wayland] Bugfix: Window maximization events were not emitted + - [Wayland] Bugfix: `glfwRestoreWindow` assumed it was always in windowed mode - [POSIX] Removed use of deprecated function `gettimeofday` - [POSIX] Bugfix: `CLOCK_MONOTONIC` was not correctly tested for or enabled - [WGL] Disabled the DWM swap interval hack for Windows 8 and later (#1072) diff --git a/src/wl_window.c b/src/wl_window.c index 06a922cf..6d71a9aa 100644 --- a/src/wl_window.c +++ b/src/wl_window.c @@ -1912,13 +1912,21 @@ void _glfwIconifyWindowWayland(_GLFWwindow* window) void _glfwRestoreWindowWayland(_GLFWwindow* window) { - if (window->wl.xdg.toplevel) + if (window->monitor) { - if (window->wl.maximized) - xdg_toplevel_unset_maximized(window->wl.xdg.toplevel); // There is no way to unset minimized, or even to know if we are // minimized, so there is nothing to do in this case. } + else + { + // We assume we are not minimized and acto only on maximization + + if (window->wl.xdg.toplevel) + { + if (window->wl.maximized) + xdg_toplevel_unset_maximized(window->wl.xdg.toplevel); + } + } } void _glfwMaximizeWindowWayland(_GLFWwindow* window) From 6857995498d6628b3052b547ecd7cdecfee342d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Fri, 10 Jun 2022 14:10:25 +0200 Subject: [PATCH 015/117] Wayland: Fix glfwSetWindowSize resizing fs windows glfwSetWindowSize would change the size of fullscreen mode windows as if they were windowed mode. --- README.md | 1 + src/wl_window.c | 17 +++++++++++++---- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index fd97d9bf..6524bd30 100644 --- a/README.md +++ b/README.md @@ -339,6 +339,7 @@ information on what to include when reporting a bug. inconsistent state - [Wayland] Bugfix: Window maximization events were not emitted - [Wayland] Bugfix: `glfwRestoreWindow` assumed it was always in windowed mode + - [Wayland] Bugfix: `glfwSetWindowSize` would resize a full screen window - [POSIX] Removed use of deprecated function `gettimeofday` - [POSIX] Bugfix: `CLOCK_MONOTONIC` was not correctly tested for or enabled - [WGL] Disabled the DWM swap interval hack for Windows 8 and later (#1072) diff --git a/src/wl_window.c b/src/wl_window.c index 6d71a9aa..56218513 100644 --- a/src/wl_window.c +++ b/src/wl_window.c @@ -506,7 +506,9 @@ static void xdgToplevelHandleConfigure(void* userData, } _glfwInputWindowSize(window, width, height); - _glfwSetWindowSizeWayland(window, width, height); + window->wl.width = width; + window->wl.height = height; + resizeWindow(window); _glfwInputWindowDamage(window); } @@ -1840,9 +1842,16 @@ void _glfwGetWindowSizeWayland(_GLFWwindow* window, int* width, int* height) void _glfwSetWindowSizeWayland(_GLFWwindow* window, int width, int height) { - window->wl.width = width; - window->wl.height = height; - resizeWindow(window); + if (window->monitor) + { + // Video mode setting is not available on Wayland + } + else + { + window->wl.width = width; + window->wl.height = height; + resizeWindow(window); + } } void _glfwSetWindowSizeLimitsWayland(_GLFWwindow* window, From 0b76e3a6f158549b96d1ae3424f094c63177b2ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Fri, 10 Jun 2022 14:19:13 +0200 Subject: [PATCH 016/117] Wayland: Fix duplicate window content scale events The window content scale event was emitted every time the window content area was resized, even if its scale had not changed. --- README.md | 2 ++ src/wl_window.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 6524bd30..4a3b17d4 100644 --- a/README.md +++ b/README.md @@ -340,6 +340,8 @@ information on what to include when reporting a bug. - [Wayland] Bugfix: Window maximization events were not emitted - [Wayland] Bugfix: `glfwRestoreWindow` assumed it was always in windowed mode - [Wayland] Bugfix: `glfwSetWindowSize` would resize a full screen window + - [Wayland] Bugfix: A window content scale event would be emitted every time + the window resized - [POSIX] Removed use of deprecated function `gettimeofday` - [POSIX] Bugfix: `CLOCK_MONOTONIC` was not correctly tested for or enabled - [WGL] Disabled the DWM swap interval hack for Windows 8 and later (#1072) diff --git a/src/wl_window.c b/src/wl_window.c index 56218513..8cead60d 100644 --- a/src/wl_window.c +++ b/src/wl_window.c @@ -315,7 +315,6 @@ static void resizeWindow(_GLFWwindow* window) if (!window->wl.transparent) setOpaqueRegion(window); _glfwInputFramebufferSize(window, scaledWidth, scaledHeight); - _glfwInputWindowContentScale(window, scale, scale); if (!window->wl.decorations.top.surface) return; @@ -362,6 +361,7 @@ static void checkScaleChange(_GLFWwindow* window) { window->wl.scale = maxScale; wl_surface_set_buffer_scale(window->wl.surface, maxScale); + _glfwInputWindowContentScale(window, maxScale, maxScale); resizeWindow(window); } } From 3bbb41eacc294d3030303eabfd16f66d452e9a72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Fri, 10 Jun 2022 15:45:07 +0200 Subject: [PATCH 017/117] Wayland: Fix glfwInit closing stdin on failure If platform initialization failed before either timer fd member had been set to -1 or a valid fd, termination would close stdin. --- README.md | 1 + src/wl_init.c | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 4a3b17d4..5e75122e 100644 --- a/README.md +++ b/README.md @@ -342,6 +342,7 @@ information on what to include when reporting a bug. - [Wayland] Bugfix: `glfwSetWindowSize` would resize a full screen window - [Wayland] Bugfix: A window content scale event would be emitted every time the window resized + - [Wayland] Bugfix: If `glfwInit` failed it would close stdin - [POSIX] Removed use of deprecated function `gettimeofday` - [POSIX] Bugfix: `CLOCK_MONOTONIC` was not correctly tested for or enabled - [WGL] Disabled the DWM swap interval hack for Windows 8 and later (#1072) diff --git a/src/wl_init.c b/src/wl_init.c index 2e3a0573..f462d0e6 100644 --- a/src/wl_init.c +++ b/src/wl_init.c @@ -479,6 +479,10 @@ int _glfwInitWayland(void) long cursorSizeLong; int cursorSize; + // These must be set before any failure checks + _glfw.wl.timerfd = -1; + _glfw.wl.cursorTimerfd = -1; + _glfw.wl.client.display_flush = (PFN_wl_display_flush) _glfwPlatformGetModuleSymbol(_glfw.wl.client.handle, "wl_display_flush"); _glfw.wl.client.display_cancel_read = (PFN_wl_display_cancel_read) @@ -635,7 +639,6 @@ int _glfwInitWayland(void) // Sync so we got all initial output events wl_display_roundtrip(_glfw.wl.display); - _glfw.wl.timerfd = -1; if (_glfw.wl.seatVersion >= 4) _glfw.wl.timerfd = timerfd_create(CLOCK_MONOTONIC, TFD_CLOEXEC | TFD_NONBLOCK); From 98c9961f3265c1a926e16ff454274e75eda377f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Fri, 17 Jun 2022 20:16:34 +0200 Subject: [PATCH 018/117] Wayland: Cleanup --- src/wl_monitor.c | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/src/wl_monitor.c b/src/wl_monitor.c index 568bdc5f..96572f46 100644 --- a/src/wl_monitor.c +++ b/src/wl_monitor.c @@ -123,9 +123,6 @@ static const struct wl_output_listener outputListener = void _glfwAddOutputWayland(uint32_t name, uint32_t version) { - _GLFWmonitor* monitor; - struct wl_output* output; - if (version < 2) { _glfwInputError(GLFW_PLATFORM_ERROR, @@ -133,19 +130,15 @@ void _glfwAddOutputWayland(uint32_t name, uint32_t version) return; } - // The actual name of this output will be set in the geometry handler. - monitor = _glfwAllocMonitor("", 0, 0); - - output = wl_registry_bind(_glfw.wl.registry, - name, - &wl_output_interface, - 2); + struct wl_output* output = wl_registry_bind(_glfw.wl.registry, + name, + &wl_output_interface, + 2); if (!output) - { - _glfwFreeMonitor(monitor); return; - } + // The actual name of this output will be set in the geometry handler + _GLFWmonitor* monitor = _glfwAllocMonitor("", 0, 0); monitor->wl.scale = 1; monitor->wl.output = output; monitor->wl.name = name; From ed39ff43f969b54ba4659293dfaf4d6948f07fed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Fri, 10 Jun 2022 15:46:24 +0200 Subject: [PATCH 019/117] Wayland: Use named constants for version checks The wayland-scanner output provides really nice, self-documenting version macros, so we should use them whenever possible. --- src/wl_init.c | 4 +++- src/wl_window.c | 3 +-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/wl_init.c b/src/wl_init.c index f462d0e6..867bf670 100644 --- a/src/wl_init.c +++ b/src/wl_init.c @@ -639,8 +639,10 @@ int _glfwInitWayland(void) // Sync so we got all initial output events wl_display_roundtrip(_glfw.wl.display); - if (_glfw.wl.seatVersion >= 4) +#ifdef WL_KEYBOARD_REPEAT_INFO_SINCE_VERSION + if (_glfw.wl.seatVersion >= WL_KEYBOARD_REPEAT_INFO_SINCE_VERSION) _glfw.wl.timerfd = timerfd_create(CLOCK_MONOTONIC, TFD_CLOEXEC | TFD_NONBLOCK); +#endif if (!_glfw.wl.wmBase) { diff --git a/src/wl_window.c b/src/wl_window.c index 8cead60d..f4c745ea 100644 --- a/src/wl_window.c +++ b/src/wl_window.c @@ -346,8 +346,7 @@ static void resizeWindow(_GLFWwindow* window) static void checkScaleChange(_GLFWwindow* window) { - // Check if we will be able to set the buffer scale or not. - if (_glfw.wl.compositorVersion < 3) + if (_glfw.wl.compositorVersion < WL_SURFACE_SET_BUFFER_SCALE_SINCE_VERSION) return; // Get the scale factor from the highest scale monitor. From afb127769a5a39246ae80e2489f0d4cf43a32fbb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Fri, 10 Jun 2022 18:36:16 +0200 Subject: [PATCH 020/117] Wayland: Add tracking of XDG fullscreen state --- src/wl_platform.h | 1 + src/wl_window.c | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/wl_platform.h b/src/wl_platform.h index 1036fb5e..c0721e2b 100644 --- a/src/wl_platform.h +++ b/src/wl_platform.h @@ -234,6 +234,7 @@ typedef struct _GLFWwindowWayland GLFWbool visible; GLFWbool maximized; GLFWbool activated; + GLFWbool fullscreen; GLFWbool hovered; GLFWbool transparent; struct wl_surface* surface; diff --git a/src/wl_window.c b/src/wl_window.c index f4c745ea..ef1ac584 100644 --- a/src/wl_window.c +++ b/src/wl_window.c @@ -522,8 +522,9 @@ static void xdgToplevelHandleConfigure(void* userData, else if (maximized && !window->wl.maximized) _glfwInputWindowMaximize(window, GLFW_TRUE); - window->wl.activated = activated; - window->wl.maximized = maximized; + window->wl.activated = activated; + window->wl.maximized = maximized; + window->wl.fullscreen = fullscreen; } static void xdgToplevelHandleClose(void* userData, From e33db6d7aa2b62072f312bd7b723efecf5b7c9ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Fri, 10 Jun 2022 18:38:06 +0200 Subject: [PATCH 021/117] Wayland: Fix resize events before ack_configure The surface was resized and the size event was emitted before we had sent xdg_surface::ack_configure. If user code then called some GLFW function that commited the surface, those changes would all get applied to the wrong configure event. This postpones size changes until after the ack. --- src/wl_platform.h | 4 +++ src/wl_window.c | 62 +++++++++++++++++++++++++++++------------------ 2 files changed, 42 insertions(+), 24 deletions(-) diff --git a/src/wl_platform.h b/src/wl_platform.h index c0721e2b..0c64bf2b 100644 --- a/src/wl_platform.h +++ b/src/wl_platform.h @@ -241,6 +241,10 @@ typedef struct _GLFWwindowWayland struct wl_egl_window* native; struct wl_callback* callback; + struct { + int width, height; + } pending; + struct { struct xdg_surface* surface; struct xdg_toplevel* toplevel; diff --git a/src/wl_window.c b/src/wl_window.c index ef1ac584..522a80e7 100644 --- a/src/wl_window.c +++ b/src/wl_window.c @@ -464,8 +464,6 @@ static void xdgToplevelHandleConfigure(void* userData, struct wl_array* states) { _GLFWwindow* window = userData; - float aspectRatio; - float targetRatio; uint32_t* state; GLFWbool maximized = GLFW_FALSE; GLFWbool fullscreen = GLFW_FALSE; @@ -489,28 +487,6 @@ static void xdgToplevelHandleConfigure(void* userData, } } - if (width != 0 && height != 0) - { - if (!maximized && !fullscreen) - { - if (window->numer != GLFW_DONT_CARE && window->denom != GLFW_DONT_CARE) - { - aspectRatio = (float)width / (float)height; - targetRatio = (float)window->numer / (float)window->denom; - if (aspectRatio < targetRatio) - height = width / targetRatio; - else if (aspectRatio > targetRatio) - width = height * targetRatio; - } - } - - _glfwInputWindowSize(window, width, height); - window->wl.width = width; - window->wl.height = height; - resizeWindow(window); - _glfwInputWindowDamage(window); - } - if (window->wl.activated && !activated) { if (window->monitor && window->autoIconify) @@ -525,6 +501,17 @@ static void xdgToplevelHandleConfigure(void* userData, window->wl.activated = activated; window->wl.maximized = maximized; window->wl.fullscreen = fullscreen; + + if (width && height) + { + window->wl.pending.width = width; + window->wl.pending.height = height; + } + else + { + window->wl.pending.width = window->wl.width; + window->wl.pending.height = window->wl.height; + } } static void xdgToplevelHandleClose(void* userData, @@ -544,7 +531,34 @@ static void xdgSurfaceHandleConfigure(void* userData, struct xdg_surface* surface, uint32_t serial) { + _GLFWwindow* window = userData; + int width = window->wl.pending.width; + int height = window->wl.pending.height; + xdg_surface_ack_configure(surface, serial); + + if (!window->wl.maximized && !window->wl.fullscreen) + { + if (window->numer != GLFW_DONT_CARE && window->denom != GLFW_DONT_CARE) + { + const float aspectRatio = (float) width / (float) height; + const float targetRatio = (float) window->numer / (float) window->denom; + if (aspectRatio < targetRatio) + height = width / targetRatio; + else if (aspectRatio > targetRatio) + width = height * targetRatio; + } + } + + if (width != window->wl.width || height != window->wl.height) + { + window->wl.width = width; + window->wl.height = height; + resizeWindow(window); + + _glfwInputWindowSize(window, width, height); + _glfwInputWindowDamage(window); + } } static const struct xdg_surface_listener xdgSurfaceListener = { From 2877fea550038d73a8d04feb38af6ca4e4c3a5b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Fri, 10 Jun 2022 18:51:57 +0200 Subject: [PATCH 022/117] Wayland: Remove superfluous comments These are just repeating parts of the identifier. --- src/wl_window.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/wl_window.c b/src/wl_window.c index 522a80e7..af00c5ab 100644 --- a/src/wl_window.c +++ b/src/wl_window.c @@ -319,24 +319,20 @@ static void resizeWindow(_GLFWwindow* window) if (!window->wl.decorations.top.surface) return; - // Top decoration. wp_viewport_set_destination(window->wl.decorations.top.viewport, window->wl.width, _GLFW_DECORATION_TOP); wl_surface_commit(window->wl.decorations.top.surface); - // Left decoration. wp_viewport_set_destination(window->wl.decorations.left.viewport, _GLFW_DECORATION_WIDTH, window->wl.height + _GLFW_DECORATION_TOP); wl_surface_commit(window->wl.decorations.left.surface); - // Right decoration. wl_subsurface_set_position(window->wl.decorations.right.subsurface, window->wl.width, -_GLFW_DECORATION_TOP); wp_viewport_set_destination(window->wl.decorations.right.viewport, _GLFW_DECORATION_WIDTH, window->wl.height + _GLFW_DECORATION_TOP); wl_surface_commit(window->wl.decorations.right.surface); - // Bottom decoration. wl_subsurface_set_position(window->wl.decorations.bottom.subsurface, -_GLFW_DECORATION_WIDTH, window->wl.height); wp_viewport_set_destination(window->wl.decorations.bottom.viewport, From 040712ce99ea787a85ae68b75fa452ee817274b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Fri, 10 Jun 2022 18:53:22 +0200 Subject: [PATCH 023/117] Wayland: Cleanup --- src/wl_window.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/wl_window.c b/src/wl_window.c index af00c5ab..e48e71d5 100644 --- a/src/wl_window.c +++ b/src/wl_window.c @@ -401,7 +401,8 @@ static void surfaceHandleLeave(void* userData, checkScaleChange(window); } -static const struct wl_surface_listener surfaceListener = { +static const struct wl_surface_listener surfaceListener = +{ surfaceHandleEnter, surfaceHandleLeave }; @@ -557,7 +558,8 @@ static void xdgSurfaceHandleConfigure(void* userData, } } -static const struct xdg_surface_listener xdgSurfaceListener = { +static const struct xdg_surface_listener xdgSurfaceListener = +{ xdgSurfaceHandleConfigure }; From 75295f48781fb2209f4d7cb1a021b299f338996a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Sun, 12 Jun 2022 18:47:30 +0200 Subject: [PATCH 024/117] Wayland: Remove unused code path --- src/wl_window.c | 28 ++++++++++------------------ 1 file changed, 10 insertions(+), 18 deletions(-) diff --git a/src/wl_window.c b/src/wl_window.c index e48e71d5..4d7e44ba 100644 --- a/src/wl_window.c +++ b/src/wl_window.c @@ -192,12 +192,10 @@ static struct wl_buffer* createShmBuffer(const GLFWimage* image) static void createDecoration(_GLFWdecorationWayland* decoration, struct wl_surface* parent, - struct wl_buffer* buffer, GLFWbool opaque, + struct wl_buffer* buffer, int x, int y, int width, int height) { - struct wl_region* region; - decoration->surface = wl_compositor_create_surface(_glfw.wl.compositor); decoration->subsurface = wl_subcompositor_get_subsurface(_glfw.wl.subcompositor, @@ -208,23 +206,17 @@ static void createDecoration(_GLFWdecorationWayland* decoration, wp_viewport_set_destination(decoration->viewport, width, height); wl_surface_attach(decoration->surface, buffer, 0, 0); - if (opaque) - { - region = wl_compositor_create_region(_glfw.wl.compositor); - wl_region_add(region, 0, 0, width, height); - wl_surface_set_opaque_region(decoration->surface, region); - wl_surface_commit(decoration->surface); - wl_region_destroy(region); - } - else - wl_surface_commit(decoration->surface); + struct wl_region* region = wl_compositor_create_region(_glfw.wl.compositor); + wl_region_add(region, 0, 0, width, height); + wl_surface_set_opaque_region(decoration->surface, region); + wl_surface_commit(decoration->surface); + wl_region_destroy(region); } static void createDecorations(_GLFWwindow* window) { unsigned char data[] = { 224, 224, 224, 255 }; const GLFWimage image = { 1, 1, data }; - GLFWbool opaque = (data[3] == 255); if (!_glfw.wl.viewporter || !window->decorated || window->wl.decorations.serverSide) return; @@ -235,19 +227,19 @@ static void createDecorations(_GLFWwindow* window) return; createDecoration(&window->wl.decorations.top, window->wl.surface, - window->wl.decorations.buffer, opaque, + window->wl.decorations.buffer, 0, -_GLFW_DECORATION_TOP, window->wl.width, _GLFW_DECORATION_TOP); createDecoration(&window->wl.decorations.left, window->wl.surface, - window->wl.decorations.buffer, opaque, + window->wl.decorations.buffer, -_GLFW_DECORATION_WIDTH, -_GLFW_DECORATION_TOP, _GLFW_DECORATION_WIDTH, window->wl.height + _GLFW_DECORATION_TOP); createDecoration(&window->wl.decorations.right, window->wl.surface, - window->wl.decorations.buffer, opaque, + window->wl.decorations.buffer, window->wl.width, -_GLFW_DECORATION_TOP, _GLFW_DECORATION_WIDTH, window->wl.height + _GLFW_DECORATION_TOP); createDecoration(&window->wl.decorations.bottom, window->wl.surface, - window->wl.decorations.buffer, opaque, + window->wl.decorations.buffer, -_GLFW_DECORATION_WIDTH, window->wl.height, window->wl.width + _GLFW_DECORATION_HORIZONTAL, _GLFW_DECORATION_WIDTH); } From 24cdc5afda8f36981eb46ae5c8189478774a325f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Thu, 16 Jun 2022 01:35:59 +0200 Subject: [PATCH 025/117] Wayland: Rename window frame size constants --- src/wl_platform.h | 5 ---- src/wl_window.c | 58 ++++++++++++++++++++++++----------------------- 2 files changed, 30 insertions(+), 33 deletions(-) diff --git a/src/wl_platform.h b/src/wl_platform.h index 0c64bf2b..7c66c736 100644 --- a/src/wl_platform.h +++ b/src/wl_platform.h @@ -198,11 +198,6 @@ typedef xkb_keysym_t (* PFN_xkb_compose_state_get_one_sym)(struct xkb_compose_st #define xkb_compose_state_get_status _glfw.wl.xkb.compose_state_get_status #define xkb_compose_state_get_one_sym _glfw.wl.xkb.compose_state_get_one_sym -#define _GLFW_DECORATION_WIDTH 4 -#define _GLFW_DECORATION_TOP 24 -#define _GLFW_DECORATION_VERTICAL (_GLFW_DECORATION_TOP + _GLFW_DECORATION_WIDTH) -#define _GLFW_DECORATION_HORIZONTAL (2 * _GLFW_DECORATION_WIDTH) - typedef enum _GLFWdecorationSideWayland { mainWindow, diff --git a/src/wl_window.c b/src/wl_window.c index 4d7e44ba..f3c7aab4 100644 --- a/src/wl_window.c +++ b/src/wl_window.c @@ -49,6 +49,8 @@ #include "wayland-pointer-constraints-unstable-v1-client-protocol.h" #include "wayland-idle-inhibit-unstable-v1-client-protocol.h" +#define GLFW_BORDER_SIZE 4 +#define GLFW_CAPTION_HEIGHT 24 static int createTmpfileCloexec(char* tmpname) { @@ -228,20 +230,20 @@ static void createDecorations(_GLFWwindow* window) createDecoration(&window->wl.decorations.top, window->wl.surface, window->wl.decorations.buffer, - 0, -_GLFW_DECORATION_TOP, - window->wl.width, _GLFW_DECORATION_TOP); + 0, -GLFW_CAPTION_HEIGHT, + window->wl.width, GLFW_CAPTION_HEIGHT); createDecoration(&window->wl.decorations.left, window->wl.surface, window->wl.decorations.buffer, - -_GLFW_DECORATION_WIDTH, -_GLFW_DECORATION_TOP, - _GLFW_DECORATION_WIDTH, window->wl.height + _GLFW_DECORATION_TOP); + -GLFW_BORDER_SIZE, -GLFW_CAPTION_HEIGHT, + GLFW_BORDER_SIZE, window->wl.height + GLFW_CAPTION_HEIGHT); createDecoration(&window->wl.decorations.right, window->wl.surface, window->wl.decorations.buffer, - window->wl.width, -_GLFW_DECORATION_TOP, - _GLFW_DECORATION_WIDTH, window->wl.height + _GLFW_DECORATION_TOP); + window->wl.width, -GLFW_CAPTION_HEIGHT, + GLFW_BORDER_SIZE, window->wl.height + GLFW_CAPTION_HEIGHT); createDecoration(&window->wl.decorations.bottom, window->wl.surface, window->wl.decorations.buffer, - -_GLFW_DECORATION_WIDTH, window->wl.height, - window->wl.width + _GLFW_DECORATION_HORIZONTAL, _GLFW_DECORATION_WIDTH); + -GLFW_BORDER_SIZE, window->wl.height, + window->wl.width + GLFW_BORDER_SIZE * 2, GLFW_BORDER_SIZE); } static void destroyDecoration(_GLFWdecorationWayland* decoration) @@ -312,23 +314,23 @@ static void resizeWindow(_GLFWwindow* window) return; wp_viewport_set_destination(window->wl.decorations.top.viewport, - window->wl.width, _GLFW_DECORATION_TOP); + window->wl.width, GLFW_CAPTION_HEIGHT); wl_surface_commit(window->wl.decorations.top.surface); wp_viewport_set_destination(window->wl.decorations.left.viewport, - _GLFW_DECORATION_WIDTH, window->wl.height + _GLFW_DECORATION_TOP); + GLFW_BORDER_SIZE, window->wl.height + GLFW_CAPTION_HEIGHT); wl_surface_commit(window->wl.decorations.left.surface); wl_subsurface_set_position(window->wl.decorations.right.subsurface, - window->wl.width, -_GLFW_DECORATION_TOP); + window->wl.width, -GLFW_CAPTION_HEIGHT); wp_viewport_set_destination(window->wl.decorations.right.viewport, - _GLFW_DECORATION_WIDTH, window->wl.height + _GLFW_DECORATION_TOP); + GLFW_BORDER_SIZE, window->wl.height + GLFW_CAPTION_HEIGHT); wl_surface_commit(window->wl.decorations.right.surface); wl_subsurface_set_position(window->wl.decorations.bottom.subsurface, - -_GLFW_DECORATION_WIDTH, window->wl.height); + -GLFW_BORDER_SIZE, window->wl.height); wp_viewport_set_destination(window->wl.decorations.bottom.viewport, - window->wl.width + _GLFW_DECORATION_HORIZONTAL, _GLFW_DECORATION_WIDTH); + window->wl.width + GLFW_BORDER_SIZE * 2, GLFW_BORDER_SIZE); wl_surface_commit(window->wl.decorations.bottom.surface); } @@ -1057,27 +1059,27 @@ static void pointerHandleMotion(void* userData, _glfw.wl.cursorPreviousName = NULL; return; case topDecoration: - if (y < _GLFW_DECORATION_WIDTH) + if (y < GLFW_BORDER_SIZE) cursorName = "n-resize"; else cursorName = "left_ptr"; break; case leftDecoration: - if (y < _GLFW_DECORATION_WIDTH) + if (y < GLFW_BORDER_SIZE) cursorName = "nw-resize"; else cursorName = "w-resize"; break; case rightDecoration: - if (y < _GLFW_DECORATION_WIDTH) + if (y < GLFW_BORDER_SIZE) cursorName = "ne-resize"; else cursorName = "e-resize"; break; case bottomDecoration: - if (x < _GLFW_DECORATION_WIDTH) + if (x < GLFW_BORDER_SIZE) cursorName = "sw-resize"; - else if (x > window->wl.width + _GLFW_DECORATION_WIDTH) + else if (x > window->wl.width + GLFW_BORDER_SIZE) cursorName = "se-resize"; else cursorName = "s-resize"; @@ -1109,27 +1111,27 @@ static void pointerHandleButton(void* userData, case mainWindow: break; case topDecoration: - if (window->wl.cursorPosY < _GLFW_DECORATION_WIDTH) + if (window->wl.cursorPosY < GLFW_BORDER_SIZE) edges = XDG_TOPLEVEL_RESIZE_EDGE_TOP; else xdg_toplevel_move(window->wl.xdg.toplevel, _glfw.wl.seat, serial); break; case leftDecoration: - if (window->wl.cursorPosY < _GLFW_DECORATION_WIDTH) + if (window->wl.cursorPosY < GLFW_BORDER_SIZE) edges = XDG_TOPLEVEL_RESIZE_EDGE_TOP_LEFT; else edges = XDG_TOPLEVEL_RESIZE_EDGE_LEFT; break; case rightDecoration: - if (window->wl.cursorPosY < _GLFW_DECORATION_WIDTH) + if (window->wl.cursorPosY < GLFW_BORDER_SIZE) edges = XDG_TOPLEVEL_RESIZE_EDGE_TOP_RIGHT; else edges = XDG_TOPLEVEL_RESIZE_EDGE_RIGHT; break; case bottomDecoration: - if (window->wl.cursorPosX < _GLFW_DECORATION_WIDTH) + if (window->wl.cursorPosX < GLFW_BORDER_SIZE) edges = XDG_TOPLEVEL_RESIZE_EDGE_BOTTOM_LEFT; - else if (window->wl.cursorPosX > window->wl.width + _GLFW_DECORATION_WIDTH) + else if (window->wl.cursorPosX > window->wl.width + GLFW_BORDER_SIZE) edges = XDG_TOPLEVEL_RESIZE_EDGE_BOTTOM_RIGHT; else edges = XDG_TOPLEVEL_RESIZE_EDGE_BOTTOM; @@ -1898,13 +1900,13 @@ void _glfwGetWindowFrameSizeWayland(_GLFWwindow* window, if (window->decorated && !window->monitor && !window->wl.decorations.serverSide) { if (top) - *top = _GLFW_DECORATION_TOP; + *top = GLFW_CAPTION_HEIGHT; if (left) - *left = _GLFW_DECORATION_WIDTH; + *left = GLFW_BORDER_SIZE; if (right) - *right = _GLFW_DECORATION_WIDTH; + *right = GLFW_BORDER_SIZE; if (bottom) - *bottom = _GLFW_DECORATION_WIDTH; + *bottom = GLFW_BORDER_SIZE; } } From 0f5b095042842006747f8dc04aded64ea3e05d2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Thu, 16 Jun 2022 01:36:55 +0200 Subject: [PATCH 026/117] Wayland: Fix erratic fallback decoration behavior The handler for xdg_toplevel::configure treated the provided size as the content area size when instead it is the size of the bounding rectangle of the wl_surface and all its subsurfaces. This caused the fallback decorations to try positioning themselves outside themselves, causing feedback loops during interactive resizing. Fixes #1991 Fixes #2115 Closes #2127 Related to #1914 --- CONTRIBUTORS.md | 2 ++ README.md | 2 ++ src/wl_window.c | 13 +++++++++++-- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 50f77fa5..1498d01e 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -24,6 +24,7 @@ video tutorials. - Waris Boonyasiriwat - Kyle Brenneman - Rok Breulj + - TheBrokenRail - Kai Burjack - Martin Capitanio - Nicolas Caramelli @@ -145,6 +146,7 @@ video tutorials. - Pierre Moulon - Martins Mozeiko - Pascal Muetschard + - James Murphy - Julian Møller - ndogxj - n3rdopolis diff --git a/README.md b/README.md index 5e75122e..3fd1a353 100644 --- a/README.md +++ b/README.md @@ -343,6 +343,8 @@ information on what to include when reporting a bug. - [Wayland] Bugfix: A window content scale event would be emitted every time the window resized - [Wayland] Bugfix: If `glfwInit` failed it would close stdin + - [Wayland] Bugfix: Manual resizing with fallback decorations behaved erratically + (#1991,#2115,#2127) - [POSIX] Removed use of deprecated function `gettimeofday` - [POSIX] Bugfix: `CLOCK_MONOTONIC` was not correctly tested for or enabled - [WGL] Disabled the DWM swap interval hack for Windows 8 and later (#1072) diff --git a/src/wl_window.c b/src/wl_window.c index f3c7aab4..900aae2a 100644 --- a/src/wl_window.c +++ b/src/wl_window.c @@ -495,8 +495,17 @@ static void xdgToplevelHandleConfigure(void* userData, if (width && height) { - window->wl.pending.width = width; - window->wl.pending.height = height; + if (window->wl.decorations.top.surface) + { + window->wl.pending.width = _glfw_max(0, width - GLFW_BORDER_SIZE * 2); + window->wl.pending.height = + _glfw_max(0, height - GLFW_BORDER_SIZE - GLFW_CAPTION_HEIGHT); + } + else + { + window->wl.pending.width = width; + window->wl.pending.height = height; + } } else { From a7b6f355008237c28faad86c2188cc5f132aec64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Sun, 12 Jun 2022 21:36:26 +0200 Subject: [PATCH 027/117] Wayland: Fix size limits for fallback decorations The size limits set on our XDG surface did not include the sizes of the fallback decorations on all sides, when in use. This led to its content area being too small. Related to #2127 --- README.md | 1 + src/wl_window.c | 53 ++++++++++++++++++++++++++++++++++++++++++------- 2 files changed, 47 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 3fd1a353..6a76c298 100644 --- a/README.md +++ b/README.md @@ -345,6 +345,7 @@ information on what to include when reporting a bug. - [Wayland] Bugfix: If `glfwInit` failed it would close stdin - [Wayland] Bugfix: Manual resizing with fallback decorations behaved erratically (#1991,#2115,#2127) + - [Wayland] Bugfix: Size limits included frame size for fallback decorations - [POSIX] Removed use of deprecated function `gettimeofday` - [POSIX] Bugfix: `CLOCK_MONOTONIC` was not correctly tested for or enabled - [WGL] Disabled the DWM swap interval hack for Windows 8 and later (#1072) diff --git a/src/wl_window.c b/src/wl_window.c index 900aae2a..a32ccfb6 100644 --- a/src/wl_window.c +++ b/src/wl_window.c @@ -617,13 +617,6 @@ static GLFWbool createXdgSurface(_GLFWwindow* window) if (window->wl.title) xdg_toplevel_set_title(window->wl.xdg.toplevel, window->wl.title); - if (window->minwidth != GLFW_DONT_CARE && window->minheight != GLFW_DONT_CARE) - xdg_toplevel_set_min_size(window->wl.xdg.toplevel, - window->minwidth, window->minheight); - if (window->maxwidth != GLFW_DONT_CARE && window->maxheight != GLFW_DONT_CARE) - xdg_toplevel_set_max_size(window->wl.xdg.toplevel, - window->maxwidth, window->maxheight); - if (window->monitor) { xdg_toplevel_set_fullscreen(window->wl.xdg.toplevel, @@ -642,6 +635,34 @@ static GLFWbool createXdgSurface(_GLFWwindow* window) setXdgDecorations(window); } + if (window->minwidth != GLFW_DONT_CARE && window->minheight != GLFW_DONT_CARE) + { + int minwidth = window->minwidth; + int minheight = window->minheight; + + if (window->wl.decorations.top.surface) + { + minwidth += GLFW_BORDER_SIZE * 2; + minheight += GLFW_CAPTION_HEIGHT + GLFW_BORDER_SIZE; + } + + xdg_toplevel_set_min_size(window->wl.xdg.toplevel, minwidth, minheight); + } + + if (window->maxwidth != GLFW_DONT_CARE && window->maxheight != GLFW_DONT_CARE) + { + int maxwidth = window->maxwidth; + int maxheight = window->maxheight; + + if (window->wl.decorations.top.surface) + { + maxwidth += GLFW_BORDER_SIZE * 2; + maxheight += GLFW_CAPTION_HEIGHT + GLFW_BORDER_SIZE; + } + + xdg_toplevel_set_max_size(window->wl.xdg.toplevel, maxwidth, maxheight); + } + wl_surface_commit(window->wl.surface); wl_display_roundtrip(_glfw.wl.display); @@ -1877,8 +1898,26 @@ void _glfwSetWindowSizeLimitsWayland(_GLFWwindow* window, { if (minwidth == GLFW_DONT_CARE || minheight == GLFW_DONT_CARE) minwidth = minheight = 0; + else + { + if (window->wl.decorations.top.surface) + { + minwidth += GLFW_BORDER_SIZE * 2; + minheight += GLFW_CAPTION_HEIGHT + GLFW_BORDER_SIZE; + } + } + if (maxwidth == GLFW_DONT_CARE || maxheight == GLFW_DONT_CARE) maxwidth = maxheight = 0; + else + { + if (window->wl.decorations.top.surface) + { + maxwidth += GLFW_BORDER_SIZE * 2; + maxheight += GLFW_CAPTION_HEIGHT + GLFW_BORDER_SIZE; + } + } + xdg_toplevel_set_min_size(window->wl.xdg.toplevel, minwidth, minheight); xdg_toplevel_set_max_size(window->wl.xdg.toplevel, maxwidth, maxheight); wl_surface_commit(window->wl.surface); From 18df0baea60ed17d744eb4b714b8b9363776c0cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Sun, 12 Jun 2022 23:16:16 +0200 Subject: [PATCH 028/117] Wayland: Cleanup --- src/wl_window.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/wl_window.c b/src/wl_window.c index a32ccfb6..cdb36718 100644 --- a/src/wl_window.c +++ b/src/wl_window.c @@ -623,14 +623,11 @@ static GLFWbool createXdgSurface(_GLFWwindow* window) window->monitor->wl.output); setIdleInhibitor(window, GLFW_TRUE); } - else if (window->wl.maximized) - { - xdg_toplevel_set_maximized(window->wl.xdg.toplevel); - setIdleInhibitor(window, GLFW_FALSE); - setXdgDecorations(window); - } else { + if (window->wl.maximized) + xdg_toplevel_set_maximized(window->wl.xdg.toplevel); + setIdleInhibitor(window, GLFW_FALSE); setXdgDecorations(window); } From c28d420060a60d579e15afb812d5bd054891179a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Mon, 13 Jun 2022 15:12:52 +0200 Subject: [PATCH 029/117] Wayland: Remove duplicate fullscreen check This check is already performed in shared code. --- src/wl_window.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/wl_window.c b/src/wl_window.c index cdb36718..0fea1a10 100644 --- a/src/wl_window.c +++ b/src/wl_window.c @@ -2098,13 +2098,10 @@ void _glfwSetWindowResizableWayland(_GLFWwindow* window, GLFWbool enabled) void _glfwSetWindowDecoratedWayland(_GLFWwindow* window, GLFWbool enabled) { - if (!window->monitor) - { - if (enabled) - createDecorations(window); - else - destroyDecorations(window); - } + if (enabled) + createDecorations(window); + else + destroyDecorations(window); } void _glfwSetWindowFloatingWayland(_GLFWwindow* window, GLFWbool enabled) From 229d628ec47073c3778ba2e37c02c8d94140be77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Mon, 13 Jun 2022 19:37:34 +0200 Subject: [PATCH 030/117] Wayland: Fix toggling of server-side decorations This is a temporary local fix to have updates to GLFW_DECORATED mostly work as intended. The whole decoration state machine needs to be restructured, but not by this commit. --- README.md | 2 ++ src/wl_window.c | 20 +++++++++++++++++--- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 6a76c298..8f3f74d9 100644 --- a/README.md +++ b/README.md @@ -346,6 +346,8 @@ information on what to include when reporting a bug. - [Wayland] Bugfix: Manual resizing with fallback decorations behaved erratically (#1991,#2115,#2127) - [Wayland] Bugfix: Size limits included frame size for fallback decorations + - [Wayland] Bugfix: Updating `GLFW_DECORATED` had no effect on server-side + decorations - [POSIX] Removed use of deprecated function `gettimeofday` - [POSIX] Bugfix: `CLOCK_MONOTONIC` was not correctly tested for or enabled - [WGL] Disabled the DWM swap interval hack for Windows 8 and later (#1072) diff --git a/src/wl_window.c b/src/wl_window.c index 0fea1a10..82fcfcd2 100644 --- a/src/wl_window.c +++ b/src/wl_window.c @@ -2098,10 +2098,24 @@ void _glfwSetWindowResizableWayland(_GLFWwindow* window, GLFWbool enabled) void _glfwSetWindowDecoratedWayland(_GLFWwindow* window, GLFWbool enabled) { - if (enabled) - createDecorations(window); + if (window->wl.xdg.decoration) + { + uint32_t mode; + + if (enabled) + mode = ZXDG_TOPLEVEL_DECORATION_V1_MODE_SERVER_SIDE; + else + mode = ZXDG_TOPLEVEL_DECORATION_V1_MODE_CLIENT_SIDE; + + zxdg_toplevel_decoration_v1_set_mode(window->wl.xdg.decoration, mode); + } else - destroyDecorations(window); + { + if (enabled) + createDecorations(window); + else + destroyDecorations(window); + } } void _glfwSetWindowFloatingWayland(_GLFWwindow* window, GLFWbool enabled) From 33d37782c6551fe67c553dd077ad7ee79f1b76f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Tue, 14 Jun 2022 18:12:49 +0200 Subject: [PATCH 031/117] Wayland: Cleanup --- src/wl_init.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/wl_init.c b/src/wl_init.c index 867bf670..2ce6f7f9 100644 --- a/src/wl_init.c +++ b/src/wl_init.c @@ -184,11 +184,9 @@ static void registryHandleGlobalRemove(void* userData, struct wl_registry* registry, uint32_t name) { - _GLFWmonitor* monitor; - for (int i = 0; i < _glfw.monitorCount; ++i) { - monitor = _glfw.monitors[i]; + _GLFWmonitor* monitor = _glfw.monitors[i]; if (monitor->wl.name == name) { _glfwInputMonitor(monitor, GLFW_DISCONNECTED, 0); From 209f6cf0935412e067e6595790cf3d3d5866923d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Tue, 14 Jun 2022 18:20:56 +0200 Subject: [PATCH 032/117] Wayland: Add support for wl_output::name We now use wl_output::name as the GLFW monitor name, on compositors that provide this event. --- README.md | 1 + src/wl_monitor.c | 32 ++++++++++++++++++++++++++++++-- 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 8f3f74d9..07d2e547 100644 --- a/README.md +++ b/README.md @@ -298,6 +298,7 @@ information on what to include when reporting a bug. - [Wayland] Added dynamic loading of all Wayland libraries - [Wayland] Added support for key names via xkbcommon - [Wayland] Added support for file path drop events (#2040) + - [Wayland] Added support for more human-readable monitor names where available - [Wayland] Removed support for `wl_shell` (#1443) - [Wayland] Bugfix: The `GLFW_HAND_CURSOR` shape used the wrong image (#1432) - [Wayland] Bugfix: `CLOCK_MONOTONIC` was not correctly enabled diff --git a/src/wl_monitor.c b/src/wl_monitor.c index 96572f46..37712ad5 100644 --- a/src/wl_monitor.c +++ b/src/wl_monitor.c @@ -55,7 +55,8 @@ static void outputHandleGeometry(void* userData, monitor->widthMM = physicalWidth; monitor->heightMM = physicalHeight; - snprintf(monitor->name, sizeof(monitor->name), "%s %s", make, model); + if (strlen(monitor->name) == 0) + snprintf(monitor->name, sizeof(monitor->name), "%s %s", make, model); } static void outputHandleMode(void* userData, @@ -108,12 +109,33 @@ static void outputHandleScale(void* userData, monitor->wl.scale = factor; } +#ifdef WL_OUTPUT_NAME_SINCE_VERSION + +void outputHandleName(void* userData, struct wl_output* wl_output, const char* name) +{ + struct _GLFWmonitor* monitor = userData; + + strncpy(monitor->name, name, sizeof(monitor->name) - 1); +} + +void outputHandleDescription(void* userData, + struct wl_output* wl_output, + const char* description) +{ +} + +#endif // WL_OUTPUT_NAME_SINCE_VERSION + static const struct wl_output_listener outputListener = { outputHandleGeometry, outputHandleMode, outputHandleDone, outputHandleScale, +#ifdef WL_OUTPUT_NAME_SINCE_VERSION + outputHandleName, + outputHandleDescription, +#endif }; @@ -130,10 +152,16 @@ void _glfwAddOutputWayland(uint32_t name, uint32_t version) return; } +#ifdef WL_OUTPUT_NAME_SINCE_VERSION + version = _glfw_min(version, WL_OUTPUT_NAME_SINCE_VERSION); +#else + version = 2; +#endif + struct wl_output* output = wl_registry_bind(_glfw.wl.registry, name, &wl_output_interface, - 2); + version); if (!output) return; From c3ad3d49ed8b436582a6fbba1c3e64f97087e362 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Tue, 14 Jun 2022 18:44:24 +0200 Subject: [PATCH 033/117] Wayland: Fix duplicate monitor connection events GLFW would report a monitor as connected each time its wl_output received an update, for example if its scale changed. This would also cause the monitor to be added to the monitor array again, causing glfwTerminate to segfault when it attempted to destroy its already destroyed wl_output. --- README.md | 4 ++++ src/wl_monitor.c | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/README.md b/README.md index 07d2e547..70f94f13 100644 --- a/README.md +++ b/README.md @@ -349,6 +349,10 @@ information on what to include when reporting a bug. - [Wayland] Bugfix: Size limits included frame size for fallback decorations - [Wayland] Bugfix: Updating `GLFW_DECORATED` had no effect on server-side decorations + - [Wayland] Bugfix: A monitor would be reported as connected again if its scale + changed + - [Wayland] Bugfix: `glfwTerminate` would segfault if any monitor had changed + scale - [POSIX] Removed use of deprecated function `gettimeofday` - [POSIX] Bugfix: `CLOCK_MONOTONIC` was not correctly tested for or enabled - [WGL] Disabled the DWM swap interval hack for Windows 8 and later (#1072) diff --git a/src/wl_monitor.c b/src/wl_monitor.c index 37712ad5..c1afd016 100644 --- a/src/wl_monitor.c +++ b/src/wl_monitor.c @@ -97,6 +97,12 @@ static void outputHandleDone(void* userData, struct wl_output* output) monitor->heightMM = (int) (mode->height * 25.4f / 96.f); } + for (int i = 0; i < _glfw.monitorCount; i++) + { + if (_glfw.monitors[i] == monitor) + return; + } + _glfwInputMonitor(monitor, GLFW_CONNECTED, _GLFW_INSERT_LAST); } From e37ba80b1343f46d1b380fd3b9816e1260d8ee0a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Tue, 14 Jun 2022 18:46:47 +0200 Subject: [PATCH 034/117] Wayland: Fix reporting of monitor scale changes Content scale events would be emitted when a window surface entered or left an output, but not when one of a window's current outputs had its scale changed. --- README.md | 2 ++ src/wl_monitor.c | 12 ++++++++++++ src/wl_platform.h | 1 + src/wl_window.c | 6 +++--- 4 files changed, 18 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 70f94f13..ccc3eae6 100644 --- a/README.md +++ b/README.md @@ -353,6 +353,8 @@ information on what to include when reporting a bug. changed - [Wayland] Bugfix: `glfwTerminate` would segfault if any monitor had changed scale + - [Wayland] Bugfix: Window content scale events were not emitted when monitor + scale changed - [POSIX] Removed use of deprecated function `gettimeofday` - [POSIX] Bugfix: `CLOCK_MONOTONIC` was not correctly tested for or enabled - [WGL] Disabled the DWM swap interval hack for Windows 8 and later (#1072) diff --git a/src/wl_monitor.c b/src/wl_monitor.c index c1afd016..336681fd 100644 --- a/src/wl_monitor.c +++ b/src/wl_monitor.c @@ -113,6 +113,18 @@ static void outputHandleScale(void* userData, struct _GLFWmonitor* monitor = userData; monitor->wl.scale = factor; + + for (_GLFWwindow* window = _glfw.windowListHead; window; window = window->next) + { + for (int i = 0; i < window->wl.monitorsCount; i++) + { + if (window->wl.monitors[i] == monitor) + { + _glfwUpdateContentScaleWayland(window); + break; + } + } + } } #ifdef WL_OUTPUT_NAME_SINCE_VERSION diff --git a/src/wl_platform.h b/src/wl_platform.h index 7c66c736..03acb261 100644 --- a/src/wl_platform.h +++ b/src/wl_platform.h @@ -507,6 +507,7 @@ GLFWbool _glfwGetGammaRampWayland(_GLFWmonitor* monitor, GLFWgammaramp* ramp); void _glfwSetGammaRampWayland(_GLFWmonitor* monitor, const GLFWgammaramp* ramp); void _glfwAddOutputWayland(uint32_t name, uint32_t version); +void _glfwUpdateContentScaleWayland(_GLFWwindow* window); GLFWbool _glfwInputTextWayland(_GLFWwindow* window, uint32_t scancode); void _glfwAddSeatListenerWayland(struct wl_seat* seat); diff --git a/src/wl_window.c b/src/wl_window.c index 82fcfcd2..73938e90 100644 --- a/src/wl_window.c +++ b/src/wl_window.c @@ -334,7 +334,7 @@ static void resizeWindow(_GLFWwindow* window) wl_surface_commit(window->wl.decorations.bottom.surface); } -static void checkScaleChange(_GLFWwindow* window) +void _glfwUpdateContentScaleWayland(_GLFWwindow* window) { if (_glfw.wl.compositorVersion < WL_SURFACE_SET_BUFFER_SCALE_SINCE_VERSION) return; @@ -372,7 +372,7 @@ static void surfaceHandleEnter(void* userData, window->wl.monitors[window->wl.monitorsCount++] = monitor; - checkScaleChange(window); + _glfwUpdateContentScaleWayland(window); } static void surfaceHandleLeave(void* userData, @@ -392,7 +392,7 @@ static void surfaceHandleLeave(void* userData, } window->wl.monitors[--window->wl.monitorsCount] = NULL; - checkScaleChange(window); + _glfwUpdateContentScaleWayland(window); } static const struct wl_surface_listener surfaceListener = From 91f18fb57697c57bf9da64ad546eed5c60518618 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Tue, 14 Jun 2022 20:37:31 +0200 Subject: [PATCH 035/117] Wayland: Fix error from glfwSetWindowAspectRatio The aspect ratio was applied during resize but any call to glfwSetWindowAspectRatio emitted a GLFW_FEATURE_UNIMPLEMENTED error. --- README.md | 2 ++ src/wl_window.c | 18 ++++++++++++++---- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index ccc3eae6..6a10ae5c 100644 --- a/README.md +++ b/README.md @@ -355,6 +355,8 @@ information on what to include when reporting a bug. scale - [Wayland] Bugfix: Window content scale events were not emitted when monitor scale changed + - [Wayland] Bugfix: `glfwSetWindowAspectRatio` reported an error instead of + applying the specified ratio - [POSIX] Removed use of deprecated function `gettimeofday` - [POSIX] Bugfix: `CLOCK_MONOTONIC` was not correctly tested for or enabled - [WGL] Disabled the DWM swap interval hack for Windows 8 and later (#1072) diff --git a/src/wl_window.c b/src/wl_window.c index 73938e90..f3dd2de1 100644 --- a/src/wl_window.c +++ b/src/wl_window.c @@ -1923,10 +1923,20 @@ void _glfwSetWindowSizeLimitsWayland(_GLFWwindow* window, void _glfwSetWindowAspectRatioWayland(_GLFWwindow* window, int numer, int denom) { - // TODO: find out how to trigger a resize. - // The actual limits are checked in the xdg_toplevel::configure handler. - _glfwInputError(GLFW_FEATURE_UNIMPLEMENTED, - "Wayland: Window aspect ratio not yet implemented"); + if (window->wl.maximized || window->wl.fullscreen) + return; + + if (numer != GLFW_DONT_CARE && denom != GLFW_DONT_CARE) + { + const float aspectRatio = (float) window->wl.width / (float) window->wl.height; + const float targetRatio = (float) numer / (float) denom; + if (aspectRatio < targetRatio) + window->wl.height = window->wl.width / targetRatio; + else if (aspectRatio > targetRatio) + window->wl.width = window->wl.height * targetRatio; + + resizeWindow(window); + } } void _glfwGetFramebufferSizeWayland(_GLFWwindow* window, int* width, int* height) From 5002522f7340e2ffb5fae07690b6091cb13ee960 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Tue, 14 Jun 2022 22:22:49 +0200 Subject: [PATCH 036/117] Wayland: Cleanup Make Wayland code use 'native' in the same senses as the rest of GLFW. --- src/wl_platform.h | 5 ++++- src/wl_window.c | 24 ++++++++++++------------ 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/src/wl_platform.h b/src/wl_platform.h index 03acb261..6f092136 100644 --- a/src/wl_platform.h +++ b/src/wl_platform.h @@ -233,9 +233,12 @@ typedef struct _GLFWwindowWayland GLFWbool hovered; GLFWbool transparent; struct wl_surface* surface; - struct wl_egl_window* native; struct wl_callback* callback; + struct { + struct wl_egl_window* window; + } egl; + struct { int width, height; } pending; diff --git a/src/wl_window.c b/src/wl_window.c index f3dd2de1..74f4adfb 100644 --- a/src/wl_window.c +++ b/src/wl_window.c @@ -305,7 +305,7 @@ static void resizeWindow(_GLFWwindow* window) int scale = window->wl.scale; int scaledWidth = window->wl.width * scale; int scaledHeight = window->wl.height * scale; - wl_egl_window_resize(window->wl.native, scaledWidth, scaledHeight, 0, 0); + wl_egl_window_resize(window->wl.egl.window, scaledWidth, scaledHeight, 0, 0); if (!window->wl.transparent) setOpaqueRegion(window); _glfwInputFramebufferSize(window, scaledWidth, scaledHeight); @@ -666,9 +666,9 @@ static GLFWbool createXdgSurface(_GLFWwindow* window) return GLFW_TRUE; } -static GLFWbool createSurface(_GLFWwindow* window, - const _GLFWwndconfig* wndconfig, - const _GLFWfbconfig* fbconfig) +static GLFWbool createNativeSurface(_GLFWwindow* window, + const _GLFWwndconfig* wndconfig, + const _GLFWfbconfig* fbconfig) { window->wl.surface = wl_compositor_create_surface(_glfw.wl.compositor); if (!window->wl.surface) @@ -680,10 +680,10 @@ static GLFWbool createSurface(_GLFWwindow* window, wl_surface_set_user_data(window->wl.surface, window); - window->wl.native = wl_egl_window_create(window->wl.surface, - wndconfig->width, - wndconfig->height); - if (!window->wl.native) + window->wl.egl.window = wl_egl_window_create(window->wl.surface, + wndconfig->width, + wndconfig->height); + if (!window->wl.egl.window) return GLFW_FALSE; window->wl.width = wndconfig->width; @@ -1759,7 +1759,7 @@ GLFWbool _glfwCreateWindowWayland(_GLFWwindow* window, const _GLFWctxconfig* ctxconfig, const _GLFWfbconfig* fbconfig) { - if (!createSurface(window, wndconfig, fbconfig)) + if (!createNativeSurface(window, wndconfig, fbconfig)) return GLFW_FALSE; if (ctxconfig->client != GLFW_NO_API) @@ -1816,8 +1816,8 @@ void _glfwDestroyWindowWayland(_GLFWwindow* window) if (window->wl.decorations.buffer) wl_buffer_destroy(window->wl.decorations.buffer); - if (window->wl.native) - wl_egl_window_destroy(window->wl.native); + if (window->wl.egl.window) + wl_egl_window_destroy(window->wl.egl.window); if (window->wl.xdg.toplevel) xdg_toplevel_destroy(window->wl.xdg.toplevel); @@ -2707,7 +2707,7 @@ EGLNativeDisplayType _glfwGetEGLNativeDisplayWayland(void) EGLNativeWindowType _glfwGetEGLNativeWindowWayland(_GLFWwindow* window) { - return window->wl.native; + return window->wl.egl.window; } void _glfwGetRequiredInstanceExtensionsWayland(char** extensions) From 9ad9f5c52a9e89c598d39ffaa918106c1a096e7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Tue, 14 Jun 2022 22:28:05 +0200 Subject: [PATCH 037/117] Wayland: Fix missing error reporting --- src/wl_window.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/wl_window.c b/src/wl_window.c index 74f4adfb..14ea103b 100644 --- a/src/wl_window.c +++ b/src/wl_window.c @@ -672,7 +672,10 @@ static GLFWbool createNativeSurface(_GLFWwindow* window, { window->wl.surface = wl_compositor_create_surface(_glfw.wl.compositor); if (!window->wl.surface) + { + _glfwInputError(GLFW_PLATFORM_ERROR, "Wayland: Failed to create window surface"); return GLFW_FALSE; + } wl_surface_add_listener(window->wl.surface, &surfaceListener, @@ -684,7 +687,10 @@ static GLFWbool createNativeSurface(_GLFWwindow* window, wndconfig->width, wndconfig->height); if (!window->wl.egl.window) + { + _glfwInputError(GLFW_PLATFORM_ERROR, "Wayland: Failed to create EGL window"); return GLFW_FALSE; + } window->wl.width = wndconfig->width; window->wl.height = wndconfig->height; From 85f5a51912c3329137377cd2ba0f0a7a34887ed7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Wed, 15 Jun 2022 17:57:54 +0200 Subject: [PATCH 038/117] Wayland: Fix events emitted before ack_configure Window iconfication and maximization events were being emitted before xdg_surface::configure, making it possible for user code to indirectly commit surface changes from those event callbacks before xdg_surface::ack_configure. This postpones those events until after the ack has been sent. --- src/wl_platform.h | 4 ++++ src/wl_window.c | 51 ++++++++++++++++++++++++++--------------------- 2 files changed, 32 insertions(+), 23 deletions(-) diff --git a/src/wl_platform.h b/src/wl_platform.h index 6f092136..d8d94822 100644 --- a/src/wl_platform.h +++ b/src/wl_platform.h @@ -241,6 +241,10 @@ typedef struct _GLFWwindowWayland struct { int width, height; + GLFWbool maximized; + GLFWbool iconified; + GLFWbool activated; + GLFWbool fullscreen; } pending; struct { diff --git a/src/wl_window.c b/src/wl_window.c index 14ea103b..53175699 100644 --- a/src/wl_window.c +++ b/src/wl_window.c @@ -456,43 +456,29 @@ static void xdgToplevelHandleConfigure(void* userData, { _GLFWwindow* window = userData; uint32_t* state; - GLFWbool maximized = GLFW_FALSE; - GLFWbool fullscreen = GLFW_FALSE; - GLFWbool activated = GLFW_FALSE; + + window->wl.pending.activated = GLFW_FALSE; + window->wl.pending.maximized = GLFW_FALSE; + window->wl.pending.fullscreen = GLFW_FALSE; wl_array_for_each(state, states) { switch (*state) { case XDG_TOPLEVEL_STATE_MAXIMIZED: - maximized = GLFW_TRUE; + window->wl.pending.maximized = GLFW_TRUE; break; case XDG_TOPLEVEL_STATE_FULLSCREEN: - fullscreen = GLFW_TRUE; + window->wl.pending.fullscreen = GLFW_TRUE; break; case XDG_TOPLEVEL_STATE_RESIZING: break; case XDG_TOPLEVEL_STATE_ACTIVATED: - activated = GLFW_TRUE; + window->wl.pending.activated = GLFW_TRUE; break; } } - if (window->wl.activated && !activated) - { - if (window->monitor && window->autoIconify) - _glfwIconifyWindowWayland(window); - } - - if (window->wl.maximized && !maximized) - _glfwInputWindowMaximize(window, GLFW_FALSE); - else if (maximized && !window->wl.maximized) - _glfwInputWindowMaximize(window, GLFW_TRUE); - - window->wl.activated = activated; - window->wl.maximized = maximized; - window->wl.fullscreen = fullscreen; - if (width && height) { if (window->wl.decorations.top.surface) @@ -532,11 +518,30 @@ static void xdgSurfaceHandleConfigure(void* userData, uint32_t serial) { _GLFWwindow* window = userData; - int width = window->wl.pending.width; - int height = window->wl.pending.height; xdg_surface_ack_configure(surface, serial); + if (window->wl.activated != window->wl.pending.activated) + { + window->wl.activated = window->wl.pending.activated; + if (!window->wl.activated) + { + if (window->monitor && window->autoIconify) + xdg_toplevel_set_minimized(window->wl.xdg.toplevel); + } + } + + if (window->wl.maximized != window->wl.pending.maximized) + { + window->wl.maximized = window->wl.pending.maximized; + _glfwInputWindowMaximize(window, window->wl.maximized); + } + + window->wl.fullscreen = window->wl.pending.fullscreen; + + int width = window->wl.pending.width; + int height = window->wl.pending.height; + if (!window->wl.maximized && !window->wl.fullscreen) { if (window->numer != GLFW_DONT_CARE && window->denom != GLFW_DONT_CARE) From 203002ef2c6a8518138eed981ba1e95cfe59c59c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Wed, 15 Jun 2022 14:12:32 +0200 Subject: [PATCH 039/117] Wayland: Fix latent bug for glfwGetWindowTitle --- src/wl_window.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/wl_window.c b/src/wl_window.c index 53175699..cc4a75bd 100644 --- a/src/wl_window.c +++ b/src/wl_window.c @@ -1845,9 +1845,10 @@ void _glfwDestroyWindowWayland(_GLFWwindow* window) void _glfwSetWindowTitleWayland(_GLFWwindow* window, const char* title) { - if (window->wl.title) - _glfw_free(window->wl.title); - window->wl.title = _glfw_strdup(title); + char* copy = _glfw_strdup(title); + _glfw_free(window->wl.title); + window->wl.title = copy; + if (window->wl.xdg.toplevel) xdg_toplevel_set_title(window->wl.xdg.toplevel, title); } From 55fcfb1bb642485b1c14fa8e20388fa2ac9fb8c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Wed, 15 Jun 2022 14:39:30 +0200 Subject: [PATCH 040/117] Wayland: Fix error for setting GLFW_FLOATING --- src/wl_window.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/wl_window.c b/src/wl_window.c index cc4a75bd..19a493a3 100644 --- a/src/wl_window.c +++ b/src/wl_window.c @@ -2142,9 +2142,8 @@ void _glfwSetWindowDecoratedWayland(_GLFWwindow* window, GLFWbool enabled) void _glfwSetWindowFloatingWayland(_GLFWwindow* window, GLFWbool enabled) { - // TODO - _glfwInputError(GLFW_FEATURE_UNIMPLEMENTED, - "Wayland: Window attribute setting not implemented yet"); + _glfwInputError(GLFW_FEATURE_UNAVAILABLE, + "Wayland: Platform does not support making a window floating"); } void _glfwSetWindowMousePassthroughWayland(_GLFWwindow* window, GLFWbool enabled) From e52046955d551a1a07bd213f5ada657f83a49fcb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Wed, 15 Jun 2022 14:41:46 +0200 Subject: [PATCH 041/117] Wayland: Cleanup --- src/wl_window.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/wl_window.c b/src/wl_window.c index 19a493a3..e25c1048 100644 --- a/src/wl_window.c +++ b/src/wl_window.c @@ -2156,6 +2156,7 @@ void _glfwSetWindowMousePassthroughWayland(_GLFWwindow* window, GLFWbool enabled } else wl_surface_set_input_region(window->wl.surface, 0); + wl_surface_commit(window->wl.surface); } From 77819c0c549fa9c1aa40ff74289bd7cfae61f296 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Wed, 15 Jun 2022 18:20:16 +0200 Subject: [PATCH 042/117] Wayland: Fix maximized state lost while hidden If a window was created as maximized, or created as hidden and then iconified or maximized before first being shown, that state was lost and the window was shown as restored. --- README.md | 2 ++ src/wl_window.c | 10 ++++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 6a10ae5c..d4a60417 100644 --- a/README.md +++ b/README.md @@ -357,6 +357,8 @@ information on what to include when reporting a bug. scale changed - [Wayland] Bugfix: `glfwSetWindowAspectRatio` reported an error instead of applying the specified ratio + - [Wayland] Bugfix: `GLFW_MAXIMIZED` window hint had no effect + - [Wayland] Bugfix: `glfwRestoreWindow` had no effect before first show - [POSIX] Removed use of deprecated function `gettimeofday` - [POSIX] Bugfix: `CLOCK_MONOTONIC` was not correctly tested for or enabled - [WGL] Disabled the DWM swap interval hack for Windows 8 and later (#1072) diff --git a/src/wl_window.c b/src/wl_window.c index e25c1048..efad74d9 100644 --- a/src/wl_window.c +++ b/src/wl_window.c @@ -702,6 +702,8 @@ static GLFWbool createNativeSurface(_GLFWwindow* window, window->wl.scale = 1; window->wl.title = _glfw_strdup(wndconfig->title); + window->wl.maximized = wndconfig->maximized; + window->wl.transparent = fbconfig->transparent; if (!window->wl.transparent) setOpaqueRegion(window); @@ -2003,10 +2005,12 @@ void _glfwRestoreWindowWayland(_GLFWwindow* window) { // We assume we are not minimized and acto only on maximization - if (window->wl.xdg.toplevel) + if (window->wl.maximized) { - if (window->wl.maximized) + if (window->wl.xdg.toplevel) xdg_toplevel_unset_maximized(window->wl.xdg.toplevel); + else + window->wl.maximized = GLFW_FALSE; } } } @@ -2015,6 +2019,8 @@ void _glfwMaximizeWindowWayland(_GLFWwindow* window) { if (window->wl.xdg.toplevel) xdg_toplevel_set_maximized(window->wl.xdg.toplevel); + else + window->wl.maximized = GLFW_TRUE; } void _glfwShowWindowWayland(_GLFWwindow* window) From 0cd1916de39b67878ae178f211921e5606c4485d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Wed, 15 Jun 2022 20:16:40 +0200 Subject: [PATCH 043/117] Wayland: Remove function only called once --- src/wl_window.c | 40 ++++++++++++++++++---------------------- 1 file changed, 18 insertions(+), 22 deletions(-) diff --git a/src/wl_window.c b/src/wl_window.c index efad74d9..d9fc1b4f 100644 --- a/src/wl_window.c +++ b/src/wl_window.c @@ -571,27 +571,6 @@ static const struct xdg_surface_listener xdgSurfaceListener = xdgSurfaceHandleConfigure }; -static void setXdgDecorations(_GLFWwindow* window) -{ - if (_glfw.wl.decorationManager) - { - window->wl.xdg.decoration = - zxdg_decoration_manager_v1_get_toplevel_decoration( - _glfw.wl.decorationManager, window->wl.xdg.toplevel); - zxdg_toplevel_decoration_v1_add_listener(window->wl.xdg.decoration, - &xdgDecorationListener, - window); - zxdg_toplevel_decoration_v1_set_mode( - window->wl.xdg.decoration, - ZXDG_TOPLEVEL_DECORATION_V1_MODE_SERVER_SIDE); - } - else - { - window->wl.decorations.serverSide = GLFW_FALSE; - createDecorations(window); - } -} - static GLFWbool createXdgSurface(_GLFWwindow* window) { window->wl.xdg.surface = xdg_wm_base_get_xdg_surface(_glfw.wl.wmBase, @@ -634,7 +613,24 @@ static GLFWbool createXdgSurface(_GLFWwindow* window) xdg_toplevel_set_maximized(window->wl.xdg.toplevel); setIdleInhibitor(window, GLFW_FALSE); - setXdgDecorations(window); + + if (_glfw.wl.decorationManager) + { + window->wl.xdg.decoration = + zxdg_decoration_manager_v1_get_toplevel_decoration( + _glfw.wl.decorationManager, window->wl.xdg.toplevel); + zxdg_toplevel_decoration_v1_add_listener(window->wl.xdg.decoration, + &xdgDecorationListener, + window); + zxdg_toplevel_decoration_v1_set_mode( + window->wl.xdg.decoration, + ZXDG_TOPLEVEL_DECORATION_V1_MODE_SERVER_SIDE); + } + else + { + window->wl.decorations.serverSide = GLFW_FALSE; + createDecorations(window); + } } if (window->minwidth != GLFW_DONT_CARE && window->minheight != GLFW_DONT_CARE) From eb9c3bee71edd2f72cf212105cb8a9ff5c77a673 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Mon, 20 Jun 2022 00:27:04 +0200 Subject: [PATCH 044/117] Wayland: Rename fallback decoration functions We are soon going to have three kinds of decorations; XDG, libdecor and our last resort fallback ones. --- src/wl_window.c | 70 ++++++++++++++++++++++++------------------------- 1 file changed, 35 insertions(+), 35 deletions(-) diff --git a/src/wl_window.c b/src/wl_window.c index d9fc1b4f..a83bde1b 100644 --- a/src/wl_window.c +++ b/src/wl_window.c @@ -192,11 +192,11 @@ static struct wl_buffer* createShmBuffer(const GLFWimage* image) return buffer; } -static void createDecoration(_GLFWdecorationWayland* decoration, - struct wl_surface* parent, - struct wl_buffer* buffer, - int x, int y, - int width, int height) +static void createFallbackDecoration(_GLFWdecorationWayland* decoration, + struct wl_surface* parent, + struct wl_buffer* buffer, + int x, int y, + int width, int height) { decoration->surface = wl_compositor_create_surface(_glfw.wl.compositor); decoration->subsurface = @@ -215,7 +215,7 @@ static void createDecoration(_GLFWdecorationWayland* decoration, wl_region_destroy(region); } -static void createDecorations(_GLFWwindow* window) +static void createFallbackDecorations(_GLFWwindow* window) { unsigned char data[] = { 224, 224, 224, 255 }; const GLFWimage image = { 1, 1, data }; @@ -228,25 +228,25 @@ static void createDecorations(_GLFWwindow* window) if (!window->wl.decorations.buffer) return; - createDecoration(&window->wl.decorations.top, window->wl.surface, - window->wl.decorations.buffer, - 0, -GLFW_CAPTION_HEIGHT, - window->wl.width, GLFW_CAPTION_HEIGHT); - createDecoration(&window->wl.decorations.left, window->wl.surface, - window->wl.decorations.buffer, - -GLFW_BORDER_SIZE, -GLFW_CAPTION_HEIGHT, - GLFW_BORDER_SIZE, window->wl.height + GLFW_CAPTION_HEIGHT); - createDecoration(&window->wl.decorations.right, window->wl.surface, - window->wl.decorations.buffer, - window->wl.width, -GLFW_CAPTION_HEIGHT, - GLFW_BORDER_SIZE, window->wl.height + GLFW_CAPTION_HEIGHT); - createDecoration(&window->wl.decorations.bottom, window->wl.surface, - window->wl.decorations.buffer, - -GLFW_BORDER_SIZE, window->wl.height, - window->wl.width + GLFW_BORDER_SIZE * 2, GLFW_BORDER_SIZE); + createFallbackDecoration(&window->wl.decorations.top, window->wl.surface, + window->wl.decorations.buffer, + 0, -GLFW_CAPTION_HEIGHT, + window->wl.width, GLFW_CAPTION_HEIGHT); + createFallbackDecoration(&window->wl.decorations.left, window->wl.surface, + window->wl.decorations.buffer, + -GLFW_BORDER_SIZE, -GLFW_CAPTION_HEIGHT, + GLFW_BORDER_SIZE, window->wl.height + GLFW_CAPTION_HEIGHT); + createFallbackDecoration(&window->wl.decorations.right, window->wl.surface, + window->wl.decorations.buffer, + window->wl.width, -GLFW_CAPTION_HEIGHT, + GLFW_BORDER_SIZE, window->wl.height + GLFW_CAPTION_HEIGHT); + createFallbackDecoration(&window->wl.decorations.bottom, window->wl.surface, + window->wl.decorations.buffer, + -GLFW_BORDER_SIZE, window->wl.height, + window->wl.width + GLFW_BORDER_SIZE * 2, GLFW_BORDER_SIZE); } -static void destroyDecoration(_GLFWdecorationWayland* decoration) +static void destroyFallbackDecoration(_GLFWdecorationWayland* decoration) { if (decoration->subsurface) wl_subsurface_destroy(decoration->subsurface); @@ -259,12 +259,12 @@ static void destroyDecoration(_GLFWdecorationWayland* decoration) decoration->viewport = NULL; } -static void destroyDecorations(_GLFWwindow* window) +static void destroyFallbackDecorations(_GLFWwindow* window) { - destroyDecoration(&window->wl.decorations.top); - destroyDecoration(&window->wl.decorations.left); - destroyDecoration(&window->wl.decorations.right); - destroyDecoration(&window->wl.decorations.bottom); + destroyFallbackDecoration(&window->wl.decorations.top); + destroyFallbackDecoration(&window->wl.decorations.left); + destroyFallbackDecoration(&window->wl.decorations.right); + destroyFallbackDecoration(&window->wl.decorations.bottom); } static void xdgDecorationHandleConfigure(void* userData, @@ -276,7 +276,7 @@ static void xdgDecorationHandleConfigure(void* userData, window->wl.decorations.serverSide = (mode == ZXDG_TOPLEVEL_DECORATION_V1_MODE_SERVER_SIDE); if (!window->wl.decorations.serverSide) - createDecorations(window); + createFallbackDecorations(window); } static const struct zxdg_toplevel_decoration_v1_listener xdgDecorationListener = @@ -432,7 +432,7 @@ static void acquireMonitor(_GLFWwindow* window) setIdleInhibitor(window, GLFW_TRUE); if (!window->wl.decorations.serverSide) - destroyDecorations(window); + destroyFallbackDecorations(window); } // Remove the window and restore the original video mode @@ -445,7 +445,7 @@ static void releaseMonitor(_GLFWwindow* window) setIdleInhibitor(window, GLFW_FALSE); if (!_glfw.wl.decorationManager) - createDecorations(window); + createFallbackDecorations(window); } static void xdgToplevelHandleConfigure(void* userData, @@ -629,7 +629,7 @@ static GLFWbool createXdgSurface(_GLFWwindow* window) else { window->wl.decorations.serverSide = GLFW_FALSE; - createDecorations(window); + createFallbackDecorations(window); } } @@ -1818,7 +1818,7 @@ void _glfwDestroyWindowWayland(_GLFWwindow* window) if (window->context.destroy) window->context.destroy(window); - destroyDecorations(window); + destroyFallbackDecorations(window); if (window->wl.xdg.decoration) zxdg_toplevel_decoration_v1_destroy(window->wl.xdg.decoration); @@ -2136,9 +2136,9 @@ void _glfwSetWindowDecoratedWayland(_GLFWwindow* window, GLFWbool enabled) else { if (enabled) - createDecorations(window); + createFallbackDecorations(window); else - destroyDecorations(window); + destroyFallbackDecorations(window); } } From 83a134a92fa8642fe50c6e9b2400044e442d038a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Mon, 20 Jun 2022 00:43:24 +0200 Subject: [PATCH 045/117] Wayland: Fix mapping failure on wlroots compositor When showing a window that had already been shown once (and so already had its shell objects), GLFW would attach a new buffer and commit it before waiting for the next configure event. This was a violation of the XDG shell protocol. This was allowed to work as intended on GNOME and KDE without error. However wlroots based compositors would (correctly) emit an error. Unfortunately, I haven't been able to find a way to get both KDE, GNOME and Sway to send the configure event we need in order to map the wl_surface again while keeping our existing shell objects, so with this commit we now create them for each call to glfwShowWindow and destroy them for each call to glfwHideWindow. Fixes #1268 --- README.md | 2 ++ src/wl_window.c | 52 +++++++++++++++++++++++++++++++------------------ 2 files changed, 35 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index d4a60417..b58dbe76 100644 --- a/README.md +++ b/README.md @@ -359,6 +359,8 @@ information on what to include when reporting a bug. applying the specified ratio - [Wayland] Bugfix: `GLFW_MAXIMIZED` window hint had no effect - [Wayland] Bugfix: `glfwRestoreWindow` had no effect before first show + - [Wayland] Bugfix: Hiding and then showing a window caused program abort on + wlroots compositors (#1268) - [POSIX] Removed use of deprecated function `gettimeofday` - [POSIX] Bugfix: `CLOCK_MONOTONIC` was not correctly tested for or enabled - [WGL] Disabled the DWM swap interval hack for Windows 8 and later (#1072) diff --git a/src/wl_window.c b/src/wl_window.c index a83bde1b..8e61a70b 100644 --- a/src/wl_window.c +++ b/src/wl_window.c @@ -562,6 +562,14 @@ static void xdgSurfaceHandleConfigure(void* userData, resizeWindow(window); _glfwInputWindowSize(window, width, height); + + if (window->wl.visible) + _glfwInputWindowDamage(window); + } + + if (!window->wl.visible) + { + window->wl.visible = GLFW_TRUE; _glfwInputWindowDamage(window); } } @@ -571,7 +579,7 @@ static const struct xdg_surface_listener xdgSurfaceListener = xdgSurfaceHandleConfigure }; -static GLFWbool createXdgSurface(_GLFWwindow* window) +static GLFWbool createShellObjects(_GLFWwindow* window) { window->wl.xdg.surface = xdg_wm_base_get_xdg_surface(_glfw.wl.wmBase, window->wl.surface); @@ -667,6 +675,24 @@ static GLFWbool createXdgSurface(_GLFWwindow* window) return GLFW_TRUE; } +static void destroyShellObjects(_GLFWwindow* window) +{ + destroyFallbackDecorations(window); + + if (window->wl.xdg.decoration) + zxdg_toplevel_decoration_v1_destroy(window->wl.xdg.decoration); + + if (window->wl.xdg.toplevel) + xdg_toplevel_destroy(window->wl.xdg.toplevel); + + if (window->wl.xdg.surface) + xdg_surface_destroy(window->wl.xdg.surface); + + window->wl.xdg.decoration = NULL; + window->wl.xdg.toplevel = NULL; + window->wl.xdg.surface = NULL; +} + static GLFWbool createNativeSurface(_GLFWwindow* window, const _GLFWwndconfig* wndconfig, const _GLFWfbconfig* fbconfig) @@ -706,10 +732,8 @@ static GLFWbool createNativeSurface(_GLFWwindow* window, if (window->monitor || wndconfig->visible) { - if (!createXdgSurface(window)) + if (!createShellObjects(window)) return GLFW_FALSE; - - window->wl.visible = GLFW_TRUE; } return GLFW_TRUE; @@ -1818,9 +1842,7 @@ void _glfwDestroyWindowWayland(_GLFWwindow* window) if (window->context.destroy) window->context.destroy(window); - destroyFallbackDecorations(window); - if (window->wl.xdg.decoration) - zxdg_toplevel_decoration_v1_destroy(window->wl.xdg.decoration); + destroyShellObjects(window); if (window->wl.decorations.buffer) wl_buffer_destroy(window->wl.decorations.buffer); @@ -1828,12 +1850,6 @@ void _glfwDestroyWindowWayland(_GLFWwindow* window) if (window->wl.egl.window) wl_egl_window_destroy(window->wl.egl.window); - if (window->wl.xdg.toplevel) - xdg_toplevel_destroy(window->wl.xdg.toplevel); - - if (window->wl.xdg.surface) - xdg_surface_destroy(window->wl.xdg.surface); - if (window->wl.surface) wl_surface_destroy(window->wl.surface); @@ -2021,15 +2037,11 @@ void _glfwMaximizeWindowWayland(_GLFWwindow* window) void _glfwShowWindowWayland(_GLFWwindow* window) { - if (!window->wl.visible) + if (!window->wl.xdg.toplevel) { // NOTE: The XDG surface and role are created here so command-line applications // with off-screen windows do not appear in for example the Unity dock - if (!window->wl.xdg.toplevel) - createXdgSurface(window); - - window->wl.visible = GLFW_TRUE; - _glfwInputWindowDamage(window); + createShellObjects(window); } } @@ -2038,6 +2050,8 @@ void _glfwHideWindowWayland(_GLFWwindow* window) if (window->wl.visible) { window->wl.visible = GLFW_FALSE; + destroyShellObjects(window); + wl_surface_attach(window->wl.surface, NULL, 0, 0); wl_surface_commit(window->wl.surface); } From 2df0ce07faead09b1d305d30cf68d95c1145c37c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Mon, 20 Jun 2022 22:20:56 +0200 Subject: [PATCH 046/117] Wayland: Store and act on XDG decoration mode Refer to the XDG decoration mode (or the lack of one) directly instead of setting a boolean in a struct meant for the fallback decorations. This makes things a bit more verbose but is in preparation for a refactoring of all decoration paths. --- src/wl_platform.h | 2 +- src/wl_window.c | 16 +++++++--------- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/src/wl_platform.h b/src/wl_platform.h index d8d94822..b3d23da0 100644 --- a/src/wl_platform.h +++ b/src/wl_platform.h @@ -251,6 +251,7 @@ typedef struct _GLFWwindowWayland struct xdg_surface* surface; struct xdg_toplevel* toplevel; struct zxdg_toplevel_decoration_v1* decoration; + uint32_t decorationMode; } xdg; _GLFWcursor* currentCursor; @@ -273,7 +274,6 @@ typedef struct _GLFWwindowWayland struct zwp_idle_inhibitor_v1* idleInhibitor; struct { - GLFWbool serverSide; struct wl_buffer* buffer; _GLFWdecorationWayland top, left, right, bottom; int focus; diff --git a/src/wl_window.c b/src/wl_window.c index 8e61a70b..44f1df7b 100644 --- a/src/wl_window.c +++ b/src/wl_window.c @@ -220,7 +220,7 @@ static void createFallbackDecorations(_GLFWwindow* window) unsigned char data[] = { 224, 224, 224, 255 }; const GLFWimage image = { 1, 1, data }; - if (!_glfw.wl.viewporter || !window->decorated || window->wl.decorations.serverSide) + if (!_glfw.wl.viewporter || !window->decorated) return; if (!window->wl.decorations.buffer) @@ -273,9 +273,9 @@ static void xdgDecorationHandleConfigure(void* userData, { _GLFWwindow* window = userData; - window->wl.decorations.serverSide = (mode == ZXDG_TOPLEVEL_DECORATION_V1_MODE_SERVER_SIDE); + window->wl.xdg.decorationMode = mode; - if (!window->wl.decorations.serverSide) + if (mode == ZXDG_TOPLEVEL_DECORATION_V1_MODE_CLIENT_SIDE) createFallbackDecorations(window); } @@ -431,7 +431,7 @@ static void acquireMonitor(_GLFWwindow* window) setIdleInhibitor(window, GLFW_TRUE); - if (!window->wl.decorations.serverSide) + if (window->wl.decorations.top.surface) destroyFallbackDecorations(window); } @@ -444,7 +444,7 @@ static void releaseMonitor(_GLFWwindow* window) setIdleInhibitor(window, GLFW_FALSE); - if (!_glfw.wl.decorationManager) + if (window->wl.xdg.decorationMode != ZXDG_TOPLEVEL_DECORATION_V1_MODE_SERVER_SIDE) createFallbackDecorations(window); } @@ -635,10 +635,7 @@ static GLFWbool createShellObjects(_GLFWwindow* window) ZXDG_TOPLEVEL_DECORATION_V1_MODE_SERVER_SIDE); } else - { - window->wl.decorations.serverSide = GLFW_FALSE; createFallbackDecorations(window); - } } if (window->minwidth != GLFW_DONT_CARE && window->minheight != GLFW_DONT_CARE) @@ -689,6 +686,7 @@ static void destroyShellObjects(_GLFWwindow* window) xdg_surface_destroy(window->wl.xdg.surface); window->wl.xdg.decoration = NULL; + window->wl.xdg.decorationMode = 0; window->wl.xdg.toplevel = NULL; window->wl.xdg.surface = NULL; } @@ -1978,7 +1976,7 @@ void _glfwGetWindowFrameSizeWayland(_GLFWwindow* window, int* left, int* top, int* right, int* bottom) { - if (window->decorated && !window->monitor && !window->wl.decorations.serverSide) + if (window->decorated && !window->monitor && window->wl.decorations.top.surface) { if (top) *top = GLFW_CAPTION_HEIGHT; From 3203599cac774c4aa48dc17eb963f4a90c6d70ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Mon, 20 Jun 2022 22:21:41 +0200 Subject: [PATCH 047/117] Wayland: Fix map before XDG decoration configure If the xdg_toplevel has a decoration, we need to wait for its first configure event as well before we are allowed to attach the first buffer. It seems racy to assume that this will always happen inside the first surface configure sequence, so this commit makes that condition explicit. This may turn out to have been overly defensive. --- src/wl_window.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/wl_window.c b/src/wl_window.c index 44f1df7b..737274f7 100644 --- a/src/wl_window.c +++ b/src/wl_window.c @@ -569,8 +569,13 @@ static void xdgSurfaceHandleConfigure(void* userData, if (!window->wl.visible) { - window->wl.visible = GLFW_TRUE; - _glfwInputWindowDamage(window); + // Allow the window to be mapped only if it either has no XDG + // decorations or they have already received a configure event + if (!window->wl.xdg.decoration || window->wl.xdg.decorationMode) + { + window->wl.visible = GLFW_TRUE; + _glfwInputWindowDamage(window); + } } } From f35e2274cbf253b659e9847354fe72d7b45dcc9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Mon, 20 Jun 2022 22:36:23 +0200 Subject: [PATCH 048/117] Wayland: Fix GLFW_DECORATED for XDG decorations On a compositor that supports server-side decorations, they were always enabled in windowed mode, even if GLFW_DECORATED was cleared. --- README.md | 2 ++ src/wl_window.c | 12 +++++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index b58dbe76..be47a336 100644 --- a/README.md +++ b/README.md @@ -361,6 +361,8 @@ information on what to include when reporting a bug. - [Wayland] Bugfix: `glfwRestoreWindow` had no effect before first show - [Wayland] Bugfix: Hiding and then showing a window caused program abort on wlroots compositors (#1268) + - [Wayland] Bugfix: `GLFW_DECORATED` was ignored when showing a window with XDG + decorations - [POSIX] Removed use of deprecated function `gettimeofday` - [POSIX] Bugfix: `CLOCK_MONOTONIC` was not correctly tested for or enabled - [WGL] Disabled the DWM swap interval hack for Windows 8 and later (#1072) diff --git a/src/wl_window.c b/src/wl_window.c index 737274f7..a3d9601b 100644 --- a/src/wl_window.c +++ b/src/wl_window.c @@ -635,9 +635,15 @@ static GLFWbool createShellObjects(_GLFWwindow* window) zxdg_toplevel_decoration_v1_add_listener(window->wl.xdg.decoration, &xdgDecorationListener, window); - zxdg_toplevel_decoration_v1_set_mode( - window->wl.xdg.decoration, - ZXDG_TOPLEVEL_DECORATION_V1_MODE_SERVER_SIDE); + + uint32_t mode; + + if (window->decorated) + mode = ZXDG_TOPLEVEL_DECORATION_V1_MODE_SERVER_SIDE; + else + mode = ZXDG_TOPLEVEL_DECORATION_V1_MODE_CLIENT_SIDE; + + zxdg_toplevel_decoration_v1_set_mode(window->wl.xdg.decoration, mode); } else createFallbackDecorations(window); From 29b7669bc6a42de729a59abc96ce8849654751c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Mon, 20 Jun 2022 22:48:35 +0200 Subject: [PATCH 049/117] Wayland: Fix transition to server-side decorations --- src/wl_window.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/wl_window.c b/src/wl_window.c index a3d9601b..300dc571 100644 --- a/src/wl_window.c +++ b/src/wl_window.c @@ -277,6 +277,8 @@ static void xdgDecorationHandleConfigure(void* userData, if (mode == ZXDG_TOPLEVEL_DECORATION_V1_MODE_CLIENT_SIDE) createFallbackDecorations(window); + else + destroyFallbackDecorations(window); } static const struct zxdg_toplevel_decoration_v1_listener xdgDecorationListener = From 80dc0533cf7234517328537a54b7675f0588713c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Mon, 20 Jun 2022 22:57:18 +0200 Subject: [PATCH 050/117] Wayland: Use enum type to store enum value --- src/wl_platform.h | 2 +- src/wl_window.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/wl_platform.h b/src/wl_platform.h index b3d23da0..b85d79a5 100644 --- a/src/wl_platform.h +++ b/src/wl_platform.h @@ -276,7 +276,7 @@ typedef struct _GLFWwindowWayland struct { struct wl_buffer* buffer; _GLFWdecorationWayland top, left, right, bottom; - int focus; + _GLFWdecorationSideWayland focus; } decorations; } _GLFWwindowWayland; diff --git a/src/wl_window.c b/src/wl_window.c index 300dc571..bf646a21 100644 --- a/src/wl_window.c +++ b/src/wl_window.c @@ -976,9 +976,9 @@ static char* readDataOfferAsString(struct wl_data_offer* offer, const char* mime } static _GLFWwindow* findWindowFromDecorationSurface(struct wl_surface* surface, - int* which) + _GLFWdecorationSideWayland* which) { - int focus; + _GLFWdecorationSideWayland focus; _GLFWwindow* window = _glfw.windowListHead; if (!which) which = &focus; @@ -1020,7 +1020,7 @@ static void pointerHandleEnter(void* userData, if (!surface) return; - int focus = 0; + _GLFWdecorationSideWayland focus = mainWindow; _GLFWwindow* window = wl_surface_get_user_data(surface); if (!window) { From 47193f15de529b6e7c182168b1c17f29bda9de4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Tue, 21 Jun 2022 15:23:32 +0200 Subject: [PATCH 051/117] Wayland: Rename function to its purpose --- src/wl_window.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/wl_window.c b/src/wl_window.c index bf646a21..4b393756 100644 --- a/src/wl_window.c +++ b/src/wl_window.c @@ -287,7 +287,7 @@ static const struct zxdg_toplevel_decoration_v1_listener xdgDecorationListener = }; // Makes the surface considered as XRGB instead of ARGB. -static void setOpaqueRegion(_GLFWwindow* window) +static void setContentAreaOpaque(_GLFWwindow* window) { struct wl_region* region; @@ -309,7 +309,7 @@ static void resizeWindow(_GLFWwindow* window) int scaledHeight = window->wl.height * scale; wl_egl_window_resize(window->wl.egl.window, scaledWidth, scaledHeight, 0, 0); if (!window->wl.transparent) - setOpaqueRegion(window); + setContentAreaOpaque(window); _glfwInputFramebufferSize(window, scaledWidth, scaledHeight); if (!window->wl.decorations.top.surface) @@ -739,7 +739,7 @@ static GLFWbool createNativeSurface(_GLFWwindow* window, window->wl.transparent = fbconfig->transparent; if (!window->wl.transparent) - setOpaqueRegion(window); + setContentAreaOpaque(window); if (window->monitor || wndconfig->visible) { From be7f4513c05a45e6252f940408e139741a462986 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Tue, 21 Jun 2022 17:37:37 +0200 Subject: [PATCH 052/117] Wayland: Remove premature surface commit calls Note that the handling of configure events, acks and commits is still not ideal. This is just a small step in, hopefully, a good direction. Fullscreen toggling via glfwSetWindowMonitor now works on Weston, but mostly incidentally. --- src/wl_window.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/wl_window.c b/src/wl_window.c index 4b393756..fb576310 100644 --- a/src/wl_window.c +++ b/src/wl_window.c @@ -297,7 +297,6 @@ static void setContentAreaOpaque(_GLFWwindow* window) wl_region_add(region, 0, 0, window->wl.width, window->wl.height); wl_surface_set_opaque_region(window->wl.surface, region); - wl_surface_commit(window->wl.surface); wl_region_destroy(region); } @@ -2183,8 +2182,6 @@ void _glfwSetWindowMousePassthroughWayland(_GLFWwindow* window, GLFWbool enabled } else wl_surface_set_input_region(window->wl.surface, 0); - - wl_surface_commit(window->wl.surface); } float _glfwGetWindowOpacityWayland(_GLFWwindow* window) @@ -2247,7 +2244,6 @@ void _glfwSetCursorPosWayland(_GLFWwindow* window, double x, double y) zwp_locked_pointer_v1_set_cursor_position_hint( window->wl.pointerLock.lockedPointer, wl_fixed_from_double(x), wl_fixed_from_double(y)); - wl_surface_commit(window->wl.surface); } } From c4fbe80d90ac7f4bd2fc0f02afccdc4d45489cbf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Tue, 21 Jun 2022 19:37:35 +0200 Subject: [PATCH 053/117] Wayland: Make function behavior match name The logic that checks the decorated attribute belongs on the outside along with other related checks (fullscreen, monitor, decoration mode). --- src/wl_window.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/wl_window.c b/src/wl_window.c index fb576310..d131534e 100644 --- a/src/wl_window.c +++ b/src/wl_window.c @@ -220,7 +220,7 @@ static void createFallbackDecorations(_GLFWwindow* window) unsigned char data[] = { 224, 224, 224, 255 }; const GLFWimage image = { 1, 1, data }; - if (!_glfw.wl.viewporter || !window->decorated) + if (!_glfw.wl.viewporter) return; if (!window->wl.decorations.buffer) @@ -276,7 +276,10 @@ static void xdgDecorationHandleConfigure(void* userData, window->wl.xdg.decorationMode = mode; if (mode == ZXDG_TOPLEVEL_DECORATION_V1_MODE_CLIENT_SIDE) - createFallbackDecorations(window); + { + if (window->decorated) + createFallbackDecorations(window); + } else destroyFallbackDecorations(window); } @@ -446,7 +449,10 @@ static void releaseMonitor(_GLFWwindow* window) setIdleInhibitor(window, GLFW_FALSE); if (window->wl.xdg.decorationMode != ZXDG_TOPLEVEL_DECORATION_V1_MODE_SERVER_SIDE) - createFallbackDecorations(window); + { + if (window->decorated) + createFallbackDecorations(window); + } } static void xdgToplevelHandleConfigure(void* userData, @@ -647,7 +653,10 @@ static GLFWbool createShellObjects(_GLFWwindow* window) zxdg_toplevel_decoration_v1_set_mode(window->wl.xdg.decoration, mode); } else - createFallbackDecorations(window); + { + if (window->decorated) + createFallbackDecorations(window); + } } if (window->minwidth != GLFW_DONT_CARE && window->minheight != GLFW_DONT_CARE) From 74b4ceb8354bbe3eb4d225bcc07c4ed4023ca1f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Tue, 21 Jun 2022 19:48:28 +0200 Subject: [PATCH 054/117] Wayland: Cleanup This moves what is effectively showing the window to where that is done on other platforms, i.e. last in the platform CreateWindow function. --- src/wl_window.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/wl_window.c b/src/wl_window.c index d131534e..072b3ba7 100644 --- a/src/wl_window.c +++ b/src/wl_window.c @@ -749,12 +749,6 @@ static GLFWbool createNativeSurface(_GLFWwindow* window, if (!window->wl.transparent) setContentAreaOpaque(window); - if (window->monitor || wndconfig->visible) - { - if (!createShellObjects(window)) - return GLFW_FALSE; - } - return GLFW_TRUE; } @@ -1839,6 +1833,12 @@ GLFWbool _glfwCreateWindowWayland(_GLFWwindow* window, if (wndconfig->mousePassthrough) _glfwSetWindowMousePassthroughWayland(window, GLFW_TRUE); + if (window->monitor || wndconfig->visible) + { + if (!createShellObjects(window)) + return GLFW_FALSE; + } + return GLFW_TRUE; } From d578c2ddfeb6a31c532ddc29de289762745548d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Tue, 21 Jun 2022 19:52:39 +0200 Subject: [PATCH 055/117] Wayland: Only create EGL window if using EGL --- src/wl_window.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/src/wl_window.c b/src/wl_window.c index 072b3ba7..e33076bb 100644 --- a/src/wl_window.c +++ b/src/wl_window.c @@ -309,7 +309,9 @@ static void resizeWindow(_GLFWwindow* window) int scale = window->wl.scale; int scaledWidth = window->wl.width * scale; int scaledHeight = window->wl.height * scale; - wl_egl_window_resize(window->wl.egl.window, scaledWidth, scaledHeight, 0, 0); + + if (window->wl.egl.window) + wl_egl_window_resize(window->wl.egl.window, scaledWidth, scaledHeight, 0, 0); if (!window->wl.transparent) setContentAreaOpaque(window); _glfwInputFramebufferSize(window, scaledWidth, scaledHeight); @@ -729,15 +731,6 @@ static GLFWbool createNativeSurface(_GLFWwindow* window, wl_surface_set_user_data(window->wl.surface, window); - window->wl.egl.window = wl_egl_window_create(window->wl.surface, - wndconfig->width, - wndconfig->height); - if (!window->wl.egl.window) - { - _glfwInputError(GLFW_PLATFORM_ERROR, "Wayland: Failed to create EGL window"); - return GLFW_FALSE; - } - window->wl.width = wndconfig->width; window->wl.height = wndconfig->height; window->wl.scale = 1; @@ -1813,6 +1806,16 @@ GLFWbool _glfwCreateWindowWayland(_GLFWwindow* window, if (ctxconfig->source == GLFW_EGL_CONTEXT_API || ctxconfig->source == GLFW_NATIVE_CONTEXT_API) { + window->wl.egl.window = wl_egl_window_create(window->wl.surface, + wndconfig->width, + wndconfig->height); + if (!window->wl.egl.window) + { + _glfwInputError(GLFW_PLATFORM_ERROR, + "Wayland: Failed to create EGL window"); + return GLFW_FALSE; + } + if (!_glfwInitEGL()) return GLFW_FALSE; if (!_glfwCreateContextEGL(window, ctxconfig, fbconfig)) From da6713cd096a40a4512f468b34c189017e73f987 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Tue, 21 Jun 2022 20:50:48 +0200 Subject: [PATCH 056/117] Wayland: Do not decorate fullscreen windows If a fullscreen window with GLFW_DECORATED set had its XDG decorations changed to client mode by the compositor, it would seemingly receive GLFW fallback decorations as if it was windowed mode. This is possibly related to #2001. --- src/wl_window.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wl_window.c b/src/wl_window.c index e33076bb..b2930c5e 100644 --- a/src/wl_window.c +++ b/src/wl_window.c @@ -277,7 +277,7 @@ static void xdgDecorationHandleConfigure(void* userData, if (mode == ZXDG_TOPLEVEL_DECORATION_V1_MODE_CLIENT_SIDE) { - if (window->decorated) + if (window->decorated && !window->monitor) createFallbackDecorations(window); } else From 98d6e8485b327288f5b53e59e6cc2267e28376bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Thu, 30 Jun 2022 21:11:10 +0200 Subject: [PATCH 057/117] Cocoa: Disable macOS fullscreen when non-resizable Windows with GLFW_RESIZABLE set to false should not be resizable by the user. --- README.md | 1 + src/cocoa_window.m | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+) diff --git a/README.md b/README.md index be47a336..5b130d5b 100644 --- a/README.md +++ b/README.md @@ -227,6 +227,7 @@ information on what to include when reporting a bug. - [Cocoa] Changed `EGLNativeWindowType` from `NSView` to `CALayer` (#1169) - [Cocoa] Changed F13 key to report Print Screen for cross-platform consistency (#1786) + - [Cocoa] Disabled macOS fullscreen when `GLFW_RESIZABLE` is false - [Cocoa] Removed dependency on the CoreVideo framework - [Cocoa] Bugfix: `glfwSetWindowSize` used a bottom-left anchor point (#1553) - [Cocoa] Bugfix: Window remained on screen after destruction until event poll diff --git a/src/cocoa_window.m b/src/cocoa_window.m index 3726f782..8821d5bc 100644 --- a/src/cocoa_window.m +++ b/src/cocoa_window.m @@ -837,6 +837,12 @@ static GLFWbool createNativeWindow(_GLFWwindow* window, NSWindowCollectionBehaviorManaged; [window->ns.object setCollectionBehavior:behavior]; } + else + { + const NSWindowCollectionBehavior behavior = + NSWindowCollectionBehaviorFullScreenNone; + [window->ns.object setCollectionBehavior:behavior]; + } if (wndconfig->floating) [window->ns.object setLevel:NSFloatingWindowLevel]; @@ -1300,6 +1306,20 @@ void _glfwSetWindowMonitorCocoa(_GLFWwindow* window, else [window->ns.object setLevel:NSNormalWindowLevel]; + if (window->resizable) + { + const NSWindowCollectionBehavior behavior = + NSWindowCollectionBehaviorFullScreenPrimary | + NSWindowCollectionBehaviorManaged; + [window->ns.object setCollectionBehavior:behavior]; + } + else + { + const NSWindowCollectionBehavior behavior = + NSWindowCollectionBehaviorFullScreenNone; + [window->ns.object setCollectionBehavior:behavior]; + } + [window->ns.object setHasShadow:YES]; // HACK: Clearing NSWindowStyleMaskTitled resets and disables the window // title property but the miniwindow title property is unaffected @@ -1365,7 +1385,23 @@ GLFWbool _glfwFramebufferTransparentCocoa(_GLFWwindow* window) void _glfwSetWindowResizableCocoa(_GLFWwindow* window, GLFWbool enabled) { @autoreleasepool { + [window->ns.object setStyleMask:getStyleMask(window)]; + + if (enabled) + { + const NSWindowCollectionBehavior behavior = + NSWindowCollectionBehaviorFullScreenPrimary | + NSWindowCollectionBehaviorManaged; + [window->ns.object setCollectionBehavior:behavior]; + } + else + { + const NSWindowCollectionBehavior behavior = + NSWindowCollectionBehaviorFullScreenNone; + [window->ns.object setCollectionBehavior:behavior]; + } + } // autoreleasepool } From 6f8ec4075be53b17c08cfe4f83f02157cc7bcc12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Thu, 30 Jun 2022 22:08:52 +0200 Subject: [PATCH 058/117] Cocoa: Fix GLFW_MAXIMIZED for nonresizable windows The reasoning here is that glfwRestoreWindow will change nothing for a windowed non-resizable window on Cocoa, and silently refusing to maximize seems slightly more like something other platforms would do. This is possibly either the right thing to do or the wrong one. --- README.md | 1 + src/cocoa_window.m | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 5b130d5b..73b1613e 100644 --- a/README.md +++ b/README.md @@ -254,6 +254,7 @@ information on what to include when reporting a bug. - [Cocoa] Bugfix: `kUTTypeURL` was deprecated in macOS 12.0 (#2003) - [Cocoa] Bugfix: A connected Apple AirPlay would emit a useless error (#1791) - [Cocoa] Bugfix: The EGL and OSMesa libraries were not unloaded on termination + - [Cocoa] Bugfix: `GLFW_MAXIMIZED` was always true when `GLFW_RESIZABLE` was false - [X11] Bugfix: The CMake files did not check for the XInput headers (#1480) - [X11] Bugfix: Key names were not updated when the keyboard layout changed (#1462,#1528) diff --git a/src/cocoa_window.m b/src/cocoa_window.m index 8821d5bc..0bbc02cf 100644 --- a/src/cocoa_window.m +++ b/src/cocoa_window.m @@ -1353,7 +1353,12 @@ GLFWbool _glfwWindowVisibleCocoa(_GLFWwindow* window) GLFWbool _glfwWindowMaximizedCocoa(_GLFWwindow* window) { @autoreleasepool { - return [window->ns.object isZoomed]; + + if (window->resizable) + return [window->ns.object isZoomed]; + else + return GLFW_FALSE; + } // autoreleasepool } From 0d599026d04ddcc2695ae938fc1864523dab7a34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Fri, 1 Jul 2022 18:19:19 +0200 Subject: [PATCH 059/117] Cocoa: Fix clearing of unrelated window style bits Whenever GLFW changed the window style mask, a new mask was created from scratch based on the attributes set on the GLFW window object. This caused us to potentially clear unrelated window style bits. This was always wrong but became a critical issue when Cocoa began throwing an exception if an application cleared the NSWindowStyleMaskFullScreen while the window is in macOS fullscreen. This commit reworks all style mask editing so it only changes the relevant bits, preserving all others. This is only a narrow bug fix to prevent crashes, intended for the stable branch. Our interaction with macOS fullscreen is still very poor. The next step after this is a set of patches that improve the interaction between the current API and macOS fullscreen. Fixes #1886 Fixes #2110 --- CONTRIBUTORS.md | 2 ++ README.md | 4 +++ src/cocoa_window.m | 80 +++++++++++++++++++++++++++++++--------------- 3 files changed, 60 insertions(+), 26 deletions(-) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 1498d01e..66e99080 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -84,6 +84,7 @@ video tutorials. - heromyth - Lucas Hinderberger - Paul Holden + - Hajime Hoshi - Warren Hu - Charles Huber - Brent Huisman @@ -149,6 +150,7 @@ video tutorials. - James Murphy - Julian Møller - ndogxj + - F. Nedelec - n3rdopolis - Kristian Nielsen - Kamil Nowakowski diff --git a/README.md b/README.md index 73b1613e..84454964 100644 --- a/README.md +++ b/README.md @@ -255,6 +255,10 @@ information on what to include when reporting a bug. - [Cocoa] Bugfix: A connected Apple AirPlay would emit a useless error (#1791) - [Cocoa] Bugfix: The EGL and OSMesa libraries were not unloaded on termination - [Cocoa] Bugfix: `GLFW_MAXIMIZED` was always true when `GLFW_RESIZABLE` was false + - [Cocoa] Bugfix: Changing `GLFW_DECORATED` in macOS fullscreen would abort + application (#1886) + - [Cocoa] Bugfix: Setting a monitor from macOS fullscreen would abort + application (#2110) - [X11] Bugfix: The CMake files did not check for the XInput headers (#1480) - [X11] Bugfix: Key names were not updated when the keyboard layout changed (#1462,#1528) diff --git a/src/cocoa_window.m b/src/cocoa_window.m index 0bbc02cf..527423ee 100644 --- a/src/cocoa_window.m +++ b/src/cocoa_window.m @@ -31,26 +31,6 @@ #include #include -// Returns the style mask corresponding to the window settings -// -static NSUInteger getStyleMask(_GLFWwindow* window) -{ - NSUInteger styleMask = NSWindowStyleMaskMiniaturizable; - - if (window->monitor || !window->decorated) - styleMask |= NSWindowStyleMaskBorderless; - else - { - styleMask |= NSWindowStyleMaskTitled | - NSWindowStyleMaskClosable; - - if (window->resizable) - styleMask |= NSWindowStyleMaskResizable; - } - - return styleMask; -} - // Returns whether the cursor is in the content area of the specified window // static GLFWbool cursorInContentArea(_GLFWwindow* window) @@ -809,9 +789,21 @@ static GLFWbool createNativeWindow(_GLFWwindow* window, else contentRect = NSMakeRect(0, 0, wndconfig->width, wndconfig->height); + NSUInteger styleMask = NSWindowStyleMaskMiniaturizable; + + if (window->monitor || !window->decorated) + styleMask |= NSWindowStyleMaskBorderless; + else + { + styleMask |= (NSWindowStyleMaskTitled | NSWindowStyleMaskClosable); + + if (window->resizable) + styleMask |= NSWindowStyleMaskResizable; + } + window->ns.object = [[GLFWWindow alloc] initWithContentRect:contentRect - styleMask:getStyleMask(window) + styleMask:styleMask backing:NSBackingStoreBuffered defer:NO]; @@ -1241,9 +1233,10 @@ void _glfwSetWindowMonitorCocoa(_GLFWwindow* window, { const NSRect contentRect = NSMakeRect(xpos, _glfwTransformYCocoa(ypos + height - 1), width, height); + const NSUInteger styleMask = [window->ns.object styleMask]; const NSRect frameRect = [window->ns.object frameRectForContentRect:contentRect - styleMask:getStyleMask(window)]; + styleMask:styleMask]; [window->ns.object setFrame:frameRect display:YES]; } @@ -1260,7 +1253,27 @@ void _glfwSetWindowMonitorCocoa(_GLFWwindow* window, // TODO: Solve this in a less terrible way _glfwPollEventsCocoa(); - const NSUInteger styleMask = getStyleMask(window); + NSUInteger styleMask = [window->ns.object styleMask]; + + if (window->monitor) + { + styleMask &= ~(NSWindowStyleMaskTitled | NSWindowStyleMaskClosable); + styleMask |= NSWindowStyleMaskBorderless; + } + else + { + if (window->decorated) + { + styleMask &= ~NSWindowStyleMaskBorderless; + styleMask |= (NSWindowStyleMaskTitled | NSWindowStyleMaskClosable); + } + + if (window->resizable) + styleMask |= NSWindowStyleMaskResizable; + else + styleMask &= ~NSWindowStyleMaskResizable; + } + [window->ns.object setStyleMask:styleMask]; // HACK: Changing the style mask can cause the first responder to be cleared [window->ns.object makeFirstResponder:window->ns.view]; @@ -1391,10 +1404,10 @@ void _glfwSetWindowResizableCocoa(_GLFWwindow* window, GLFWbool enabled) { @autoreleasepool { - [window->ns.object setStyleMask:getStyleMask(window)]; - + const NSUInteger styleMask = [window->ns.object styleMask]; if (enabled) { + [window->ns.object setStyleMask:(styleMask | NSWindowStyleMaskResizable)]; const NSWindowCollectionBehavior behavior = NSWindowCollectionBehaviorFullScreenPrimary | NSWindowCollectionBehaviorManaged; @@ -1402,6 +1415,7 @@ void _glfwSetWindowResizableCocoa(_GLFWwindow* window, GLFWbool enabled) } else { + [window->ns.object setStyleMask:(styleMask & ~NSWindowStyleMaskResizable)]; const NSWindowCollectionBehavior behavior = NSWindowCollectionBehaviorFullScreenNone; [window->ns.object setCollectionBehavior:behavior]; @@ -1413,8 +1427,22 @@ void _glfwSetWindowResizableCocoa(_GLFWwindow* window, GLFWbool enabled) void _glfwSetWindowDecoratedCocoa(_GLFWwindow* window, GLFWbool enabled) { @autoreleasepool { - [window->ns.object setStyleMask:getStyleMask(window)]; + + NSUInteger styleMask = [window->ns.object styleMask]; + if (enabled) + { + styleMask |= (NSWindowStyleMaskTitled | NSWindowStyleMaskClosable); + styleMask &= ~NSWindowStyleMaskBorderless; + } + else + { + styleMask |= NSWindowStyleMaskBorderless; + styleMask &= ~(NSWindowStyleMaskTitled | NSWindowStyleMaskClosable); + } + + [window->ns.object setStyleMask:styleMask]; [window->ns.object makeFirstResponder:window->ns.view]; + } // autoreleasepool } From 510a08cde210d133fed1da21dd080072d92ee04a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Thu, 7 Jul 2022 22:55:27 +0200 Subject: [PATCH 060/117] Update glad to include Vulkan 1.3 Also add the VK_KHR_portability_enumeration extension, which will be needed on macOS. --- deps/glad/vulkan.h | 2488 +++++++++++++++++++++++++++++++++++++------- 1 file changed, 2103 insertions(+), 385 deletions(-) diff --git a/deps/glad/vulkan.h b/deps/glad/vulkan.h index 9e78dad9..469ffe5e 100644 --- a/deps/glad/vulkan.h +++ b/deps/glad/vulkan.h @@ -1,12 +1,12 @@ /** - * Loader generated by glad 2.0.0-beta on Wed Aug 25 21:20:29 2021 + * Loader generated by glad 2.0.0-beta on Thu Jul 7 20:52:04 2022 * * Generator: C/C++ * Specification: vk - * Extensions: 3 + * Extensions: 4 * * APIs: - * - vulkan=1.1 + * - vulkan=1.3 * * Options: * - ALIAS = False @@ -18,10 +18,10 @@ * - ON_DEMAND = False * * Commandline: - * --api='vulkan=1.1' --extensions='VK_EXT_debug_report,VK_KHR_surface,VK_KHR_swapchain' c --header-only + * --api='vulkan=1.3' --extensions='VK_EXT_debug_report,VK_KHR_portability_enumeration,VK_KHR_surface,VK_KHR_swapchain' c --header-only * * Online: - * http://glad.sh/#api=vulkan%3D1.1&extensions=VK_EXT_debug_report%2CVK_KHR_surface%2CVK_KHR_swapchain&generator=c&options=HEADER_ONLY + * http://glad.sh/#api=vulkan%3D1.3&extensions=VK_EXT_debug_report%2CVK_KHR_portability_enumeration%2CVK_KHR_surface%2CVK_KHR_swapchain&generator=c&options=HEADER_ONLY * */ @@ -162,21 +162,25 @@ typedef void (*GLADpostcallback)(void *ret, const char *name, GLADapiproc apipro #define VK_ATTACHMENT_UNUSED (~0U) #define VK_EXT_DEBUG_REPORT_EXTENSION_NAME "VK_EXT_debug_report" -#define VK_EXT_DEBUG_REPORT_SPEC_VERSION 9 +#define VK_EXT_DEBUG_REPORT_SPEC_VERSION 10 #define VK_FALSE 0 +#define VK_KHR_PORTABILITY_ENUMERATION_EXTENSION_NAME "VK_KHR_portability_enumeration" +#define VK_KHR_PORTABILITY_ENUMERATION_SPEC_VERSION 1 #define VK_KHR_SURFACE_EXTENSION_NAME "VK_KHR_surface" #define VK_KHR_SURFACE_SPEC_VERSION 25 #define VK_KHR_SWAPCHAIN_EXTENSION_NAME "VK_KHR_swapchain" #define VK_KHR_SWAPCHAIN_SPEC_VERSION 70 -#define VK_LOD_CLAMP_NONE 1000.0f +#define VK_LOD_CLAMP_NONE 1000.0F #define VK_LUID_SIZE 8 #define VK_MAX_DESCRIPTION_SIZE 256 #define VK_MAX_DEVICE_GROUP_SIZE 32 +#define VK_MAX_DRIVER_INFO_SIZE 256 +#define VK_MAX_DRIVER_NAME_SIZE 256 #define VK_MAX_EXTENSION_NAME_SIZE 256 #define VK_MAX_MEMORY_HEAPS 16 #define VK_MAX_MEMORY_TYPES 32 #define VK_MAX_PHYSICAL_DEVICE_NAME_SIZE 256 -#define VK_QUEUE_FAMILY_EXTERNAL (~0U-1) +#define VK_QUEUE_FAMILY_EXTERNAL (~1U) #define VK_QUEUE_FAMILY_IGNORED (~0U) #define VK_REMAINING_ARRAY_LAYERS (~0U) #define VK_REMAINING_MIP_LEVELS (~0U) @@ -190,7 +194,7 @@ typedef void (*GLADpostcallback)(void *ret, const char *name, GLADapiproc apipro /* File: vk_platform.h */ /* */ /* -** Copyright (c) 2014-2020 The Khronos Group Inc. +** Copyright 2014-2022 The Khronos Group Inc. ** ** SPDX-License-Identifier: Apache-2.0 */ @@ -230,7 +234,7 @@ extern "C" #define VKAPI_CALL __stdcall #define VKAPI_PTR VKAPI_CALL #elif defined(__ANDROID__) && defined(__ARM_ARCH) && __ARM_ARCH < 7 - #error "Vulkan isn't supported for the 'armeabi' NDK ABI" + #error "Vulkan is not supported for the 'armeabi' NDK ABI" #elif defined(__ANDROID__) && defined(__ARM_ARCH) && __ARM_ARCH >= 7 && defined(__ARM_32BIT_STATE) /* On Android 32-bit ARM targets, Vulkan functions use the "hardfloat" */ /* calling convention, i.e. float parameters are passed in registers. This */ @@ -246,7 +250,9 @@ extern "C" #define VKAPI_PTR #endif -#include +#if !defined(VK_NO_STDDEF_H) + #include +#endif /* !defined(VK_NO_STDDEF_H) */ #if !defined(VK_NO_STDINT_H) #if defined(_MSC_VER) && (_MSC_VER < 1600) @@ -268,43 +274,64 @@ extern "C" #endif /* __cplusplus */ #endif - +/* DEPRECATED: This define is deprecated. VK_MAKE_API_VERSION should be used instead. */ #define VK_MAKE_VERSION(major, minor, patch) \ ((((uint32_t)(major)) << 22) | (((uint32_t)(minor)) << 12) | ((uint32_t)(patch))) - +/* DEPRECATED: This define is deprecated. VK_API_VERSION_MAJOR should be used instead. */ #define VK_VERSION_MAJOR(version) ((uint32_t)(version) >> 22) - -#define VK_VERSION_MINOR(version) (((uint32_t)(version) >> 12) & 0x3ff) - -#define VK_VERSION_PATCH(version) ((uint32_t)(version) & 0xfff) - +/* DEPRECATED: This define is deprecated. VK_API_VERSION_MINOR should be used instead. */ +#define VK_VERSION_MINOR(version) (((uint32_t)(version) >> 12) & 0x3FFU) +/* DEPRECATED: This define is deprecated. VK_API_VERSION_PATCH should be used instead. */ +#define VK_VERSION_PATCH(version) ((uint32_t)(version) & 0xFFFU) +#define VK_MAKE_API_VERSION(variant, major, minor, patch) \ + ((((uint32_t)(variant)) << 29) | (((uint32_t)(major)) << 22) | (((uint32_t)(minor)) << 12) | ((uint32_t)(patch))) +#define VK_API_VERSION_VARIANT(version) ((uint32_t)(version) >> 29) +#define VK_API_VERSION_MAJOR(version) (((uint32_t)(version) >> 22) & 0x7FU) +#define VK_API_VERSION_MINOR(version) (((uint32_t)(version) >> 12) & 0x3FFU) +#define VK_API_VERSION_PATCH(version) ((uint32_t)(version) & 0xFFFU) /* DEPRECATED: This define has been removed. Specific version defines (e.g. VK_API_VERSION_1_0), or the VK_MAKE_VERSION macro, should be used instead. */ /*#define VK_API_VERSION VK_MAKE_VERSION(1, 0, 0) // Patch version should always be set to 0 */ - /* Vulkan 1.0 version number */ -#define VK_API_VERSION_1_0 VK_MAKE_VERSION(1, 0, 0)/* Patch version should always be set to 0 */ - +#define VK_API_VERSION_1_0 VK_MAKE_API_VERSION(0, 1, 0, 0)/* Patch version should always be set to 0 */ /* Vulkan 1.1 version number */ -#define VK_API_VERSION_1_1 VK_MAKE_VERSION(1, 1, 0)/* Patch version should always be set to 0 */ - +#define VK_API_VERSION_1_1 VK_MAKE_API_VERSION(0, 1, 1, 0)/* Patch version should always be set to 0 */ +/* Vulkan 1.2 version number */ +#define VK_API_VERSION_1_2 VK_MAKE_API_VERSION(0, 1, 2, 0)/* Patch version should always be set to 0 */ +/* Vulkan 1.3 version number */ +#define VK_API_VERSION_1_3 VK_MAKE_API_VERSION(0, 1, 3, 0)/* Patch version should always be set to 0 */ /* Version of this file */ -#define VK_HEADER_VERSION 152 - +#define VK_HEADER_VERSION 220 /* Complete version of this file */ -#define VK_HEADER_VERSION_COMPLETE VK_MAKE_VERSION(1, 2, VK_HEADER_VERSION) - +#define VK_HEADER_VERSION_COMPLETE VK_MAKE_API_VERSION(0, 1, 3, VK_HEADER_VERSION) #define VK_DEFINE_HANDLE(object) typedef struct object##_T* object; - -#if !defined(VK_DEFINE_NON_DISPATCHABLE_HANDLE) -#if defined(__LP64__) || defined(_WIN64) || (defined(__x86_64__) && !defined(__ILP32__) ) || defined(_M_X64) || defined(__ia64) || defined (_M_IA64) || defined(__aarch64__) || defined(__powerpc64__) +#ifndef VK_USE_64_BIT_PTR_DEFINES + #if defined(__LP64__) || defined(_WIN64) || (defined(__x86_64__) && !defined(__ILP32__) ) || defined(_M_X64) || defined(__ia64) || defined (_M_IA64) || defined(__aarch64__) || defined(__powerpc64__) + #define VK_USE_64_BIT_PTR_DEFINES 1 + #else + #define VK_USE_64_BIT_PTR_DEFINES 0 + #endif +#endif +#ifndef VK_DEFINE_NON_DISPATCHABLE_HANDLE + #if (VK_USE_64_BIT_PTR_DEFINES==1) + #if (defined(__cplusplus) && (__cplusplus >= 201103L)) || (defined(_MSVC_LANG) && (_MSVC_LANG >= 201103L)) + #define VK_NULL_HANDLE nullptr + #else + #define VK_NULL_HANDLE ((void*)0) + #endif + #else + #define VK_NULL_HANDLE 0ULL + #endif +#endif +#ifndef VK_NULL_HANDLE + #define VK_NULL_HANDLE 0 +#endif +#ifndef VK_DEFINE_NON_DISPATCHABLE_HANDLE + #if (VK_USE_64_BIT_PTR_DEFINES==1) #define VK_DEFINE_NON_DISPATCHABLE_HANDLE(object) typedef struct object##_T *object; -#else + #else #define VK_DEFINE_NON_DISPATCHABLE_HANDLE(object) typedef uint64_t object; + #endif #endif -#endif - -#define VK_NULL_HANDLE 0 - @@ -314,76 +341,48 @@ extern "C" VK_DEFINE_HANDLE(VkInstance) - VK_DEFINE_HANDLE(VkPhysicalDevice) - VK_DEFINE_HANDLE(VkDevice) - VK_DEFINE_HANDLE(VkQueue) - VK_DEFINE_HANDLE(VkCommandBuffer) - VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkDeviceMemory) - VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkCommandPool) - VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkBuffer) - VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkBufferView) - VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkImage) - VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkImageView) - VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkShaderModule) - VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkPipeline) - VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkPipelineLayout) - VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkSampler) - VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkDescriptorSet) - VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkDescriptorSetLayout) - VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkDescriptorPool) - VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkFence) - VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkSemaphore) - VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkEvent) - VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkQueryPool) - VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkFramebuffer) - VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkRenderPass) - VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkPipelineCache) - VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkDescriptorUpdateTemplate) - VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkSamplerYcbcrConversion) - +VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkPrivateDataSlot) VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkSurfaceKHR) - VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkSwapchainKHR) - VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkDebugReportCallbackEXT) - typedef enum VkAttachmentLoadOp { VK_ATTACHMENT_LOAD_OP_LOAD = 0, VK_ATTACHMENT_LOAD_OP_CLEAR = 1, - VK_ATTACHMENT_LOAD_OP_DONT_CARE = 2 + VK_ATTACHMENT_LOAD_OP_DONT_CARE = 2, + VK_ATTACHMENT_LOAD_OP_MAX_ENUM = 0x7FFFFFFF } VkAttachmentLoadOp; - typedef enum VkAttachmentStoreOp { VK_ATTACHMENT_STORE_OP_STORE = 0, - VK_ATTACHMENT_STORE_OP_DONT_CARE = 1 + VK_ATTACHMENT_STORE_OP_DONT_CARE = 1, + VK_ATTACHMENT_STORE_OP_NONE = 1000301000, + VK_ATTACHMENT_STORE_OP_MAX_ENUM = 0x7FFFFFFF } VkAttachmentStoreOp; - typedef enum VkBlendFactor { VK_BLEND_FACTOR_ZERO = 0, VK_BLEND_FACTOR_ONE = 1, @@ -403,47 +402,63 @@ typedef enum VkBlendFactor { VK_BLEND_FACTOR_SRC1_COLOR = 15, VK_BLEND_FACTOR_ONE_MINUS_SRC1_COLOR = 16, VK_BLEND_FACTOR_SRC1_ALPHA = 17, - VK_BLEND_FACTOR_ONE_MINUS_SRC1_ALPHA = 18 + VK_BLEND_FACTOR_ONE_MINUS_SRC1_ALPHA = 18, + VK_BLEND_FACTOR_MAX_ENUM = 0x7FFFFFFF } VkBlendFactor; - typedef enum VkBlendOp { VK_BLEND_OP_ADD = 0, VK_BLEND_OP_SUBTRACT = 1, VK_BLEND_OP_REVERSE_SUBTRACT = 2, VK_BLEND_OP_MIN = 3, - VK_BLEND_OP_MAX = 4 + VK_BLEND_OP_MAX = 4, + VK_BLEND_OP_MAX_ENUM = 0x7FFFFFFF } VkBlendOp; - typedef enum VkBorderColor { VK_BORDER_COLOR_FLOAT_TRANSPARENT_BLACK = 0, VK_BORDER_COLOR_INT_TRANSPARENT_BLACK = 1, VK_BORDER_COLOR_FLOAT_OPAQUE_BLACK = 2, VK_BORDER_COLOR_INT_OPAQUE_BLACK = 3, VK_BORDER_COLOR_FLOAT_OPAQUE_WHITE = 4, - VK_BORDER_COLOR_INT_OPAQUE_WHITE = 5 + VK_BORDER_COLOR_INT_OPAQUE_WHITE = 5, + VK_BORDER_COLOR_MAX_ENUM = 0x7FFFFFFF } VkBorderColor; - - - - +typedef enum VkFramebufferCreateFlagBits { + VK_FRAMEBUFFER_CREATE_IMAGELESS_BIT = 1, + VK_FRAMEBUFFER_CREATE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF +} VkFramebufferCreateFlagBits; typedef enum VkPipelineCacheHeaderVersion { - VK_PIPELINE_CACHE_HEADER_VERSION_ONE = 1 + VK_PIPELINE_CACHE_HEADER_VERSION_ONE = 1, + VK_PIPELINE_CACHE_HEADER_VERSION_MAX_ENUM = 0x7FFFFFFF } VkPipelineCacheHeaderVersion; - - - - +typedef enum VkPipelineCacheCreateFlagBits { + VK_PIPELINE_CACHE_CREATE_EXTERNALLY_SYNCHRONIZED_BIT = 1, + VK_PIPELINE_CACHE_CREATE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF +} VkPipelineCacheCreateFlagBits; +typedef enum VkPipelineShaderStageCreateFlagBits { + VK_PIPELINE_SHADER_STAGE_CREATE_ALLOW_VARYING_SUBGROUP_SIZE_BIT = 1, + VK_PIPELINE_SHADER_STAGE_CREATE_REQUIRE_FULL_SUBGROUPS_BIT = 2, + VK_PIPELINE_SHADER_STAGE_CREATE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF +} VkPipelineShaderStageCreateFlagBits; +typedef enum VkDescriptorSetLayoutCreateFlagBits { + VK_DESCRIPTOR_SET_LAYOUT_CREATE_UPDATE_AFTER_BIND_POOL_BIT = 2, + VK_DESCRIPTOR_SET_LAYOUT_CREATE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF +} VkDescriptorSetLayoutCreateFlagBits; +typedef enum VkInstanceCreateFlagBits { + VK_INSTANCE_CREATE_ENUMERATE_PORTABILITY_BIT_KHR = 1, + VK_INSTANCE_CREATE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF +} VkInstanceCreateFlagBits; typedef enum VkDeviceQueueCreateFlagBits { - VK_DEVICE_QUEUE_CREATE_PROTECTED_BIT = 1 + VK_DEVICE_QUEUE_CREATE_PROTECTED_BIT = 1, + VK_DEVICE_QUEUE_CREATE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF } VkDeviceQueueCreateFlagBits; - typedef enum VkBufferCreateFlagBits { VK_BUFFER_CREATE_SPARSE_BINDING_BIT = 1, VK_BUFFER_CREATE_SPARSE_RESIDENCY_BIT = 2, VK_BUFFER_CREATE_SPARSE_ALIASED_BIT = 4, - VK_BUFFER_CREATE_PROTECTED_BIT = 8 + VK_BUFFER_CREATE_PROTECTED_BIT = 8, + VK_BUFFER_CREATE_DEVICE_ADDRESS_CAPTURE_REPLAY_BIT = 16, + VK_BUFFER_CREATE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF } VkBufferCreateFlagBits; - typedef enum VkBufferUsageFlagBits { VK_BUFFER_USAGE_TRANSFER_SRC_BIT = 1, VK_BUFFER_USAGE_TRANSFER_DST_BIT = 2, @@ -453,16 +468,17 @@ typedef enum VkBufferUsageFlagBits { VK_BUFFER_USAGE_STORAGE_BUFFER_BIT = 32, VK_BUFFER_USAGE_INDEX_BUFFER_BIT = 64, VK_BUFFER_USAGE_VERTEX_BUFFER_BIT = 128, - VK_BUFFER_USAGE_INDIRECT_BUFFER_BIT = 256 + VK_BUFFER_USAGE_INDIRECT_BUFFER_BIT = 256, + VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT = 131072, + VK_BUFFER_USAGE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF } VkBufferUsageFlagBits; - typedef enum VkColorComponentFlagBits { VK_COLOR_COMPONENT_R_BIT = 1, VK_COLOR_COMPONENT_G_BIT = 2, VK_COLOR_COMPONENT_B_BIT = 4, - VK_COLOR_COMPONENT_A_BIT = 8 + VK_COLOR_COMPONENT_A_BIT = 8, + VK_COLOR_COMPONENT_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF } VkColorComponentFlagBits; - typedef enum VkComponentSwizzle { VK_COMPONENT_SWIZZLE_IDENTITY = 0, VK_COMPONENT_SWIZZLE_ZERO = 1, @@ -470,34 +486,34 @@ typedef enum VkComponentSwizzle { VK_COMPONENT_SWIZZLE_R = 3, VK_COMPONENT_SWIZZLE_G = 4, VK_COMPONENT_SWIZZLE_B = 5, - VK_COMPONENT_SWIZZLE_A = 6 + VK_COMPONENT_SWIZZLE_A = 6, + VK_COMPONENT_SWIZZLE_MAX_ENUM = 0x7FFFFFFF } VkComponentSwizzle; - typedef enum VkCommandPoolCreateFlagBits { VK_COMMAND_POOL_CREATE_TRANSIENT_BIT = 1, VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT = 2, - VK_COMMAND_POOL_CREATE_PROTECTED_BIT = 4 + VK_COMMAND_POOL_CREATE_PROTECTED_BIT = 4, + VK_COMMAND_POOL_CREATE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF } VkCommandPoolCreateFlagBits; - typedef enum VkCommandPoolResetFlagBits { - VK_COMMAND_POOL_RESET_RELEASE_RESOURCES_BIT = 1 + VK_COMMAND_POOL_RESET_RELEASE_RESOURCES_BIT = 1, + VK_COMMAND_POOL_RESET_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF } VkCommandPoolResetFlagBits; - typedef enum VkCommandBufferResetFlagBits { - VK_COMMAND_BUFFER_RESET_RELEASE_RESOURCES_BIT = 1 + VK_COMMAND_BUFFER_RESET_RELEASE_RESOURCES_BIT = 1, + VK_COMMAND_BUFFER_RESET_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF } VkCommandBufferResetFlagBits; - typedef enum VkCommandBufferLevel { VK_COMMAND_BUFFER_LEVEL_PRIMARY = 0, - VK_COMMAND_BUFFER_LEVEL_SECONDARY = 1 + VK_COMMAND_BUFFER_LEVEL_SECONDARY = 1, + VK_COMMAND_BUFFER_LEVEL_MAX_ENUM = 0x7FFFFFFF } VkCommandBufferLevel; - typedef enum VkCommandBufferUsageFlagBits { VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT = 1, VK_COMMAND_BUFFER_USAGE_RENDER_PASS_CONTINUE_BIT = 2, - VK_COMMAND_BUFFER_USAGE_SIMULTANEOUS_USE_BIT = 4 + VK_COMMAND_BUFFER_USAGE_SIMULTANEOUS_USE_BIT = 4, + VK_COMMAND_BUFFER_USAGE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF } VkCommandBufferUsageFlagBits; - typedef enum VkCompareOp { VK_COMPARE_OP_NEVER = 0, VK_COMPARE_OP_LESS = 1, @@ -506,16 +522,16 @@ typedef enum VkCompareOp { VK_COMPARE_OP_GREATER = 4, VK_COMPARE_OP_NOT_EQUAL = 5, VK_COMPARE_OP_GREATER_OR_EQUAL = 6, - VK_COMPARE_OP_ALWAYS = 7 + VK_COMPARE_OP_ALWAYS = 7, + VK_COMPARE_OP_MAX_ENUM = 0x7FFFFFFF } VkCompareOp; - typedef enum VkCullModeFlagBits { VK_CULL_MODE_NONE = 0, VK_CULL_MODE_FRONT_BIT = 1, VK_CULL_MODE_BACK_BIT = 2, - VK_CULL_MODE_FRONT_AND_BACK = 0x00000003 + VK_CULL_MODE_FRONT_AND_BACK = 0x00000003, + VK_CULL_MODE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF } VkCullModeFlagBits; - typedef enum VkDescriptorType { VK_DESCRIPTOR_TYPE_SAMPLER = 0, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER = 1, @@ -527,9 +543,10 @@ typedef enum VkDescriptorType { VK_DESCRIPTOR_TYPE_STORAGE_BUFFER = 7, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC = 8, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC = 9, - VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT = 10 + VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT = 10, + VK_DESCRIPTOR_TYPE_INLINE_UNIFORM_BLOCK = 1000138000, + VK_DESCRIPTOR_TYPE_MAX_ENUM = 0x7FFFFFFF } VkDescriptorType; - typedef enum VkDynamicState { VK_DYNAMIC_STATE_VIEWPORT = 0, VK_DYNAMIC_STATE_SCISSOR = 1, @@ -539,19 +556,34 @@ typedef enum VkDynamicState { VK_DYNAMIC_STATE_DEPTH_BOUNDS = 5, VK_DYNAMIC_STATE_STENCIL_COMPARE_MASK = 6, VK_DYNAMIC_STATE_STENCIL_WRITE_MASK = 7, - VK_DYNAMIC_STATE_STENCIL_REFERENCE = 8 + VK_DYNAMIC_STATE_STENCIL_REFERENCE = 8, + VK_DYNAMIC_STATE_CULL_MODE = 1000267000, + VK_DYNAMIC_STATE_FRONT_FACE = 1000267001, + VK_DYNAMIC_STATE_PRIMITIVE_TOPOLOGY = 1000267002, + VK_DYNAMIC_STATE_VIEWPORT_WITH_COUNT = 1000267003, + VK_DYNAMIC_STATE_SCISSOR_WITH_COUNT = 1000267004, + VK_DYNAMIC_STATE_VERTEX_INPUT_BINDING_STRIDE = 1000267005, + VK_DYNAMIC_STATE_DEPTH_TEST_ENABLE = 1000267006, + VK_DYNAMIC_STATE_DEPTH_WRITE_ENABLE = 1000267007, + VK_DYNAMIC_STATE_DEPTH_COMPARE_OP = 1000267008, + VK_DYNAMIC_STATE_DEPTH_BOUNDS_TEST_ENABLE = 1000267009, + VK_DYNAMIC_STATE_STENCIL_TEST_ENABLE = 1000267010, + VK_DYNAMIC_STATE_STENCIL_OP = 1000267011, + VK_DYNAMIC_STATE_RASTERIZER_DISCARD_ENABLE = 1000377001, + VK_DYNAMIC_STATE_DEPTH_BIAS_ENABLE = 1000377002, + VK_DYNAMIC_STATE_PRIMITIVE_RESTART_ENABLE = 1000377004, + VK_DYNAMIC_STATE_MAX_ENUM = 0x7FFFFFFF } VkDynamicState; - typedef enum VkFenceCreateFlagBits { - VK_FENCE_CREATE_SIGNALED_BIT = 1 + VK_FENCE_CREATE_SIGNALED_BIT = 1, + VK_FENCE_CREATE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF } VkFenceCreateFlagBits; - typedef enum VkPolygonMode { VK_POLYGON_MODE_FILL = 0, VK_POLYGON_MODE_LINE = 1, - VK_POLYGON_MODE_POINT = 2 + VK_POLYGON_MODE_POINT = 2, + VK_POLYGON_MODE_MAX_ENUM = 0x7FFFFFFF } VkPolygonMode; - typedef enum VkFormat { VK_FORMAT_UNDEFINED = 0, VK_FORMAT_R4G4_UNORM_PACK8 = 1, @@ -771,9 +803,29 @@ typedef enum VkFormat { VK_FORMAT_G16_B16R16_2PLANE_420_UNORM = 1000156030, VK_FORMAT_G16_B16_R16_3PLANE_422_UNORM = 1000156031, VK_FORMAT_G16_B16R16_2PLANE_422_UNORM = 1000156032, - VK_FORMAT_G16_B16_R16_3PLANE_444_UNORM = 1000156033 + VK_FORMAT_G16_B16_R16_3PLANE_444_UNORM = 1000156033, + VK_FORMAT_G8_B8R8_2PLANE_444_UNORM = 1000330000, + VK_FORMAT_G10X6_B10X6R10X6_2PLANE_444_UNORM_3PACK16 = 1000330001, + VK_FORMAT_G12X4_B12X4R12X4_2PLANE_444_UNORM_3PACK16 = 1000330002, + VK_FORMAT_G16_B16R16_2PLANE_444_UNORM = 1000330003, + VK_FORMAT_A4R4G4B4_UNORM_PACK16 = 1000340000, + VK_FORMAT_A4B4G4R4_UNORM_PACK16 = 1000340001, + VK_FORMAT_ASTC_4x4_SFLOAT_BLOCK = 1000066000, + VK_FORMAT_ASTC_5x4_SFLOAT_BLOCK = 1000066001, + VK_FORMAT_ASTC_5x5_SFLOAT_BLOCK = 1000066002, + VK_FORMAT_ASTC_6x5_SFLOAT_BLOCK = 1000066003, + VK_FORMAT_ASTC_6x6_SFLOAT_BLOCK = 1000066004, + VK_FORMAT_ASTC_8x5_SFLOAT_BLOCK = 1000066005, + VK_FORMAT_ASTC_8x6_SFLOAT_BLOCK = 1000066006, + VK_FORMAT_ASTC_8x8_SFLOAT_BLOCK = 1000066007, + VK_FORMAT_ASTC_10x5_SFLOAT_BLOCK = 1000066008, + VK_FORMAT_ASTC_10x6_SFLOAT_BLOCK = 1000066009, + VK_FORMAT_ASTC_10x8_SFLOAT_BLOCK = 1000066010, + VK_FORMAT_ASTC_10x10_SFLOAT_BLOCK = 1000066011, + VK_FORMAT_ASTC_12x10_SFLOAT_BLOCK = 1000066012, + VK_FORMAT_ASTC_12x12_SFLOAT_BLOCK = 1000066013, + VK_FORMAT_MAX_ENUM = 0x7FFFFFFF } VkFormat; - typedef enum VkFormatFeatureFlagBits { VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT = 1, VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT = 2, @@ -796,14 +848,15 @@ typedef enum VkFormatFeatureFlagBits { VK_FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_CHROMA_RECONSTRUCTION_EXPLICIT_BIT = 1048576, VK_FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_CHROMA_RECONSTRUCTION_EXPLICIT_FORCEABLE_BIT = 2097152, VK_FORMAT_FEATURE_DISJOINT_BIT = 4194304, - VK_FORMAT_FEATURE_COSITED_CHROMA_SAMPLES_BIT = 8388608 + VK_FORMAT_FEATURE_COSITED_CHROMA_SAMPLES_BIT = 8388608, + VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_MINMAX_BIT = 65536, + VK_FORMAT_FEATURE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF } VkFormatFeatureFlagBits; - typedef enum VkFrontFace { VK_FRONT_FACE_COUNTER_CLOCKWISE = 0, - VK_FRONT_FACE_CLOCKWISE = 1 + VK_FRONT_FACE_CLOCKWISE = 1, + VK_FRONT_FACE_MAX_ENUM = 0x7FFFFFFF } VkFrontFace; - typedef enum VkImageAspectFlagBits { VK_IMAGE_ASPECT_COLOR_BIT = 1, VK_IMAGE_ASPECT_DEPTH_BIT = 2, @@ -811,9 +864,10 @@ typedef enum VkImageAspectFlagBits { VK_IMAGE_ASPECT_METADATA_BIT = 8, VK_IMAGE_ASPECT_PLANE_0_BIT = 16, VK_IMAGE_ASPECT_PLANE_1_BIT = 32, - VK_IMAGE_ASPECT_PLANE_2_BIT = 64 + VK_IMAGE_ASPECT_PLANE_2_BIT = 64, + VK_IMAGE_ASPECT_NONE = 0, + VK_IMAGE_ASPECT_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF } VkImageAspectFlagBits; - typedef enum VkImageCreateFlagBits { VK_IMAGE_CREATE_SPARSE_BINDING_BIT = 1, VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT = 2, @@ -826,9 +880,9 @@ typedef enum VkImageCreateFlagBits { VK_IMAGE_CREATE_BLOCK_TEXEL_VIEW_COMPATIBLE_BIT = 128, VK_IMAGE_CREATE_EXTENDED_USAGE_BIT = 256, VK_IMAGE_CREATE_PROTECTED_BIT = 2048, - VK_IMAGE_CREATE_DISJOINT_BIT = 512 + VK_IMAGE_CREATE_DISJOINT_BIT = 512, + VK_IMAGE_CREATE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF } VkImageCreateFlagBits; - typedef enum VkImageLayout { VK_IMAGE_LAYOUT_UNDEFINED = 0, VK_IMAGE_LAYOUT_GENERAL = 1, @@ -841,20 +895,26 @@ typedef enum VkImageLayout { VK_IMAGE_LAYOUT_PREINITIALIZED = 8, VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_STENCIL_ATTACHMENT_OPTIMAL = 1000117000, VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_STENCIL_READ_ONLY_OPTIMAL = 1000117001, - VK_IMAGE_LAYOUT_PRESENT_SRC_KHR = 1000001002 + VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL = 1000241000, + VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL = 1000241001, + VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL = 1000241002, + VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL = 1000241003, + VK_IMAGE_LAYOUT_READ_ONLY_OPTIMAL = 1000314000, + VK_IMAGE_LAYOUT_ATTACHMENT_OPTIMAL = 1000314001, + VK_IMAGE_LAYOUT_PRESENT_SRC_KHR = 1000001002, + VK_IMAGE_LAYOUT_MAX_ENUM = 0x7FFFFFFF } VkImageLayout; - typedef enum VkImageTiling { VK_IMAGE_TILING_OPTIMAL = 0, - VK_IMAGE_TILING_LINEAR = 1 + VK_IMAGE_TILING_LINEAR = 1, + VK_IMAGE_TILING_MAX_ENUM = 0x7FFFFFFF } VkImageTiling; - typedef enum VkImageType { VK_IMAGE_TYPE_1D = 0, VK_IMAGE_TYPE_2D = 1, - VK_IMAGE_TYPE_3D = 2 + VK_IMAGE_TYPE_3D = 2, + VK_IMAGE_TYPE_MAX_ENUM = 0x7FFFFFFF } VkImageType; - typedef enum VkImageUsageFlagBits { VK_IMAGE_USAGE_TRANSFER_SRC_BIT = 1, VK_IMAGE_USAGE_TRANSFER_DST_BIT = 2, @@ -863,10 +923,9 @@ typedef enum VkImageUsageFlagBits { VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT = 16, VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT = 32, VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT = 64, - VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT = 128 + VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT = 128, + VK_IMAGE_USAGE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF } VkImageUsageFlagBits; - - typedef enum VkImageViewType { VK_IMAGE_VIEW_TYPE_1D = 0, VK_IMAGE_VIEW_TYPE_2D = 1, @@ -874,19 +933,19 @@ typedef enum VkImageViewType { VK_IMAGE_VIEW_TYPE_CUBE = 3, VK_IMAGE_VIEW_TYPE_1D_ARRAY = 4, VK_IMAGE_VIEW_TYPE_2D_ARRAY = 5, - VK_IMAGE_VIEW_TYPE_CUBE_ARRAY = 6 + VK_IMAGE_VIEW_TYPE_CUBE_ARRAY = 6, + VK_IMAGE_VIEW_TYPE_MAX_ENUM = 0x7FFFFFFF } VkImageViewType; - typedef enum VkSharingMode { VK_SHARING_MODE_EXCLUSIVE = 0, - VK_SHARING_MODE_CONCURRENT = 1 + VK_SHARING_MODE_CONCURRENT = 1, + VK_SHARING_MODE_MAX_ENUM = 0x7FFFFFFF } VkSharingMode; - typedef enum VkIndexType { VK_INDEX_TYPE_UINT16 = 0, - VK_INDEX_TYPE_UINT32 = 1 + VK_INDEX_TYPE_UINT32 = 1, + VK_INDEX_TYPE_MAX_ENUM = 0x7FFFFFFF } VkIndexType; - typedef enum VkLogicOp { VK_LOGIC_OP_CLEAR = 0, VK_LOGIC_OP_AND = 1, @@ -903,14 +962,14 @@ typedef enum VkLogicOp { VK_LOGIC_OP_COPY_INVERTED = 12, VK_LOGIC_OP_OR_INVERTED = 13, VK_LOGIC_OP_NAND = 14, - VK_LOGIC_OP_SET = 15 + VK_LOGIC_OP_SET = 15, + VK_LOGIC_OP_MAX_ENUM = 0x7FFFFFFF } VkLogicOp; - typedef enum VkMemoryHeapFlagBits { VK_MEMORY_HEAP_DEVICE_LOCAL_BIT = 1, - VK_MEMORY_HEAP_MULTI_INSTANCE_BIT = 2 + VK_MEMORY_HEAP_MULTI_INSTANCE_BIT = 2, + VK_MEMORY_HEAP_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF } VkMemoryHeapFlagBits; - typedef enum VkAccessFlagBits { VK_ACCESS_INDIRECT_COMMAND_READ_BIT = 1, VK_ACCESS_INDEX_READ_BIT = 2, @@ -928,40 +987,43 @@ typedef enum VkAccessFlagBits { VK_ACCESS_HOST_READ_BIT = 8192, VK_ACCESS_HOST_WRITE_BIT = 16384, VK_ACCESS_MEMORY_READ_BIT = 32768, - VK_ACCESS_MEMORY_WRITE_BIT = 65536 + VK_ACCESS_MEMORY_WRITE_BIT = 65536, + VK_ACCESS_NONE = 0, + VK_ACCESS_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF } VkAccessFlagBits; - typedef enum VkMemoryPropertyFlagBits { VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT = 1, VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT = 2, VK_MEMORY_PROPERTY_HOST_COHERENT_BIT = 4, VK_MEMORY_PROPERTY_HOST_CACHED_BIT = 8, VK_MEMORY_PROPERTY_LAZILY_ALLOCATED_BIT = 16, - VK_MEMORY_PROPERTY_PROTECTED_BIT = 32 + VK_MEMORY_PROPERTY_PROTECTED_BIT = 32, + VK_MEMORY_PROPERTY_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF } VkMemoryPropertyFlagBits; - typedef enum VkPhysicalDeviceType { VK_PHYSICAL_DEVICE_TYPE_OTHER = 0, VK_PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU = 1, VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU = 2, VK_PHYSICAL_DEVICE_TYPE_VIRTUAL_GPU = 3, - VK_PHYSICAL_DEVICE_TYPE_CPU = 4 + VK_PHYSICAL_DEVICE_TYPE_CPU = 4, + VK_PHYSICAL_DEVICE_TYPE_MAX_ENUM = 0x7FFFFFFF } VkPhysicalDeviceType; - typedef enum VkPipelineBindPoint { VK_PIPELINE_BIND_POINT_GRAPHICS = 0, - VK_PIPELINE_BIND_POINT_COMPUTE = 1 + VK_PIPELINE_BIND_POINT_COMPUTE = 1, + VK_PIPELINE_BIND_POINT_MAX_ENUM = 0x7FFFFFFF } VkPipelineBindPoint; - typedef enum VkPipelineCreateFlagBits { VK_PIPELINE_CREATE_DISABLE_OPTIMIZATION_BIT = 1, VK_PIPELINE_CREATE_ALLOW_DERIVATIVES_BIT = 2, VK_PIPELINE_CREATE_DERIVATIVE_BIT = 4, VK_PIPELINE_CREATE_VIEW_INDEX_FROM_DEVICE_INDEX_BIT = 8, VK_PIPELINE_CREATE_DISPATCH_BASE_BIT = 16, - VK_PIPELINE_CREATE_DISPATCH_BASE = VK_PIPELINE_CREATE_DISPATCH_BASE_BIT + VK_PIPELINE_CREATE_DISPATCH_BASE = VK_PIPELINE_CREATE_DISPATCH_BASE_BIT, + VK_PIPELINE_CREATE_FAIL_ON_PIPELINE_COMPILE_REQUIRED_BIT = 256, + VK_PIPELINE_CREATE_EARLY_RETURN_ON_FAILURE_BIT = 512, + VK_PIPELINE_CREATE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF } VkPipelineCreateFlagBits; - typedef enum VkPrimitiveTopology { VK_PRIMITIVE_TOPOLOGY_POINT_LIST = 0, VK_PRIMITIVE_TOPOLOGY_LINE_LIST = 1, @@ -973,13 +1035,13 @@ typedef enum VkPrimitiveTopology { VK_PRIMITIVE_TOPOLOGY_LINE_STRIP_WITH_ADJACENCY = 7, VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST_WITH_ADJACENCY = 8, VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP_WITH_ADJACENCY = 9, - VK_PRIMITIVE_TOPOLOGY_PATCH_LIST = 10 + VK_PRIMITIVE_TOPOLOGY_PATCH_LIST = 10, + VK_PRIMITIVE_TOPOLOGY_MAX_ENUM = 0x7FFFFFFF } VkPrimitiveTopology; - typedef enum VkQueryControlFlagBits { - VK_QUERY_CONTROL_PRECISE_BIT = 1 + VK_QUERY_CONTROL_PRECISE_BIT = 1, + VK_QUERY_CONTROL_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF } VkQueryControlFlagBits; - typedef enum VkQueryPipelineStatisticFlagBits { VK_QUERY_PIPELINE_STATISTIC_INPUT_ASSEMBLY_VERTICES_BIT = 1, VK_QUERY_PIPELINE_STATISTIC_INPUT_ASSEMBLY_PRIMITIVES_BIT = 2, @@ -991,35 +1053,35 @@ typedef enum VkQueryPipelineStatisticFlagBits { VK_QUERY_PIPELINE_STATISTIC_FRAGMENT_SHADER_INVOCATIONS_BIT = 128, VK_QUERY_PIPELINE_STATISTIC_TESSELLATION_CONTROL_SHADER_PATCHES_BIT = 256, VK_QUERY_PIPELINE_STATISTIC_TESSELLATION_EVALUATION_SHADER_INVOCATIONS_BIT = 512, - VK_QUERY_PIPELINE_STATISTIC_COMPUTE_SHADER_INVOCATIONS_BIT = 1024 + VK_QUERY_PIPELINE_STATISTIC_COMPUTE_SHADER_INVOCATIONS_BIT = 1024, + VK_QUERY_PIPELINE_STATISTIC_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF } VkQueryPipelineStatisticFlagBits; - typedef enum VkQueryResultFlagBits { VK_QUERY_RESULT_64_BIT = 1, VK_QUERY_RESULT_WAIT_BIT = 2, VK_QUERY_RESULT_WITH_AVAILABILITY_BIT = 4, - VK_QUERY_RESULT_PARTIAL_BIT = 8 + VK_QUERY_RESULT_PARTIAL_BIT = 8, + VK_QUERY_RESULT_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF } VkQueryResultFlagBits; - typedef enum VkQueryType { VK_QUERY_TYPE_OCCLUSION = 0, VK_QUERY_TYPE_PIPELINE_STATISTICS = 1, - VK_QUERY_TYPE_TIMESTAMP = 2 + VK_QUERY_TYPE_TIMESTAMP = 2, + VK_QUERY_TYPE_MAX_ENUM = 0x7FFFFFFF } VkQueryType; - typedef enum VkQueueFlagBits { VK_QUEUE_GRAPHICS_BIT = 1, VK_QUEUE_COMPUTE_BIT = 2, VK_QUEUE_TRANSFER_BIT = 4, VK_QUEUE_SPARSE_BINDING_BIT = 8, - VK_QUEUE_PROTECTED_BIT = 16 + VK_QUEUE_PROTECTED_BIT = 16, + VK_QUEUE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF } VkQueueFlagBits; - typedef enum VkSubpassContents { VK_SUBPASS_CONTENTS_INLINE = 0, - VK_SUBPASS_CONTENTS_SECONDARY_COMMAND_BUFFERS = 1 + VK_SUBPASS_CONTENTS_SECONDARY_COMMAND_BUFFERS = 1, + VK_SUBPASS_CONTENTS_MAX_ENUM = 0x7FFFFFFF } VkSubpassContents; - typedef enum VkResult { VK_SUCCESS = 0, VK_NOT_READY = 1, @@ -1042,13 +1104,16 @@ typedef enum VkResult { VK_ERROR_UNKNOWN = -13, VK_ERROR_OUT_OF_POOL_MEMORY = -1000069000, VK_ERROR_INVALID_EXTERNAL_HANDLE = -1000072003, + VK_ERROR_FRAGMENTATION = -1000161000, + VK_ERROR_INVALID_OPAQUE_CAPTURE_ADDRESS = -1000257000, + VK_PIPELINE_COMPILE_REQUIRED = 1000297000, VK_ERROR_SURFACE_LOST_KHR = -1000000000, VK_ERROR_NATIVE_WINDOW_IN_USE_KHR = -1000000001, VK_SUBOPTIMAL_KHR = 1000001003, VK_ERROR_OUT_OF_DATE_KHR = -1000001004, - VK_ERROR_VALIDATION_FAILED_EXT = -1000011001 + VK_ERROR_VALIDATION_FAILED_EXT = -1000011001, + VK_RESULT_MAX_ENUM = 0x7FFFFFFF } VkResult; - typedef enum VkShaderStageFlagBits { VK_SHADER_STAGE_VERTEX_BIT = 1, VK_SHADER_STAGE_TESSELLATION_CONTROL_BIT = 2, @@ -1057,20 +1122,20 @@ typedef enum VkShaderStageFlagBits { VK_SHADER_STAGE_FRAGMENT_BIT = 16, VK_SHADER_STAGE_COMPUTE_BIT = 32, VK_SHADER_STAGE_ALL_GRAPHICS = 0x0000001F, - VK_SHADER_STAGE_ALL = 0x7FFFFFFF + VK_SHADER_STAGE_ALL = 0x7FFFFFFF, + VK_SHADER_STAGE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF } VkShaderStageFlagBits; - typedef enum VkSparseMemoryBindFlagBits { - VK_SPARSE_MEMORY_BIND_METADATA_BIT = 1 + VK_SPARSE_MEMORY_BIND_METADATA_BIT = 1, + VK_SPARSE_MEMORY_BIND_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF } VkSparseMemoryBindFlagBits; - typedef enum VkStencilFaceFlagBits { VK_STENCIL_FACE_FRONT_BIT = 1, VK_STENCIL_FACE_BACK_BIT = 2, VK_STENCIL_FACE_FRONT_AND_BACK = 0x00000003, - VK_STENCIL_FRONT_AND_BACK = VK_STENCIL_FACE_FRONT_AND_BACK + VK_STENCIL_FRONT_AND_BACK = VK_STENCIL_FACE_FRONT_AND_BACK, + VK_STENCIL_FACE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF } VkStencilFaceFlagBits; - typedef enum VkStencilOp { VK_STENCIL_OP_KEEP = 0, VK_STENCIL_OP_ZERO = 1, @@ -1079,9 +1144,9 @@ typedef enum VkStencilOp { VK_STENCIL_OP_DECREMENT_AND_CLAMP = 4, VK_STENCIL_OP_INVERT = 5, VK_STENCIL_OP_INCREMENT_AND_WRAP = 6, - VK_STENCIL_OP_DECREMENT_AND_WRAP = 7 + VK_STENCIL_OP_DECREMENT_AND_WRAP = 7, + VK_STENCIL_OP_MAX_ENUM = 0x7FFFFFFF } VkStencilOp; - typedef enum VkStructureType { VK_STRUCTURE_TYPE_APPLICATION_INFO = 0, VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO = 1, @@ -1199,6 +1264,108 @@ typedef enum VkStructureType { VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_SUPPORT = 1000168001, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_DRAW_PARAMETERS_FEATURES = 1000063000, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_DRAW_PARAMETER_FEATURES = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_DRAW_PARAMETERS_FEATURES, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_1_FEATURES = 49, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_1_PROPERTIES = 50, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_2_FEATURES = 51, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_2_PROPERTIES = 52, + VK_STRUCTURE_TYPE_IMAGE_FORMAT_LIST_CREATE_INFO = 1000147000, + VK_STRUCTURE_TYPE_ATTACHMENT_DESCRIPTION_2 = 1000109000, + VK_STRUCTURE_TYPE_ATTACHMENT_REFERENCE_2 = 1000109001, + VK_STRUCTURE_TYPE_SUBPASS_DESCRIPTION_2 = 1000109002, + VK_STRUCTURE_TYPE_SUBPASS_DEPENDENCY_2 = 1000109003, + VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO_2 = 1000109004, + VK_STRUCTURE_TYPE_SUBPASS_BEGIN_INFO = 1000109005, + VK_STRUCTURE_TYPE_SUBPASS_END_INFO = 1000109006, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_8BIT_STORAGE_FEATURES = 1000177000, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DRIVER_PROPERTIES = 1000196000, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_ATOMIC_INT64_FEATURES = 1000180000, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_FLOAT16_INT8_FEATURES = 1000082000, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FLOAT_CONTROLS_PROPERTIES = 1000197000, + VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_BINDING_FLAGS_CREATE_INFO = 1000161000, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_INDEXING_FEATURES = 1000161001, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_INDEXING_PROPERTIES = 1000161002, + VK_STRUCTURE_TYPE_DESCRIPTOR_SET_VARIABLE_DESCRIPTOR_COUNT_ALLOCATE_INFO = 1000161003, + VK_STRUCTURE_TYPE_DESCRIPTOR_SET_VARIABLE_DESCRIPTOR_COUNT_LAYOUT_SUPPORT = 1000161004, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEPTH_STENCIL_RESOLVE_PROPERTIES = 1000199000, + VK_STRUCTURE_TYPE_SUBPASS_DESCRIPTION_DEPTH_STENCIL_RESOLVE = 1000199001, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SCALAR_BLOCK_LAYOUT_FEATURES = 1000221000, + VK_STRUCTURE_TYPE_IMAGE_STENCIL_USAGE_CREATE_INFO = 1000246000, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SAMPLER_FILTER_MINMAX_PROPERTIES = 1000130000, + VK_STRUCTURE_TYPE_SAMPLER_REDUCTION_MODE_CREATE_INFO = 1000130001, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_MEMORY_MODEL_FEATURES = 1000211000, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGELESS_FRAMEBUFFER_FEATURES = 1000108000, + VK_STRUCTURE_TYPE_FRAMEBUFFER_ATTACHMENTS_CREATE_INFO = 1000108001, + VK_STRUCTURE_TYPE_FRAMEBUFFER_ATTACHMENT_IMAGE_INFO = 1000108002, + VK_STRUCTURE_TYPE_RENDER_PASS_ATTACHMENT_BEGIN_INFO = 1000108003, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_UNIFORM_BUFFER_STANDARD_LAYOUT_FEATURES = 1000253000, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_SUBGROUP_EXTENDED_TYPES_FEATURES = 1000175000, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SEPARATE_DEPTH_STENCIL_LAYOUTS_FEATURES = 1000241000, + VK_STRUCTURE_TYPE_ATTACHMENT_REFERENCE_STENCIL_LAYOUT = 1000241001, + VK_STRUCTURE_TYPE_ATTACHMENT_DESCRIPTION_STENCIL_LAYOUT = 1000241002, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_HOST_QUERY_RESET_FEATURES = 1000261000, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TIMELINE_SEMAPHORE_FEATURES = 1000207000, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TIMELINE_SEMAPHORE_PROPERTIES = 1000207001, + VK_STRUCTURE_TYPE_SEMAPHORE_TYPE_CREATE_INFO = 1000207002, + VK_STRUCTURE_TYPE_TIMELINE_SEMAPHORE_SUBMIT_INFO = 1000207003, + VK_STRUCTURE_TYPE_SEMAPHORE_WAIT_INFO = 1000207004, + VK_STRUCTURE_TYPE_SEMAPHORE_SIGNAL_INFO = 1000207005, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_BUFFER_DEVICE_ADDRESS_FEATURES = 1000257000, + VK_STRUCTURE_TYPE_BUFFER_DEVICE_ADDRESS_INFO = 1000244001, + VK_STRUCTURE_TYPE_BUFFER_OPAQUE_CAPTURE_ADDRESS_CREATE_INFO = 1000257002, + VK_STRUCTURE_TYPE_MEMORY_OPAQUE_CAPTURE_ADDRESS_ALLOCATE_INFO = 1000257003, + VK_STRUCTURE_TYPE_DEVICE_MEMORY_OPAQUE_CAPTURE_ADDRESS_INFO = 1000257004, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_3_FEATURES = 53, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_3_PROPERTIES = 54, + VK_STRUCTURE_TYPE_PIPELINE_CREATION_FEEDBACK_CREATE_INFO = 1000192000, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_TERMINATE_INVOCATION_FEATURES = 1000215000, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TOOL_PROPERTIES = 1000245000, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_DEMOTE_TO_HELPER_INVOCATION_FEATURES = 1000276000, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PRIVATE_DATA_FEATURES = 1000295000, + VK_STRUCTURE_TYPE_DEVICE_PRIVATE_DATA_CREATE_INFO = 1000295001, + VK_STRUCTURE_TYPE_PRIVATE_DATA_SLOT_CREATE_INFO = 1000295002, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PIPELINE_CREATION_CACHE_CONTROL_FEATURES = 1000297000, + VK_STRUCTURE_TYPE_MEMORY_BARRIER_2 = 1000314000, + VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER_2 = 1000314001, + VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER_2 = 1000314002, + VK_STRUCTURE_TYPE_DEPENDENCY_INFO = 1000314003, + VK_STRUCTURE_TYPE_SUBMIT_INFO_2 = 1000314004, + VK_STRUCTURE_TYPE_SEMAPHORE_SUBMIT_INFO = 1000314005, + VK_STRUCTURE_TYPE_COMMAND_BUFFER_SUBMIT_INFO = 1000314006, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SYNCHRONIZATION_2_FEATURES = 1000314007, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ZERO_INITIALIZE_WORKGROUP_MEMORY_FEATURES = 1000325000, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_ROBUSTNESS_FEATURES = 1000335000, + VK_STRUCTURE_TYPE_COPY_BUFFER_INFO_2 = 1000337000, + VK_STRUCTURE_TYPE_COPY_IMAGE_INFO_2 = 1000337001, + VK_STRUCTURE_TYPE_COPY_BUFFER_TO_IMAGE_INFO_2 = 1000337002, + VK_STRUCTURE_TYPE_COPY_IMAGE_TO_BUFFER_INFO_2 = 1000337003, + VK_STRUCTURE_TYPE_BLIT_IMAGE_INFO_2 = 1000337004, + VK_STRUCTURE_TYPE_RESOLVE_IMAGE_INFO_2 = 1000337005, + VK_STRUCTURE_TYPE_BUFFER_COPY_2 = 1000337006, + VK_STRUCTURE_TYPE_IMAGE_COPY_2 = 1000337007, + VK_STRUCTURE_TYPE_IMAGE_BLIT_2 = 1000337008, + VK_STRUCTURE_TYPE_BUFFER_IMAGE_COPY_2 = 1000337009, + VK_STRUCTURE_TYPE_IMAGE_RESOLVE_2 = 1000337010, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBGROUP_SIZE_CONTROL_PROPERTIES = 1000225000, + VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_REQUIRED_SUBGROUP_SIZE_CREATE_INFO = 1000225001, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBGROUP_SIZE_CONTROL_FEATURES = 1000225002, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_INLINE_UNIFORM_BLOCK_FEATURES = 1000138000, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_INLINE_UNIFORM_BLOCK_PROPERTIES = 1000138001, + VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET_INLINE_UNIFORM_BLOCK = 1000138002, + VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_INLINE_UNIFORM_BLOCK_CREATE_INFO = 1000138003, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TEXTURE_COMPRESSION_ASTC_HDR_FEATURES = 1000066000, + VK_STRUCTURE_TYPE_RENDERING_INFO = 1000044000, + VK_STRUCTURE_TYPE_RENDERING_ATTACHMENT_INFO = 1000044001, + VK_STRUCTURE_TYPE_PIPELINE_RENDERING_CREATE_INFO = 1000044002, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DYNAMIC_RENDERING_FEATURES = 1000044003, + VK_STRUCTURE_TYPE_COMMAND_BUFFER_INHERITANCE_RENDERING_INFO = 1000044004, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_INTEGER_DOT_PRODUCT_FEATURES = 1000280000, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_INTEGER_DOT_PRODUCT_PROPERTIES = 1000280001, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TEXEL_BUFFER_ALIGNMENT_PROPERTIES = 1000281001, + VK_STRUCTURE_TYPE_FORMAT_PROPERTIES_3 = 1000360000, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_4_FEATURES = 1000413000, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_4_PROPERTIES = 1000413001, + VK_STRUCTURE_TYPE_DEVICE_BUFFER_MEMORY_REQUIREMENTS = 1000413002, + VK_STRUCTURE_TYPE_DEVICE_IMAGE_MEMORY_REQUIREMENTS = 1000413003, VK_STRUCTURE_TYPE_SWAPCHAIN_CREATE_INFO_KHR = 1000001000, VK_STRUCTURE_TYPE_PRESENT_INFO_KHR = 1000001001, VK_STRUCTURE_TYPE_DEVICE_GROUP_PRESENT_CAPABILITIES_KHR = 1000060007, @@ -1208,43 +1375,44 @@ typedef enum VkStructureType { VK_STRUCTURE_TYPE_DEVICE_GROUP_PRESENT_INFO_KHR = 1000060011, VK_STRUCTURE_TYPE_DEVICE_GROUP_SWAPCHAIN_CREATE_INFO_KHR = 1000060012, VK_STRUCTURE_TYPE_DEBUG_REPORT_CALLBACK_CREATE_INFO_EXT = 1000011000, - VK_STRUCTURE_TYPE_DEBUG_REPORT_CREATE_INFO_EXT = VK_STRUCTURE_TYPE_DEBUG_REPORT_CALLBACK_CREATE_INFO_EXT + VK_STRUCTURE_TYPE_DEBUG_REPORT_CREATE_INFO_EXT = VK_STRUCTURE_TYPE_DEBUG_REPORT_CALLBACK_CREATE_INFO_EXT, + VK_STRUCTURE_TYPE_MAX_ENUM = 0x7FFFFFFF } VkStructureType; - typedef enum VkSystemAllocationScope { VK_SYSTEM_ALLOCATION_SCOPE_COMMAND = 0, VK_SYSTEM_ALLOCATION_SCOPE_OBJECT = 1, VK_SYSTEM_ALLOCATION_SCOPE_CACHE = 2, VK_SYSTEM_ALLOCATION_SCOPE_DEVICE = 3, - VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE = 4 + VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE = 4, + VK_SYSTEM_ALLOCATION_SCOPE_MAX_ENUM = 0x7FFFFFFF } VkSystemAllocationScope; - typedef enum VkInternalAllocationType { - VK_INTERNAL_ALLOCATION_TYPE_EXECUTABLE = 0 + VK_INTERNAL_ALLOCATION_TYPE_EXECUTABLE = 0, + VK_INTERNAL_ALLOCATION_TYPE_MAX_ENUM = 0x7FFFFFFF } VkInternalAllocationType; - typedef enum VkSamplerAddressMode { VK_SAMPLER_ADDRESS_MODE_REPEAT = 0, VK_SAMPLER_ADDRESS_MODE_MIRRORED_REPEAT = 1, VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE = 2, - VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER = 3 + VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER = 3, + VK_SAMPLER_ADDRESS_MODE_MIRROR_CLAMP_TO_EDGE = 4, + VK_SAMPLER_ADDRESS_MODE_MAX_ENUM = 0x7FFFFFFF } VkSamplerAddressMode; - typedef enum VkFilter { VK_FILTER_NEAREST = 0, - VK_FILTER_LINEAR = 1 + VK_FILTER_LINEAR = 1, + VK_FILTER_MAX_ENUM = 0x7FFFFFFF } VkFilter; - typedef enum VkSamplerMipmapMode { VK_SAMPLER_MIPMAP_MODE_NEAREST = 0, - VK_SAMPLER_MIPMAP_MODE_LINEAR = 1 + VK_SAMPLER_MIPMAP_MODE_LINEAR = 1, + VK_SAMPLER_MIPMAP_MODE_MAX_ENUM = 0x7FFFFFFF } VkSamplerMipmapMode; - typedef enum VkVertexInputRate { VK_VERTEX_INPUT_RATE_VERTEX = 0, - VK_VERTEX_INPUT_RATE_INSTANCE = 1 + VK_VERTEX_INPUT_RATE_INSTANCE = 1, + VK_VERTEX_INPUT_RATE_MAX_ENUM = 0x7FFFFFFF } VkVertexInputRate; - typedef enum VkPipelineStageFlagBits { VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT = 1, VK_PIPELINE_STAGE_DRAW_INDIRECT_BIT = 2, @@ -1262,15 +1430,16 @@ typedef enum VkPipelineStageFlagBits { VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT = 8192, VK_PIPELINE_STAGE_HOST_BIT = 16384, VK_PIPELINE_STAGE_ALL_GRAPHICS_BIT = 32768, - VK_PIPELINE_STAGE_ALL_COMMANDS_BIT = 65536 + VK_PIPELINE_STAGE_ALL_COMMANDS_BIT = 65536, + VK_PIPELINE_STAGE_NONE = 0, + VK_PIPELINE_STAGE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF } VkPipelineStageFlagBits; - typedef enum VkSparseImageFormatFlagBits { VK_SPARSE_IMAGE_FORMAT_SINGLE_MIPTAIL_BIT = 1, VK_SPARSE_IMAGE_FORMAT_ALIGNED_MIP_SIZE_BIT = 2, - VK_SPARSE_IMAGE_FORMAT_NONSTANDARD_BLOCK_SIZE_BIT = 4 + VK_SPARSE_IMAGE_FORMAT_NONSTANDARD_BLOCK_SIZE_BIT = 4, + VK_SPARSE_IMAGE_FORMAT_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF } VkSparseImageFormatFlagBits; - typedef enum VkSampleCountFlagBits { VK_SAMPLE_COUNT_1_BIT = 1, VK_SAMPLE_COUNT_2_BIT = 2, @@ -1278,23 +1447,24 @@ typedef enum VkSampleCountFlagBits { VK_SAMPLE_COUNT_8_BIT = 8, VK_SAMPLE_COUNT_16_BIT = 16, VK_SAMPLE_COUNT_32_BIT = 32, - VK_SAMPLE_COUNT_64_BIT = 64 + VK_SAMPLE_COUNT_64_BIT = 64, + VK_SAMPLE_COUNT_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF } VkSampleCountFlagBits; - typedef enum VkAttachmentDescriptionFlagBits { - VK_ATTACHMENT_DESCRIPTION_MAY_ALIAS_BIT = 1 + VK_ATTACHMENT_DESCRIPTION_MAY_ALIAS_BIT = 1, + VK_ATTACHMENT_DESCRIPTION_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF } VkAttachmentDescriptionFlagBits; - typedef enum VkDescriptorPoolCreateFlagBits { - VK_DESCRIPTOR_POOL_CREATE_FREE_DESCRIPTOR_SET_BIT = 1 + VK_DESCRIPTOR_POOL_CREATE_FREE_DESCRIPTOR_SET_BIT = 1, + VK_DESCRIPTOR_POOL_CREATE_UPDATE_AFTER_BIND_BIT = 2, + VK_DESCRIPTOR_POOL_CREATE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF } VkDescriptorPoolCreateFlagBits; - typedef enum VkDependencyFlagBits { VK_DEPENDENCY_BY_REGION_BIT = 1, VK_DEPENDENCY_DEVICE_GROUP_BIT = 4, - VK_DEPENDENCY_VIEW_LOCAL_BIT = 2 + VK_DEPENDENCY_VIEW_LOCAL_BIT = 2, + VK_DEPENDENCY_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF } VkDependencyFlagBits; - typedef enum VkObjectType { VK_OBJECT_TYPE_UNKNOWN = 0, VK_OBJECT_TYPE_INSTANCE = 1, @@ -1324,41 +1494,253 @@ typedef enum VkObjectType { VK_OBJECT_TYPE_COMMAND_POOL = 25, VK_OBJECT_TYPE_SAMPLER_YCBCR_CONVERSION = 1000156000, VK_OBJECT_TYPE_DESCRIPTOR_UPDATE_TEMPLATE = 1000085000, + VK_OBJECT_TYPE_PRIVATE_DATA_SLOT = 1000295000, VK_OBJECT_TYPE_SURFACE_KHR = 1000000000, VK_OBJECT_TYPE_SWAPCHAIN_KHR = 1000001000, - VK_OBJECT_TYPE_DEBUG_REPORT_CALLBACK_EXT = 1000011000 + VK_OBJECT_TYPE_DEBUG_REPORT_CALLBACK_EXT = 1000011000, + VK_OBJECT_TYPE_MAX_ENUM = 0x7FFFFFFF } VkObjectType; - +typedef enum VkEventCreateFlagBits { + VK_EVENT_CREATE_DEVICE_ONLY_BIT = 1, + VK_EVENT_CREATE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF +} VkEventCreateFlagBits; typedef enum VkDescriptorUpdateTemplateType { - VK_DESCRIPTOR_UPDATE_TEMPLATE_TYPE_DESCRIPTOR_SET = 0 + VK_DESCRIPTOR_UPDATE_TEMPLATE_TYPE_DESCRIPTOR_SET = 0, + VK_DESCRIPTOR_UPDATE_TEMPLATE_TYPE_MAX_ENUM = 0x7FFFFFFF } VkDescriptorUpdateTemplateType; - - typedef enum VkPointClippingBehavior { VK_POINT_CLIPPING_BEHAVIOR_ALL_CLIP_PLANES = 0, - VK_POINT_CLIPPING_BEHAVIOR_USER_CLIP_PLANES_ONLY = 1 + VK_POINT_CLIPPING_BEHAVIOR_USER_CLIP_PLANES_ONLY = 1, + VK_POINT_CLIPPING_BEHAVIOR_MAX_ENUM = 0x7FFFFFFF } VkPointClippingBehavior; +typedef enum VkResolveModeFlagBits { + VK_RESOLVE_MODE_NONE = 0, + VK_RESOLVE_MODE_SAMPLE_ZERO_BIT = 1, + VK_RESOLVE_MODE_AVERAGE_BIT = 2, + VK_RESOLVE_MODE_MIN_BIT = 4, + VK_RESOLVE_MODE_MAX_BIT = 8, + VK_RESOLVE_MODE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF +} VkResolveModeFlagBits; +typedef enum VkDescriptorBindingFlagBits { + VK_DESCRIPTOR_BINDING_UPDATE_AFTER_BIND_BIT = 1, + VK_DESCRIPTOR_BINDING_UPDATE_UNUSED_WHILE_PENDING_BIT = 2, + VK_DESCRIPTOR_BINDING_PARTIALLY_BOUND_BIT = 4, + VK_DESCRIPTOR_BINDING_VARIABLE_DESCRIPTOR_COUNT_BIT = 8, + VK_DESCRIPTOR_BINDING_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF +} VkDescriptorBindingFlagBits; +typedef enum VkSemaphoreType { + VK_SEMAPHORE_TYPE_BINARY = 0, + VK_SEMAPHORE_TYPE_TIMELINE = 1, + VK_SEMAPHORE_TYPE_MAX_ENUM = 0x7FFFFFFF +} VkSemaphoreType; +typedef enum VkPipelineCreationFeedbackFlagBits { + VK_PIPELINE_CREATION_FEEDBACK_VALID_BIT = 1, + VK_PIPELINE_CREATION_FEEDBACK_VALID_BIT_EXT = VK_PIPELINE_CREATION_FEEDBACK_VALID_BIT, + VK_PIPELINE_CREATION_FEEDBACK_APPLICATION_PIPELINE_CACHE_HIT_BIT = 2, + VK_PIPELINE_CREATION_FEEDBACK_APPLICATION_PIPELINE_CACHE_HIT_BIT_EXT = VK_PIPELINE_CREATION_FEEDBACK_APPLICATION_PIPELINE_CACHE_HIT_BIT, + VK_PIPELINE_CREATION_FEEDBACK_BASE_PIPELINE_ACCELERATION_BIT = 4, + VK_PIPELINE_CREATION_FEEDBACK_BASE_PIPELINE_ACCELERATION_BIT_EXT = VK_PIPELINE_CREATION_FEEDBACK_BASE_PIPELINE_ACCELERATION_BIT, + VK_PIPELINE_CREATION_FEEDBACK_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF +} VkPipelineCreationFeedbackFlagBits; +typedef enum VkSemaphoreWaitFlagBits { + VK_SEMAPHORE_WAIT_ANY_BIT = 1, + VK_SEMAPHORE_WAIT_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF +} VkSemaphoreWaitFlagBits; +typedef enum VkToolPurposeFlagBits { + VK_TOOL_PURPOSE_VALIDATION_BIT = 1, + VK_TOOL_PURPOSE_VALIDATION_BIT_EXT = VK_TOOL_PURPOSE_VALIDATION_BIT, + VK_TOOL_PURPOSE_PROFILING_BIT = 2, + VK_TOOL_PURPOSE_PROFILING_BIT_EXT = VK_TOOL_PURPOSE_PROFILING_BIT, + VK_TOOL_PURPOSE_TRACING_BIT = 4, + VK_TOOL_PURPOSE_TRACING_BIT_EXT = VK_TOOL_PURPOSE_TRACING_BIT, + VK_TOOL_PURPOSE_ADDITIONAL_FEATURES_BIT = 8, + VK_TOOL_PURPOSE_ADDITIONAL_FEATURES_BIT_EXT = VK_TOOL_PURPOSE_ADDITIONAL_FEATURES_BIT, + VK_TOOL_PURPOSE_MODIFYING_FEATURES_BIT = 16, + VK_TOOL_PURPOSE_MODIFYING_FEATURES_BIT_EXT = VK_TOOL_PURPOSE_MODIFYING_FEATURES_BIT, + VK_TOOL_PURPOSE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF +} VkToolPurposeFlagBits; +typedef uint64_t VkAccessFlagBits2; +static const VkAccessFlagBits2 VK_ACCESS_2_NONE = 0; +static const VkAccessFlagBits2 VK_ACCESS_2_NONE_KHR = 0; +static const VkAccessFlagBits2 VK_ACCESS_2_INDIRECT_COMMAND_READ_BIT = 1; +static const VkAccessFlagBits2 VK_ACCESS_2_INDIRECT_COMMAND_READ_BIT_KHR = 1; +static const VkAccessFlagBits2 VK_ACCESS_2_INDEX_READ_BIT = 2; +static const VkAccessFlagBits2 VK_ACCESS_2_INDEX_READ_BIT_KHR = 2; +static const VkAccessFlagBits2 VK_ACCESS_2_VERTEX_ATTRIBUTE_READ_BIT = 4; +static const VkAccessFlagBits2 VK_ACCESS_2_VERTEX_ATTRIBUTE_READ_BIT_KHR = 4; +static const VkAccessFlagBits2 VK_ACCESS_2_UNIFORM_READ_BIT = 8; +static const VkAccessFlagBits2 VK_ACCESS_2_UNIFORM_READ_BIT_KHR = 8; +static const VkAccessFlagBits2 VK_ACCESS_2_INPUT_ATTACHMENT_READ_BIT = 16; +static const VkAccessFlagBits2 VK_ACCESS_2_INPUT_ATTACHMENT_READ_BIT_KHR = 16; +static const VkAccessFlagBits2 VK_ACCESS_2_SHADER_READ_BIT = 32; +static const VkAccessFlagBits2 VK_ACCESS_2_SHADER_READ_BIT_KHR = 32; +static const VkAccessFlagBits2 VK_ACCESS_2_SHADER_WRITE_BIT = 64; +static const VkAccessFlagBits2 VK_ACCESS_2_SHADER_WRITE_BIT_KHR = 64; +static const VkAccessFlagBits2 VK_ACCESS_2_COLOR_ATTACHMENT_READ_BIT = 128; +static const VkAccessFlagBits2 VK_ACCESS_2_COLOR_ATTACHMENT_READ_BIT_KHR = 128; +static const VkAccessFlagBits2 VK_ACCESS_2_COLOR_ATTACHMENT_WRITE_BIT = 256; +static const VkAccessFlagBits2 VK_ACCESS_2_COLOR_ATTACHMENT_WRITE_BIT_KHR = 256; +static const VkAccessFlagBits2 VK_ACCESS_2_DEPTH_STENCIL_ATTACHMENT_READ_BIT = 512; +static const VkAccessFlagBits2 VK_ACCESS_2_DEPTH_STENCIL_ATTACHMENT_READ_BIT_KHR = 512; +static const VkAccessFlagBits2 VK_ACCESS_2_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT = 1024; +static const VkAccessFlagBits2 VK_ACCESS_2_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT_KHR = 1024; +static const VkAccessFlagBits2 VK_ACCESS_2_TRANSFER_READ_BIT = 2048; +static const VkAccessFlagBits2 VK_ACCESS_2_TRANSFER_READ_BIT_KHR = 2048; +static const VkAccessFlagBits2 VK_ACCESS_2_TRANSFER_WRITE_BIT = 4096; +static const VkAccessFlagBits2 VK_ACCESS_2_TRANSFER_WRITE_BIT_KHR = 4096; +static const VkAccessFlagBits2 VK_ACCESS_2_HOST_READ_BIT = 8192; +static const VkAccessFlagBits2 VK_ACCESS_2_HOST_READ_BIT_KHR = 8192; +static const VkAccessFlagBits2 VK_ACCESS_2_HOST_WRITE_BIT = 16384; +static const VkAccessFlagBits2 VK_ACCESS_2_HOST_WRITE_BIT_KHR = 16384; +static const VkAccessFlagBits2 VK_ACCESS_2_MEMORY_READ_BIT = 32768; +static const VkAccessFlagBits2 VK_ACCESS_2_MEMORY_READ_BIT_KHR = 32768; +static const VkAccessFlagBits2 VK_ACCESS_2_MEMORY_WRITE_BIT = 65536; +static const VkAccessFlagBits2 VK_ACCESS_2_MEMORY_WRITE_BIT_KHR = 65536; +static const VkAccessFlagBits2 VK_ACCESS_2_SHADER_SAMPLED_READ_BIT = 4294967296; +static const VkAccessFlagBits2 VK_ACCESS_2_SHADER_SAMPLED_READ_BIT_KHR = 4294967296; +static const VkAccessFlagBits2 VK_ACCESS_2_SHADER_STORAGE_READ_BIT = 8589934592; +static const VkAccessFlagBits2 VK_ACCESS_2_SHADER_STORAGE_READ_BIT_KHR = 8589934592; +static const VkAccessFlagBits2 VK_ACCESS_2_SHADER_STORAGE_WRITE_BIT = 17179869184; +static const VkAccessFlagBits2 VK_ACCESS_2_SHADER_STORAGE_WRITE_BIT_KHR = 17179869184; +typedef uint64_t VkPipelineStageFlagBits2; +static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_NONE = 0; +static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_NONE_KHR = 0; +static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_TOP_OF_PIPE_BIT = 1; +static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_TOP_OF_PIPE_BIT_KHR = 1; +static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_DRAW_INDIRECT_BIT = 2; +static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_DRAW_INDIRECT_BIT_KHR = 2; +static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_VERTEX_INPUT_BIT = 4; +static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_VERTEX_INPUT_BIT_KHR = 4; +static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_VERTEX_SHADER_BIT = 8; +static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_VERTEX_SHADER_BIT_KHR = 8; +static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_TESSELLATION_CONTROL_SHADER_BIT = 16; +static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_TESSELLATION_CONTROL_SHADER_BIT_KHR = 16; +static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_TESSELLATION_EVALUATION_SHADER_BIT = 32; +static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_TESSELLATION_EVALUATION_SHADER_BIT_KHR = 32; +static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_GEOMETRY_SHADER_BIT = 64; +static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_GEOMETRY_SHADER_BIT_KHR = 64; +static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_FRAGMENT_SHADER_BIT = 128; +static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_FRAGMENT_SHADER_BIT_KHR = 128; +static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_EARLY_FRAGMENT_TESTS_BIT = 256; +static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_EARLY_FRAGMENT_TESTS_BIT_KHR = 256; +static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_LATE_FRAGMENT_TESTS_BIT = 512; +static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_LATE_FRAGMENT_TESTS_BIT_KHR = 512; +static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_COLOR_ATTACHMENT_OUTPUT_BIT = 1024; +static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_COLOR_ATTACHMENT_OUTPUT_BIT_KHR = 1024; +static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_COMPUTE_SHADER_BIT = 2048; +static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_COMPUTE_SHADER_BIT_KHR = 2048; +static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_ALL_TRANSFER_BIT = 4096; +static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_ALL_TRANSFER_BIT_KHR = 4096; +static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_TRANSFER_BIT = 4096; +static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_TRANSFER_BIT_KHR = 4096; +static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_BOTTOM_OF_PIPE_BIT = 8192; +static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_BOTTOM_OF_PIPE_BIT_KHR = 8192; +static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_HOST_BIT = 16384; +static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_HOST_BIT_KHR = 16384; +static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_ALL_GRAPHICS_BIT = 32768; +static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_ALL_GRAPHICS_BIT_KHR = 32768; +static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT = 65536; +static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT_KHR = 65536; +static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_COPY_BIT = 4294967296; +static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_COPY_BIT_KHR = 4294967296; +static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_RESOLVE_BIT = 8589934592; +static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_RESOLVE_BIT_KHR = 8589934592; +static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_BLIT_BIT = 17179869184; +static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_BLIT_BIT_KHR = 17179869184; +static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_CLEAR_BIT = 34359738368; +static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_CLEAR_BIT_KHR = 34359738368; +static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_INDEX_INPUT_BIT = 68719476736; +static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_INDEX_INPUT_BIT_KHR = 68719476736; +static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_VERTEX_ATTRIBUTE_INPUT_BIT = 137438953472; +static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_VERTEX_ATTRIBUTE_INPUT_BIT_KHR = 137438953472; +static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_PRE_RASTERIZATION_SHADERS_BIT = 274877906944; +static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_PRE_RASTERIZATION_SHADERS_BIT_KHR = 274877906944; +typedef uint64_t VkFormatFeatureFlagBits2; +static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_SAMPLED_IMAGE_BIT = 1; +static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_SAMPLED_IMAGE_BIT_KHR = 1; +static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_STORAGE_IMAGE_BIT = 2; +static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_STORAGE_IMAGE_BIT_KHR = 2; +static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_STORAGE_IMAGE_ATOMIC_BIT = 4; +static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_STORAGE_IMAGE_ATOMIC_BIT_KHR = 4; +static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_UNIFORM_TEXEL_BUFFER_BIT = 8; +static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_UNIFORM_TEXEL_BUFFER_BIT_KHR = 8; +static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_STORAGE_TEXEL_BUFFER_BIT = 16; +static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_STORAGE_TEXEL_BUFFER_BIT_KHR = 16; +static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_STORAGE_TEXEL_BUFFER_ATOMIC_BIT = 32; +static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_STORAGE_TEXEL_BUFFER_ATOMIC_BIT_KHR = 32; +static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_VERTEX_BUFFER_BIT = 64; +static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_VERTEX_BUFFER_BIT_KHR = 64; +static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_COLOR_ATTACHMENT_BIT = 128; +static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_COLOR_ATTACHMENT_BIT_KHR = 128; +static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_COLOR_ATTACHMENT_BLEND_BIT = 256; +static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_COLOR_ATTACHMENT_BLEND_BIT_KHR = 256; +static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_DEPTH_STENCIL_ATTACHMENT_BIT = 512; +static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_DEPTH_STENCIL_ATTACHMENT_BIT_KHR = 512; +static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_BLIT_SRC_BIT = 1024; +static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_BLIT_SRC_BIT_KHR = 1024; +static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_BLIT_DST_BIT = 2048; +static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_BLIT_DST_BIT_KHR = 2048; +static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_SAMPLED_IMAGE_FILTER_LINEAR_BIT = 4096; +static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_SAMPLED_IMAGE_FILTER_LINEAR_BIT_KHR = 4096; +static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_SAMPLED_IMAGE_FILTER_CUBIC_BIT = 8192; +static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_SAMPLED_IMAGE_FILTER_CUBIC_BIT_EXT = 8192; +static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_TRANSFER_SRC_BIT = 16384; +static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_TRANSFER_SRC_BIT_KHR = 16384; +static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_TRANSFER_DST_BIT = 32768; +static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_TRANSFER_DST_BIT_KHR = 32768; +static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_SAMPLED_IMAGE_FILTER_MINMAX_BIT = 65536; +static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_SAMPLED_IMAGE_FILTER_MINMAX_BIT_KHR = 65536; +static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_MIDPOINT_CHROMA_SAMPLES_BIT = 131072; +static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_MIDPOINT_CHROMA_SAMPLES_BIT_KHR = 131072; +static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_SAMPLED_IMAGE_YCBCR_CONVERSION_LINEAR_FILTER_BIT = 262144; +static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_SAMPLED_IMAGE_YCBCR_CONVERSION_LINEAR_FILTER_BIT_KHR = 262144; +static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_SAMPLED_IMAGE_YCBCR_CONVERSION_SEPARATE_RECONSTRUCTION_FILTER_BIT = 524288; +static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_SAMPLED_IMAGE_YCBCR_CONVERSION_SEPARATE_RECONSTRUCTION_FILTER_BIT_KHR = 524288; +static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_SAMPLED_IMAGE_YCBCR_CONVERSION_CHROMA_RECONSTRUCTION_EXPLICIT_BIT = 1048576; +static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_SAMPLED_IMAGE_YCBCR_CONVERSION_CHROMA_RECONSTRUCTION_EXPLICIT_BIT_KHR = 1048576; +static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_SAMPLED_IMAGE_YCBCR_CONVERSION_CHROMA_RECONSTRUCTION_EXPLICIT_FORCEABLE_BIT = 2097152; +static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_SAMPLED_IMAGE_YCBCR_CONVERSION_CHROMA_RECONSTRUCTION_EXPLICIT_FORCEABLE_BIT_KHR = 2097152; +static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_DISJOINT_BIT = 4194304; +static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_DISJOINT_BIT_KHR = 4194304; +static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_COSITED_CHROMA_SAMPLES_BIT = 8388608; +static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_COSITED_CHROMA_SAMPLES_BIT_KHR = 8388608; +static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_STORAGE_READ_WITHOUT_FORMAT_BIT = 2147483648; +static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_STORAGE_READ_WITHOUT_FORMAT_BIT_KHR = 2147483648; +static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_STORAGE_WRITE_WITHOUT_FORMAT_BIT = 4294967296; +static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_STORAGE_WRITE_WITHOUT_FORMAT_BIT_KHR = 4294967296; +static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_SAMPLED_IMAGE_DEPTH_COMPARISON_BIT = 8589934592; +static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_SAMPLED_IMAGE_DEPTH_COMPARISON_BIT_KHR = 8589934592; + +typedef enum VkRenderingFlagBits { + VK_RENDERING_CONTENTS_SECONDARY_COMMAND_BUFFERS_BIT = 1, + VK_RENDERING_CONTENTS_SECONDARY_COMMAND_BUFFERS_BIT_KHR = VK_RENDERING_CONTENTS_SECONDARY_COMMAND_BUFFERS_BIT, + VK_RENDERING_SUSPENDING_BIT = 2, + VK_RENDERING_SUSPENDING_BIT_KHR = VK_RENDERING_SUSPENDING_BIT, + VK_RENDERING_RESUMING_BIT = 4, + VK_RENDERING_RESUMING_BIT_KHR = VK_RENDERING_RESUMING_BIT, + VK_RENDERING_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF +} VkRenderingFlagBits; typedef enum VkColorSpaceKHR { VK_COLOR_SPACE_SRGB_NONLINEAR_KHR = 0, - VK_COLORSPACE_SRGB_NONLINEAR_KHR = VK_COLOR_SPACE_SRGB_NONLINEAR_KHR + VK_COLORSPACE_SRGB_NONLINEAR_KHR = VK_COLOR_SPACE_SRGB_NONLINEAR_KHR, + VK_COLOR_SPACE_MAX_ENUM_KHR = 0x7FFFFFFF } VkColorSpaceKHR; - typedef enum VkCompositeAlphaFlagBitsKHR { VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR = 1, VK_COMPOSITE_ALPHA_PRE_MULTIPLIED_BIT_KHR = 2, VK_COMPOSITE_ALPHA_POST_MULTIPLIED_BIT_KHR = 4, - VK_COMPOSITE_ALPHA_INHERIT_BIT_KHR = 8 + VK_COMPOSITE_ALPHA_INHERIT_BIT_KHR = 8, + VK_COMPOSITE_ALPHA_FLAG_BITS_MAX_ENUM_KHR = 0x7FFFFFFF } VkCompositeAlphaFlagBitsKHR; - typedef enum VkPresentModeKHR { VK_PRESENT_MODE_IMMEDIATE_KHR = 0, VK_PRESENT_MODE_MAILBOX_KHR = 1, VK_PRESENT_MODE_FIFO_KHR = 2, - VK_PRESENT_MODE_FIFO_RELAXED_KHR = 3 + VK_PRESENT_MODE_FIFO_RELAXED_KHR = 3, + VK_PRESENT_MODE_MAX_ENUM_KHR = 0x7FFFFFFF } VkPresentModeKHR; - typedef enum VkSurfaceTransformFlagBitsKHR { VK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR = 1, VK_SURFACE_TRANSFORM_ROTATE_90_BIT_KHR = 2, @@ -1368,17 +1750,17 @@ typedef enum VkSurfaceTransformFlagBitsKHR { VK_SURFACE_TRANSFORM_HORIZONTAL_MIRROR_ROTATE_90_BIT_KHR = 32, VK_SURFACE_TRANSFORM_HORIZONTAL_MIRROR_ROTATE_180_BIT_KHR = 64, VK_SURFACE_TRANSFORM_HORIZONTAL_MIRROR_ROTATE_270_BIT_KHR = 128, - VK_SURFACE_TRANSFORM_INHERIT_BIT_KHR = 256 + VK_SURFACE_TRANSFORM_INHERIT_BIT_KHR = 256, + VK_SURFACE_TRANSFORM_FLAG_BITS_MAX_ENUM_KHR = 0x7FFFFFFF } VkSurfaceTransformFlagBitsKHR; - typedef enum VkDebugReportFlagBitsEXT { VK_DEBUG_REPORT_INFORMATION_BIT_EXT = 1, VK_DEBUG_REPORT_WARNING_BIT_EXT = 2, VK_DEBUG_REPORT_PERFORMANCE_WARNING_BIT_EXT = 4, VK_DEBUG_REPORT_ERROR_BIT_EXT = 8, - VK_DEBUG_REPORT_DEBUG_BIT_EXT = 16 + VK_DEBUG_REPORT_DEBUG_BIT_EXT = 16, + VK_DEBUG_REPORT_FLAG_BITS_MAX_ENUM_EXT = 0x7FFFFFFF } VkDebugReportFlagBitsEXT; - typedef enum VkDebugReportObjectTypeEXT { VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT = 0, VK_DEBUG_REPORT_OBJECT_TYPE_INSTANCE_EXT = 1, @@ -1415,9 +1797,9 @@ typedef enum VkDebugReportObjectTypeEXT { VK_DEBUG_REPORT_OBJECT_TYPE_VALIDATION_CACHE_EXT_EXT = 33, VK_DEBUG_REPORT_OBJECT_TYPE_VALIDATION_CACHE_EXT = VK_DEBUG_REPORT_OBJECT_TYPE_VALIDATION_CACHE_EXT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_SAMPLER_YCBCR_CONVERSION_EXT = 1000156000, - VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_UPDATE_TEMPLATE_EXT = 1000085000 + VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_UPDATE_TEMPLATE_EXT = 1000085000, + VK_DEBUG_REPORT_OBJECT_TYPE_MAX_ENUM_EXT = 0x7FFFFFFF } VkDebugReportObjectTypeEXT; - typedef enum VkExternalMemoryHandleTypeFlagBits { VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD_BIT = 1, VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_BIT = 2, @@ -1425,72 +1807,74 @@ typedef enum VkExternalMemoryHandleTypeFlagBits { VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_TEXTURE_BIT = 8, VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_TEXTURE_KMT_BIT = 16, VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D12_HEAP_BIT = 32, - VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D12_RESOURCE_BIT = 64 + VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D12_RESOURCE_BIT = 64, + VK_EXTERNAL_MEMORY_HANDLE_TYPE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF } VkExternalMemoryHandleTypeFlagBits; - typedef enum VkExternalMemoryFeatureFlagBits { VK_EXTERNAL_MEMORY_FEATURE_DEDICATED_ONLY_BIT = 1, VK_EXTERNAL_MEMORY_FEATURE_EXPORTABLE_BIT = 2, - VK_EXTERNAL_MEMORY_FEATURE_IMPORTABLE_BIT = 4 + VK_EXTERNAL_MEMORY_FEATURE_IMPORTABLE_BIT = 4, + VK_EXTERNAL_MEMORY_FEATURE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF } VkExternalMemoryFeatureFlagBits; - typedef enum VkExternalSemaphoreHandleTypeFlagBits { VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_FD_BIT = 1, VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_BIT = 2, VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_KMT_BIT = 4, VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D12_FENCE_BIT = 8, VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D11_FENCE_BIT = VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D12_FENCE_BIT, - VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_SYNC_FD_BIT = 16 + VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_SYNC_FD_BIT = 16, + VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF } VkExternalSemaphoreHandleTypeFlagBits; - typedef enum VkExternalSemaphoreFeatureFlagBits { VK_EXTERNAL_SEMAPHORE_FEATURE_EXPORTABLE_BIT = 1, - VK_EXTERNAL_SEMAPHORE_FEATURE_IMPORTABLE_BIT = 2 + VK_EXTERNAL_SEMAPHORE_FEATURE_IMPORTABLE_BIT = 2, + VK_EXTERNAL_SEMAPHORE_FEATURE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF } VkExternalSemaphoreFeatureFlagBits; - typedef enum VkSemaphoreImportFlagBits { - VK_SEMAPHORE_IMPORT_TEMPORARY_BIT = 1 + VK_SEMAPHORE_IMPORT_TEMPORARY_BIT = 1, + VK_SEMAPHORE_IMPORT_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF } VkSemaphoreImportFlagBits; - typedef enum VkExternalFenceHandleTypeFlagBits { VK_EXTERNAL_FENCE_HANDLE_TYPE_OPAQUE_FD_BIT = 1, VK_EXTERNAL_FENCE_HANDLE_TYPE_OPAQUE_WIN32_BIT = 2, VK_EXTERNAL_FENCE_HANDLE_TYPE_OPAQUE_WIN32_KMT_BIT = 4, - VK_EXTERNAL_FENCE_HANDLE_TYPE_SYNC_FD_BIT = 8 + VK_EXTERNAL_FENCE_HANDLE_TYPE_SYNC_FD_BIT = 8, + VK_EXTERNAL_FENCE_HANDLE_TYPE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF } VkExternalFenceHandleTypeFlagBits; - typedef enum VkExternalFenceFeatureFlagBits { VK_EXTERNAL_FENCE_FEATURE_EXPORTABLE_BIT = 1, - VK_EXTERNAL_FENCE_FEATURE_IMPORTABLE_BIT = 2 + VK_EXTERNAL_FENCE_FEATURE_IMPORTABLE_BIT = 2, + VK_EXTERNAL_FENCE_FEATURE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF } VkExternalFenceFeatureFlagBits; - typedef enum VkFenceImportFlagBits { - VK_FENCE_IMPORT_TEMPORARY_BIT = 1 + VK_FENCE_IMPORT_TEMPORARY_BIT = 1, + VK_FENCE_IMPORT_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF } VkFenceImportFlagBits; - typedef enum VkPeerMemoryFeatureFlagBits { VK_PEER_MEMORY_FEATURE_COPY_SRC_BIT = 1, VK_PEER_MEMORY_FEATURE_COPY_DST_BIT = 2, VK_PEER_MEMORY_FEATURE_GENERIC_SRC_BIT = 4, - VK_PEER_MEMORY_FEATURE_GENERIC_DST_BIT = 8 + VK_PEER_MEMORY_FEATURE_GENERIC_DST_BIT = 8, + VK_PEER_MEMORY_FEATURE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF } VkPeerMemoryFeatureFlagBits; - typedef enum VkMemoryAllocateFlagBits { - VK_MEMORY_ALLOCATE_DEVICE_MASK_BIT = 1 + VK_MEMORY_ALLOCATE_DEVICE_MASK_BIT = 1, + VK_MEMORY_ALLOCATE_DEVICE_ADDRESS_BIT = 2, + VK_MEMORY_ALLOCATE_DEVICE_ADDRESS_CAPTURE_REPLAY_BIT = 4, + VK_MEMORY_ALLOCATE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF } VkMemoryAllocateFlagBits; - typedef enum VkDeviceGroupPresentModeFlagBitsKHR { VK_DEVICE_GROUP_PRESENT_MODE_LOCAL_BIT_KHR = 1, VK_DEVICE_GROUP_PRESENT_MODE_REMOTE_BIT_KHR = 2, VK_DEVICE_GROUP_PRESENT_MODE_SUM_BIT_KHR = 4, - VK_DEVICE_GROUP_PRESENT_MODE_LOCAL_MULTI_DEVICE_BIT_KHR = 8 + VK_DEVICE_GROUP_PRESENT_MODE_LOCAL_MULTI_DEVICE_BIT_KHR = 8, + VK_DEVICE_GROUP_PRESENT_MODE_FLAG_BITS_MAX_ENUM_KHR = 0x7FFFFFFF } VkDeviceGroupPresentModeFlagBitsKHR; - typedef enum VkSwapchainCreateFlagBitsKHR { VK_SWAPCHAIN_CREATE_SPLIT_INSTANCE_BIND_REGIONS_BIT_KHR = 1, - VK_SWAPCHAIN_CREATE_PROTECTED_BIT_KHR = 2 + VK_SWAPCHAIN_CREATE_PROTECTED_BIT_KHR = 2, + VK_SWAPCHAIN_CREATE_FLAG_BITS_MAX_ENUM_KHR = 0x7FFFFFFF } VkSwapchainCreateFlagBitsKHR; - typedef enum VkSubgroupFeatureFlagBits { VK_SUBGROUP_FEATURE_BASIC_BIT = 1, VK_SUBGROUP_FEATURE_VOTE_BIT = 2, @@ -1499,71 +1883,109 @@ typedef enum VkSubgroupFeatureFlagBits { VK_SUBGROUP_FEATURE_SHUFFLE_BIT = 16, VK_SUBGROUP_FEATURE_SHUFFLE_RELATIVE_BIT = 32, VK_SUBGROUP_FEATURE_CLUSTERED_BIT = 64, - VK_SUBGROUP_FEATURE_QUAD_BIT = 128 + VK_SUBGROUP_FEATURE_QUAD_BIT = 128, + VK_SUBGROUP_FEATURE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF } VkSubgroupFeatureFlagBits; - typedef enum VkTessellationDomainOrigin { VK_TESSELLATION_DOMAIN_ORIGIN_UPPER_LEFT = 0, - VK_TESSELLATION_DOMAIN_ORIGIN_LOWER_LEFT = 1 + VK_TESSELLATION_DOMAIN_ORIGIN_LOWER_LEFT = 1, + VK_TESSELLATION_DOMAIN_ORIGIN_MAX_ENUM = 0x7FFFFFFF } VkTessellationDomainOrigin; - typedef enum VkSamplerYcbcrModelConversion { VK_SAMPLER_YCBCR_MODEL_CONVERSION_RGB_IDENTITY = 0, VK_SAMPLER_YCBCR_MODEL_CONVERSION_YCBCR_IDENTITY = 1, VK_SAMPLER_YCBCR_MODEL_CONVERSION_YCBCR_709 = 2, VK_SAMPLER_YCBCR_MODEL_CONVERSION_YCBCR_601 = 3, - VK_SAMPLER_YCBCR_MODEL_CONVERSION_YCBCR_2020 = 4 + VK_SAMPLER_YCBCR_MODEL_CONVERSION_YCBCR_2020 = 4, + VK_SAMPLER_YCBCR_MODEL_CONVERSION_MAX_ENUM = 0x7FFFFFFF } VkSamplerYcbcrModelConversion; - typedef enum VkSamplerYcbcrRange { VK_SAMPLER_YCBCR_RANGE_ITU_FULL = 0, - VK_SAMPLER_YCBCR_RANGE_ITU_NARROW = 1 + VK_SAMPLER_YCBCR_RANGE_ITU_NARROW = 1, + VK_SAMPLER_YCBCR_RANGE_MAX_ENUM = 0x7FFFFFFF } VkSamplerYcbcrRange; - typedef enum VkChromaLocation { VK_CHROMA_LOCATION_COSITED_EVEN = 0, - VK_CHROMA_LOCATION_MIDPOINT = 1 + VK_CHROMA_LOCATION_MIDPOINT = 1, + VK_CHROMA_LOCATION_MAX_ENUM = 0x7FFFFFFF } VkChromaLocation; - +typedef enum VkSamplerReductionMode { + VK_SAMPLER_REDUCTION_MODE_WEIGHTED_AVERAGE = 0, + VK_SAMPLER_REDUCTION_MODE_MIN = 1, + VK_SAMPLER_REDUCTION_MODE_MAX = 2, + VK_SAMPLER_REDUCTION_MODE_MAX_ENUM = 0x7FFFFFFF +} VkSamplerReductionMode; +typedef enum VkShaderFloatControlsIndependence { + VK_SHADER_FLOAT_CONTROLS_INDEPENDENCE_32_BIT_ONLY = 0, + VK_SHADER_FLOAT_CONTROLS_INDEPENDENCE_ALL = 1, + VK_SHADER_FLOAT_CONTROLS_INDEPENDENCE_NONE = 2, + VK_SHADER_FLOAT_CONTROLS_INDEPENDENCE_MAX_ENUM = 0x7FFFFFFF +} VkShaderFloatControlsIndependence; +typedef enum VkSubmitFlagBits { + VK_SUBMIT_PROTECTED_BIT = 1, + VK_SUBMIT_PROTECTED_BIT_KHR = VK_SUBMIT_PROTECTED_BIT, + VK_SUBMIT_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF +} VkSubmitFlagBits; typedef enum VkVendorId { VK_VENDOR_ID_VIV = 0x10001, VK_VENDOR_ID_VSI = 0x10002, VK_VENDOR_ID_KAZAN = 0x10003, VK_VENDOR_ID_CODEPLAY = 0x10004, - VK_VENDOR_ID_MESA = 0x10005 + VK_VENDOR_ID_MESA = 0x10005, + VK_VENDOR_ID_POCL = 0x10006, + VK_VENDOR_ID_MAX_ENUM = 0x7FFFFFFF } VkVendorId; - +typedef enum VkDriverId { + VK_DRIVER_ID_AMD_PROPRIETARY = 1, + VK_DRIVER_ID_AMD_OPEN_SOURCE = 2, + VK_DRIVER_ID_MESA_RADV = 3, + VK_DRIVER_ID_NVIDIA_PROPRIETARY = 4, + VK_DRIVER_ID_INTEL_PROPRIETARY_WINDOWS = 5, + VK_DRIVER_ID_INTEL_OPEN_SOURCE_MESA = 6, + VK_DRIVER_ID_IMAGINATION_PROPRIETARY = 7, + VK_DRIVER_ID_QUALCOMM_PROPRIETARY = 8, + VK_DRIVER_ID_ARM_PROPRIETARY = 9, + VK_DRIVER_ID_GOOGLE_SWIFTSHADER = 10, + VK_DRIVER_ID_GGP_PROPRIETARY = 11, + VK_DRIVER_ID_BROADCOM_PROPRIETARY = 12, + VK_DRIVER_ID_MESA_LLVMPIPE = 13, + VK_DRIVER_ID_MOLTENVK = 14, + VK_DRIVER_ID_COREAVI_PROPRIETARY = 15, + VK_DRIVER_ID_JUICE_PROPRIETARY = 16, + VK_DRIVER_ID_VERISILICON_PROPRIETARY = 17, + VK_DRIVER_ID_MESA_TURNIP = 18, + VK_DRIVER_ID_MESA_V3DV = 19, + VK_DRIVER_ID_MESA_PANVK = 20, + VK_DRIVER_ID_SAMSUNG_PROPRIETARY = 21, + VK_DRIVER_ID_MESA_VENUS = 22, + VK_DRIVER_ID_MESA_DOZEN = 23, + VK_DRIVER_ID_MAX_ENUM = 0x7FFFFFFF +} VkDriverId; typedef void (VKAPI_PTR *PFN_vkInternalAllocationNotification)( void* pUserData, size_t size, VkInternalAllocationType allocationType, VkSystemAllocationScope allocationScope); - typedef void (VKAPI_PTR *PFN_vkInternalFreeNotification)( void* pUserData, size_t size, VkInternalAllocationType allocationType, VkSystemAllocationScope allocationScope); - typedef void* (VKAPI_PTR *PFN_vkReallocationFunction)( void* pUserData, void* pOriginal, size_t size, size_t alignment, VkSystemAllocationScope allocationScope); - typedef void* (VKAPI_PTR *PFN_vkAllocationFunction)( void* pUserData, size_t size, size_t alignment, VkSystemAllocationScope allocationScope); - typedef void (VKAPI_PTR *PFN_vkFreeFunction)( void* pUserData, void* pMemory); - typedef void (VKAPI_PTR *PFN_vkVoidFunction)(void); - typedef struct VkBaseOutStructure { VkStructureType sType; struct VkBaseOutStructure * pNext; @@ -1721,6 +2143,14 @@ typedef struct VkStencilOpState { uint32_t reference; } VkStencilOpState; +typedef struct VkPipelineCacheHeaderVersionOne { + uint32_t headerSize; + VkPipelineCacheHeaderVersion headerVersion; + uint32_t vendorID; + uint32_t deviceID; + uint8_t pipelineCacheUUID [ VK_UUID_SIZE ]; +} VkPipelineCacheHeaderVersionOne; + typedef struct VkCommandBufferAllocateInfo { VkStructureType sType; const void * pNext; @@ -1787,6 +2217,28 @@ typedef struct VkPresentInfoKHR { VkResult * pResults; } VkPresentInfoKHR; +typedef struct VkDevicePrivateDataCreateInfo { + VkStructureType sType; + const void * pNext; + uint32_t privateDataSlotRequestCount; +} VkDevicePrivateDataCreateInfo; + +typedef struct VkConformanceVersion { + uint8_t major; + uint8_t minor; + uint8_t subminor; + uint8_t patch; +} VkConformanceVersion; + +typedef struct VkPhysicalDeviceDriverProperties { + VkStructureType sType; + void * pNext; + VkDriverId driverID; + char driverName [ VK_MAX_DRIVER_NAME_SIZE ]; + char driverInfo [ VK_MAX_DRIVER_INFO_SIZE ]; + VkConformanceVersion conformanceVersion; +} VkPhysicalDeviceDriverProperties; + typedef struct VkPhysicalDeviceExternalImageFormatInfo { VkStructureType sType; const void * pNext; @@ -1939,7 +2391,7 @@ typedef struct VkImageSparseMemoryRequirementsInfo2 { typedef struct VkPhysicalDevicePointClippingProperties { VkStructureType sType; void * pNext; - VkPointClippingBehavior pointClippingBehavior; + VkPointClippingBehavior pointClippingBehavior; } VkPhysicalDevicePointClippingProperties; typedef struct VkMemoryDedicatedAllocateInfo { @@ -1979,168 +2431,268 @@ typedef struct VkSamplerYcbcrConversionImageFormatProperties { uint32_t combinedImageSamplerDescriptorCount; } VkSamplerYcbcrConversionImageFormatProperties; +typedef struct VkSamplerReductionModeCreateInfo { + VkStructureType sType; + const void * pNext; + VkSamplerReductionMode reductionMode; +} VkSamplerReductionModeCreateInfo; + +typedef struct VkPhysicalDeviceInlineUniformBlockProperties { + VkStructureType sType; + void * pNext; + uint32_t maxInlineUniformBlockSize; + uint32_t maxPerStageDescriptorInlineUniformBlocks; + uint32_t maxPerStageDescriptorUpdateAfterBindInlineUniformBlocks; + uint32_t maxDescriptorSetInlineUniformBlocks; + uint32_t maxDescriptorSetUpdateAfterBindInlineUniformBlocks; +} VkPhysicalDeviceInlineUniformBlockProperties; + +typedef struct VkWriteDescriptorSetInlineUniformBlock { + VkStructureType sType; + const void * pNext; + uint32_t dataSize; + const void * pData; +} VkWriteDescriptorSetInlineUniformBlock; + +typedef struct VkDescriptorPoolInlineUniformBlockCreateInfo { + VkStructureType sType; + const void * pNext; + uint32_t maxInlineUniformBlockBindings; +} VkDescriptorPoolInlineUniformBlockCreateInfo; + +typedef struct VkImageFormatListCreateInfo { + VkStructureType sType; + const void * pNext; + uint32_t viewFormatCount; + const VkFormat * pViewFormats; +} VkImageFormatListCreateInfo; + +typedef struct VkDescriptorSetVariableDescriptorCountAllocateInfo { + VkStructureType sType; + const void * pNext; + uint32_t descriptorSetCount; + const uint32_t * pDescriptorCounts; +} VkDescriptorSetVariableDescriptorCountAllocateInfo; + +typedef struct VkDescriptorSetVariableDescriptorCountLayoutSupport { + VkStructureType sType; + void * pNext; + uint32_t maxVariableDescriptorCount; +} VkDescriptorSetVariableDescriptorCountLayoutSupport; + +typedef struct VkSubpassBeginInfo { + VkStructureType sType; + const void * pNext; + VkSubpassContents contents; +} VkSubpassBeginInfo; + +typedef struct VkSubpassEndInfo { + VkStructureType sType; + const void * pNext; +} VkSubpassEndInfo; + +typedef struct VkPhysicalDeviceTimelineSemaphoreProperties { + VkStructureType sType; + void * pNext; + uint64_t maxTimelineSemaphoreValueDifference; +} VkPhysicalDeviceTimelineSemaphoreProperties; + +typedef struct VkSemaphoreTypeCreateInfo { + VkStructureType sType; + const void * pNext; + VkSemaphoreType semaphoreType; + uint64_t initialValue; +} VkSemaphoreTypeCreateInfo; + +typedef struct VkTimelineSemaphoreSubmitInfo { + VkStructureType sType; + const void * pNext; + uint32_t waitSemaphoreValueCount; + const uint64_t * pWaitSemaphoreValues; + uint32_t signalSemaphoreValueCount; + const uint64_t * pSignalSemaphoreValues; +} VkTimelineSemaphoreSubmitInfo; + +typedef struct VkSemaphoreSignalInfo { + VkStructureType sType; + const void * pNext; + VkSemaphore semaphore; + uint64_t value; +} VkSemaphoreSignalInfo; + +typedef struct VkBufferDeviceAddressInfo { + VkStructureType sType; + const void * pNext; + VkBuffer buffer; +} VkBufferDeviceAddressInfo; + +typedef struct VkBufferOpaqueCaptureAddressCreateInfo { + VkStructureType sType; + const void * pNext; + uint64_t opaqueCaptureAddress; +} VkBufferOpaqueCaptureAddressCreateInfo; + +typedef struct VkRenderPassAttachmentBeginInfo { + VkStructureType sType; + const void * pNext; + uint32_t attachmentCount; + const VkImageView * pAttachments; +} VkRenderPassAttachmentBeginInfo; + +typedef struct VkAttachmentReferenceStencilLayout { + VkStructureType sType; + void * pNext; + VkImageLayout stencilLayout; +} VkAttachmentReferenceStencilLayout; + +typedef struct VkAttachmentDescriptionStencilLayout { + VkStructureType sType; + void * pNext; + VkImageLayout stencilInitialLayout; + VkImageLayout stencilFinalLayout; +} VkAttachmentDescriptionStencilLayout; + +typedef struct VkPipelineShaderStageRequiredSubgroupSizeCreateInfo { + VkStructureType sType; + void * pNext; + uint32_t requiredSubgroupSize; +} VkPipelineShaderStageRequiredSubgroupSizeCreateInfo; + +typedef struct VkMemoryOpaqueCaptureAddressAllocateInfo { + VkStructureType sType; + const void * pNext; + uint64_t opaqueCaptureAddress; +} VkMemoryOpaqueCaptureAddressAllocateInfo; + +typedef struct VkDeviceMemoryOpaqueCaptureAddressInfo { + VkStructureType sType; + const void * pNext; + VkDeviceMemory memory; +} VkDeviceMemoryOpaqueCaptureAddressInfo; + +typedef struct VkCommandBufferSubmitInfo { + VkStructureType sType; + const void * pNext; + VkCommandBuffer commandBuffer; + uint32_t deviceMask; +} VkCommandBufferSubmitInfo; + +typedef struct VkPipelineRenderingCreateInfo { + VkStructureType sType; + const void * pNext; + uint32_t viewMask; + uint32_t colorAttachmentCount; + const VkFormat * pColorAttachmentFormats; + VkFormat depthAttachmentFormat; + VkFormat stencilAttachmentFormat; +} VkPipelineRenderingCreateInfo; + +typedef struct VkRenderingAttachmentInfo { + VkStructureType sType; + const void * pNext; + VkImageView imageView; + VkImageLayout imageLayout; + VkResolveModeFlagBits resolveMode; + VkImageView resolveImageView; + VkImageLayout resolveImageLayout; + VkAttachmentLoadOp loadOp; + VkAttachmentStoreOp storeOp; + VkClearValue clearValue; +} VkRenderingAttachmentInfo; + typedef uint32_t VkSampleMask; - typedef uint32_t VkBool32; - typedef uint32_t VkFlags; - +typedef uint64_t VkFlags64; typedef uint64_t VkDeviceSize; - typedef uint64_t VkDeviceAddress; - typedef VkFlags VkFramebufferCreateFlags; - typedef VkFlags VkQueryPoolCreateFlags; - typedef VkFlags VkRenderPassCreateFlags; - typedef VkFlags VkSamplerCreateFlags; - typedef VkFlags VkPipelineLayoutCreateFlags; - typedef VkFlags VkPipelineCacheCreateFlags; - typedef VkFlags VkPipelineDepthStencilStateCreateFlags; - typedef VkFlags VkPipelineDynamicStateCreateFlags; - typedef VkFlags VkPipelineColorBlendStateCreateFlags; - typedef VkFlags VkPipelineMultisampleStateCreateFlags; - typedef VkFlags VkPipelineRasterizationStateCreateFlags; - typedef VkFlags VkPipelineViewportStateCreateFlags; - typedef VkFlags VkPipelineTessellationStateCreateFlags; - typedef VkFlags VkPipelineInputAssemblyStateCreateFlags; - typedef VkFlags VkPipelineVertexInputStateCreateFlags; - typedef VkFlags VkPipelineShaderStageCreateFlags; - typedef VkFlags VkDescriptorSetLayoutCreateFlags; - typedef VkFlags VkBufferViewCreateFlags; - typedef VkFlags VkInstanceCreateFlags; - typedef VkFlags VkDeviceCreateFlags; - typedef VkFlags VkDeviceQueueCreateFlags; - typedef VkFlags VkQueueFlags; - typedef VkFlags VkMemoryPropertyFlags; - typedef VkFlags VkMemoryHeapFlags; - typedef VkFlags VkAccessFlags; - typedef VkFlags VkBufferUsageFlags; - typedef VkFlags VkBufferCreateFlags; - typedef VkFlags VkShaderStageFlags; - typedef VkFlags VkImageUsageFlags; - typedef VkFlags VkImageCreateFlags; - typedef VkFlags VkImageViewCreateFlags; - typedef VkFlags VkPipelineCreateFlags; - typedef VkFlags VkColorComponentFlags; - typedef VkFlags VkFenceCreateFlags; - typedef VkFlags VkSemaphoreCreateFlags; - typedef VkFlags VkFormatFeatureFlags; - typedef VkFlags VkQueryControlFlags; - typedef VkFlags VkQueryResultFlags; - typedef VkFlags VkShaderModuleCreateFlags; - typedef VkFlags VkEventCreateFlags; - typedef VkFlags VkCommandPoolCreateFlags; - typedef VkFlags VkCommandPoolResetFlags; - typedef VkFlags VkCommandBufferResetFlags; - typedef VkFlags VkCommandBufferUsageFlags; - typedef VkFlags VkQueryPipelineStatisticFlags; - typedef VkFlags VkMemoryMapFlags; - typedef VkFlags VkImageAspectFlags; - typedef VkFlags VkSparseMemoryBindFlags; - typedef VkFlags VkSparseImageFormatFlags; - typedef VkFlags VkSubpassDescriptionFlags; - typedef VkFlags VkPipelineStageFlags; - typedef VkFlags VkSampleCountFlags; - typedef VkFlags VkAttachmentDescriptionFlags; - typedef VkFlags VkStencilFaceFlags; - typedef VkFlags VkCullModeFlags; - typedef VkFlags VkDescriptorPoolCreateFlags; - typedef VkFlags VkDescriptorPoolResetFlags; - typedef VkFlags VkDependencyFlags; - typedef VkFlags VkSubgroupFeatureFlags; - +typedef VkFlags VkPrivateDataSlotCreateFlags; typedef VkFlags VkDescriptorUpdateTemplateCreateFlags; - +typedef VkFlags VkPipelineCreationFeedbackFlags; +typedef VkFlags VkSemaphoreWaitFlags; +typedef VkFlags64 VkAccessFlags2; +typedef VkFlags64 VkPipelineStageFlags2; +typedef VkFlags64 VkFormatFeatureFlags2; +typedef VkFlags VkRenderingFlags; typedef VkFlags VkCompositeAlphaFlagsKHR; - typedef VkFlags VkSurfaceTransformFlagsKHR; - typedef VkFlags VkSwapchainCreateFlagsKHR; - typedef VkFlags VkPeerMemoryFeatureFlags; - typedef VkFlags VkMemoryAllocateFlags; - typedef VkFlags VkDeviceGroupPresentModeFlagsKHR; - typedef VkFlags VkDebugReportFlagsEXT; - typedef VkFlags VkCommandPoolTrimFlags; - typedef VkFlags VkExternalMemoryHandleTypeFlags; - typedef VkFlags VkExternalMemoryFeatureFlags; - typedef VkFlags VkExternalSemaphoreHandleTypeFlags; - typedef VkFlags VkExternalSemaphoreFeatureFlags; - typedef VkFlags VkSemaphoreImportFlags; - typedef VkFlags VkExternalFenceHandleTypeFlags; - typedef VkFlags VkExternalFenceFeatureFlags; - typedef VkFlags VkFenceImportFlags; - +typedef VkFlags VkDescriptorBindingFlags; +typedef VkFlags VkResolveModeFlags; +typedef VkFlags VkToolPurposeFlags; +typedef VkFlags VkSubmitFlags; typedef VkBool32 (VKAPI_PTR *PFN_vkDebugReportCallbackEXT)( VkDebugReportFlagsEXT flags, VkDebugReportObjectTypeEXT objectType, @@ -2150,7 +2702,6 @@ typedef VkBool32 (VKAPI_PTR *PFN_vkDebugReportCallbackEXT)( const char* pLayerPrefix, const char* pMessage, void* pUserData); - typedef struct VkDeviceQueueCreateInfo { VkStructureType sType; const void * pNext; @@ -2192,8 +2743,8 @@ typedef struct VkMemoryRequirements { } VkMemoryRequirements; typedef struct VkSparseImageFormatProperties { - VkImageAspectFlags aspectMask; - VkExtent3D imageGranularity; + VkImageAspectFlags aspectMask; + VkExtent3D imageGranularity; VkSparseImageFormatFlags flags; } VkSparseImageFormatProperties; @@ -2842,11 +3393,11 @@ typedef struct VkPhysicalDeviceFeatures { } VkPhysicalDeviceFeatures; typedef struct VkPhysicalDeviceSparseProperties { - VkBool32 residencyStandard2DBlockShape; - VkBool32 residencyStandard2DMultisampleBlockShape; - VkBool32 residencyStandard3DBlockShape; - VkBool32 residencyAlignedMipSize; - VkBool32 residencyNonResidentStrict; + VkBool32 residencyStandard2DBlockShape; + VkBool32 residencyStandard2DMultisampleBlockShape; + VkBool32 residencyStandard3DBlockShape; + VkBool32 residencyAlignedMipSize; + VkBool32 residencyNonResidentStrict; } VkPhysicalDeviceSparseProperties; typedef struct VkPhysicalDeviceLimits { @@ -2905,28 +3456,28 @@ typedef struct VkPhysicalDeviceLimits { uint32_t maxComputeWorkGroupCount [3]; uint32_t maxComputeWorkGroupInvocations; uint32_t maxComputeWorkGroupSize [3]; - uint32_t subPixelPrecisionBits; - uint32_t subTexelPrecisionBits; - uint32_t mipmapPrecisionBits; + uint32_t subPixelPrecisionBits; + uint32_t subTexelPrecisionBits; + uint32_t mipmapPrecisionBits; uint32_t maxDrawIndexedIndexValue; uint32_t maxDrawIndirectCount; float maxSamplerLodBias; float maxSamplerAnisotropy; uint32_t maxViewports; uint32_t maxViewportDimensions [2]; - float viewportBoundsRange [2]; - uint32_t viewportSubPixelBits; - size_t minMemoryMapAlignment; - VkDeviceSize minTexelBufferOffsetAlignment; - VkDeviceSize minUniformBufferOffsetAlignment; - VkDeviceSize minStorageBufferOffsetAlignment; + float viewportBoundsRange [2]; + uint32_t viewportSubPixelBits; + size_t minMemoryMapAlignment; + VkDeviceSize minTexelBufferOffsetAlignment; + VkDeviceSize minUniformBufferOffsetAlignment; + VkDeviceSize minStorageBufferOffsetAlignment; int32_t minTexelOffset; uint32_t maxTexelOffset; int32_t minTexelGatherOffset; uint32_t maxTexelGatherOffset; float minInterpolationOffset; float maxInterpolationOffset; - uint32_t subPixelInterpolationOffsetBits; + uint32_t subPixelInterpolationOffsetBits; uint32_t maxFramebufferWidth; uint32_t maxFramebufferHeight; uint32_t maxFramebufferLayers; @@ -2941,21 +3492,21 @@ typedef struct VkPhysicalDeviceLimits { VkSampleCountFlags sampledImageStencilSampleCounts; VkSampleCountFlags storageImageSampleCounts; uint32_t maxSampleMaskWords; - VkBool32 timestampComputeAndGraphics; - float timestampPeriod; + VkBool32 timestampComputeAndGraphics; + float timestampPeriod; uint32_t maxClipDistances; uint32_t maxCullDistances; uint32_t maxCombinedClipAndCullDistances; uint32_t discreteQueuePriorities; - float pointSizeRange [2]; - float lineWidthRange [2]; - float pointSizeGranularity; - float lineWidthGranularity; - VkBool32 strictLines; - VkBool32 standardSampleLocations; - VkDeviceSize optimalBufferCopyOffsetAlignment; - VkDeviceSize optimalBufferCopyRowPitchAlignment; - VkDeviceSize nonCoherentAtomSize; + float pointSizeRange [2]; + float lineWidthRange [2]; + float pointSizeGranularity; + float lineWidthGranularity; + VkBool32 strictLines; + VkBool32 standardSampleLocations; + VkDeviceSize optimalBufferCopyOffsetAlignment; + VkDeviceSize optimalBufferCopyRowPitchAlignment; + VkDeviceSize nonCoherentAtomSize; } VkPhysicalDeviceLimits; typedef struct VkSemaphoreCreateInfo { @@ -2977,7 +3528,7 @@ typedef struct VkFramebufferCreateInfo { VkStructureType sType; const void * pNext; VkFramebufferCreateFlags flags; - VkRenderPass renderPass; + VkRenderPass renderPass; uint32_t attachmentCount; const VkImageView * pAttachments; uint32_t width; @@ -3039,6 +3590,18 @@ typedef struct VkDebugReportCallbackCreateInfoEXT { void * pUserData; } VkDebugReportCallbackCreateInfoEXT; +typedef struct VkPrivateDataSlotCreateInfo { + VkStructureType sType; + const void * pNext; + VkPrivateDataSlotCreateFlags flags; +} VkPrivateDataSlotCreateInfo; + +typedef struct VkPhysicalDevicePrivateDataFeatures { + VkStructureType sType; + void * pNext; + VkBool32 privateData; +} VkPhysicalDevicePrivateDataFeatures; + typedef struct VkPhysicalDeviceFeatures2 { VkStructureType sType; void * pNext; @@ -3070,13 +3633,13 @@ typedef struct VkPhysicalDeviceImageFormatInfo2 { typedef struct VkQueueFamilyProperties2 { VkStructureType sType; void * pNext; - VkQueueFamilyProperties queueFamilyProperties; + VkQueueFamilyProperties queueFamilyProperties; } VkQueueFamilyProperties2; typedef struct VkSparseImageFormatProperties2 { VkStructureType sType; void * pNext; - VkSparseImageFormatProperties properties; + VkSparseImageFormatProperties properties; } VkSparseImageFormatProperties2; typedef struct VkPhysicalDeviceSparseImageFormatInfo2 { @@ -3127,11 +3690,11 @@ typedef struct VkExternalBufferProperties { typedef struct VkPhysicalDeviceIDProperties { VkStructureType sType; void * pNext; - uint8_t deviceUUID [ VK_UUID_SIZE ]; - uint8_t driverUUID [ VK_UUID_SIZE ]; - uint8_t deviceLUID [ VK_LUID_SIZE ]; - uint32_t deviceNodeMask; - VkBool32 deviceLUIDValid; + uint8_t deviceUUID [ VK_UUID_SIZE ]; + uint8_t driverUUID [ VK_UUID_SIZE ]; + uint8_t deviceLUID [ VK_LUID_SIZE ]; + uint32_t deviceNodeMask; + VkBool32 deviceLUIDValid; } VkPhysicalDeviceIDProperties; typedef struct VkExternalMemoryImageCreateInfo { @@ -3221,7 +3784,7 @@ typedef struct VkBindImageMemoryInfo { typedef struct VkDeviceGroupPresentCapabilitiesKHR { VkStructureType sType; - const void * pNext; + void * pNext; uint32_t presentMask [ VK_MAX_DEVICE_GROUP_SIZE ]; VkDeviceGroupPresentModeFlagsKHR modes; } VkDeviceGroupPresentCapabilitiesKHR; @@ -3270,12 +3833,31 @@ typedef struct VkPhysicalDevice16BitStorageFeatures { typedef struct VkPhysicalDeviceSubgroupProperties { VkStructureType sType; void * pNext; - uint32_t subgroupSize; + uint32_t subgroupSize; VkShaderStageFlags supportedStages; VkSubgroupFeatureFlags supportedOperations; VkBool32 quadOperationsInAllStages; } VkPhysicalDeviceSubgroupProperties; +typedef struct VkPhysicalDeviceShaderSubgroupExtendedTypesFeatures { + VkStructureType sType; + void * pNext; + VkBool32 shaderSubgroupExtendedTypes; +} VkPhysicalDeviceShaderSubgroupExtendedTypesFeatures; + +typedef struct VkDeviceBufferMemoryRequirements { + VkStructureType sType; + const void * pNext; + const VkBufferCreateInfo * pCreateInfo; +} VkDeviceBufferMemoryRequirements; + +typedef struct VkDeviceImageMemoryRequirements { + VkStructureType sType; + const void * pNext; + const VkImageCreateInfo * pCreateInfo; + VkImageAspectFlagBits planeAspect; +} VkDeviceImageMemoryRequirements; + typedef struct VkMemoryRequirements2 { VkStructureType sType; void * pNext; @@ -3346,6 +3928,20 @@ typedef struct VkDeviceQueueInfo2 { uint32_t queueIndex; } VkDeviceQueueInfo2; +typedef struct VkPhysicalDeviceSamplerFilterMinmaxProperties { + VkStructureType sType; + void * pNext; + VkBool32 filterMinmaxSingleComponentFormats; + VkBool32 filterMinmaxImageComponentMapping; +} VkPhysicalDeviceSamplerFilterMinmaxProperties; + +typedef struct VkPhysicalDeviceInlineUniformBlockFeatures { + VkStructureType sType; + void * pNext; + VkBool32 inlineUniformBlock; + VkBool32 descriptorBindingInlineUniformBlockUpdateAfterBind; +} VkPhysicalDeviceInlineUniformBlockFeatures; + typedef struct VkPhysicalDeviceMaintenance3Properties { VkStructureType sType; void * pNext; @@ -3353,6 +3949,18 @@ typedef struct VkPhysicalDeviceMaintenance3Properties { VkDeviceSize maxMemoryAllocationSize; } VkPhysicalDeviceMaintenance3Properties; +typedef struct VkPhysicalDeviceMaintenance4Features { + VkStructureType sType; + void * pNext; + VkBool32 maintenance4; +} VkPhysicalDeviceMaintenance4Features; + +typedef struct VkPhysicalDeviceMaintenance4Properties { + VkStructureType sType; + void * pNext; + VkDeviceSize maxBufferSize; +} VkPhysicalDeviceMaintenance4Properties; + typedef struct VkDescriptorSetLayoutSupport { VkStructureType sType; void * pNext; @@ -3367,6 +3975,839 @@ typedef struct VkPhysicalDeviceShaderDrawParametersFeatures { typedef struct VkPhysicalDeviceShaderDrawParametersFeatures VkPhysicalDeviceShaderDrawParameterFeatures; +typedef struct VkPhysicalDeviceShaderFloat16Int8Features { + VkStructureType sType; + void * pNext; + VkBool32 shaderFloat16; + VkBool32 shaderInt8; +} VkPhysicalDeviceShaderFloat16Int8Features; + +typedef struct VkPhysicalDeviceFloatControlsProperties { + VkStructureType sType; + void * pNext; + VkShaderFloatControlsIndependence denormBehaviorIndependence; + VkShaderFloatControlsIndependence roundingModeIndependence; + VkBool32 shaderSignedZeroInfNanPreserveFloat16; + VkBool32 shaderSignedZeroInfNanPreserveFloat32; + VkBool32 shaderSignedZeroInfNanPreserveFloat64; + VkBool32 shaderDenormPreserveFloat16; + VkBool32 shaderDenormPreserveFloat32; + VkBool32 shaderDenormPreserveFloat64; + VkBool32 shaderDenormFlushToZeroFloat16; + VkBool32 shaderDenormFlushToZeroFloat32; + VkBool32 shaderDenormFlushToZeroFloat64; + VkBool32 shaderRoundingModeRTEFloat16; + VkBool32 shaderRoundingModeRTEFloat32; + VkBool32 shaderRoundingModeRTEFloat64; + VkBool32 shaderRoundingModeRTZFloat16; + VkBool32 shaderRoundingModeRTZFloat32; + VkBool32 shaderRoundingModeRTZFloat64; +} VkPhysicalDeviceFloatControlsProperties; + +typedef struct VkPhysicalDeviceHostQueryResetFeatures { + VkStructureType sType; + void * pNext; + VkBool32 hostQueryReset; +} VkPhysicalDeviceHostQueryResetFeatures; + +typedef struct VkPhysicalDeviceDescriptorIndexingFeatures { + VkStructureType sType; + void * pNext; + VkBool32 shaderInputAttachmentArrayDynamicIndexing; + VkBool32 shaderUniformTexelBufferArrayDynamicIndexing; + VkBool32 shaderStorageTexelBufferArrayDynamicIndexing; + VkBool32 shaderUniformBufferArrayNonUniformIndexing; + VkBool32 shaderSampledImageArrayNonUniformIndexing; + VkBool32 shaderStorageBufferArrayNonUniformIndexing; + VkBool32 shaderStorageImageArrayNonUniformIndexing; + VkBool32 shaderInputAttachmentArrayNonUniformIndexing; + VkBool32 shaderUniformTexelBufferArrayNonUniformIndexing; + VkBool32 shaderStorageTexelBufferArrayNonUniformIndexing; + VkBool32 descriptorBindingUniformBufferUpdateAfterBind; + VkBool32 descriptorBindingSampledImageUpdateAfterBind; + VkBool32 descriptorBindingStorageImageUpdateAfterBind; + VkBool32 descriptorBindingStorageBufferUpdateAfterBind; + VkBool32 descriptorBindingUniformTexelBufferUpdateAfterBind; + VkBool32 descriptorBindingStorageTexelBufferUpdateAfterBind; + VkBool32 descriptorBindingUpdateUnusedWhilePending; + VkBool32 descriptorBindingPartiallyBound; + VkBool32 descriptorBindingVariableDescriptorCount; + VkBool32 runtimeDescriptorArray; +} VkPhysicalDeviceDescriptorIndexingFeatures; + +typedef struct VkPhysicalDeviceDescriptorIndexingProperties { + VkStructureType sType; + void * pNext; + uint32_t maxUpdateAfterBindDescriptorsInAllPools; + VkBool32 shaderUniformBufferArrayNonUniformIndexingNative; + VkBool32 shaderSampledImageArrayNonUniformIndexingNative; + VkBool32 shaderStorageBufferArrayNonUniformIndexingNative; + VkBool32 shaderStorageImageArrayNonUniformIndexingNative; + VkBool32 shaderInputAttachmentArrayNonUniformIndexingNative; + VkBool32 robustBufferAccessUpdateAfterBind; + VkBool32 quadDivergentImplicitLod; + uint32_t maxPerStageDescriptorUpdateAfterBindSamplers; + uint32_t maxPerStageDescriptorUpdateAfterBindUniformBuffers; + uint32_t maxPerStageDescriptorUpdateAfterBindStorageBuffers; + uint32_t maxPerStageDescriptorUpdateAfterBindSampledImages; + uint32_t maxPerStageDescriptorUpdateAfterBindStorageImages; + uint32_t maxPerStageDescriptorUpdateAfterBindInputAttachments; + uint32_t maxPerStageUpdateAfterBindResources; + uint32_t maxDescriptorSetUpdateAfterBindSamplers; + uint32_t maxDescriptorSetUpdateAfterBindUniformBuffers; + uint32_t maxDescriptorSetUpdateAfterBindUniformBuffersDynamic; + uint32_t maxDescriptorSetUpdateAfterBindStorageBuffers; + uint32_t maxDescriptorSetUpdateAfterBindStorageBuffersDynamic; + uint32_t maxDescriptorSetUpdateAfterBindSampledImages; + uint32_t maxDescriptorSetUpdateAfterBindStorageImages; + uint32_t maxDescriptorSetUpdateAfterBindInputAttachments; +} VkPhysicalDeviceDescriptorIndexingProperties; + +typedef struct VkDescriptorSetLayoutBindingFlagsCreateInfo { + VkStructureType sType; + const void * pNext; + uint32_t bindingCount; + const VkDescriptorBindingFlags * pBindingFlags; +} VkDescriptorSetLayoutBindingFlagsCreateInfo; + +typedef struct VkAttachmentDescription2 { + VkStructureType sType; + const void * pNext; + VkAttachmentDescriptionFlags flags; + VkFormat format; + VkSampleCountFlagBits samples; + VkAttachmentLoadOp loadOp; + VkAttachmentStoreOp storeOp; + VkAttachmentLoadOp stencilLoadOp; + VkAttachmentStoreOp stencilStoreOp; + VkImageLayout initialLayout; + VkImageLayout finalLayout; +} VkAttachmentDescription2; + +typedef struct VkAttachmentReference2 { + VkStructureType sType; + const void * pNext; + uint32_t attachment; + VkImageLayout layout; + VkImageAspectFlags aspectMask; +} VkAttachmentReference2; + +typedef struct VkSubpassDescription2 { + VkStructureType sType; + const void * pNext; + VkSubpassDescriptionFlags flags; + VkPipelineBindPoint pipelineBindPoint; + uint32_t viewMask; + uint32_t inputAttachmentCount; + const VkAttachmentReference2 * pInputAttachments; + uint32_t colorAttachmentCount; + const VkAttachmentReference2 * pColorAttachments; + const VkAttachmentReference2 * pResolveAttachments; + const VkAttachmentReference2 * pDepthStencilAttachment; + uint32_t preserveAttachmentCount; + const uint32_t * pPreserveAttachments; +} VkSubpassDescription2; + +typedef struct VkSubpassDependency2 { + VkStructureType sType; + const void * pNext; + uint32_t srcSubpass; + uint32_t dstSubpass; + VkPipelineStageFlags srcStageMask; + VkPipelineStageFlags dstStageMask; + VkAccessFlags srcAccessMask; + VkAccessFlags dstAccessMask; + VkDependencyFlags dependencyFlags; + int32_t viewOffset; +} VkSubpassDependency2; + +typedef struct VkRenderPassCreateInfo2 { + VkStructureType sType; + const void * pNext; + VkRenderPassCreateFlags flags; + uint32_t attachmentCount; + const VkAttachmentDescription2 * pAttachments; + uint32_t subpassCount; + const VkSubpassDescription2 * pSubpasses; + uint32_t dependencyCount; + const VkSubpassDependency2 * pDependencies; + uint32_t correlatedViewMaskCount; + const uint32_t * pCorrelatedViewMasks; +} VkRenderPassCreateInfo2; + +typedef struct VkPhysicalDeviceTimelineSemaphoreFeatures { + VkStructureType sType; + void * pNext; + VkBool32 timelineSemaphore; +} VkPhysicalDeviceTimelineSemaphoreFeatures; + +typedef struct VkSemaphoreWaitInfo { + VkStructureType sType; + const void * pNext; + VkSemaphoreWaitFlags flags; + uint32_t semaphoreCount; + const VkSemaphore * pSemaphores; + const uint64_t * pValues; +} VkSemaphoreWaitInfo; + +typedef struct VkPhysicalDevice8BitStorageFeatures { + VkStructureType sType; + void * pNext; + VkBool32 storageBuffer8BitAccess; + VkBool32 uniformAndStorageBuffer8BitAccess; + VkBool32 storagePushConstant8; +} VkPhysicalDevice8BitStorageFeatures; + +typedef struct VkPhysicalDeviceVulkanMemoryModelFeatures { + VkStructureType sType; + void * pNext; + VkBool32 vulkanMemoryModel; + VkBool32 vulkanMemoryModelDeviceScope; + VkBool32 vulkanMemoryModelAvailabilityVisibilityChains; +} VkPhysicalDeviceVulkanMemoryModelFeatures; + +typedef struct VkPhysicalDeviceShaderAtomicInt64Features { + VkStructureType sType; + void * pNext; + VkBool32 shaderBufferInt64Atomics; + VkBool32 shaderSharedInt64Atomics; +} VkPhysicalDeviceShaderAtomicInt64Features; + +typedef struct VkPhysicalDeviceDepthStencilResolveProperties { + VkStructureType sType; + void * pNext; + VkResolveModeFlags supportedDepthResolveModes; + VkResolveModeFlags supportedStencilResolveModes; + VkBool32 independentResolveNone; + VkBool32 independentResolve; +} VkPhysicalDeviceDepthStencilResolveProperties; + +typedef struct VkSubpassDescriptionDepthStencilResolve { + VkStructureType sType; + const void * pNext; + VkResolveModeFlagBits depthResolveMode; + VkResolveModeFlagBits stencilResolveMode; + const VkAttachmentReference2 * pDepthStencilResolveAttachment; +} VkSubpassDescriptionDepthStencilResolve; + +typedef struct VkImageStencilUsageCreateInfo { + VkStructureType sType; + const void * pNext; + VkImageUsageFlags stencilUsage; +} VkImageStencilUsageCreateInfo; + +typedef struct VkPhysicalDeviceScalarBlockLayoutFeatures { + VkStructureType sType; + void * pNext; + VkBool32 scalarBlockLayout; +} VkPhysicalDeviceScalarBlockLayoutFeatures; + +typedef struct VkPhysicalDeviceUniformBufferStandardLayoutFeatures { + VkStructureType sType; + void * pNext; + VkBool32 uniformBufferStandardLayout; +} VkPhysicalDeviceUniformBufferStandardLayoutFeatures; + +typedef struct VkPhysicalDeviceBufferDeviceAddressFeatures { + VkStructureType sType; + void * pNext; + VkBool32 bufferDeviceAddress; + VkBool32 bufferDeviceAddressCaptureReplay; + VkBool32 bufferDeviceAddressMultiDevice; +} VkPhysicalDeviceBufferDeviceAddressFeatures; + +typedef struct VkPhysicalDeviceImagelessFramebufferFeatures { + VkStructureType sType; + void * pNext; + VkBool32 imagelessFramebuffer; +} VkPhysicalDeviceImagelessFramebufferFeatures; + +typedef struct VkFramebufferAttachmentImageInfo { + VkStructureType sType; + const void * pNext; + VkImageCreateFlags flags; + VkImageUsageFlags usage; + uint32_t width; + uint32_t height; + uint32_t layerCount; + uint32_t viewFormatCount; + const VkFormat * pViewFormats; +} VkFramebufferAttachmentImageInfo; + +typedef struct VkPhysicalDeviceTextureCompressionASTCHDRFeatures { + VkStructureType sType; + void * pNext; + VkBool32 textureCompressionASTC_HDR; +} VkPhysicalDeviceTextureCompressionASTCHDRFeatures; + +typedef struct VkPipelineCreationFeedback { + VkPipelineCreationFeedbackFlags flags; + uint64_t duration; +} VkPipelineCreationFeedback; + +typedef struct VkPipelineCreationFeedbackCreateInfo { + VkStructureType sType; + const void * pNext; + VkPipelineCreationFeedback * pPipelineCreationFeedback; + uint32_t pipelineStageCreationFeedbackCount; + VkPipelineCreationFeedback * pPipelineStageCreationFeedbacks; +} VkPipelineCreationFeedbackCreateInfo; + +typedef struct VkPhysicalDeviceSeparateDepthStencilLayoutsFeatures { + VkStructureType sType; + void * pNext; + VkBool32 separateDepthStencilLayouts; +} VkPhysicalDeviceSeparateDepthStencilLayoutsFeatures; + +typedef struct VkPhysicalDeviceShaderDemoteToHelperInvocationFeatures { + VkStructureType sType; + void * pNext; + VkBool32 shaderDemoteToHelperInvocation; +} VkPhysicalDeviceShaderDemoteToHelperInvocationFeatures; + +typedef struct VkPhysicalDeviceTexelBufferAlignmentProperties { + VkStructureType sType; + void * pNext; + VkDeviceSize storageTexelBufferOffsetAlignmentBytes; + VkBool32 storageTexelBufferOffsetSingleTexelAlignment; + VkDeviceSize uniformTexelBufferOffsetAlignmentBytes; + VkBool32 uniformTexelBufferOffsetSingleTexelAlignment; +} VkPhysicalDeviceTexelBufferAlignmentProperties; + +typedef struct VkPhysicalDeviceSubgroupSizeControlFeatures { + VkStructureType sType; + void * pNext; + VkBool32 subgroupSizeControl; + VkBool32 computeFullSubgroups; +} VkPhysicalDeviceSubgroupSizeControlFeatures; + +typedef struct VkPhysicalDeviceSubgroupSizeControlProperties { + VkStructureType sType; + void * pNext; + uint32_t minSubgroupSize; + uint32_t maxSubgroupSize; + uint32_t maxComputeWorkgroupSubgroups; + VkShaderStageFlags requiredSubgroupSizeStages; +} VkPhysicalDeviceSubgroupSizeControlProperties; + +typedef struct VkPhysicalDevicePipelineCreationCacheControlFeatures { + VkStructureType sType; + void * pNext; + VkBool32 pipelineCreationCacheControl; +} VkPhysicalDevicePipelineCreationCacheControlFeatures; + +typedef struct VkPhysicalDeviceVulkan11Features { + VkStructureType sType; + void * pNext; + VkBool32 storageBuffer16BitAccess; + VkBool32 uniformAndStorageBuffer16BitAccess; + VkBool32 storagePushConstant16; + VkBool32 storageInputOutput16; + VkBool32 multiview; + VkBool32 multiviewGeometryShader; + VkBool32 multiviewTessellationShader; + VkBool32 variablePointersStorageBuffer; + VkBool32 variablePointers; + VkBool32 protectedMemory; + VkBool32 samplerYcbcrConversion; + VkBool32 shaderDrawParameters; +} VkPhysicalDeviceVulkan11Features; + +typedef struct VkPhysicalDeviceVulkan11Properties { + VkStructureType sType; + void * pNext; + uint8_t deviceUUID [ VK_UUID_SIZE ]; + uint8_t driverUUID [ VK_UUID_SIZE ]; + uint8_t deviceLUID [ VK_LUID_SIZE ]; + uint32_t deviceNodeMask; + VkBool32 deviceLUIDValid; + uint32_t subgroupSize; + VkShaderStageFlags subgroupSupportedStages; + VkSubgroupFeatureFlags subgroupSupportedOperations; + VkBool32 subgroupQuadOperationsInAllStages; + VkPointClippingBehavior pointClippingBehavior; + uint32_t maxMultiviewViewCount; + uint32_t maxMultiviewInstanceIndex; + VkBool32 protectedNoFault; + uint32_t maxPerSetDescriptors; + VkDeviceSize maxMemoryAllocationSize; +} VkPhysicalDeviceVulkan11Properties; + +typedef struct VkPhysicalDeviceVulkan12Features { + VkStructureType sType; + void * pNext; + VkBool32 samplerMirrorClampToEdge; + VkBool32 drawIndirectCount; + VkBool32 storageBuffer8BitAccess; + VkBool32 uniformAndStorageBuffer8BitAccess; + VkBool32 storagePushConstant8; + VkBool32 shaderBufferInt64Atomics; + VkBool32 shaderSharedInt64Atomics; + VkBool32 shaderFloat16; + VkBool32 shaderInt8; + VkBool32 descriptorIndexing; + VkBool32 shaderInputAttachmentArrayDynamicIndexing; + VkBool32 shaderUniformTexelBufferArrayDynamicIndexing; + VkBool32 shaderStorageTexelBufferArrayDynamicIndexing; + VkBool32 shaderUniformBufferArrayNonUniformIndexing; + VkBool32 shaderSampledImageArrayNonUniformIndexing; + VkBool32 shaderStorageBufferArrayNonUniformIndexing; + VkBool32 shaderStorageImageArrayNonUniformIndexing; + VkBool32 shaderInputAttachmentArrayNonUniformIndexing; + VkBool32 shaderUniformTexelBufferArrayNonUniformIndexing; + VkBool32 shaderStorageTexelBufferArrayNonUniformIndexing; + VkBool32 descriptorBindingUniformBufferUpdateAfterBind; + VkBool32 descriptorBindingSampledImageUpdateAfterBind; + VkBool32 descriptorBindingStorageImageUpdateAfterBind; + VkBool32 descriptorBindingStorageBufferUpdateAfterBind; + VkBool32 descriptorBindingUniformTexelBufferUpdateAfterBind; + VkBool32 descriptorBindingStorageTexelBufferUpdateAfterBind; + VkBool32 descriptorBindingUpdateUnusedWhilePending; + VkBool32 descriptorBindingPartiallyBound; + VkBool32 descriptorBindingVariableDescriptorCount; + VkBool32 runtimeDescriptorArray; + VkBool32 samplerFilterMinmax; + VkBool32 scalarBlockLayout; + VkBool32 imagelessFramebuffer; + VkBool32 uniformBufferStandardLayout; + VkBool32 shaderSubgroupExtendedTypes; + VkBool32 separateDepthStencilLayouts; + VkBool32 hostQueryReset; + VkBool32 timelineSemaphore; + VkBool32 bufferDeviceAddress; + VkBool32 bufferDeviceAddressCaptureReplay; + VkBool32 bufferDeviceAddressMultiDevice; + VkBool32 vulkanMemoryModel; + VkBool32 vulkanMemoryModelDeviceScope; + VkBool32 vulkanMemoryModelAvailabilityVisibilityChains; + VkBool32 shaderOutputViewportIndex; + VkBool32 shaderOutputLayer; + VkBool32 subgroupBroadcastDynamicId; +} VkPhysicalDeviceVulkan12Features; + +typedef struct VkPhysicalDeviceVulkan12Properties { + VkStructureType sType; + void * pNext; + VkDriverId driverID; + char driverName [ VK_MAX_DRIVER_NAME_SIZE ]; + char driverInfo [ VK_MAX_DRIVER_INFO_SIZE ]; + VkConformanceVersion conformanceVersion; + VkShaderFloatControlsIndependence denormBehaviorIndependence; + VkShaderFloatControlsIndependence roundingModeIndependence; + VkBool32 shaderSignedZeroInfNanPreserveFloat16; + VkBool32 shaderSignedZeroInfNanPreserveFloat32; + VkBool32 shaderSignedZeroInfNanPreserveFloat64; + VkBool32 shaderDenormPreserveFloat16; + VkBool32 shaderDenormPreserveFloat32; + VkBool32 shaderDenormPreserveFloat64; + VkBool32 shaderDenormFlushToZeroFloat16; + VkBool32 shaderDenormFlushToZeroFloat32; + VkBool32 shaderDenormFlushToZeroFloat64; + VkBool32 shaderRoundingModeRTEFloat16; + VkBool32 shaderRoundingModeRTEFloat32; + VkBool32 shaderRoundingModeRTEFloat64; + VkBool32 shaderRoundingModeRTZFloat16; + VkBool32 shaderRoundingModeRTZFloat32; + VkBool32 shaderRoundingModeRTZFloat64; + uint32_t maxUpdateAfterBindDescriptorsInAllPools; + VkBool32 shaderUniformBufferArrayNonUniformIndexingNative; + VkBool32 shaderSampledImageArrayNonUniformIndexingNative; + VkBool32 shaderStorageBufferArrayNonUniformIndexingNative; + VkBool32 shaderStorageImageArrayNonUniformIndexingNative; + VkBool32 shaderInputAttachmentArrayNonUniformIndexingNative; + VkBool32 robustBufferAccessUpdateAfterBind; + VkBool32 quadDivergentImplicitLod; + uint32_t maxPerStageDescriptorUpdateAfterBindSamplers; + uint32_t maxPerStageDescriptorUpdateAfterBindUniformBuffers; + uint32_t maxPerStageDescriptorUpdateAfterBindStorageBuffers; + uint32_t maxPerStageDescriptorUpdateAfterBindSampledImages; + uint32_t maxPerStageDescriptorUpdateAfterBindStorageImages; + uint32_t maxPerStageDescriptorUpdateAfterBindInputAttachments; + uint32_t maxPerStageUpdateAfterBindResources; + uint32_t maxDescriptorSetUpdateAfterBindSamplers; + uint32_t maxDescriptorSetUpdateAfterBindUniformBuffers; + uint32_t maxDescriptorSetUpdateAfterBindUniformBuffersDynamic; + uint32_t maxDescriptorSetUpdateAfterBindStorageBuffers; + uint32_t maxDescriptorSetUpdateAfterBindStorageBuffersDynamic; + uint32_t maxDescriptorSetUpdateAfterBindSampledImages; + uint32_t maxDescriptorSetUpdateAfterBindStorageImages; + uint32_t maxDescriptorSetUpdateAfterBindInputAttachments; + VkResolveModeFlags supportedDepthResolveModes; + VkResolveModeFlags supportedStencilResolveModes; + VkBool32 independentResolveNone; + VkBool32 independentResolve; + VkBool32 filterMinmaxSingleComponentFormats; + VkBool32 filterMinmaxImageComponentMapping; + uint64_t maxTimelineSemaphoreValueDifference; + VkSampleCountFlags framebufferIntegerColorSampleCounts; +} VkPhysicalDeviceVulkan12Properties; + +typedef struct VkPhysicalDeviceVulkan13Features { + VkStructureType sType; + void * pNext; + VkBool32 robustImageAccess; + VkBool32 inlineUniformBlock; + VkBool32 descriptorBindingInlineUniformBlockUpdateAfterBind; + VkBool32 pipelineCreationCacheControl; + VkBool32 privateData; + VkBool32 shaderDemoteToHelperInvocation; + VkBool32 shaderTerminateInvocation; + VkBool32 subgroupSizeControl; + VkBool32 computeFullSubgroups; + VkBool32 synchronization2; + VkBool32 textureCompressionASTC_HDR; + VkBool32 shaderZeroInitializeWorkgroupMemory; + VkBool32 dynamicRendering; + VkBool32 shaderIntegerDotProduct; + VkBool32 maintenance4; +} VkPhysicalDeviceVulkan13Features; + +typedef struct VkPhysicalDeviceVulkan13Properties { + VkStructureType sType; + void * pNext; + uint32_t minSubgroupSize; + uint32_t maxSubgroupSize; + uint32_t maxComputeWorkgroupSubgroups; + VkShaderStageFlags requiredSubgroupSizeStages; + uint32_t maxInlineUniformBlockSize; + uint32_t maxPerStageDescriptorInlineUniformBlocks; + uint32_t maxPerStageDescriptorUpdateAfterBindInlineUniformBlocks; + uint32_t maxDescriptorSetInlineUniformBlocks; + uint32_t maxDescriptorSetUpdateAfterBindInlineUniformBlocks; + uint32_t maxInlineUniformTotalSize; + VkBool32 integerDotProduct8BitUnsignedAccelerated; + VkBool32 integerDotProduct8BitSignedAccelerated; + VkBool32 integerDotProduct8BitMixedSignednessAccelerated; + VkBool32 integerDotProduct4x8BitPackedUnsignedAccelerated; + VkBool32 integerDotProduct4x8BitPackedSignedAccelerated; + VkBool32 integerDotProduct4x8BitPackedMixedSignednessAccelerated; + VkBool32 integerDotProduct16BitUnsignedAccelerated; + VkBool32 integerDotProduct16BitSignedAccelerated; + VkBool32 integerDotProduct16BitMixedSignednessAccelerated; + VkBool32 integerDotProduct32BitUnsignedAccelerated; + VkBool32 integerDotProduct32BitSignedAccelerated; + VkBool32 integerDotProduct32BitMixedSignednessAccelerated; + VkBool32 integerDotProduct64BitUnsignedAccelerated; + VkBool32 integerDotProduct64BitSignedAccelerated; + VkBool32 integerDotProduct64BitMixedSignednessAccelerated; + VkBool32 integerDotProductAccumulatingSaturating8BitUnsignedAccelerated; + VkBool32 integerDotProductAccumulatingSaturating8BitSignedAccelerated; + VkBool32 integerDotProductAccumulatingSaturating8BitMixedSignednessAccelerated; + VkBool32 integerDotProductAccumulatingSaturating4x8BitPackedUnsignedAccelerated; + VkBool32 integerDotProductAccumulatingSaturating4x8BitPackedSignedAccelerated; + VkBool32 integerDotProductAccumulatingSaturating4x8BitPackedMixedSignednessAccelerated; + VkBool32 integerDotProductAccumulatingSaturating16BitUnsignedAccelerated; + VkBool32 integerDotProductAccumulatingSaturating16BitSignedAccelerated; + VkBool32 integerDotProductAccumulatingSaturating16BitMixedSignednessAccelerated; + VkBool32 integerDotProductAccumulatingSaturating32BitUnsignedAccelerated; + VkBool32 integerDotProductAccumulatingSaturating32BitSignedAccelerated; + VkBool32 integerDotProductAccumulatingSaturating32BitMixedSignednessAccelerated; + VkBool32 integerDotProductAccumulatingSaturating64BitUnsignedAccelerated; + VkBool32 integerDotProductAccumulatingSaturating64BitSignedAccelerated; + VkBool32 integerDotProductAccumulatingSaturating64BitMixedSignednessAccelerated; + VkDeviceSize storageTexelBufferOffsetAlignmentBytes; + VkBool32 storageTexelBufferOffsetSingleTexelAlignment; + VkDeviceSize uniformTexelBufferOffsetAlignmentBytes; + VkBool32 uniformTexelBufferOffsetSingleTexelAlignment; + VkDeviceSize maxBufferSize; +} VkPhysicalDeviceVulkan13Properties; + +typedef struct VkPhysicalDeviceToolProperties { + VkStructureType sType; + void * pNext; + char name [ VK_MAX_EXTENSION_NAME_SIZE ]; + char version [ VK_MAX_EXTENSION_NAME_SIZE ]; + VkToolPurposeFlags purposes; + char description [ VK_MAX_DESCRIPTION_SIZE ]; + char layer [ VK_MAX_EXTENSION_NAME_SIZE ]; +} VkPhysicalDeviceToolProperties; + +typedef struct VkPhysicalDeviceZeroInitializeWorkgroupMemoryFeatures { + VkStructureType sType; + void * pNext; + VkBool32 shaderZeroInitializeWorkgroupMemory; +} VkPhysicalDeviceZeroInitializeWorkgroupMemoryFeatures; + +typedef struct VkPhysicalDeviceImageRobustnessFeatures { + VkStructureType sType; + void * pNext; + VkBool32 robustImageAccess; +} VkPhysicalDeviceImageRobustnessFeatures; + +typedef struct VkBufferCopy2 { + VkStructureType sType; + const void * pNext; + VkDeviceSize srcOffset; + VkDeviceSize dstOffset; + VkDeviceSize size; +} VkBufferCopy2; + +typedef struct VkImageCopy2 { + VkStructureType sType; + const void * pNext; + VkImageSubresourceLayers srcSubresource; + VkOffset3D srcOffset; + VkImageSubresourceLayers dstSubresource; + VkOffset3D dstOffset; + VkExtent3D extent; +} VkImageCopy2; + +typedef struct VkImageBlit2 { + VkStructureType sType; + const void * pNext; + VkImageSubresourceLayers srcSubresource; + VkOffset3D srcOffsets [2]; + VkImageSubresourceLayers dstSubresource; + VkOffset3D dstOffsets [2]; +} VkImageBlit2; + +typedef struct VkBufferImageCopy2 { + VkStructureType sType; + const void * pNext; + VkDeviceSize bufferOffset; + uint32_t bufferRowLength; + uint32_t bufferImageHeight; + VkImageSubresourceLayers imageSubresource; + VkOffset3D imageOffset; + VkExtent3D imageExtent; +} VkBufferImageCopy2; + +typedef struct VkImageResolve2 { + VkStructureType sType; + const void * pNext; + VkImageSubresourceLayers srcSubresource; + VkOffset3D srcOffset; + VkImageSubresourceLayers dstSubresource; + VkOffset3D dstOffset; + VkExtent3D extent; +} VkImageResolve2; + +typedef struct VkCopyBufferInfo2 { + VkStructureType sType; + const void * pNext; + VkBuffer srcBuffer; + VkBuffer dstBuffer; + uint32_t regionCount; + const VkBufferCopy2 * pRegions; +} VkCopyBufferInfo2; + +typedef struct VkCopyImageInfo2 { + VkStructureType sType; + const void * pNext; + VkImage srcImage; + VkImageLayout srcImageLayout; + VkImage dstImage; + VkImageLayout dstImageLayout; + uint32_t regionCount; + const VkImageCopy2 * pRegions; +} VkCopyImageInfo2; + +typedef struct VkBlitImageInfo2 { + VkStructureType sType; + const void * pNext; + VkImage srcImage; + VkImageLayout srcImageLayout; + VkImage dstImage; + VkImageLayout dstImageLayout; + uint32_t regionCount; + const VkImageBlit2 * pRegions; + VkFilter filter; +} VkBlitImageInfo2; + +typedef struct VkCopyBufferToImageInfo2 { + VkStructureType sType; + const void * pNext; + VkBuffer srcBuffer; + VkImage dstImage; + VkImageLayout dstImageLayout; + uint32_t regionCount; + const VkBufferImageCopy2 * pRegions; +} VkCopyBufferToImageInfo2; + +typedef struct VkCopyImageToBufferInfo2 { + VkStructureType sType; + const void * pNext; + VkImage srcImage; + VkImageLayout srcImageLayout; + VkBuffer dstBuffer; + uint32_t regionCount; + const VkBufferImageCopy2 * pRegions; +} VkCopyImageToBufferInfo2; + +typedef struct VkResolveImageInfo2 { + VkStructureType sType; + const void * pNext; + VkImage srcImage; + VkImageLayout srcImageLayout; + VkImage dstImage; + VkImageLayout dstImageLayout; + uint32_t regionCount; + const VkImageResolve2 * pRegions; +} VkResolveImageInfo2; + +typedef struct VkPhysicalDeviceShaderTerminateInvocationFeatures { + VkStructureType sType; + void * pNext; + VkBool32 shaderTerminateInvocation; +} VkPhysicalDeviceShaderTerminateInvocationFeatures; + +typedef struct VkMemoryBarrier2 { + VkStructureType sType; + const void * pNext; + VkPipelineStageFlags2 srcStageMask; + VkAccessFlags2 srcAccessMask; + VkPipelineStageFlags2 dstStageMask; + VkAccessFlags2 dstAccessMask; +} VkMemoryBarrier2; + +typedef struct VkImageMemoryBarrier2 { + VkStructureType sType; + const void * pNext; + VkPipelineStageFlags2 srcStageMask; + VkAccessFlags2 srcAccessMask; + VkPipelineStageFlags2 dstStageMask; + VkAccessFlags2 dstAccessMask; + VkImageLayout oldLayout; + VkImageLayout newLayout; + uint32_t srcQueueFamilyIndex; + uint32_t dstQueueFamilyIndex; + VkImage image; + VkImageSubresourceRange subresourceRange; +} VkImageMemoryBarrier2; + +typedef struct VkBufferMemoryBarrier2 { + VkStructureType sType; + const void * pNext; + VkPipelineStageFlags2 srcStageMask; + VkAccessFlags2 srcAccessMask; + VkPipelineStageFlags2 dstStageMask; + VkAccessFlags2 dstAccessMask; + uint32_t srcQueueFamilyIndex; + uint32_t dstQueueFamilyIndex; + VkBuffer buffer; + VkDeviceSize offset; + VkDeviceSize size; +} VkBufferMemoryBarrier2; + +typedef struct VkDependencyInfo { + VkStructureType sType; + const void * pNext; + VkDependencyFlags dependencyFlags; + uint32_t memoryBarrierCount; + const VkMemoryBarrier2 * pMemoryBarriers; + uint32_t bufferMemoryBarrierCount; + const VkBufferMemoryBarrier2 * pBufferMemoryBarriers; + uint32_t imageMemoryBarrierCount; + const VkImageMemoryBarrier2 * pImageMemoryBarriers; +} VkDependencyInfo; + +typedef struct VkSemaphoreSubmitInfo { + VkStructureType sType; + const void * pNext; + VkSemaphore semaphore; + uint64_t value; + VkPipelineStageFlags2 stageMask; + uint32_t deviceIndex; +} VkSemaphoreSubmitInfo; + +typedef struct VkSubmitInfo2 { + VkStructureType sType; + const void * pNext; + VkSubmitFlags flags; + uint32_t waitSemaphoreInfoCount; + const VkSemaphoreSubmitInfo * pWaitSemaphoreInfos; + uint32_t commandBufferInfoCount; + const VkCommandBufferSubmitInfo * pCommandBufferInfos; + uint32_t signalSemaphoreInfoCount; + const VkSemaphoreSubmitInfo * pSignalSemaphoreInfos; +} VkSubmitInfo2; + +typedef struct VkPhysicalDeviceSynchronization2Features { + VkStructureType sType; + void * pNext; + VkBool32 synchronization2; +} VkPhysicalDeviceSynchronization2Features; + +typedef struct VkPhysicalDeviceShaderIntegerDotProductFeatures { + VkStructureType sType; + void * pNext; + VkBool32 shaderIntegerDotProduct; +} VkPhysicalDeviceShaderIntegerDotProductFeatures; + +typedef struct VkPhysicalDeviceShaderIntegerDotProductProperties { + VkStructureType sType; + void * pNext; + VkBool32 integerDotProduct8BitUnsignedAccelerated; + VkBool32 integerDotProduct8BitSignedAccelerated; + VkBool32 integerDotProduct8BitMixedSignednessAccelerated; + VkBool32 integerDotProduct4x8BitPackedUnsignedAccelerated; + VkBool32 integerDotProduct4x8BitPackedSignedAccelerated; + VkBool32 integerDotProduct4x8BitPackedMixedSignednessAccelerated; + VkBool32 integerDotProduct16BitUnsignedAccelerated; + VkBool32 integerDotProduct16BitSignedAccelerated; + VkBool32 integerDotProduct16BitMixedSignednessAccelerated; + VkBool32 integerDotProduct32BitUnsignedAccelerated; + VkBool32 integerDotProduct32BitSignedAccelerated; + VkBool32 integerDotProduct32BitMixedSignednessAccelerated; + VkBool32 integerDotProduct64BitUnsignedAccelerated; + VkBool32 integerDotProduct64BitSignedAccelerated; + VkBool32 integerDotProduct64BitMixedSignednessAccelerated; + VkBool32 integerDotProductAccumulatingSaturating8BitUnsignedAccelerated; + VkBool32 integerDotProductAccumulatingSaturating8BitSignedAccelerated; + VkBool32 integerDotProductAccumulatingSaturating8BitMixedSignednessAccelerated; + VkBool32 integerDotProductAccumulatingSaturating4x8BitPackedUnsignedAccelerated; + VkBool32 integerDotProductAccumulatingSaturating4x8BitPackedSignedAccelerated; + VkBool32 integerDotProductAccumulatingSaturating4x8BitPackedMixedSignednessAccelerated; + VkBool32 integerDotProductAccumulatingSaturating16BitUnsignedAccelerated; + VkBool32 integerDotProductAccumulatingSaturating16BitSignedAccelerated; + VkBool32 integerDotProductAccumulatingSaturating16BitMixedSignednessAccelerated; + VkBool32 integerDotProductAccumulatingSaturating32BitUnsignedAccelerated; + VkBool32 integerDotProductAccumulatingSaturating32BitSignedAccelerated; + VkBool32 integerDotProductAccumulatingSaturating32BitMixedSignednessAccelerated; + VkBool32 integerDotProductAccumulatingSaturating64BitUnsignedAccelerated; + VkBool32 integerDotProductAccumulatingSaturating64BitSignedAccelerated; + VkBool32 integerDotProductAccumulatingSaturating64BitMixedSignednessAccelerated; +} VkPhysicalDeviceShaderIntegerDotProductProperties; + +typedef struct VkFormatProperties3 { + VkStructureType sType; + void * pNext; + VkFormatFeatureFlags2 linearTilingFeatures; + VkFormatFeatureFlags2 optimalTilingFeatures; + VkFormatFeatureFlags2 bufferFeatures; +} VkFormatProperties3; + +typedef struct VkRenderingInfo { + VkStructureType sType; + const void * pNext; + VkRenderingFlags flags; + VkRect2D renderArea; + uint32_t layerCount; + uint32_t viewMask; + uint32_t colorAttachmentCount; + const VkRenderingAttachmentInfo * pColorAttachments; + const VkRenderingAttachmentInfo * pDepthAttachment; + const VkRenderingAttachmentInfo * pStencilAttachment; +} VkRenderingInfo; + +typedef struct VkPhysicalDeviceDynamicRenderingFeatures { + VkStructureType sType; + void * pNext; + VkBool32 dynamicRendering; +} VkPhysicalDeviceDynamicRenderingFeatures; + +typedef struct VkCommandBufferInheritanceRenderingInfo { + VkStructureType sType; + const void * pNext; + VkRenderingFlags flags; + uint32_t viewMask; + uint32_t colorAttachmentCount; + const VkFormat * pColorAttachmentFormats; + VkFormat depthAttachmentFormat; + VkFormat stencilAttachmentFormat; + VkSampleCountFlagBits rasterizationSamples; +} VkCommandBufferInheritanceRenderingInfo; + typedef struct VkPhysicalDeviceProperties { uint32_t apiVersion; uint32_t driverVersion; @@ -3411,14 +4852,27 @@ typedef struct VkPhysicalDeviceMemoryProperties2 { VkPhysicalDeviceMemoryProperties memoryProperties; } VkPhysicalDeviceMemoryProperties2; +typedef struct VkFramebufferAttachmentsCreateInfo { + VkStructureType sType; + const void * pNext; + uint32_t attachmentImageInfoCount; + const VkFramebufferAttachmentImageInfo * pAttachmentImageInfos; +} VkFramebufferAttachmentsCreateInfo; + #define VK_VERSION_1_0 1 GLAD_API_CALL int GLAD_VK_VERSION_1_0; #define VK_VERSION_1_1 1 GLAD_API_CALL int GLAD_VK_VERSION_1_1; +#define VK_VERSION_1_2 1 +GLAD_API_CALL int GLAD_VK_VERSION_1_2; +#define VK_VERSION_1_3 1 +GLAD_API_CALL int GLAD_VK_VERSION_1_3; #define VK_EXT_debug_report 1 GLAD_API_CALL int GLAD_VK_EXT_debug_report; +#define VK_KHR_portability_enumeration 1 +GLAD_API_CALL int GLAD_VK_KHR_portability_enumeration; #define VK_KHR_surface 1 GLAD_API_CALL int GLAD_VK_KHR_surface; #define VK_KHR_swapchain 1 @@ -3437,18 +4891,26 @@ typedef VkResult (GLAD_API_PTR *PFN_vkBindImageMemory)(VkDevice device, VkImage typedef VkResult (GLAD_API_PTR *PFN_vkBindImageMemory2)(VkDevice device, uint32_t bindInfoCount, const VkBindImageMemoryInfo * pBindInfos); typedef void (GLAD_API_PTR *PFN_vkCmdBeginQuery)(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t query, VkQueryControlFlags flags); typedef void (GLAD_API_PTR *PFN_vkCmdBeginRenderPass)(VkCommandBuffer commandBuffer, const VkRenderPassBeginInfo * pRenderPassBegin, VkSubpassContents contents); +typedef void (GLAD_API_PTR *PFN_vkCmdBeginRenderPass2)(VkCommandBuffer commandBuffer, const VkRenderPassBeginInfo * pRenderPassBegin, const VkSubpassBeginInfo * pSubpassBeginInfo); +typedef void (GLAD_API_PTR *PFN_vkCmdBeginRendering)(VkCommandBuffer commandBuffer, const VkRenderingInfo * pRenderingInfo); typedef void (GLAD_API_PTR *PFN_vkCmdBindDescriptorSets)(VkCommandBuffer commandBuffer, VkPipelineBindPoint pipelineBindPoint, VkPipelineLayout layout, uint32_t firstSet, uint32_t descriptorSetCount, const VkDescriptorSet * pDescriptorSets, uint32_t dynamicOffsetCount, const uint32_t * pDynamicOffsets); typedef void (GLAD_API_PTR *PFN_vkCmdBindIndexBuffer)(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, VkIndexType indexType); typedef void (GLAD_API_PTR *PFN_vkCmdBindPipeline)(VkCommandBuffer commandBuffer, VkPipelineBindPoint pipelineBindPoint, VkPipeline pipeline); typedef void (GLAD_API_PTR *PFN_vkCmdBindVertexBuffers)(VkCommandBuffer commandBuffer, uint32_t firstBinding, uint32_t bindingCount, const VkBuffer * pBuffers, const VkDeviceSize * pOffsets); +typedef void (GLAD_API_PTR *PFN_vkCmdBindVertexBuffers2)(VkCommandBuffer commandBuffer, uint32_t firstBinding, uint32_t bindingCount, const VkBuffer * pBuffers, const VkDeviceSize * pOffsets, const VkDeviceSize * pSizes, const VkDeviceSize * pStrides); typedef void (GLAD_API_PTR *PFN_vkCmdBlitImage)(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount, const VkImageBlit * pRegions, VkFilter filter); +typedef void (GLAD_API_PTR *PFN_vkCmdBlitImage2)(VkCommandBuffer commandBuffer, const VkBlitImageInfo2 * pBlitImageInfo); typedef void (GLAD_API_PTR *PFN_vkCmdClearAttachments)(VkCommandBuffer commandBuffer, uint32_t attachmentCount, const VkClearAttachment * pAttachments, uint32_t rectCount, const VkClearRect * pRects); typedef void (GLAD_API_PTR *PFN_vkCmdClearColorImage)(VkCommandBuffer commandBuffer, VkImage image, VkImageLayout imageLayout, const VkClearColorValue * pColor, uint32_t rangeCount, const VkImageSubresourceRange * pRanges); typedef void (GLAD_API_PTR *PFN_vkCmdClearDepthStencilImage)(VkCommandBuffer commandBuffer, VkImage image, VkImageLayout imageLayout, const VkClearDepthStencilValue * pDepthStencil, uint32_t rangeCount, const VkImageSubresourceRange * pRanges); typedef void (GLAD_API_PTR *PFN_vkCmdCopyBuffer)(VkCommandBuffer commandBuffer, VkBuffer srcBuffer, VkBuffer dstBuffer, uint32_t regionCount, const VkBufferCopy * pRegions); +typedef void (GLAD_API_PTR *PFN_vkCmdCopyBuffer2)(VkCommandBuffer commandBuffer, const VkCopyBufferInfo2 * pCopyBufferInfo); typedef void (GLAD_API_PTR *PFN_vkCmdCopyBufferToImage)(VkCommandBuffer commandBuffer, VkBuffer srcBuffer, VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount, const VkBufferImageCopy * pRegions); +typedef void (GLAD_API_PTR *PFN_vkCmdCopyBufferToImage2)(VkCommandBuffer commandBuffer, const VkCopyBufferToImageInfo2 * pCopyBufferToImageInfo); typedef void (GLAD_API_PTR *PFN_vkCmdCopyImage)(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount, const VkImageCopy * pRegions); +typedef void (GLAD_API_PTR *PFN_vkCmdCopyImage2)(VkCommandBuffer commandBuffer, const VkCopyImageInfo2 * pCopyImageInfo); typedef void (GLAD_API_PTR *PFN_vkCmdCopyImageToBuffer)(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkBuffer dstBuffer, uint32_t regionCount, const VkBufferImageCopy * pRegions); +typedef void (GLAD_API_PTR *PFN_vkCmdCopyImageToBuffer2)(VkCommandBuffer commandBuffer, const VkCopyImageToBufferInfo2 * pCopyImageToBufferInfo); typedef void (GLAD_API_PTR *PFN_vkCmdCopyQueryPoolResults)(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t firstQuery, uint32_t queryCount, VkBuffer dstBuffer, VkDeviceSize dstOffset, VkDeviceSize stride, VkQueryResultFlags flags); typedef void (GLAD_API_PTR *PFN_vkCmdDispatch)(VkCommandBuffer commandBuffer, uint32_t groupCountX, uint32_t groupCountY, uint32_t groupCountZ); typedef void (GLAD_API_PTR *PFN_vkCmdDispatchBase)(VkCommandBuffer commandBuffer, uint32_t baseGroupX, uint32_t baseGroupY, uint32_t baseGroupZ, uint32_t groupCountX, uint32_t groupCountY, uint32_t groupCountZ); @@ -3456,31 +4918,56 @@ typedef void (GLAD_API_PTR *PFN_vkCmdDispatchIndirect)(VkCommandBuffer commandBu typedef void (GLAD_API_PTR *PFN_vkCmdDraw)(VkCommandBuffer commandBuffer, uint32_t vertexCount, uint32_t instanceCount, uint32_t firstVertex, uint32_t firstInstance); typedef void (GLAD_API_PTR *PFN_vkCmdDrawIndexed)(VkCommandBuffer commandBuffer, uint32_t indexCount, uint32_t instanceCount, uint32_t firstIndex, int32_t vertexOffset, uint32_t firstInstance); typedef void (GLAD_API_PTR *PFN_vkCmdDrawIndexedIndirect)(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, uint32_t drawCount, uint32_t stride); +typedef void (GLAD_API_PTR *PFN_vkCmdDrawIndexedIndirectCount)(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, VkBuffer countBuffer, VkDeviceSize countBufferOffset, uint32_t maxDrawCount, uint32_t stride); typedef void (GLAD_API_PTR *PFN_vkCmdDrawIndirect)(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, uint32_t drawCount, uint32_t stride); +typedef void (GLAD_API_PTR *PFN_vkCmdDrawIndirectCount)(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, VkBuffer countBuffer, VkDeviceSize countBufferOffset, uint32_t maxDrawCount, uint32_t stride); typedef void (GLAD_API_PTR *PFN_vkCmdEndQuery)(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t query); typedef void (GLAD_API_PTR *PFN_vkCmdEndRenderPass)(VkCommandBuffer commandBuffer); +typedef void (GLAD_API_PTR *PFN_vkCmdEndRenderPass2)(VkCommandBuffer commandBuffer, const VkSubpassEndInfo * pSubpassEndInfo); +typedef void (GLAD_API_PTR *PFN_vkCmdEndRendering)(VkCommandBuffer commandBuffer); typedef void (GLAD_API_PTR *PFN_vkCmdExecuteCommands)(VkCommandBuffer commandBuffer, uint32_t commandBufferCount, const VkCommandBuffer * pCommandBuffers); typedef void (GLAD_API_PTR *PFN_vkCmdFillBuffer)(VkCommandBuffer commandBuffer, VkBuffer dstBuffer, VkDeviceSize dstOffset, VkDeviceSize size, uint32_t data); typedef void (GLAD_API_PTR *PFN_vkCmdNextSubpass)(VkCommandBuffer commandBuffer, VkSubpassContents contents); +typedef void (GLAD_API_PTR *PFN_vkCmdNextSubpass2)(VkCommandBuffer commandBuffer, const VkSubpassBeginInfo * pSubpassBeginInfo, const VkSubpassEndInfo * pSubpassEndInfo); typedef void (GLAD_API_PTR *PFN_vkCmdPipelineBarrier)(VkCommandBuffer commandBuffer, VkPipelineStageFlags srcStageMask, VkPipelineStageFlags dstStageMask, VkDependencyFlags dependencyFlags, uint32_t memoryBarrierCount, const VkMemoryBarrier * pMemoryBarriers, uint32_t bufferMemoryBarrierCount, const VkBufferMemoryBarrier * pBufferMemoryBarriers, uint32_t imageMemoryBarrierCount, const VkImageMemoryBarrier * pImageMemoryBarriers); +typedef void (GLAD_API_PTR *PFN_vkCmdPipelineBarrier2)(VkCommandBuffer commandBuffer, const VkDependencyInfo * pDependencyInfo); typedef void (GLAD_API_PTR *PFN_vkCmdPushConstants)(VkCommandBuffer commandBuffer, VkPipelineLayout layout, VkShaderStageFlags stageFlags, uint32_t offset, uint32_t size, const void * pValues); typedef void (GLAD_API_PTR *PFN_vkCmdResetEvent)(VkCommandBuffer commandBuffer, VkEvent event, VkPipelineStageFlags stageMask); +typedef void (GLAD_API_PTR *PFN_vkCmdResetEvent2)(VkCommandBuffer commandBuffer, VkEvent event, VkPipelineStageFlags2 stageMask); typedef void (GLAD_API_PTR *PFN_vkCmdResetQueryPool)(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t firstQuery, uint32_t queryCount); typedef void (GLAD_API_PTR *PFN_vkCmdResolveImage)(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount, const VkImageResolve * pRegions); +typedef void (GLAD_API_PTR *PFN_vkCmdResolveImage2)(VkCommandBuffer commandBuffer, const VkResolveImageInfo2 * pResolveImageInfo); typedef void (GLAD_API_PTR *PFN_vkCmdSetBlendConstants)(VkCommandBuffer commandBuffer, const float blendConstants [4]); +typedef void (GLAD_API_PTR *PFN_vkCmdSetCullMode)(VkCommandBuffer commandBuffer, VkCullModeFlags cullMode); typedef void (GLAD_API_PTR *PFN_vkCmdSetDepthBias)(VkCommandBuffer commandBuffer, float depthBiasConstantFactor, float depthBiasClamp, float depthBiasSlopeFactor); +typedef void (GLAD_API_PTR *PFN_vkCmdSetDepthBiasEnable)(VkCommandBuffer commandBuffer, VkBool32 depthBiasEnable); typedef void (GLAD_API_PTR *PFN_vkCmdSetDepthBounds)(VkCommandBuffer commandBuffer, float minDepthBounds, float maxDepthBounds); +typedef void (GLAD_API_PTR *PFN_vkCmdSetDepthBoundsTestEnable)(VkCommandBuffer commandBuffer, VkBool32 depthBoundsTestEnable); +typedef void (GLAD_API_PTR *PFN_vkCmdSetDepthCompareOp)(VkCommandBuffer commandBuffer, VkCompareOp depthCompareOp); +typedef void (GLAD_API_PTR *PFN_vkCmdSetDepthTestEnable)(VkCommandBuffer commandBuffer, VkBool32 depthTestEnable); +typedef void (GLAD_API_PTR *PFN_vkCmdSetDepthWriteEnable)(VkCommandBuffer commandBuffer, VkBool32 depthWriteEnable); typedef void (GLAD_API_PTR *PFN_vkCmdSetDeviceMask)(VkCommandBuffer commandBuffer, uint32_t deviceMask); typedef void (GLAD_API_PTR *PFN_vkCmdSetEvent)(VkCommandBuffer commandBuffer, VkEvent event, VkPipelineStageFlags stageMask); +typedef void (GLAD_API_PTR *PFN_vkCmdSetEvent2)(VkCommandBuffer commandBuffer, VkEvent event, const VkDependencyInfo * pDependencyInfo); +typedef void (GLAD_API_PTR *PFN_vkCmdSetFrontFace)(VkCommandBuffer commandBuffer, VkFrontFace frontFace); typedef void (GLAD_API_PTR *PFN_vkCmdSetLineWidth)(VkCommandBuffer commandBuffer, float lineWidth); +typedef void (GLAD_API_PTR *PFN_vkCmdSetPrimitiveRestartEnable)(VkCommandBuffer commandBuffer, VkBool32 primitiveRestartEnable); +typedef void (GLAD_API_PTR *PFN_vkCmdSetPrimitiveTopology)(VkCommandBuffer commandBuffer, VkPrimitiveTopology primitiveTopology); +typedef void (GLAD_API_PTR *PFN_vkCmdSetRasterizerDiscardEnable)(VkCommandBuffer commandBuffer, VkBool32 rasterizerDiscardEnable); typedef void (GLAD_API_PTR *PFN_vkCmdSetScissor)(VkCommandBuffer commandBuffer, uint32_t firstScissor, uint32_t scissorCount, const VkRect2D * pScissors); +typedef void (GLAD_API_PTR *PFN_vkCmdSetScissorWithCount)(VkCommandBuffer commandBuffer, uint32_t scissorCount, const VkRect2D * pScissors); typedef void (GLAD_API_PTR *PFN_vkCmdSetStencilCompareMask)(VkCommandBuffer commandBuffer, VkStencilFaceFlags faceMask, uint32_t compareMask); +typedef void (GLAD_API_PTR *PFN_vkCmdSetStencilOp)(VkCommandBuffer commandBuffer, VkStencilFaceFlags faceMask, VkStencilOp failOp, VkStencilOp passOp, VkStencilOp depthFailOp, VkCompareOp compareOp); typedef void (GLAD_API_PTR *PFN_vkCmdSetStencilReference)(VkCommandBuffer commandBuffer, VkStencilFaceFlags faceMask, uint32_t reference); +typedef void (GLAD_API_PTR *PFN_vkCmdSetStencilTestEnable)(VkCommandBuffer commandBuffer, VkBool32 stencilTestEnable); typedef void (GLAD_API_PTR *PFN_vkCmdSetStencilWriteMask)(VkCommandBuffer commandBuffer, VkStencilFaceFlags faceMask, uint32_t writeMask); typedef void (GLAD_API_PTR *PFN_vkCmdSetViewport)(VkCommandBuffer commandBuffer, uint32_t firstViewport, uint32_t viewportCount, const VkViewport * pViewports); +typedef void (GLAD_API_PTR *PFN_vkCmdSetViewportWithCount)(VkCommandBuffer commandBuffer, uint32_t viewportCount, const VkViewport * pViewports); typedef void (GLAD_API_PTR *PFN_vkCmdUpdateBuffer)(VkCommandBuffer commandBuffer, VkBuffer dstBuffer, VkDeviceSize dstOffset, VkDeviceSize dataSize, const void * pData); typedef void (GLAD_API_PTR *PFN_vkCmdWaitEvents)(VkCommandBuffer commandBuffer, uint32_t eventCount, const VkEvent * pEvents, VkPipelineStageFlags srcStageMask, VkPipelineStageFlags dstStageMask, uint32_t memoryBarrierCount, const VkMemoryBarrier * pMemoryBarriers, uint32_t bufferMemoryBarrierCount, const VkBufferMemoryBarrier * pBufferMemoryBarriers, uint32_t imageMemoryBarrierCount, const VkImageMemoryBarrier * pImageMemoryBarriers); +typedef void (GLAD_API_PTR *PFN_vkCmdWaitEvents2)(VkCommandBuffer commandBuffer, uint32_t eventCount, const VkEvent * pEvents, const VkDependencyInfo * pDependencyInfos); typedef void (GLAD_API_PTR *PFN_vkCmdWriteTimestamp)(VkCommandBuffer commandBuffer, VkPipelineStageFlagBits pipelineStage, VkQueryPool queryPool, uint32_t query); +typedef void (GLAD_API_PTR *PFN_vkCmdWriteTimestamp2)(VkCommandBuffer commandBuffer, VkPipelineStageFlags2 stage, VkQueryPool queryPool, uint32_t query); typedef VkResult (GLAD_API_PTR *PFN_vkCreateBuffer)(VkDevice device, const VkBufferCreateInfo * pCreateInfo, const VkAllocationCallbacks * pAllocator, VkBuffer * pBuffer); typedef VkResult (GLAD_API_PTR *PFN_vkCreateBufferView)(VkDevice device, const VkBufferViewCreateInfo * pCreateInfo, const VkAllocationCallbacks * pAllocator, VkBufferView * pView); typedef VkResult (GLAD_API_PTR *PFN_vkCreateCommandPool)(VkDevice device, const VkCommandPoolCreateInfo * pCreateInfo, const VkAllocationCallbacks * pAllocator, VkCommandPool * pCommandPool); @@ -3499,8 +4986,10 @@ typedef VkResult (GLAD_API_PTR *PFN_vkCreateImageView)(VkDevice device, const Vk typedef VkResult (GLAD_API_PTR *PFN_vkCreateInstance)(const VkInstanceCreateInfo * pCreateInfo, const VkAllocationCallbacks * pAllocator, VkInstance * pInstance); typedef VkResult (GLAD_API_PTR *PFN_vkCreatePipelineCache)(VkDevice device, const VkPipelineCacheCreateInfo * pCreateInfo, const VkAllocationCallbacks * pAllocator, VkPipelineCache * pPipelineCache); typedef VkResult (GLAD_API_PTR *PFN_vkCreatePipelineLayout)(VkDevice device, const VkPipelineLayoutCreateInfo * pCreateInfo, const VkAllocationCallbacks * pAllocator, VkPipelineLayout * pPipelineLayout); +typedef VkResult (GLAD_API_PTR *PFN_vkCreatePrivateDataSlot)(VkDevice device, const VkPrivateDataSlotCreateInfo * pCreateInfo, const VkAllocationCallbacks * pAllocator, VkPrivateDataSlot * pPrivateDataSlot); typedef VkResult (GLAD_API_PTR *PFN_vkCreateQueryPool)(VkDevice device, const VkQueryPoolCreateInfo * pCreateInfo, const VkAllocationCallbacks * pAllocator, VkQueryPool * pQueryPool); typedef VkResult (GLAD_API_PTR *PFN_vkCreateRenderPass)(VkDevice device, const VkRenderPassCreateInfo * pCreateInfo, const VkAllocationCallbacks * pAllocator, VkRenderPass * pRenderPass); +typedef VkResult (GLAD_API_PTR *PFN_vkCreateRenderPass2)(VkDevice device, const VkRenderPassCreateInfo2 * pCreateInfo, const VkAllocationCallbacks * pAllocator, VkRenderPass * pRenderPass); typedef VkResult (GLAD_API_PTR *PFN_vkCreateSampler)(VkDevice device, const VkSamplerCreateInfo * pCreateInfo, const VkAllocationCallbacks * pAllocator, VkSampler * pSampler); typedef VkResult (GLAD_API_PTR *PFN_vkCreateSamplerYcbcrConversion)(VkDevice device, const VkSamplerYcbcrConversionCreateInfo * pCreateInfo, const VkAllocationCallbacks * pAllocator, VkSamplerYcbcrConversion * pYcbcrConversion); typedef VkResult (GLAD_API_PTR *PFN_vkCreateSemaphore)(VkDevice device, const VkSemaphoreCreateInfo * pCreateInfo, const VkAllocationCallbacks * pAllocator, VkSemaphore * pSemaphore); @@ -3524,6 +5013,7 @@ typedef void (GLAD_API_PTR *PFN_vkDestroyInstance)(VkInstance instance, const Vk typedef void (GLAD_API_PTR *PFN_vkDestroyPipeline)(VkDevice device, VkPipeline pipeline, const VkAllocationCallbacks * pAllocator); typedef void (GLAD_API_PTR *PFN_vkDestroyPipelineCache)(VkDevice device, VkPipelineCache pipelineCache, const VkAllocationCallbacks * pAllocator); typedef void (GLAD_API_PTR *PFN_vkDestroyPipelineLayout)(VkDevice device, VkPipelineLayout pipelineLayout, const VkAllocationCallbacks * pAllocator); +typedef void (GLAD_API_PTR *PFN_vkDestroyPrivateDataSlot)(VkDevice device, VkPrivateDataSlot privateDataSlot, const VkAllocationCallbacks * pAllocator); typedef void (GLAD_API_PTR *PFN_vkDestroyQueryPool)(VkDevice device, VkQueryPool queryPool, const VkAllocationCallbacks * pAllocator); typedef void (GLAD_API_PTR *PFN_vkDestroyRenderPass)(VkDevice device, VkRenderPass renderPass, const VkAllocationCallbacks * pAllocator); typedef void (GLAD_API_PTR *PFN_vkDestroySampler)(VkDevice device, VkSampler sampler, const VkAllocationCallbacks * pAllocator); @@ -3545,13 +5035,19 @@ typedef VkResult (GLAD_API_PTR *PFN_vkFlushMappedMemoryRanges)(VkDevice device, typedef void (GLAD_API_PTR *PFN_vkFreeCommandBuffers)(VkDevice device, VkCommandPool commandPool, uint32_t commandBufferCount, const VkCommandBuffer * pCommandBuffers); typedef VkResult (GLAD_API_PTR *PFN_vkFreeDescriptorSets)(VkDevice device, VkDescriptorPool descriptorPool, uint32_t descriptorSetCount, const VkDescriptorSet * pDescriptorSets); typedef void (GLAD_API_PTR *PFN_vkFreeMemory)(VkDevice device, VkDeviceMemory memory, const VkAllocationCallbacks * pAllocator); +typedef VkDeviceAddress (GLAD_API_PTR *PFN_vkGetBufferDeviceAddress)(VkDevice device, const VkBufferDeviceAddressInfo * pInfo); typedef void (GLAD_API_PTR *PFN_vkGetBufferMemoryRequirements)(VkDevice device, VkBuffer buffer, VkMemoryRequirements * pMemoryRequirements); typedef void (GLAD_API_PTR *PFN_vkGetBufferMemoryRequirements2)(VkDevice device, const VkBufferMemoryRequirementsInfo2 * pInfo, VkMemoryRequirements2 * pMemoryRequirements); +typedef uint64_t (GLAD_API_PTR *PFN_vkGetBufferOpaqueCaptureAddress)(VkDevice device, const VkBufferDeviceAddressInfo * pInfo); typedef void (GLAD_API_PTR *PFN_vkGetDescriptorSetLayoutSupport)(VkDevice device, const VkDescriptorSetLayoutCreateInfo * pCreateInfo, VkDescriptorSetLayoutSupport * pSupport); +typedef void (GLAD_API_PTR *PFN_vkGetDeviceBufferMemoryRequirements)(VkDevice device, const VkDeviceBufferMemoryRequirements * pInfo, VkMemoryRequirements2 * pMemoryRequirements); typedef void (GLAD_API_PTR *PFN_vkGetDeviceGroupPeerMemoryFeatures)(VkDevice device, uint32_t heapIndex, uint32_t localDeviceIndex, uint32_t remoteDeviceIndex, VkPeerMemoryFeatureFlags * pPeerMemoryFeatures); typedef VkResult (GLAD_API_PTR *PFN_vkGetDeviceGroupPresentCapabilitiesKHR)(VkDevice device, VkDeviceGroupPresentCapabilitiesKHR * pDeviceGroupPresentCapabilities); typedef VkResult (GLAD_API_PTR *PFN_vkGetDeviceGroupSurfacePresentModesKHR)(VkDevice device, VkSurfaceKHR surface, VkDeviceGroupPresentModeFlagsKHR * pModes); +typedef void (GLAD_API_PTR *PFN_vkGetDeviceImageMemoryRequirements)(VkDevice device, const VkDeviceImageMemoryRequirements * pInfo, VkMemoryRequirements2 * pMemoryRequirements); +typedef void (GLAD_API_PTR *PFN_vkGetDeviceImageSparseMemoryRequirements)(VkDevice device, const VkDeviceImageMemoryRequirements * pInfo, uint32_t * pSparseMemoryRequirementCount, VkSparseImageMemoryRequirements2 * pSparseMemoryRequirements); typedef void (GLAD_API_PTR *PFN_vkGetDeviceMemoryCommitment)(VkDevice device, VkDeviceMemory memory, VkDeviceSize * pCommittedMemoryInBytes); +typedef uint64_t (GLAD_API_PTR *PFN_vkGetDeviceMemoryOpaqueCaptureAddress)(VkDevice device, const VkDeviceMemoryOpaqueCaptureAddressInfo * pInfo); typedef PFN_vkVoidFunction (GLAD_API_PTR *PFN_vkGetDeviceProcAddr)(VkDevice device, const char * pName); typedef void (GLAD_API_PTR *PFN_vkGetDeviceQueue)(VkDevice device, uint32_t queueFamilyIndex, uint32_t queueIndex, VkQueue * pQueue); typedef void (GLAD_API_PTR *PFN_vkGetDeviceQueue2)(VkDevice device, const VkDeviceQueueInfo2 * pQueueInfo, VkQueue * pQueue); @@ -3585,9 +5081,12 @@ typedef VkResult (GLAD_API_PTR *PFN_vkGetPhysicalDeviceSurfaceCapabilitiesKHR)(V typedef VkResult (GLAD_API_PTR *PFN_vkGetPhysicalDeviceSurfaceFormatsKHR)(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, uint32_t * pSurfaceFormatCount, VkSurfaceFormatKHR * pSurfaceFormats); typedef VkResult (GLAD_API_PTR *PFN_vkGetPhysicalDeviceSurfacePresentModesKHR)(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, uint32_t * pPresentModeCount, VkPresentModeKHR * pPresentModes); typedef VkResult (GLAD_API_PTR *PFN_vkGetPhysicalDeviceSurfaceSupportKHR)(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, VkSurfaceKHR surface, VkBool32 * pSupported); +typedef VkResult (GLAD_API_PTR *PFN_vkGetPhysicalDeviceToolProperties)(VkPhysicalDevice physicalDevice, uint32_t * pToolCount, VkPhysicalDeviceToolProperties * pToolProperties); typedef VkResult (GLAD_API_PTR *PFN_vkGetPipelineCacheData)(VkDevice device, VkPipelineCache pipelineCache, size_t * pDataSize, void * pData); +typedef void (GLAD_API_PTR *PFN_vkGetPrivateData)(VkDevice device, VkObjectType objectType, uint64_t objectHandle, VkPrivateDataSlot privateDataSlot, uint64_t * pData); typedef VkResult (GLAD_API_PTR *PFN_vkGetQueryPoolResults)(VkDevice device, VkQueryPool queryPool, uint32_t firstQuery, uint32_t queryCount, size_t dataSize, void * pData, VkDeviceSize stride, VkQueryResultFlags flags); typedef void (GLAD_API_PTR *PFN_vkGetRenderAreaGranularity)(VkDevice device, VkRenderPass renderPass, VkExtent2D * pGranularity); +typedef VkResult (GLAD_API_PTR *PFN_vkGetSemaphoreCounterValue)(VkDevice device, VkSemaphore semaphore, uint64_t * pValue); typedef VkResult (GLAD_API_PTR *PFN_vkGetSwapchainImagesKHR)(VkDevice device, VkSwapchainKHR swapchain, uint32_t * pSwapchainImageCount, VkImage * pSwapchainImages); typedef VkResult (GLAD_API_PTR *PFN_vkInvalidateMappedMemoryRanges)(VkDevice device, uint32_t memoryRangeCount, const VkMappedMemoryRange * pMemoryRanges); typedef VkResult (GLAD_API_PTR *PFN_vkMapMemory)(VkDevice device, VkDeviceMemory memory, VkDeviceSize offset, VkDeviceSize size, VkMemoryMapFlags flags, void ** ppData); @@ -3595,18 +5094,23 @@ typedef VkResult (GLAD_API_PTR *PFN_vkMergePipelineCaches)(VkDevice device, VkPi typedef VkResult (GLAD_API_PTR *PFN_vkQueueBindSparse)(VkQueue queue, uint32_t bindInfoCount, const VkBindSparseInfo * pBindInfo, VkFence fence); typedef VkResult (GLAD_API_PTR *PFN_vkQueuePresentKHR)(VkQueue queue, const VkPresentInfoKHR * pPresentInfo); typedef VkResult (GLAD_API_PTR *PFN_vkQueueSubmit)(VkQueue queue, uint32_t submitCount, const VkSubmitInfo * pSubmits, VkFence fence); +typedef VkResult (GLAD_API_PTR *PFN_vkQueueSubmit2)(VkQueue queue, uint32_t submitCount, const VkSubmitInfo2 * pSubmits, VkFence fence); typedef VkResult (GLAD_API_PTR *PFN_vkQueueWaitIdle)(VkQueue queue); typedef VkResult (GLAD_API_PTR *PFN_vkResetCommandBuffer)(VkCommandBuffer commandBuffer, VkCommandBufferResetFlags flags); typedef VkResult (GLAD_API_PTR *PFN_vkResetCommandPool)(VkDevice device, VkCommandPool commandPool, VkCommandPoolResetFlags flags); typedef VkResult (GLAD_API_PTR *PFN_vkResetDescriptorPool)(VkDevice device, VkDescriptorPool descriptorPool, VkDescriptorPoolResetFlags flags); typedef VkResult (GLAD_API_PTR *PFN_vkResetEvent)(VkDevice device, VkEvent event); typedef VkResult (GLAD_API_PTR *PFN_vkResetFences)(VkDevice device, uint32_t fenceCount, const VkFence * pFences); +typedef void (GLAD_API_PTR *PFN_vkResetQueryPool)(VkDevice device, VkQueryPool queryPool, uint32_t firstQuery, uint32_t queryCount); typedef VkResult (GLAD_API_PTR *PFN_vkSetEvent)(VkDevice device, VkEvent event); +typedef VkResult (GLAD_API_PTR *PFN_vkSetPrivateData)(VkDevice device, VkObjectType objectType, uint64_t objectHandle, VkPrivateDataSlot privateDataSlot, uint64_t data); +typedef VkResult (GLAD_API_PTR *PFN_vkSignalSemaphore)(VkDevice device, const VkSemaphoreSignalInfo * pSignalInfo); typedef void (GLAD_API_PTR *PFN_vkTrimCommandPool)(VkDevice device, VkCommandPool commandPool, VkCommandPoolTrimFlags flags); typedef void (GLAD_API_PTR *PFN_vkUnmapMemory)(VkDevice device, VkDeviceMemory memory); typedef void (GLAD_API_PTR *PFN_vkUpdateDescriptorSetWithTemplate)(VkDevice device, VkDescriptorSet descriptorSet, VkDescriptorUpdateTemplate descriptorUpdateTemplate, const void * pData); typedef void (GLAD_API_PTR *PFN_vkUpdateDescriptorSets)(VkDevice device, uint32_t descriptorWriteCount, const VkWriteDescriptorSet * pDescriptorWrites, uint32_t descriptorCopyCount, const VkCopyDescriptorSet * pDescriptorCopies); typedef VkResult (GLAD_API_PTR *PFN_vkWaitForFences)(VkDevice device, uint32_t fenceCount, const VkFence * pFences, VkBool32 waitAll, uint64_t timeout); +typedef VkResult (GLAD_API_PTR *PFN_vkWaitSemaphores)(VkDevice device, const VkSemaphoreWaitInfo * pWaitInfo, uint64_t timeout); GLAD_API_CALL PFN_vkAcquireNextImage2KHR glad_vkAcquireNextImage2KHR; #define vkAcquireNextImage2KHR glad_vkAcquireNextImage2KHR @@ -3632,6 +5136,10 @@ GLAD_API_CALL PFN_vkCmdBeginQuery glad_vkCmdBeginQuery; #define vkCmdBeginQuery glad_vkCmdBeginQuery GLAD_API_CALL PFN_vkCmdBeginRenderPass glad_vkCmdBeginRenderPass; #define vkCmdBeginRenderPass glad_vkCmdBeginRenderPass +GLAD_API_CALL PFN_vkCmdBeginRenderPass2 glad_vkCmdBeginRenderPass2; +#define vkCmdBeginRenderPass2 glad_vkCmdBeginRenderPass2 +GLAD_API_CALL PFN_vkCmdBeginRendering glad_vkCmdBeginRendering; +#define vkCmdBeginRendering glad_vkCmdBeginRendering GLAD_API_CALL PFN_vkCmdBindDescriptorSets glad_vkCmdBindDescriptorSets; #define vkCmdBindDescriptorSets glad_vkCmdBindDescriptorSets GLAD_API_CALL PFN_vkCmdBindIndexBuffer glad_vkCmdBindIndexBuffer; @@ -3640,8 +5148,12 @@ GLAD_API_CALL PFN_vkCmdBindPipeline glad_vkCmdBindPipeline; #define vkCmdBindPipeline glad_vkCmdBindPipeline GLAD_API_CALL PFN_vkCmdBindVertexBuffers glad_vkCmdBindVertexBuffers; #define vkCmdBindVertexBuffers glad_vkCmdBindVertexBuffers +GLAD_API_CALL PFN_vkCmdBindVertexBuffers2 glad_vkCmdBindVertexBuffers2; +#define vkCmdBindVertexBuffers2 glad_vkCmdBindVertexBuffers2 GLAD_API_CALL PFN_vkCmdBlitImage glad_vkCmdBlitImage; #define vkCmdBlitImage glad_vkCmdBlitImage +GLAD_API_CALL PFN_vkCmdBlitImage2 glad_vkCmdBlitImage2; +#define vkCmdBlitImage2 glad_vkCmdBlitImage2 GLAD_API_CALL PFN_vkCmdClearAttachments glad_vkCmdClearAttachments; #define vkCmdClearAttachments glad_vkCmdClearAttachments GLAD_API_CALL PFN_vkCmdClearColorImage glad_vkCmdClearColorImage; @@ -3650,12 +5162,20 @@ GLAD_API_CALL PFN_vkCmdClearDepthStencilImage glad_vkCmdClearDepthStencilImage; #define vkCmdClearDepthStencilImage glad_vkCmdClearDepthStencilImage GLAD_API_CALL PFN_vkCmdCopyBuffer glad_vkCmdCopyBuffer; #define vkCmdCopyBuffer glad_vkCmdCopyBuffer +GLAD_API_CALL PFN_vkCmdCopyBuffer2 glad_vkCmdCopyBuffer2; +#define vkCmdCopyBuffer2 glad_vkCmdCopyBuffer2 GLAD_API_CALL PFN_vkCmdCopyBufferToImage glad_vkCmdCopyBufferToImage; #define vkCmdCopyBufferToImage glad_vkCmdCopyBufferToImage +GLAD_API_CALL PFN_vkCmdCopyBufferToImage2 glad_vkCmdCopyBufferToImage2; +#define vkCmdCopyBufferToImage2 glad_vkCmdCopyBufferToImage2 GLAD_API_CALL PFN_vkCmdCopyImage glad_vkCmdCopyImage; #define vkCmdCopyImage glad_vkCmdCopyImage +GLAD_API_CALL PFN_vkCmdCopyImage2 glad_vkCmdCopyImage2; +#define vkCmdCopyImage2 glad_vkCmdCopyImage2 GLAD_API_CALL PFN_vkCmdCopyImageToBuffer glad_vkCmdCopyImageToBuffer; #define vkCmdCopyImageToBuffer glad_vkCmdCopyImageToBuffer +GLAD_API_CALL PFN_vkCmdCopyImageToBuffer2 glad_vkCmdCopyImageToBuffer2; +#define vkCmdCopyImageToBuffer2 glad_vkCmdCopyImageToBuffer2 GLAD_API_CALL PFN_vkCmdCopyQueryPoolResults glad_vkCmdCopyQueryPoolResults; #define vkCmdCopyQueryPoolResults glad_vkCmdCopyQueryPoolResults GLAD_API_CALL PFN_vkCmdDispatch glad_vkCmdDispatch; @@ -3670,56 +5190,106 @@ GLAD_API_CALL PFN_vkCmdDrawIndexed glad_vkCmdDrawIndexed; #define vkCmdDrawIndexed glad_vkCmdDrawIndexed GLAD_API_CALL PFN_vkCmdDrawIndexedIndirect glad_vkCmdDrawIndexedIndirect; #define vkCmdDrawIndexedIndirect glad_vkCmdDrawIndexedIndirect +GLAD_API_CALL PFN_vkCmdDrawIndexedIndirectCount glad_vkCmdDrawIndexedIndirectCount; +#define vkCmdDrawIndexedIndirectCount glad_vkCmdDrawIndexedIndirectCount GLAD_API_CALL PFN_vkCmdDrawIndirect glad_vkCmdDrawIndirect; #define vkCmdDrawIndirect glad_vkCmdDrawIndirect +GLAD_API_CALL PFN_vkCmdDrawIndirectCount glad_vkCmdDrawIndirectCount; +#define vkCmdDrawIndirectCount glad_vkCmdDrawIndirectCount GLAD_API_CALL PFN_vkCmdEndQuery glad_vkCmdEndQuery; #define vkCmdEndQuery glad_vkCmdEndQuery GLAD_API_CALL PFN_vkCmdEndRenderPass glad_vkCmdEndRenderPass; #define vkCmdEndRenderPass glad_vkCmdEndRenderPass +GLAD_API_CALL PFN_vkCmdEndRenderPass2 glad_vkCmdEndRenderPass2; +#define vkCmdEndRenderPass2 glad_vkCmdEndRenderPass2 +GLAD_API_CALL PFN_vkCmdEndRendering glad_vkCmdEndRendering; +#define vkCmdEndRendering glad_vkCmdEndRendering GLAD_API_CALL PFN_vkCmdExecuteCommands glad_vkCmdExecuteCommands; #define vkCmdExecuteCommands glad_vkCmdExecuteCommands GLAD_API_CALL PFN_vkCmdFillBuffer glad_vkCmdFillBuffer; #define vkCmdFillBuffer glad_vkCmdFillBuffer GLAD_API_CALL PFN_vkCmdNextSubpass glad_vkCmdNextSubpass; #define vkCmdNextSubpass glad_vkCmdNextSubpass +GLAD_API_CALL PFN_vkCmdNextSubpass2 glad_vkCmdNextSubpass2; +#define vkCmdNextSubpass2 glad_vkCmdNextSubpass2 GLAD_API_CALL PFN_vkCmdPipelineBarrier glad_vkCmdPipelineBarrier; #define vkCmdPipelineBarrier glad_vkCmdPipelineBarrier +GLAD_API_CALL PFN_vkCmdPipelineBarrier2 glad_vkCmdPipelineBarrier2; +#define vkCmdPipelineBarrier2 glad_vkCmdPipelineBarrier2 GLAD_API_CALL PFN_vkCmdPushConstants glad_vkCmdPushConstants; #define vkCmdPushConstants glad_vkCmdPushConstants GLAD_API_CALL PFN_vkCmdResetEvent glad_vkCmdResetEvent; #define vkCmdResetEvent glad_vkCmdResetEvent +GLAD_API_CALL PFN_vkCmdResetEvent2 glad_vkCmdResetEvent2; +#define vkCmdResetEvent2 glad_vkCmdResetEvent2 GLAD_API_CALL PFN_vkCmdResetQueryPool glad_vkCmdResetQueryPool; #define vkCmdResetQueryPool glad_vkCmdResetQueryPool GLAD_API_CALL PFN_vkCmdResolveImage glad_vkCmdResolveImage; #define vkCmdResolveImage glad_vkCmdResolveImage +GLAD_API_CALL PFN_vkCmdResolveImage2 glad_vkCmdResolveImage2; +#define vkCmdResolveImage2 glad_vkCmdResolveImage2 GLAD_API_CALL PFN_vkCmdSetBlendConstants glad_vkCmdSetBlendConstants; #define vkCmdSetBlendConstants glad_vkCmdSetBlendConstants +GLAD_API_CALL PFN_vkCmdSetCullMode glad_vkCmdSetCullMode; +#define vkCmdSetCullMode glad_vkCmdSetCullMode GLAD_API_CALL PFN_vkCmdSetDepthBias glad_vkCmdSetDepthBias; #define vkCmdSetDepthBias glad_vkCmdSetDepthBias +GLAD_API_CALL PFN_vkCmdSetDepthBiasEnable glad_vkCmdSetDepthBiasEnable; +#define vkCmdSetDepthBiasEnable glad_vkCmdSetDepthBiasEnable GLAD_API_CALL PFN_vkCmdSetDepthBounds glad_vkCmdSetDepthBounds; #define vkCmdSetDepthBounds glad_vkCmdSetDepthBounds +GLAD_API_CALL PFN_vkCmdSetDepthBoundsTestEnable glad_vkCmdSetDepthBoundsTestEnable; +#define vkCmdSetDepthBoundsTestEnable glad_vkCmdSetDepthBoundsTestEnable +GLAD_API_CALL PFN_vkCmdSetDepthCompareOp glad_vkCmdSetDepthCompareOp; +#define vkCmdSetDepthCompareOp glad_vkCmdSetDepthCompareOp +GLAD_API_CALL PFN_vkCmdSetDepthTestEnable glad_vkCmdSetDepthTestEnable; +#define vkCmdSetDepthTestEnable glad_vkCmdSetDepthTestEnable +GLAD_API_CALL PFN_vkCmdSetDepthWriteEnable glad_vkCmdSetDepthWriteEnable; +#define vkCmdSetDepthWriteEnable glad_vkCmdSetDepthWriteEnable GLAD_API_CALL PFN_vkCmdSetDeviceMask glad_vkCmdSetDeviceMask; #define vkCmdSetDeviceMask glad_vkCmdSetDeviceMask GLAD_API_CALL PFN_vkCmdSetEvent glad_vkCmdSetEvent; #define vkCmdSetEvent glad_vkCmdSetEvent +GLAD_API_CALL PFN_vkCmdSetEvent2 glad_vkCmdSetEvent2; +#define vkCmdSetEvent2 glad_vkCmdSetEvent2 +GLAD_API_CALL PFN_vkCmdSetFrontFace glad_vkCmdSetFrontFace; +#define vkCmdSetFrontFace glad_vkCmdSetFrontFace GLAD_API_CALL PFN_vkCmdSetLineWidth glad_vkCmdSetLineWidth; #define vkCmdSetLineWidth glad_vkCmdSetLineWidth +GLAD_API_CALL PFN_vkCmdSetPrimitiveRestartEnable glad_vkCmdSetPrimitiveRestartEnable; +#define vkCmdSetPrimitiveRestartEnable glad_vkCmdSetPrimitiveRestartEnable +GLAD_API_CALL PFN_vkCmdSetPrimitiveTopology glad_vkCmdSetPrimitiveTopology; +#define vkCmdSetPrimitiveTopology glad_vkCmdSetPrimitiveTopology +GLAD_API_CALL PFN_vkCmdSetRasterizerDiscardEnable glad_vkCmdSetRasterizerDiscardEnable; +#define vkCmdSetRasterizerDiscardEnable glad_vkCmdSetRasterizerDiscardEnable GLAD_API_CALL PFN_vkCmdSetScissor glad_vkCmdSetScissor; #define vkCmdSetScissor glad_vkCmdSetScissor +GLAD_API_CALL PFN_vkCmdSetScissorWithCount glad_vkCmdSetScissorWithCount; +#define vkCmdSetScissorWithCount glad_vkCmdSetScissorWithCount GLAD_API_CALL PFN_vkCmdSetStencilCompareMask glad_vkCmdSetStencilCompareMask; #define vkCmdSetStencilCompareMask glad_vkCmdSetStencilCompareMask +GLAD_API_CALL PFN_vkCmdSetStencilOp glad_vkCmdSetStencilOp; +#define vkCmdSetStencilOp glad_vkCmdSetStencilOp GLAD_API_CALL PFN_vkCmdSetStencilReference glad_vkCmdSetStencilReference; #define vkCmdSetStencilReference glad_vkCmdSetStencilReference +GLAD_API_CALL PFN_vkCmdSetStencilTestEnable glad_vkCmdSetStencilTestEnable; +#define vkCmdSetStencilTestEnable glad_vkCmdSetStencilTestEnable GLAD_API_CALL PFN_vkCmdSetStencilWriteMask glad_vkCmdSetStencilWriteMask; #define vkCmdSetStencilWriteMask glad_vkCmdSetStencilWriteMask GLAD_API_CALL PFN_vkCmdSetViewport glad_vkCmdSetViewport; #define vkCmdSetViewport glad_vkCmdSetViewport +GLAD_API_CALL PFN_vkCmdSetViewportWithCount glad_vkCmdSetViewportWithCount; +#define vkCmdSetViewportWithCount glad_vkCmdSetViewportWithCount GLAD_API_CALL PFN_vkCmdUpdateBuffer glad_vkCmdUpdateBuffer; #define vkCmdUpdateBuffer glad_vkCmdUpdateBuffer GLAD_API_CALL PFN_vkCmdWaitEvents glad_vkCmdWaitEvents; #define vkCmdWaitEvents glad_vkCmdWaitEvents +GLAD_API_CALL PFN_vkCmdWaitEvents2 glad_vkCmdWaitEvents2; +#define vkCmdWaitEvents2 glad_vkCmdWaitEvents2 GLAD_API_CALL PFN_vkCmdWriteTimestamp glad_vkCmdWriteTimestamp; #define vkCmdWriteTimestamp glad_vkCmdWriteTimestamp +GLAD_API_CALL PFN_vkCmdWriteTimestamp2 glad_vkCmdWriteTimestamp2; +#define vkCmdWriteTimestamp2 glad_vkCmdWriteTimestamp2 GLAD_API_CALL PFN_vkCreateBuffer glad_vkCreateBuffer; #define vkCreateBuffer glad_vkCreateBuffer GLAD_API_CALL PFN_vkCreateBufferView glad_vkCreateBufferView; @@ -3756,10 +5326,14 @@ GLAD_API_CALL PFN_vkCreatePipelineCache glad_vkCreatePipelineCache; #define vkCreatePipelineCache glad_vkCreatePipelineCache GLAD_API_CALL PFN_vkCreatePipelineLayout glad_vkCreatePipelineLayout; #define vkCreatePipelineLayout glad_vkCreatePipelineLayout +GLAD_API_CALL PFN_vkCreatePrivateDataSlot glad_vkCreatePrivateDataSlot; +#define vkCreatePrivateDataSlot glad_vkCreatePrivateDataSlot GLAD_API_CALL PFN_vkCreateQueryPool glad_vkCreateQueryPool; #define vkCreateQueryPool glad_vkCreateQueryPool GLAD_API_CALL PFN_vkCreateRenderPass glad_vkCreateRenderPass; #define vkCreateRenderPass glad_vkCreateRenderPass +GLAD_API_CALL PFN_vkCreateRenderPass2 glad_vkCreateRenderPass2; +#define vkCreateRenderPass2 glad_vkCreateRenderPass2 GLAD_API_CALL PFN_vkCreateSampler glad_vkCreateSampler; #define vkCreateSampler glad_vkCreateSampler GLAD_API_CALL PFN_vkCreateSamplerYcbcrConversion glad_vkCreateSamplerYcbcrConversion; @@ -3806,6 +5380,8 @@ GLAD_API_CALL PFN_vkDestroyPipelineCache glad_vkDestroyPipelineCache; #define vkDestroyPipelineCache glad_vkDestroyPipelineCache GLAD_API_CALL PFN_vkDestroyPipelineLayout glad_vkDestroyPipelineLayout; #define vkDestroyPipelineLayout glad_vkDestroyPipelineLayout +GLAD_API_CALL PFN_vkDestroyPrivateDataSlot glad_vkDestroyPrivateDataSlot; +#define vkDestroyPrivateDataSlot glad_vkDestroyPrivateDataSlot GLAD_API_CALL PFN_vkDestroyQueryPool glad_vkDestroyQueryPool; #define vkDestroyQueryPool glad_vkDestroyQueryPool GLAD_API_CALL PFN_vkDestroyRenderPass glad_vkDestroyRenderPass; @@ -3848,20 +5424,32 @@ GLAD_API_CALL PFN_vkFreeDescriptorSets glad_vkFreeDescriptorSets; #define vkFreeDescriptorSets glad_vkFreeDescriptorSets GLAD_API_CALL PFN_vkFreeMemory glad_vkFreeMemory; #define vkFreeMemory glad_vkFreeMemory +GLAD_API_CALL PFN_vkGetBufferDeviceAddress glad_vkGetBufferDeviceAddress; +#define vkGetBufferDeviceAddress glad_vkGetBufferDeviceAddress GLAD_API_CALL PFN_vkGetBufferMemoryRequirements glad_vkGetBufferMemoryRequirements; #define vkGetBufferMemoryRequirements glad_vkGetBufferMemoryRequirements GLAD_API_CALL PFN_vkGetBufferMemoryRequirements2 glad_vkGetBufferMemoryRequirements2; #define vkGetBufferMemoryRequirements2 glad_vkGetBufferMemoryRequirements2 +GLAD_API_CALL PFN_vkGetBufferOpaqueCaptureAddress glad_vkGetBufferOpaqueCaptureAddress; +#define vkGetBufferOpaqueCaptureAddress glad_vkGetBufferOpaqueCaptureAddress GLAD_API_CALL PFN_vkGetDescriptorSetLayoutSupport glad_vkGetDescriptorSetLayoutSupport; #define vkGetDescriptorSetLayoutSupport glad_vkGetDescriptorSetLayoutSupport +GLAD_API_CALL PFN_vkGetDeviceBufferMemoryRequirements glad_vkGetDeviceBufferMemoryRequirements; +#define vkGetDeviceBufferMemoryRequirements glad_vkGetDeviceBufferMemoryRequirements GLAD_API_CALL PFN_vkGetDeviceGroupPeerMemoryFeatures glad_vkGetDeviceGroupPeerMemoryFeatures; #define vkGetDeviceGroupPeerMemoryFeatures glad_vkGetDeviceGroupPeerMemoryFeatures GLAD_API_CALL PFN_vkGetDeviceGroupPresentCapabilitiesKHR glad_vkGetDeviceGroupPresentCapabilitiesKHR; #define vkGetDeviceGroupPresentCapabilitiesKHR glad_vkGetDeviceGroupPresentCapabilitiesKHR GLAD_API_CALL PFN_vkGetDeviceGroupSurfacePresentModesKHR glad_vkGetDeviceGroupSurfacePresentModesKHR; #define vkGetDeviceGroupSurfacePresentModesKHR glad_vkGetDeviceGroupSurfacePresentModesKHR +GLAD_API_CALL PFN_vkGetDeviceImageMemoryRequirements glad_vkGetDeviceImageMemoryRequirements; +#define vkGetDeviceImageMemoryRequirements glad_vkGetDeviceImageMemoryRequirements +GLAD_API_CALL PFN_vkGetDeviceImageSparseMemoryRequirements glad_vkGetDeviceImageSparseMemoryRequirements; +#define vkGetDeviceImageSparseMemoryRequirements glad_vkGetDeviceImageSparseMemoryRequirements GLAD_API_CALL PFN_vkGetDeviceMemoryCommitment glad_vkGetDeviceMemoryCommitment; #define vkGetDeviceMemoryCommitment glad_vkGetDeviceMemoryCommitment +GLAD_API_CALL PFN_vkGetDeviceMemoryOpaqueCaptureAddress glad_vkGetDeviceMemoryOpaqueCaptureAddress; +#define vkGetDeviceMemoryOpaqueCaptureAddress glad_vkGetDeviceMemoryOpaqueCaptureAddress GLAD_API_CALL PFN_vkGetDeviceProcAddr glad_vkGetDeviceProcAddr; #define vkGetDeviceProcAddr glad_vkGetDeviceProcAddr GLAD_API_CALL PFN_vkGetDeviceQueue glad_vkGetDeviceQueue; @@ -3928,12 +5516,18 @@ GLAD_API_CALL PFN_vkGetPhysicalDeviceSurfacePresentModesKHR glad_vkGetPhysicalDe #define vkGetPhysicalDeviceSurfacePresentModesKHR glad_vkGetPhysicalDeviceSurfacePresentModesKHR GLAD_API_CALL PFN_vkGetPhysicalDeviceSurfaceSupportKHR glad_vkGetPhysicalDeviceSurfaceSupportKHR; #define vkGetPhysicalDeviceSurfaceSupportKHR glad_vkGetPhysicalDeviceSurfaceSupportKHR +GLAD_API_CALL PFN_vkGetPhysicalDeviceToolProperties glad_vkGetPhysicalDeviceToolProperties; +#define vkGetPhysicalDeviceToolProperties glad_vkGetPhysicalDeviceToolProperties GLAD_API_CALL PFN_vkGetPipelineCacheData glad_vkGetPipelineCacheData; #define vkGetPipelineCacheData glad_vkGetPipelineCacheData +GLAD_API_CALL PFN_vkGetPrivateData glad_vkGetPrivateData; +#define vkGetPrivateData glad_vkGetPrivateData GLAD_API_CALL PFN_vkGetQueryPoolResults glad_vkGetQueryPoolResults; #define vkGetQueryPoolResults glad_vkGetQueryPoolResults GLAD_API_CALL PFN_vkGetRenderAreaGranularity glad_vkGetRenderAreaGranularity; #define vkGetRenderAreaGranularity glad_vkGetRenderAreaGranularity +GLAD_API_CALL PFN_vkGetSemaphoreCounterValue glad_vkGetSemaphoreCounterValue; +#define vkGetSemaphoreCounterValue glad_vkGetSemaphoreCounterValue GLAD_API_CALL PFN_vkGetSwapchainImagesKHR glad_vkGetSwapchainImagesKHR; #define vkGetSwapchainImagesKHR glad_vkGetSwapchainImagesKHR GLAD_API_CALL PFN_vkInvalidateMappedMemoryRanges glad_vkInvalidateMappedMemoryRanges; @@ -3948,6 +5542,8 @@ GLAD_API_CALL PFN_vkQueuePresentKHR glad_vkQueuePresentKHR; #define vkQueuePresentKHR glad_vkQueuePresentKHR GLAD_API_CALL PFN_vkQueueSubmit glad_vkQueueSubmit; #define vkQueueSubmit glad_vkQueueSubmit +GLAD_API_CALL PFN_vkQueueSubmit2 glad_vkQueueSubmit2; +#define vkQueueSubmit2 glad_vkQueueSubmit2 GLAD_API_CALL PFN_vkQueueWaitIdle glad_vkQueueWaitIdle; #define vkQueueWaitIdle glad_vkQueueWaitIdle GLAD_API_CALL PFN_vkResetCommandBuffer glad_vkResetCommandBuffer; @@ -3960,8 +5556,14 @@ GLAD_API_CALL PFN_vkResetEvent glad_vkResetEvent; #define vkResetEvent glad_vkResetEvent GLAD_API_CALL PFN_vkResetFences glad_vkResetFences; #define vkResetFences glad_vkResetFences +GLAD_API_CALL PFN_vkResetQueryPool glad_vkResetQueryPool; +#define vkResetQueryPool glad_vkResetQueryPool GLAD_API_CALL PFN_vkSetEvent glad_vkSetEvent; #define vkSetEvent glad_vkSetEvent +GLAD_API_CALL PFN_vkSetPrivateData glad_vkSetPrivateData; +#define vkSetPrivateData glad_vkSetPrivateData +GLAD_API_CALL PFN_vkSignalSemaphore glad_vkSignalSemaphore; +#define vkSignalSemaphore glad_vkSignalSemaphore GLAD_API_CALL PFN_vkTrimCommandPool glad_vkTrimCommandPool; #define vkTrimCommandPool glad_vkTrimCommandPool GLAD_API_CALL PFN_vkUnmapMemory glad_vkUnmapMemory; @@ -3972,6 +5574,8 @@ GLAD_API_CALL PFN_vkUpdateDescriptorSets glad_vkUpdateDescriptorSets; #define vkUpdateDescriptorSets glad_vkUpdateDescriptorSets GLAD_API_CALL PFN_vkWaitForFences glad_vkWaitForFences; #define vkWaitForFences glad_vkWaitForFences +GLAD_API_CALL PFN_vkWaitSemaphores glad_vkWaitSemaphores; +#define vkWaitSemaphores glad_vkWaitSemaphores @@ -4012,7 +5616,10 @@ extern "C" { int GLAD_VK_VERSION_1_0 = 0; int GLAD_VK_VERSION_1_1 = 0; +int GLAD_VK_VERSION_1_2 = 0; +int GLAD_VK_VERSION_1_3 = 0; int GLAD_VK_EXT_debug_report = 0; +int GLAD_VK_KHR_portability_enumeration = 0; int GLAD_VK_KHR_surface = 0; int GLAD_VK_KHR_swapchain = 0; @@ -4030,18 +5637,26 @@ PFN_vkBindImageMemory glad_vkBindImageMemory = NULL; PFN_vkBindImageMemory2 glad_vkBindImageMemory2 = NULL; PFN_vkCmdBeginQuery glad_vkCmdBeginQuery = NULL; PFN_vkCmdBeginRenderPass glad_vkCmdBeginRenderPass = NULL; +PFN_vkCmdBeginRenderPass2 glad_vkCmdBeginRenderPass2 = NULL; +PFN_vkCmdBeginRendering glad_vkCmdBeginRendering = NULL; PFN_vkCmdBindDescriptorSets glad_vkCmdBindDescriptorSets = NULL; PFN_vkCmdBindIndexBuffer glad_vkCmdBindIndexBuffer = NULL; PFN_vkCmdBindPipeline glad_vkCmdBindPipeline = NULL; PFN_vkCmdBindVertexBuffers glad_vkCmdBindVertexBuffers = NULL; +PFN_vkCmdBindVertexBuffers2 glad_vkCmdBindVertexBuffers2 = NULL; PFN_vkCmdBlitImage glad_vkCmdBlitImage = NULL; +PFN_vkCmdBlitImage2 glad_vkCmdBlitImage2 = NULL; PFN_vkCmdClearAttachments glad_vkCmdClearAttachments = NULL; PFN_vkCmdClearColorImage glad_vkCmdClearColorImage = NULL; PFN_vkCmdClearDepthStencilImage glad_vkCmdClearDepthStencilImage = NULL; PFN_vkCmdCopyBuffer glad_vkCmdCopyBuffer = NULL; +PFN_vkCmdCopyBuffer2 glad_vkCmdCopyBuffer2 = NULL; PFN_vkCmdCopyBufferToImage glad_vkCmdCopyBufferToImage = NULL; +PFN_vkCmdCopyBufferToImage2 glad_vkCmdCopyBufferToImage2 = NULL; PFN_vkCmdCopyImage glad_vkCmdCopyImage = NULL; +PFN_vkCmdCopyImage2 glad_vkCmdCopyImage2 = NULL; PFN_vkCmdCopyImageToBuffer glad_vkCmdCopyImageToBuffer = NULL; +PFN_vkCmdCopyImageToBuffer2 glad_vkCmdCopyImageToBuffer2 = NULL; PFN_vkCmdCopyQueryPoolResults glad_vkCmdCopyQueryPoolResults = NULL; PFN_vkCmdDispatch glad_vkCmdDispatch = NULL; PFN_vkCmdDispatchBase glad_vkCmdDispatchBase = NULL; @@ -4049,31 +5664,56 @@ PFN_vkCmdDispatchIndirect glad_vkCmdDispatchIndirect = NULL; PFN_vkCmdDraw glad_vkCmdDraw = NULL; PFN_vkCmdDrawIndexed glad_vkCmdDrawIndexed = NULL; PFN_vkCmdDrawIndexedIndirect glad_vkCmdDrawIndexedIndirect = NULL; +PFN_vkCmdDrawIndexedIndirectCount glad_vkCmdDrawIndexedIndirectCount = NULL; PFN_vkCmdDrawIndirect glad_vkCmdDrawIndirect = NULL; +PFN_vkCmdDrawIndirectCount glad_vkCmdDrawIndirectCount = NULL; PFN_vkCmdEndQuery glad_vkCmdEndQuery = NULL; PFN_vkCmdEndRenderPass glad_vkCmdEndRenderPass = NULL; +PFN_vkCmdEndRenderPass2 glad_vkCmdEndRenderPass2 = NULL; +PFN_vkCmdEndRendering glad_vkCmdEndRendering = NULL; PFN_vkCmdExecuteCommands glad_vkCmdExecuteCommands = NULL; PFN_vkCmdFillBuffer glad_vkCmdFillBuffer = NULL; PFN_vkCmdNextSubpass glad_vkCmdNextSubpass = NULL; +PFN_vkCmdNextSubpass2 glad_vkCmdNextSubpass2 = NULL; PFN_vkCmdPipelineBarrier glad_vkCmdPipelineBarrier = NULL; +PFN_vkCmdPipelineBarrier2 glad_vkCmdPipelineBarrier2 = NULL; PFN_vkCmdPushConstants glad_vkCmdPushConstants = NULL; PFN_vkCmdResetEvent glad_vkCmdResetEvent = NULL; +PFN_vkCmdResetEvent2 glad_vkCmdResetEvent2 = NULL; PFN_vkCmdResetQueryPool glad_vkCmdResetQueryPool = NULL; PFN_vkCmdResolveImage glad_vkCmdResolveImage = NULL; +PFN_vkCmdResolveImage2 glad_vkCmdResolveImage2 = NULL; PFN_vkCmdSetBlendConstants glad_vkCmdSetBlendConstants = NULL; +PFN_vkCmdSetCullMode glad_vkCmdSetCullMode = NULL; PFN_vkCmdSetDepthBias glad_vkCmdSetDepthBias = NULL; +PFN_vkCmdSetDepthBiasEnable glad_vkCmdSetDepthBiasEnable = NULL; PFN_vkCmdSetDepthBounds glad_vkCmdSetDepthBounds = NULL; +PFN_vkCmdSetDepthBoundsTestEnable glad_vkCmdSetDepthBoundsTestEnable = NULL; +PFN_vkCmdSetDepthCompareOp glad_vkCmdSetDepthCompareOp = NULL; +PFN_vkCmdSetDepthTestEnable glad_vkCmdSetDepthTestEnable = NULL; +PFN_vkCmdSetDepthWriteEnable glad_vkCmdSetDepthWriteEnable = NULL; PFN_vkCmdSetDeviceMask glad_vkCmdSetDeviceMask = NULL; PFN_vkCmdSetEvent glad_vkCmdSetEvent = NULL; +PFN_vkCmdSetEvent2 glad_vkCmdSetEvent2 = NULL; +PFN_vkCmdSetFrontFace glad_vkCmdSetFrontFace = NULL; PFN_vkCmdSetLineWidth glad_vkCmdSetLineWidth = NULL; +PFN_vkCmdSetPrimitiveRestartEnable glad_vkCmdSetPrimitiveRestartEnable = NULL; +PFN_vkCmdSetPrimitiveTopology glad_vkCmdSetPrimitiveTopology = NULL; +PFN_vkCmdSetRasterizerDiscardEnable glad_vkCmdSetRasterizerDiscardEnable = NULL; PFN_vkCmdSetScissor glad_vkCmdSetScissor = NULL; +PFN_vkCmdSetScissorWithCount glad_vkCmdSetScissorWithCount = NULL; PFN_vkCmdSetStencilCompareMask glad_vkCmdSetStencilCompareMask = NULL; +PFN_vkCmdSetStencilOp glad_vkCmdSetStencilOp = NULL; PFN_vkCmdSetStencilReference glad_vkCmdSetStencilReference = NULL; +PFN_vkCmdSetStencilTestEnable glad_vkCmdSetStencilTestEnable = NULL; PFN_vkCmdSetStencilWriteMask glad_vkCmdSetStencilWriteMask = NULL; PFN_vkCmdSetViewport glad_vkCmdSetViewport = NULL; +PFN_vkCmdSetViewportWithCount glad_vkCmdSetViewportWithCount = NULL; PFN_vkCmdUpdateBuffer glad_vkCmdUpdateBuffer = NULL; PFN_vkCmdWaitEvents glad_vkCmdWaitEvents = NULL; +PFN_vkCmdWaitEvents2 glad_vkCmdWaitEvents2 = NULL; PFN_vkCmdWriteTimestamp glad_vkCmdWriteTimestamp = NULL; +PFN_vkCmdWriteTimestamp2 glad_vkCmdWriteTimestamp2 = NULL; PFN_vkCreateBuffer glad_vkCreateBuffer = NULL; PFN_vkCreateBufferView glad_vkCreateBufferView = NULL; PFN_vkCreateCommandPool glad_vkCreateCommandPool = NULL; @@ -4092,8 +5732,10 @@ PFN_vkCreateImageView glad_vkCreateImageView = NULL; PFN_vkCreateInstance glad_vkCreateInstance = NULL; PFN_vkCreatePipelineCache glad_vkCreatePipelineCache = NULL; PFN_vkCreatePipelineLayout glad_vkCreatePipelineLayout = NULL; +PFN_vkCreatePrivateDataSlot glad_vkCreatePrivateDataSlot = NULL; PFN_vkCreateQueryPool glad_vkCreateQueryPool = NULL; PFN_vkCreateRenderPass glad_vkCreateRenderPass = NULL; +PFN_vkCreateRenderPass2 glad_vkCreateRenderPass2 = NULL; PFN_vkCreateSampler glad_vkCreateSampler = NULL; PFN_vkCreateSamplerYcbcrConversion glad_vkCreateSamplerYcbcrConversion = NULL; PFN_vkCreateSemaphore glad_vkCreateSemaphore = NULL; @@ -4117,6 +5759,7 @@ PFN_vkDestroyInstance glad_vkDestroyInstance = NULL; PFN_vkDestroyPipeline glad_vkDestroyPipeline = NULL; PFN_vkDestroyPipelineCache glad_vkDestroyPipelineCache = NULL; PFN_vkDestroyPipelineLayout glad_vkDestroyPipelineLayout = NULL; +PFN_vkDestroyPrivateDataSlot glad_vkDestroyPrivateDataSlot = NULL; PFN_vkDestroyQueryPool glad_vkDestroyQueryPool = NULL; PFN_vkDestroyRenderPass glad_vkDestroyRenderPass = NULL; PFN_vkDestroySampler glad_vkDestroySampler = NULL; @@ -4138,13 +5781,19 @@ PFN_vkFlushMappedMemoryRanges glad_vkFlushMappedMemoryRanges = NULL; PFN_vkFreeCommandBuffers glad_vkFreeCommandBuffers = NULL; PFN_vkFreeDescriptorSets glad_vkFreeDescriptorSets = NULL; PFN_vkFreeMemory glad_vkFreeMemory = NULL; +PFN_vkGetBufferDeviceAddress glad_vkGetBufferDeviceAddress = NULL; PFN_vkGetBufferMemoryRequirements glad_vkGetBufferMemoryRequirements = NULL; PFN_vkGetBufferMemoryRequirements2 glad_vkGetBufferMemoryRequirements2 = NULL; +PFN_vkGetBufferOpaqueCaptureAddress glad_vkGetBufferOpaqueCaptureAddress = NULL; PFN_vkGetDescriptorSetLayoutSupport glad_vkGetDescriptorSetLayoutSupport = NULL; +PFN_vkGetDeviceBufferMemoryRequirements glad_vkGetDeviceBufferMemoryRequirements = NULL; PFN_vkGetDeviceGroupPeerMemoryFeatures glad_vkGetDeviceGroupPeerMemoryFeatures = NULL; PFN_vkGetDeviceGroupPresentCapabilitiesKHR glad_vkGetDeviceGroupPresentCapabilitiesKHR = NULL; PFN_vkGetDeviceGroupSurfacePresentModesKHR glad_vkGetDeviceGroupSurfacePresentModesKHR = NULL; +PFN_vkGetDeviceImageMemoryRequirements glad_vkGetDeviceImageMemoryRequirements = NULL; +PFN_vkGetDeviceImageSparseMemoryRequirements glad_vkGetDeviceImageSparseMemoryRequirements = NULL; PFN_vkGetDeviceMemoryCommitment glad_vkGetDeviceMemoryCommitment = NULL; +PFN_vkGetDeviceMemoryOpaqueCaptureAddress glad_vkGetDeviceMemoryOpaqueCaptureAddress = NULL; PFN_vkGetDeviceProcAddr glad_vkGetDeviceProcAddr = NULL; PFN_vkGetDeviceQueue glad_vkGetDeviceQueue = NULL; PFN_vkGetDeviceQueue2 glad_vkGetDeviceQueue2 = NULL; @@ -4178,9 +5827,12 @@ PFN_vkGetPhysicalDeviceSurfaceCapabilitiesKHR glad_vkGetPhysicalDeviceSurfaceCap PFN_vkGetPhysicalDeviceSurfaceFormatsKHR glad_vkGetPhysicalDeviceSurfaceFormatsKHR = NULL; PFN_vkGetPhysicalDeviceSurfacePresentModesKHR glad_vkGetPhysicalDeviceSurfacePresentModesKHR = NULL; PFN_vkGetPhysicalDeviceSurfaceSupportKHR glad_vkGetPhysicalDeviceSurfaceSupportKHR = NULL; +PFN_vkGetPhysicalDeviceToolProperties glad_vkGetPhysicalDeviceToolProperties = NULL; PFN_vkGetPipelineCacheData glad_vkGetPipelineCacheData = NULL; +PFN_vkGetPrivateData glad_vkGetPrivateData = NULL; PFN_vkGetQueryPoolResults glad_vkGetQueryPoolResults = NULL; PFN_vkGetRenderAreaGranularity glad_vkGetRenderAreaGranularity = NULL; +PFN_vkGetSemaphoreCounterValue glad_vkGetSemaphoreCounterValue = NULL; PFN_vkGetSwapchainImagesKHR glad_vkGetSwapchainImagesKHR = NULL; PFN_vkInvalidateMappedMemoryRanges glad_vkInvalidateMappedMemoryRanges = NULL; PFN_vkMapMemory glad_vkMapMemory = NULL; @@ -4188,18 +5840,23 @@ PFN_vkMergePipelineCaches glad_vkMergePipelineCaches = NULL; PFN_vkQueueBindSparse glad_vkQueueBindSparse = NULL; PFN_vkQueuePresentKHR glad_vkQueuePresentKHR = NULL; PFN_vkQueueSubmit glad_vkQueueSubmit = NULL; +PFN_vkQueueSubmit2 glad_vkQueueSubmit2 = NULL; PFN_vkQueueWaitIdle glad_vkQueueWaitIdle = NULL; PFN_vkResetCommandBuffer glad_vkResetCommandBuffer = NULL; PFN_vkResetCommandPool glad_vkResetCommandPool = NULL; PFN_vkResetDescriptorPool glad_vkResetDescriptorPool = NULL; PFN_vkResetEvent glad_vkResetEvent = NULL; PFN_vkResetFences glad_vkResetFences = NULL; +PFN_vkResetQueryPool glad_vkResetQueryPool = NULL; PFN_vkSetEvent glad_vkSetEvent = NULL; +PFN_vkSetPrivateData glad_vkSetPrivateData = NULL; +PFN_vkSignalSemaphore glad_vkSignalSemaphore = NULL; PFN_vkTrimCommandPool glad_vkTrimCommandPool = NULL; PFN_vkUnmapMemory glad_vkUnmapMemory = NULL; PFN_vkUpdateDescriptorSetWithTemplate glad_vkUpdateDescriptorSetWithTemplate = NULL; PFN_vkUpdateDescriptorSets glad_vkUpdateDescriptorSets = NULL; PFN_vkWaitForFences glad_vkWaitForFences = NULL; +PFN_vkWaitSemaphores glad_vkWaitSemaphores = NULL; static void glad_vk_load_VK_VERSION_1_0( GLADuserptrloadfunc load, void* userptr) { @@ -4373,6 +6030,62 @@ static void glad_vk_load_VK_VERSION_1_1( GLADuserptrloadfunc load, void* userptr glad_vkTrimCommandPool = (PFN_vkTrimCommandPool) load(userptr, "vkTrimCommandPool"); glad_vkUpdateDescriptorSetWithTemplate = (PFN_vkUpdateDescriptorSetWithTemplate) load(userptr, "vkUpdateDescriptorSetWithTemplate"); } +static void glad_vk_load_VK_VERSION_1_2( GLADuserptrloadfunc load, void* userptr) { + if(!GLAD_VK_VERSION_1_2) return; + glad_vkCmdBeginRenderPass2 = (PFN_vkCmdBeginRenderPass2) load(userptr, "vkCmdBeginRenderPass2"); + glad_vkCmdDrawIndexedIndirectCount = (PFN_vkCmdDrawIndexedIndirectCount) load(userptr, "vkCmdDrawIndexedIndirectCount"); + glad_vkCmdDrawIndirectCount = (PFN_vkCmdDrawIndirectCount) load(userptr, "vkCmdDrawIndirectCount"); + glad_vkCmdEndRenderPass2 = (PFN_vkCmdEndRenderPass2) load(userptr, "vkCmdEndRenderPass2"); + glad_vkCmdNextSubpass2 = (PFN_vkCmdNextSubpass2) load(userptr, "vkCmdNextSubpass2"); + glad_vkCreateRenderPass2 = (PFN_vkCreateRenderPass2) load(userptr, "vkCreateRenderPass2"); + glad_vkGetBufferDeviceAddress = (PFN_vkGetBufferDeviceAddress) load(userptr, "vkGetBufferDeviceAddress"); + glad_vkGetBufferOpaqueCaptureAddress = (PFN_vkGetBufferOpaqueCaptureAddress) load(userptr, "vkGetBufferOpaqueCaptureAddress"); + glad_vkGetDeviceMemoryOpaqueCaptureAddress = (PFN_vkGetDeviceMemoryOpaqueCaptureAddress) load(userptr, "vkGetDeviceMemoryOpaqueCaptureAddress"); + glad_vkGetSemaphoreCounterValue = (PFN_vkGetSemaphoreCounterValue) load(userptr, "vkGetSemaphoreCounterValue"); + glad_vkResetQueryPool = (PFN_vkResetQueryPool) load(userptr, "vkResetQueryPool"); + glad_vkSignalSemaphore = (PFN_vkSignalSemaphore) load(userptr, "vkSignalSemaphore"); + glad_vkWaitSemaphores = (PFN_vkWaitSemaphores) load(userptr, "vkWaitSemaphores"); +} +static void glad_vk_load_VK_VERSION_1_3( GLADuserptrloadfunc load, void* userptr) { + if(!GLAD_VK_VERSION_1_3) return; + glad_vkCmdBeginRendering = (PFN_vkCmdBeginRendering) load(userptr, "vkCmdBeginRendering"); + glad_vkCmdBindVertexBuffers2 = (PFN_vkCmdBindVertexBuffers2) load(userptr, "vkCmdBindVertexBuffers2"); + glad_vkCmdBlitImage2 = (PFN_vkCmdBlitImage2) load(userptr, "vkCmdBlitImage2"); + glad_vkCmdCopyBuffer2 = (PFN_vkCmdCopyBuffer2) load(userptr, "vkCmdCopyBuffer2"); + glad_vkCmdCopyBufferToImage2 = (PFN_vkCmdCopyBufferToImage2) load(userptr, "vkCmdCopyBufferToImage2"); + glad_vkCmdCopyImage2 = (PFN_vkCmdCopyImage2) load(userptr, "vkCmdCopyImage2"); + glad_vkCmdCopyImageToBuffer2 = (PFN_vkCmdCopyImageToBuffer2) load(userptr, "vkCmdCopyImageToBuffer2"); + glad_vkCmdEndRendering = (PFN_vkCmdEndRendering) load(userptr, "vkCmdEndRendering"); + glad_vkCmdPipelineBarrier2 = (PFN_vkCmdPipelineBarrier2) load(userptr, "vkCmdPipelineBarrier2"); + glad_vkCmdResetEvent2 = (PFN_vkCmdResetEvent2) load(userptr, "vkCmdResetEvent2"); + glad_vkCmdResolveImage2 = (PFN_vkCmdResolveImage2) load(userptr, "vkCmdResolveImage2"); + glad_vkCmdSetCullMode = (PFN_vkCmdSetCullMode) load(userptr, "vkCmdSetCullMode"); + glad_vkCmdSetDepthBiasEnable = (PFN_vkCmdSetDepthBiasEnable) load(userptr, "vkCmdSetDepthBiasEnable"); + glad_vkCmdSetDepthBoundsTestEnable = (PFN_vkCmdSetDepthBoundsTestEnable) load(userptr, "vkCmdSetDepthBoundsTestEnable"); + glad_vkCmdSetDepthCompareOp = (PFN_vkCmdSetDepthCompareOp) load(userptr, "vkCmdSetDepthCompareOp"); + glad_vkCmdSetDepthTestEnable = (PFN_vkCmdSetDepthTestEnable) load(userptr, "vkCmdSetDepthTestEnable"); + glad_vkCmdSetDepthWriteEnable = (PFN_vkCmdSetDepthWriteEnable) load(userptr, "vkCmdSetDepthWriteEnable"); + glad_vkCmdSetEvent2 = (PFN_vkCmdSetEvent2) load(userptr, "vkCmdSetEvent2"); + glad_vkCmdSetFrontFace = (PFN_vkCmdSetFrontFace) load(userptr, "vkCmdSetFrontFace"); + glad_vkCmdSetPrimitiveRestartEnable = (PFN_vkCmdSetPrimitiveRestartEnable) load(userptr, "vkCmdSetPrimitiveRestartEnable"); + glad_vkCmdSetPrimitiveTopology = (PFN_vkCmdSetPrimitiveTopology) load(userptr, "vkCmdSetPrimitiveTopology"); + glad_vkCmdSetRasterizerDiscardEnable = (PFN_vkCmdSetRasterizerDiscardEnable) load(userptr, "vkCmdSetRasterizerDiscardEnable"); + glad_vkCmdSetScissorWithCount = (PFN_vkCmdSetScissorWithCount) load(userptr, "vkCmdSetScissorWithCount"); + glad_vkCmdSetStencilOp = (PFN_vkCmdSetStencilOp) load(userptr, "vkCmdSetStencilOp"); + glad_vkCmdSetStencilTestEnable = (PFN_vkCmdSetStencilTestEnable) load(userptr, "vkCmdSetStencilTestEnable"); + glad_vkCmdSetViewportWithCount = (PFN_vkCmdSetViewportWithCount) load(userptr, "vkCmdSetViewportWithCount"); + glad_vkCmdWaitEvents2 = (PFN_vkCmdWaitEvents2) load(userptr, "vkCmdWaitEvents2"); + glad_vkCmdWriteTimestamp2 = (PFN_vkCmdWriteTimestamp2) load(userptr, "vkCmdWriteTimestamp2"); + glad_vkCreatePrivateDataSlot = (PFN_vkCreatePrivateDataSlot) load(userptr, "vkCreatePrivateDataSlot"); + glad_vkDestroyPrivateDataSlot = (PFN_vkDestroyPrivateDataSlot) load(userptr, "vkDestroyPrivateDataSlot"); + glad_vkGetDeviceBufferMemoryRequirements = (PFN_vkGetDeviceBufferMemoryRequirements) load(userptr, "vkGetDeviceBufferMemoryRequirements"); + glad_vkGetDeviceImageMemoryRequirements = (PFN_vkGetDeviceImageMemoryRequirements) load(userptr, "vkGetDeviceImageMemoryRequirements"); + glad_vkGetDeviceImageSparseMemoryRequirements = (PFN_vkGetDeviceImageSparseMemoryRequirements) load(userptr, "vkGetDeviceImageSparseMemoryRequirements"); + glad_vkGetPhysicalDeviceToolProperties = (PFN_vkGetPhysicalDeviceToolProperties) load(userptr, "vkGetPhysicalDeviceToolProperties"); + glad_vkGetPrivateData = (PFN_vkGetPrivateData) load(userptr, "vkGetPrivateData"); + glad_vkQueueSubmit2 = (PFN_vkQueueSubmit2) load(userptr, "vkQueueSubmit2"); + glad_vkSetPrivateData = (PFN_vkSetPrivateData) load(userptr, "vkSetPrivateData"); +} static void glad_vk_load_VK_EXT_debug_report( GLADuserptrloadfunc load, void* userptr) { if(!GLAD_VK_EXT_debug_report) return; glad_vkCreateDebugReportCallbackEXT = (PFN_vkCreateDebugReportCallbackEXT) load(userptr, "vkCreateDebugReportCallbackEXT"); @@ -4530,6 +6243,7 @@ static int glad_vk_find_extensions_vulkan( VkPhysicalDevice physical_device) { if (!glad_vk_get_extensions(physical_device, &extension_count, &extensions)) return 0; GLAD_VK_EXT_debug_report = glad_vk_has_extension("VK_EXT_debug_report", extension_count, extensions); + GLAD_VK_KHR_portability_enumeration = glad_vk_has_extension("VK_KHR_portability_enumeration", extension_count, extensions); GLAD_VK_KHR_surface = glad_vk_has_extension("VK_KHR_surface", extension_count, extensions); GLAD_VK_KHR_swapchain = glad_vk_has_extension("VK_KHR_swapchain", extension_count, extensions); @@ -4567,6 +6281,8 @@ static int glad_vk_find_core_vulkan( VkPhysicalDevice physical_device) { GLAD_VK_VERSION_1_0 = (major == 1 && minor >= 0) || major > 1; GLAD_VK_VERSION_1_1 = (major == 1 && minor >= 1) || major > 1; + GLAD_VK_VERSION_1_2 = (major == 1 && minor >= 2) || major > 1; + GLAD_VK_VERSION_1_3 = (major == 1 && minor >= 3) || major > 1; return GLAD_MAKE_VERSION(major, minor); } @@ -4584,6 +6300,8 @@ int gladLoadVulkanUserPtr( VkPhysicalDevice physical_device, GLADuserptrloadfunc glad_vk_load_VK_VERSION_1_0(load, userptr); glad_vk_load_VK_VERSION_1_1(load, userptr); + glad_vk_load_VK_VERSION_1_2(load, userptr); + glad_vk_load_VK_VERSION_1_3(load, userptr); if (!glad_vk_find_extensions_vulkan( physical_device)) return 0; glad_vk_load_VK_EXT_debug_report(load, userptr); From 3b3d58df47166865494c29cf3aeb826d1dd29777 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Wed, 6 Jul 2022 23:07:20 +0200 Subject: [PATCH 061/117] Add support for VK_KHR_portability_enumeration The use of this extension is required to enable the MoltenVK physical device as of Vulkan SDK 1.3.216.0. This is because MoltenVK is still very (very) slightly non-conformant. --- tests/glfwinfo.c | 130 ++++++++++++++++++++++++++-------------- tests/triangle-vulkan.c | 11 ++++ 2 files changed, 96 insertions(+), 45 deletions(-) diff --git a/tests/glfwinfo.c b/tests/glfwinfo.c index 14347e4b..d57f48c3 100644 --- a/tests/glfwinfo.c +++ b/tests/glfwinfo.c @@ -255,21 +255,6 @@ static void list_context_extensions(int client, int major, int minor) } } -static void list_vulkan_instance_extensions(void) -{ - printf("Vulkan instance extensions:\n"); - - uint32_t ep_count; - vkEnumerateInstanceExtensionProperties(NULL, &ep_count, NULL); - VkExtensionProperties* ep = calloc(ep_count, sizeof(VkExtensionProperties)); - vkEnumerateInstanceExtensionProperties(NULL, &ep_count, ep); - - for (uint32_t i = 0; i < ep_count; i++) - printf(" %s (spec version %u)\n", ep[i].extensionName, ep[i].specVersion); - - free(ep); -} - static void list_vulkan_instance_layers(void) { printf("Vulkan instance layers:\n"); @@ -290,21 +275,6 @@ static void list_vulkan_instance_layers(void) free(lp); } -static void list_vulkan_device_extensions(VkInstance instance, VkPhysicalDevice device) -{ - printf("Vulkan device extensions:\n"); - - uint32_t ep_count; - vkEnumerateDeviceExtensionProperties(device, NULL, &ep_count, NULL); - VkExtensionProperties* ep = calloc(ep_count, sizeof(VkExtensionProperties)); - vkEnumerateDeviceExtensionProperties(device, NULL, &ep_count, ep); - - for (uint32_t i = 0; i < ep_count; i++) - printf(" %s (spec version %u)\n", ep[i].extensionName, ep[i].specVersion); - - free(ep); -} - static void list_vulkan_device_layers(VkInstance instance, VkPhysicalDevice device) { printf("Vulkan device layers:\n"); @@ -953,20 +923,51 @@ int main(int argc, char** argv) VK_VERSION_MAJOR(loader_version), VK_VERSION_MINOR(loader_version)); - uint32_t re_count; - const char** re = glfwGetRequiredInstanceExtensions(&re_count); + uint32_t glfw_re_count; + const char** glfw_re = glfwGetRequiredInstanceExtensions(&glfw_re_count); - if (re) + uint32_t re_count = glfw_re_count; + const char** re = calloc(glfw_re_count, sizeof(char*)); + + if (glfw_re) { printf("Vulkan window surface required instance extensions:\n"); - for (uint32_t i = 0; i < re_count; i++) - printf(" %s\n", re[i]); + for (uint32_t i = 0; i < glfw_re_count; i++) + { + printf(" %s\n", glfw_re[i]); + re[i] = glfw_re[i]; + } } else printf("Vulkan window surface extensions missing\n"); + uint32_t ep_count; + vkEnumerateInstanceExtensionProperties(NULL, &ep_count, NULL); + VkExtensionProperties* ep = calloc(ep_count, sizeof(VkExtensionProperties)); + vkEnumerateInstanceExtensionProperties(NULL, &ep_count, ep); + if (list_extensions) - list_vulkan_instance_extensions(); + { + printf("Vulkan instance extensions:\n"); + + for (uint32_t i = 0; i < ep_count; i++) + printf(" %s (spec version %u)\n", ep[i].extensionName, ep[i].specVersion); + } + + bool portability_enumeration = false; + + for (uint32_t i = 0; i < ep_count; i++) + { + if (strcmp(ep[i].extensionName, "VK_KHR_portability_enumeration") != 0) + continue; + + re_count++; + re = realloc(re, sizeof(char*) * re_count); + re[re_count - 1] = "VK_KHR_portability_enumeration"; + portability_enumeration = true; + } + + free(ep); if (list_layers) list_vulkan_instance_layers(); @@ -987,6 +988,9 @@ int main(int argc, char** argv) ici.enabledExtensionCount = re_count; ici.ppEnabledExtensionNames = re; + if (portability_enumeration) + ici.flags |= VK_INSTANCE_CREATE_ENUMERATE_PORTABILITY_BIT_KHR; + VkInstance instance = VK_NULL_HANDLE; if (vkCreateInstance(&ici, NULL, &instance) != VK_SUCCESS) @@ -995,9 +999,11 @@ int main(int argc, char** argv) exit(EXIT_FAILURE); } + free(re); + gladLoadVulkanUserPtr(NULL, (GLADuserptrloadfunc) glfwGetInstanceProcAddress, instance); - if (re) + if (glfw_re_count) { VkSurfaceKHR surface = VK_NULL_HANDLE; @@ -1020,16 +1026,44 @@ int main(int argc, char** argv) VkPhysicalDeviceProperties pdp; vkGetPhysicalDeviceProperties(pd[i], &pdp); - printf("Vulkan %s device: \"%s\" (API version %i.%i)\n", - get_device_type_name(pdp.deviceType), - pdp.deviceName, - VK_VERSION_MAJOR(pdp.apiVersion), - VK_VERSION_MINOR(pdp.apiVersion)); - uint32_t qfp_count; vkGetPhysicalDeviceQueueFamilyProperties(pd[i], &qfp_count, NULL); - if (re) + uint32_t ep_count; + vkEnumerateDeviceExtensionProperties(pd[i], NULL, &ep_count, NULL); + VkExtensionProperties* ep = calloc(ep_count, sizeof(VkExtensionProperties)); + vkEnumerateDeviceExtensionProperties(pd[i], NULL, &ep_count, ep); + + if (portability_enumeration) + { + bool conformant = true; + + for (uint32_t j = 0; j < ep_count; j++) + { + if (strcmp(ep[j].extensionName, "VK_KHR_portability_subset") == 0) + { + conformant = false; + break; + } + } + + printf("Vulkan %s %s device: \"%s\" (API version %i.%i)\n", + conformant ? "conformant" : "non-conformant", + get_device_type_name(pdp.deviceType), + pdp.deviceName, + VK_VERSION_MAJOR(pdp.apiVersion), + VK_VERSION_MINOR(pdp.apiVersion)); + } + else + { + printf("Vulkan %s device: \"%s\" (API version %i.%i)\n", + get_device_type_name(pdp.deviceType), + pdp.deviceName, + VK_VERSION_MAJOR(pdp.apiVersion), + VK_VERSION_MINOR(pdp.apiVersion)); + } + + if (glfw_re_count) { printf("Vulkan device queue family presentation support:\n"); for (uint32_t j = 0; j < qfp_count; j++) @@ -1043,7 +1077,13 @@ int main(int argc, char** argv) } if (list_extensions) - list_vulkan_device_extensions(instance, pd[i]); + { + printf("Vulkan device extensions:\n"); + for (uint32_t j = 0; j < ep_count; j++) + printf(" %s (spec version %u)\n", ep[j].extensionName, ep[j].specVersion); + } + + free(ep); if (list_layers) list_vulkan_device_layers(instance, pd[i]); diff --git a/tests/triangle-vulkan.c b/tests/triangle-vulkan.c index fb5db3e2..b38ee139 100644 --- a/tests/triangle-vulkan.c +++ b/tests/triangle-vulkan.c @@ -1561,6 +1561,7 @@ static VkBool32 demo_check_layers(uint32_t check_count, const char **check_names static void demo_init_vk(struct demo *demo) { VkResult err; + VkBool32 portability_enumeration = VK_FALSE; uint32_t i = 0; uint32_t required_extension_count = 0; uint32_t instance_extension_count = 0; @@ -1668,6 +1669,13 @@ static void demo_init_vk(struct demo *demo) { } } assert(demo->enabled_extension_count < 64); + if (!strcmp(VK_KHR_PORTABILITY_ENUMERATION_EXTENSION_NAME, + instance_extensions[i].extensionName)) { + demo->extension_names[demo->enabled_extension_count++] = + VK_KHR_PORTABILITY_ENUMERATION_EXTENSION_NAME; + portability_enumeration = VK_TRUE; + } + assert(demo->enabled_extension_count < 64); } free(instance_extensions); @@ -1692,6 +1700,9 @@ static void demo_init_vk(struct demo *demo) { .ppEnabledExtensionNames = (const char *const *)demo->extension_names, }; + if (portability_enumeration) + inst_info.flags |= VK_INSTANCE_CREATE_ENUMERATE_PORTABILITY_BIT_KHR; + uint32_t gpu_count; err = vkCreateInstance(&inst_info, NULL, &demo->inst); From 9b7713cf92582cf56c4f79116001c33d1e6e655f Mon Sep 17 00:00:00 2001 From: Nikita Fediuchin Date: Thu, 26 May 2022 09:27:39 +0300 Subject: [PATCH 062/117] Cocoa: Fix search path for private Vulkan loader According to both Apple and LunarG, a private copy of the macOS Vulkan loader libvulkan.1.dylib should be placed in the Frameworks directory of the bundle and not its main executable directory. This commit updates the dynamic loading path accordingly. Fixes #2113 Closes #2120 --- src/cocoa_init.m | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/cocoa_init.m b/src/cocoa_init.m index 6bc6496a..48f67690 100644 --- a/src/cocoa_init.m +++ b/src/cocoa_init.m @@ -460,11 +460,18 @@ void* _glfwLoadLocalVulkanLoaderCocoa(void) if (!bundle) return NULL; - CFURLRef url = - CFBundleCopyAuxiliaryExecutableURL(bundle, CFSTR("libvulkan.1.dylib")); - if (!url) + CFURLRef frameworksUrl = CFBundleCopyPrivateFrameworksURL(bundle); + if (!frameworksUrl) return NULL; + CFURLRef url = CFURLCreateCopyAppendingPathComponent( + kCFAllocatorDefault, frameworksUrl, CFSTR("libvulkan.1.dylib"), false); + if (!url) + { + CFRelease(frameworksUrl); + return NULL; + } + char path[PATH_MAX]; void* handle = NULL; @@ -472,6 +479,7 @@ void* _glfwLoadLocalVulkanLoaderCocoa(void) handle = _glfwPlatformLoadModule(path); CFRelease(url); + CFRelease(frameworksUrl); return handle; } From dfb26023fca8d7cdd24bf43003109b89acea6869 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Thu, 7 Jul 2022 20:01:28 +0200 Subject: [PATCH 063/117] Update changelog and add credit Related to #2113 Related to #2120 --- CONTRIBUTORS.md | 1 + README.md | 2 ++ 2 files changed, 3 insertions(+) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 66e99080..6dc92466 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -60,6 +60,7 @@ video tutorials. - Jan Ekström - Siavash Eliasi - Ahmad Fatoum + - Nikita Fediuchin - Felipe Ferreira - Michael Fogleman - Jason Francis diff --git a/README.md b/README.md index 84454964..6239c034 100644 --- a/README.md +++ b/README.md @@ -259,6 +259,8 @@ information on what to include when reporting a bug. application (#1886) - [Cocoa] Bugfix: Setting a monitor from macOS fullscreen would abort application (#2110) + - [Cocoa] Bugfix: The Vulkan loader was not loaded from the `Frameworks` bundle + subdirectory (#2113,#2120) - [X11] Bugfix: The CMake files did not check for the XInput headers (#1480) - [X11] Bugfix: Key names were not updated when the keyboard layout changed (#1462,#1528) From 78b19548d9395898ecca6b792a37125520f93f5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Thu, 7 Jul 2022 20:26:37 +0200 Subject: [PATCH 064/117] Documentation work Related to #2113 Related to #2120 --- docs/vulkan.dox | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/docs/vulkan.dox b/docs/vulkan.dox index 31891036..8e9821ca 100644 --- a/docs/vulkan.dox +++ b/docs/vulkan.dox @@ -37,8 +37,8 @@ By default, GLFW will load the Vulkan loader dynamically at runtime via its stan `vulkan-1.dll` on Windows, `libvulkan.so.1` on Linux and other Unix-like systems and `libvulkan.1.dylib` on macOS. -@macos GLFW will also look up and search the executable subdirectory of your application -bundle. +@macos GLFW will also look up and search the `Frameworks` subdirectory of your +application bundle. If your code is using a Vulkan loader with a different name or in a non-standard location you will need to direct GLFW to it. Pass your version of `vkGetInstanceProcAddr` to @ref @@ -188,6 +188,13 @@ check whether any extensions you wish to enable are already in the returned array, as it is an error to specify an extension more than once in the `VkInstanceCreateInfo` struct. +@macos MoltenVK is (as of July 2022) not yet a fully conformant implementation +of Vulkan. As of Vulkan SDK 1.3.216.0, this means you must also enable the +`VK_KHR_portability_enumeration` instance extension and set the +`VK_INSTANCE_CREATE_ENUMERATE_PORTABILITY_BIT_KHR` bit in the instance creation +info flags for MoltenVK to show up in the list of physical devices. For more +information, see the Vulkan and MoltenVK documentation. + @section vulkan_present Querying for Vulkan presentation support From 2db528d8cddcebc4c96fdac0c6a2d72792578004 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Thu, 7 Jul 2022 22:48:03 +0200 Subject: [PATCH 065/117] Cocoa: Cleanup --- src/cocoa_init.m | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/cocoa_init.m b/src/cocoa_init.m index 48f67690..aa369f9c 100644 --- a/src/cocoa_init.m +++ b/src/cocoa_init.m @@ -464,9 +464,9 @@ void* _glfwLoadLocalVulkanLoaderCocoa(void) if (!frameworksUrl) return NULL; - CFURLRef url = CFURLCreateCopyAppendingPathComponent( + CFURLRef loaderUrl = CFURLCreateCopyAppendingPathComponent( kCFAllocatorDefault, frameworksUrl, CFSTR("libvulkan.1.dylib"), false); - if (!url) + if (!loaderUrl) { CFRelease(frameworksUrl); return NULL; @@ -475,10 +475,10 @@ void* _glfwLoadLocalVulkanLoaderCocoa(void) char path[PATH_MAX]; void* handle = NULL; - if (CFURLGetFileSystemRepresentation(url, true, (UInt8*) path, sizeof(path) - 1)) + if (CFURLGetFileSystemRepresentation(loaderUrl, true, (UInt8*) path, sizeof(path) - 1)) handle = _glfwPlatformLoadModule(path); - CFRelease(url); + CFRelease(loaderUrl); CFRelease(frameworksUrl); return handle; } From 84e165ef64ce117c5f1fa99b607f5bd143973e65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Fri, 8 Jul 2022 00:19:03 +0200 Subject: [PATCH 066/117] Win32: Work around warnings on MSVC 19.32.x --- tests/glfwinfo.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/glfwinfo.c b/tests/glfwinfo.c index d57f48c3..eda2f821 100644 --- a/tests/glfwinfo.c +++ b/tests/glfwinfo.c @@ -962,7 +962,7 @@ int main(int argc, char** argv) continue; re_count++; - re = realloc(re, sizeof(char*) * re_count); + re = realloc((void*) re, sizeof(char*) * re_count); re[re_count - 1] = "VK_KHR_portability_enumeration"; portability_enumeration = true; } @@ -999,7 +999,7 @@ int main(int argc, char** argv) exit(EXIT_FAILURE); } - free(re); + free((void*) re); gladLoadVulkanUserPtr(NULL, (GLADuserptrloadfunc) glfwGetInstanceProcAddress, instance); From 36f0bf00a92b15e301bb28e840a4361e0b74b123 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Fri, 8 Jul 2022 15:51:07 +0200 Subject: [PATCH 067/117] Cocoa: Fix build failure on OS X 10.11 The NSWindowCollectionBehaviorFullScreenNone enum value is missing from system headers on 10.11 despite the documentation claiming it was added in 10.7. Unfortunately Apple has taken down all API release notes for versions prior to 10.14. This fixes a build failure introduced with 98d6e8485b327288f5b53e59e6cc2267e28376bd. --- src/cocoa_window.m | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/cocoa_window.m b/src/cocoa_window.m index 527423ee..5bb1289b 100644 --- a/src/cocoa_window.m +++ b/src/cocoa_window.m @@ -31,6 +31,10 @@ #include #include +// HACK: This enum value is missing from framework headers on OS X 10.11 despite +// having been (according to documentation) added in Mac OS X 10.7 +#define NSWindowCollectionBehaviorFullScreenNone (1 << 9) + // Returns whether the cursor is in the content area of the specified window // static GLFWbool cursorInContentArea(_GLFWwindow* window) From 060631c9658010945c6b89935e5ac41a5b4a991c Mon Sep 17 00:00:00 2001 From: JoelNiemela Date: Fri, 8 Jul 2022 18:52:54 -0500 Subject: [PATCH 068/117] Fix typos in docs Closes #2150 --- docs/CONTRIBUTING.md | 4 ++-- docs/build.dox | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/CONTRIBUTING.md b/docs/CONTRIBUTING.md index 11ddf09b..050c1bed 100644 --- a/docs/CONTRIBUTING.md +++ b/docs/CONTRIBUTING.md @@ -351,8 +351,8 @@ __Note:__ If you haven't already implemented the feature, check first if there already is an open issue for it and if it's already being developed in an [experimental branch](https://github.com/glfw/glfw/branches/all). -__There is no preferred patch size__. A one character change is just as welcome -as one adding a thousand line one, if that is the appropriate size for the +__There is no preferred patch size__. A one-character change is just as welcome +as one adding a thousand lines, if that is the appropriate size for the feature. In addition to the code, a complete feature includes: diff --git a/docs/build.dox b/docs/build.dox index aa06b0f4..c7677037 100644 --- a/docs/build.dox +++ b/docs/build.dox @@ -57,7 +57,7 @@ macros that disable similar headers below it. Both of these mechanisms depend on the extension loader header defining a known macro. If yours doesn't or you don't know which one your users will pick, the -@ref GLFW_INCLUDE_NONE macro will explicitly to prevent the GLFW header from +@ref GLFW_INCLUDE_NONE macro will explicitly prevent the GLFW header from including the OpenGL header. This will also allow you to include the two headers in any order. From 8e725338bf210b9cc53f6b874307080e16368802 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Mon, 11 Jul 2022 20:54:03 +0200 Subject: [PATCH 069/117] Add credit Related to #2150 --- CONTRIBUTORS.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 6dc92466..0fa2f6b1 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -154,6 +154,7 @@ video tutorials. - F. Nedelec - n3rdopolis - Kristian Nielsen + - Joel Niemelä - Kamil Nowakowski - onox - Denis Ovod From 5c948a6e6e52eb89e11d1a424bbf578bfc573319 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Tue, 21 Jun 2022 23:12:31 +0200 Subject: [PATCH 070/117] Wayland: Fix comment typo --- src/wl_window.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wl_window.c b/src/wl_window.c index b2930c5e..5be14253 100644 --- a/src/wl_window.c +++ b/src/wl_window.c @@ -2037,7 +2037,7 @@ void _glfwRestoreWindowWayland(_GLFWwindow* window) } else { - // We assume we are not minimized and acto only on maximization + // We assume we are not minimized and act only on maximization if (window->wl.maximized) { From 88a39006e3407656a7ca33d23f8045c6aca43008 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Tue, 21 Jun 2022 23:19:40 +0200 Subject: [PATCH 071/117] Wayland: Cleanup --- src/wl_window.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/wl_window.c b/src/wl_window.c index 5be14253..1661d241 100644 --- a/src/wl_window.c +++ b/src/wl_window.c @@ -604,9 +604,7 @@ static GLFWbool createShellObjects(_GLFWwindow* window) return GLFW_FALSE; } - xdg_surface_add_listener(window->wl.xdg.surface, - &xdgSurfaceListener, - window); + xdg_surface_add_listener(window->wl.xdg.surface, &xdgSurfaceListener, window); window->wl.xdg.toplevel = xdg_surface_get_toplevel(window->wl.xdg.surface); if (!window->wl.xdg.toplevel) @@ -616,17 +614,14 @@ static GLFWbool createShellObjects(_GLFWwindow* window) return GLFW_FALSE; } - xdg_toplevel_add_listener(window->wl.xdg.toplevel, - &xdgToplevelListener, - window); + xdg_toplevel_add_listener(window->wl.xdg.toplevel, &xdgToplevelListener, window); if (window->wl.title) xdg_toplevel_set_title(window->wl.xdg.toplevel, window->wl.title); if (window->monitor) { - xdg_toplevel_set_fullscreen(window->wl.xdg.toplevel, - window->monitor->wl.output); + xdg_toplevel_set_fullscreen(window->wl.xdg.toplevel, window->monitor->wl.output); setIdleInhibitor(window, GLFW_TRUE); } else From 2796e61af7b4d0c5f2380c3e1803e21ac1089029 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Fri, 24 Jun 2022 19:29:29 +0200 Subject: [PATCH 072/117] Documentation work --- include/GLFW/glfw3.h | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/include/GLFW/glfw3.h b/include/GLFW/glfw3.h index 52225c74..eddd963e 100644 --- a/include/GLFW/glfw3.h +++ b/include/GLFW/glfw3.h @@ -3671,8 +3671,9 @@ GLFWAPI void glfwSetWindowOpacity(GLFWwindow* window, float opacity); * previously restored. If the window is already iconified, this function does * nothing. * - * If the specified window is a full screen window, the original monitor - * resolution is restored until the window is restored. + * If the specified window is a full screen window, GLFW restores the original + * video mode of the monitor. The window's desired video mode is set again + * when the window is restored. * * @param[in] window The window to iconify. * @@ -3702,8 +3703,8 @@ GLFWAPI void glfwIconifyWindow(GLFWwindow* window); * (minimized) or maximized. If the window is already restored, this function * does nothing. * - * If the specified window is a full screen window, the resolution chosen for - * the window is restored on the selected monitor. + * If the specified window is an iconified full screen window, its desired + * video mode is set again for its monitor when the window is restored. * * @param[in] window The window to restore. * @@ -3971,6 +3972,9 @@ GLFWAPI void glfwSetWindowMonitor(GLFWwindow* window, GLFWmonitor* monitor, int * errors. However, this function should not fail as long as it is passed * valid arguments and the library has been [initialized](@ref intro_init). * + * @remark @wayland The Wayland protocol provides no way to check whether a + * window is iconfied, so @ref GLFW_ICONIFIED always returns `GLFW_FALSE`. + * * @thread_safety This function must only be called from the main thread. * * @sa @ref window_attribs From 6dd526fb1a9c16c3170a0ebd2b5c73e4a2719245 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Tue, 28 Jun 2022 22:26:39 +0200 Subject: [PATCH 073/117] Win32: Fix right Shift scancode when using CJK IME Fixes #2050 --- CONTRIBUTORS.md | 1 + README.md | 1 + src/win32_window.c | 4 ++++ 3 files changed, 6 insertions(+) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 0fa2f6b1..2548dea2 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -19,6 +19,7 @@ video tutorials. - Nevyn Bengtsson - Niklas Bergström - Denis Bernard + - BiBi - Doug Binks - blanco - Waris Boonyasiriwat diff --git a/README.md b/README.md index 6239c034..452577de 100644 --- a/README.md +++ b/README.md @@ -221,6 +221,7 @@ information on what to include when reporting a bug. match event scancode (#1993) - [Win32] Bugfix: Instance-local operations used executable instance (#469,#1296,#1395) - [Win32] Bugfix: The OSMesa library was not unloaded on termination + - [Win32] Bugfix: Right shift emitted `GLFW_KEY_UNKNOWN` when using a CJK IME (#2050) - [Cocoa] Added support for `VK_EXT_metal_surface` (#1619) - [Cocoa] Added locating the Vulkan loader at runtime in an application bundle - [Cocoa] Moved main menu creation to GLFW initialization time (#1649) diff --git a/src/win32_window.c b/src/win32_window.c index 8d9c95e7..168529e2 100644 --- a/src/win32_window.c +++ b/src/win32_window.c @@ -727,6 +727,10 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM l if (scancode == 0x146) scancode = 0x45; + // HACK: CJK IME sets the extended bit for right Shift + if (scancode == 0x136) + scancode = 0x36; + key = _glfw.win32.keycodes[scancode]; // The Ctrl keys require special handling From fd7e737216dfdcecd4522b7d8c8dd2439d3dac3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Tue, 12 Jul 2022 11:44:37 +0200 Subject: [PATCH 074/117] Linux: Fix duplicate joystick objects This fixes a regression introduced by 2c204ab52ecaa51bfd32b777aef715dae937f009. This broke the check for whether there is already a GLFW joystick object for a given input device, making it always fail. --- src/linux_joystick.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/linux_joystick.c b/src/linux_joystick.c index b8b5778e..fd5dabdf 100644 --- a/src/linux_joystick.c +++ b/src/linux_joystick.c @@ -128,7 +128,7 @@ static GLFWbool openJoystickDevice(const char* path) { for (int jid = 0; jid <= GLFW_JOYSTICK_LAST; jid++) { - if (_glfw.joysticks[jid].connected) + if (!_glfw.joysticks[jid].connected) continue; if (strcmp(_glfw.joysticks[jid].linjs.path, path) == 0) return GLFW_FALSE; From aa80d24d01d150e26d664ff2d5da22e95db6bb82 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Tue, 28 Jun 2022 23:19:30 +0200 Subject: [PATCH 075/117] Documentation work Fixes #1596 --- docs/input.dox | 18 +++++++++++++++--- include/GLFW/glfw3.h | 3 +-- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/docs/input.dox b/docs/input.dox index faa94cd4..41508e7b 100644 --- a/docs/input.dox +++ b/docs/input.dox @@ -123,9 +123,21 @@ void key_callback(GLFWwindow* window, int key, int scancode, int action, int mod } @endcode -The action is one of `GLFW_PRESS`, `GLFW_REPEAT` or `GLFW_RELEASE`. The key -will be `GLFW_KEY_UNKNOWN` if GLFW lacks a key token for it, for example -_E-mail_ and _Play_ keys. +The action is one of `GLFW_PRESS`, `GLFW_REPEAT` or `GLFW_RELEASE`. Events with +`GLFW_PRESS` and `GLFW_RELEASE` actions are emitted for every key press. Most +keys will also emit events with `GLFW_REPEAT` actions while a key is held down. + +Key events with `GLFW_REPEAT` actions are intended for text input. They are +emitted at the rate set in the user's keyboard settings. At most one key is +repeated even if several keys are held down. `GLFW_REPEAT` actions should not +be relied on to know which keys are being held down or to drive animation. +Instead you should either save the state of relevant keys based on `GLFW_PRESS` +and `GLFW_RELEASE` actions, or call @ref glfwGetKey, which provides basic cached +key state. + +The key will be one of the existing [key tokens](@ref keys), or +`GLFW_KEY_UNKNOWN` if GLFW lacks a token for it, for example _E-mail_ and _Play_ +keys. The scancode is unique for every key, regardless of whether it has a key token. Scancodes are platform-specific but consistent over time, so keys will have diff --git a/include/GLFW/glfw3.h b/include/GLFW/glfw3.h index eddd963e..aa6ddc33 100644 --- a/include/GLFW/glfw3.h +++ b/include/GLFW/glfw3.h @@ -4734,8 +4734,7 @@ GLFWAPI int glfwGetKeyScancode(int key); * * This function returns the last state reported for the specified key to the * specified window. The returned state is one of `GLFW_PRESS` or - * `GLFW_RELEASE`. The higher-level action `GLFW_REPEAT` is only reported to - * the key callback. + * `GLFW_RELEASE`. The action `GLFW_REPEAT` is only reported to the key callback. * * If the @ref GLFW_STICKY_KEYS input mode is enabled, this function returns * `GLFW_PRESS` the first time you call it for a key that was pressed, even if From d77aaa770f97cd22b16cb4c8b9a3b9aaf33da245 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Wed, 13 Jul 2022 12:53:25 +0200 Subject: [PATCH 076/117] Wayland: Fix non-standard struct initialization --- src/wl_window.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/wl_window.c b/src/wl_window.c index 1661d241..80c601d0 100644 --- a/src/wl_window.c +++ b/src/wl_window.c @@ -743,7 +743,7 @@ static GLFWbool createNativeSurface(_GLFWwindow* window, static void setCursorImage(_GLFWwindow* window, _GLFWcursorWayland* cursorWayland) { - struct itimerspec timer = {}; + struct itimerspec timer = {0}; struct wl_cursor* wlCursor = cursorWayland->cursor; struct wl_cursor_image* image; struct wl_buffer* buffer; @@ -1397,7 +1397,7 @@ static void keyboardHandleLeave(void* userData, if (!window) return; - struct itimerspec timer = {}; + struct itimerspec timer = {0}; timerfd_settime(_glfw.wl.timerfd, 0, &timer, NULL); _glfw.wl.serial = serial; @@ -1471,7 +1471,7 @@ static void keyboardHandleKey(void* userData, _glfw.wl.serial = serial; _glfwInputKey(window, key, scancode, action, _glfw.wl.xkb.modifiers); - struct itimerspec timer = {}; + struct itimerspec timer = {0}; if (action == GLFW_PRESS) { From 4df24735ef6bb644830ecdacf89dd04cd8547b86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Wed, 13 Jul 2022 14:26:25 +0200 Subject: [PATCH 077/117] Wayland: Do not emit events for destroyed window During platform window destruction, all of its callbacks have already been removed, so emitting events for it does nothing. --- src/wl_window.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/wl_window.c b/src/wl_window.c index 80c601d0..8ad16cc0 100644 --- a/src/wl_window.c +++ b/src/wl_window.c @@ -1843,15 +1843,10 @@ GLFWbool _glfwCreateWindowWayland(_GLFWwindow* window, void _glfwDestroyWindowWayland(_GLFWwindow* window) { if (window == _glfw.wl.pointerFocus) - { _glfw.wl.pointerFocus = NULL; - _glfwInputCursorEnter(window, GLFW_FALSE); - } + if (window == _glfw.wl.keyboardFocus) - { _glfw.wl.keyboardFocus = NULL; - _glfwInputWindowFocus(window, GLFW_FALSE); - } if (window->wl.idleInhibitor) zwp_idle_inhibitor_v1_destroy(window->wl.idleInhibitor); From e47cb7c1e20f20b8f7d091e477be3fe41201836e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Wed, 13 Jul 2022 20:13:01 +0200 Subject: [PATCH 078/117] Wayland: Update state before emitting events --- src/wl_window.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/wl_window.c b/src/wl_window.c index 8ad16cc0..df208a33 100644 --- a/src/wl_window.c +++ b/src/wl_window.c @@ -1044,8 +1044,8 @@ static void pointerHandleLeave(void* userData, _glfw.wl.serial = serial; _glfw.wl.pointerFocus = NULL; - _glfwInputCursorEnter(window, GLFW_FALSE); _glfw.wl.cursorPreviousName = NULL; + _glfwInputCursorEnter(window, GLFW_FALSE); } static void setCursor(_GLFWwindow* window, const char* name) @@ -1116,8 +1116,8 @@ static void pointerHandleMotion(void* userData, switch (window->wl.decorations.focus) { case mainWindow: - _glfwInputCursorPos(window, x, y); _glfw.wl.cursorPreviousName = NULL; + _glfwInputCursorPos(window, x, y); return; case topDecoration: if (y < GLFW_BORDER_SIZE) From a1a73ee86257a62818b010cd3de55e10d7ce7105 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Wed, 13 Jul 2022 20:33:30 +0200 Subject: [PATCH 079/117] Wayland: Make text input logic static Since the seat listener was moved into wl_window.c there is no reason for text input to have external linkage. --- src/wl_platform.h | 1 - src/wl_window.c | 101 +++++++++++++++++++++++----------------------- 2 files changed, 50 insertions(+), 52 deletions(-) diff --git a/src/wl_platform.h b/src/wl_platform.h index b85d79a5..b84aff9a 100644 --- a/src/wl_platform.h +++ b/src/wl_platform.h @@ -515,7 +515,6 @@ void _glfwSetGammaRampWayland(_GLFWmonitor* monitor, const GLFWgammaramp* ramp); void _glfwAddOutputWayland(uint32_t name, uint32_t version); void _glfwUpdateContentScaleWayland(_GLFWwindow* window); -GLFWbool _glfwInputTextWayland(_GLFWwindow* window, uint32_t scancode); void _glfwAddSeatListenerWayland(struct wl_seat* seat); void _glfwAddDataDeviceListenerWayland(struct wl_data_device* device); diff --git a/src/wl_window.c b/src/wl_window.c index df208a33..6e070aaf 100644 --- a/src/wl_window.c +++ b/src/wl_window.c @@ -821,6 +821,54 @@ static GLFWbool flushDisplay(void) return GLFW_TRUE; } +static int translateKey(uint32_t scancode) +{ + if (scancode < sizeof(_glfw.wl.keycodes) / sizeof(_glfw.wl.keycodes[0])) + return _glfw.wl.keycodes[scancode]; + + return GLFW_KEY_UNKNOWN; +} + +static xkb_keysym_t composeSymbol(xkb_keysym_t sym) +{ + if (sym == XKB_KEY_NoSymbol || !_glfw.wl.xkb.composeState) + return sym; + if (xkb_compose_state_feed(_glfw.wl.xkb.composeState, sym) + != XKB_COMPOSE_FEED_ACCEPTED) + return sym; + switch (xkb_compose_state_get_status(_glfw.wl.xkb.composeState)) + { + case XKB_COMPOSE_COMPOSED: + return xkb_compose_state_get_one_sym(_glfw.wl.xkb.composeState); + case XKB_COMPOSE_COMPOSING: + case XKB_COMPOSE_CANCELLED: + return XKB_KEY_NoSymbol; + case XKB_COMPOSE_NOTHING: + default: + return sym; + } +} + +GLFWbool inputText(_GLFWwindow* window, uint32_t scancode) +{ + const xkb_keysym_t* keysyms; + const xkb_keycode_t keycode = scancode + 8; + + if (xkb_state_key_get_syms(_glfw.wl.xkb.state, keycode, &keysyms) == 1) + { + const xkb_keysym_t keysym = composeSymbol(keysyms[0]); + const uint32_t codepoint = _glfwKeySym2Unicode(keysym); + if (codepoint != GLFW_INVALID_CODEPOINT) + { + const int mods = _glfw.wl.xkb.modifiers; + const int plain = !(mods & (GLFW_MOD_CONTROL | GLFW_MOD_ALT)); + _glfwInputChar(window, codepoint, mods, plain); + } + } + + return xkb_keymap_key_repeats(_glfw.wl.xkb.keymap, keycode); +} + static void handleEvents(double* timeout) { GLFWbool event = GLFW_FALSE; @@ -880,8 +928,7 @@ static void handleEvents(double* timeout) _glfw.wl.keyboardLastScancode, GLFW_PRESS, _glfw.wl.xkb.modifiers); - _glfwInputTextWayland(_glfw.wl.keyboardFocus, - _glfw.wl.keyboardLastScancode); + inputText(_glfw.wl.keyboardFocus, _glfw.wl.keyboardLastScancode); } event = GLFW_TRUE; @@ -1405,54 +1452,6 @@ static void keyboardHandleLeave(void* userData, _glfwInputWindowFocus(window, GLFW_FALSE); } -static int translateKey(uint32_t scancode) -{ - if (scancode < sizeof(_glfw.wl.keycodes) / sizeof(_glfw.wl.keycodes[0])) - return _glfw.wl.keycodes[scancode]; - - return GLFW_KEY_UNKNOWN; -} - -static xkb_keysym_t composeSymbol(xkb_keysym_t sym) -{ - if (sym == XKB_KEY_NoSymbol || !_glfw.wl.xkb.composeState) - return sym; - if (xkb_compose_state_feed(_glfw.wl.xkb.composeState, sym) - != XKB_COMPOSE_FEED_ACCEPTED) - return sym; - switch (xkb_compose_state_get_status(_glfw.wl.xkb.composeState)) - { - case XKB_COMPOSE_COMPOSED: - return xkb_compose_state_get_one_sym(_glfw.wl.xkb.composeState); - case XKB_COMPOSE_COMPOSING: - case XKB_COMPOSE_CANCELLED: - return XKB_KEY_NoSymbol; - case XKB_COMPOSE_NOTHING: - default: - return sym; - } -} - -GLFWbool _glfwInputTextWayland(_GLFWwindow* window, uint32_t scancode) -{ - const xkb_keysym_t* keysyms; - const xkb_keycode_t keycode = scancode + 8; - - if (xkb_state_key_get_syms(_glfw.wl.xkb.state, keycode, &keysyms) == 1) - { - const xkb_keysym_t keysym = composeSymbol(keysyms[0]); - const uint32_t codepoint = _glfwKeySym2Unicode(keysym); - if (codepoint != GLFW_INVALID_CODEPOINT) - { - const int mods = _glfw.wl.xkb.modifiers; - const int plain = !(mods & (GLFW_MOD_CONTROL | GLFW_MOD_ALT)); - _glfwInputChar(window, codepoint, mods, plain); - } - } - - return xkb_keymap_key_repeats(_glfw.wl.xkb.keymap, keycode); -} - static void keyboardHandleKey(void* userData, struct wl_keyboard* keyboard, uint32_t serial, @@ -1475,7 +1474,7 @@ static void keyboardHandleKey(void* userData, if (action == GLFW_PRESS) { - const GLFWbool shouldRepeat = _glfwInputTextWayland(window, scancode); + const GLFWbool shouldRepeat = inputText(window, scancode); if (shouldRepeat && _glfw.wl.keyboardRepeatRate > 0) { From 9180923ea08d70d15a287b49a06ffbecd781a060 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Wed, 13 Jul 2022 21:32:30 +0200 Subject: [PATCH 080/117] Wayland: Clean up key repeat logic --- src/wl_init.c | 11 +++++++---- src/wl_platform.h | 10 +++++----- src/wl_window.c | 40 ++++++++++++++++++++-------------------- 3 files changed, 32 insertions(+), 29 deletions(-) diff --git a/src/wl_init.c b/src/wl_init.c index 2ce6f7f9..06928a04 100644 --- a/src/wl_init.c +++ b/src/wl_init.c @@ -478,7 +478,7 @@ int _glfwInitWayland(void) int cursorSize; // These must be set before any failure checks - _glfw.wl.timerfd = -1; + _glfw.wl.keyRepeatTimerfd = -1; _glfw.wl.cursorTimerfd = -1; _glfw.wl.client.display_flush = (PFN_wl_display_flush) @@ -639,7 +639,10 @@ int _glfwInitWayland(void) #ifdef WL_KEYBOARD_REPEAT_INFO_SINCE_VERSION if (_glfw.wl.seatVersion >= WL_KEYBOARD_REPEAT_INFO_SINCE_VERSION) - _glfw.wl.timerfd = timerfd_create(CLOCK_MONOTONIC, TFD_CLOEXEC | TFD_NONBLOCK); + { + _glfw.wl.keyRepeatTimerfd = + timerfd_create(CLOCK_MONOTONIC, TFD_CLOEXEC | TFD_NONBLOCK); + } #endif if (!_glfw.wl.wmBase) @@ -772,8 +775,8 @@ void _glfwTerminateWayland(void) wl_display_disconnect(_glfw.wl.display); } - if (_glfw.wl.timerfd >= 0) - close(_glfw.wl.timerfd); + if (_glfw.wl.keyRepeatTimerfd >= 0) + close(_glfw.wl.keyRepeatTimerfd); if (_glfw.wl.cursorTimerfd >= 0) close(_glfw.wl.cursorTimerfd); diff --git a/src/wl_platform.h b/src/wl_platform.h index b84aff9a..f65bcb11 100644 --- a/src/wl_platform.h +++ b/src/wl_platform.h @@ -322,12 +322,12 @@ typedef struct _GLFWlibraryWayland uint32_t serial; uint32_t pointerEnterSerial; - int32_t keyboardRepeatRate; - int32_t keyboardRepeatDelay; - int keyboardLastKey; - int keyboardLastScancode; + int keyRepeatTimerfd; + int32_t keyRepeatRate; + int32_t keyRepeatDelay; + int keyRepeatScancode; + char* clipboardString; - int timerfd; short int keycodes[256]; short int scancodes[GLFW_KEY_LAST + 1]; char keynames[GLFW_KEY_LAST + 1][5]; diff --git a/src/wl_window.c b/src/wl_window.c index 6e070aaf..87de85d9 100644 --- a/src/wl_window.c +++ b/src/wl_window.c @@ -849,7 +849,7 @@ static xkb_keysym_t composeSymbol(xkb_keysym_t sym) } } -GLFWbool inputText(_GLFWwindow* window, uint32_t scancode) +void inputText(_GLFWwindow* window, uint32_t scancode) { const xkb_keysym_t* keysyms; const xkb_keycode_t keycode = scancode + 8; @@ -865,8 +865,6 @@ GLFWbool inputText(_GLFWwindow* window, uint32_t scancode) _glfwInputChar(window, codepoint, mods, plain); } } - - return xkb_keymap_key_repeats(_glfw.wl.xkb.keymap, keycode); } static void handleEvents(double* timeout) @@ -875,7 +873,7 @@ static void handleEvents(double* timeout) struct pollfd fds[] = { { wl_display_get_fd(_glfw.wl.display), POLLIN }, - { _glfw.wl.timerfd, POLLIN }, + { _glfw.wl.keyRepeatTimerfd, POLLIN }, { _glfw.wl.cursorTimerfd, POLLIN }, }; @@ -919,16 +917,16 @@ static void handleEvents(double* timeout) { uint64_t repeats; - if (read(_glfw.wl.timerfd, &repeats, sizeof(repeats)) == 8) + if (read(_glfw.wl.keyRepeatTimerfd, &repeats, sizeof(repeats)) == 8) { for (uint64_t i = 0; i < repeats; i++) { _glfwInputKey(_glfw.wl.keyboardFocus, - _glfw.wl.keyboardLastKey, - _glfw.wl.keyboardLastScancode, + translateKey(_glfw.wl.keyRepeatScancode), + _glfw.wl.keyRepeatScancode, GLFW_PRESS, _glfw.wl.xkb.modifiers); - inputText(_glfw.wl.keyboardFocus, _glfw.wl.keyboardLastScancode); + inputText(_glfw.wl.keyboardFocus, _glfw.wl.keyRepeatScancode); } event = GLFW_TRUE; @@ -1445,7 +1443,7 @@ static void keyboardHandleLeave(void* userData, return; struct itimerspec timer = {0}; - timerfd_settime(_glfw.wl.timerfd, 0, &timer, NULL); + timerfd_settime(_glfw.wl.keyRepeatTimerfd, 0, &timer, NULL); _glfw.wl.serial = serial; _glfw.wl.keyboardFocus = NULL; @@ -1474,23 +1472,25 @@ static void keyboardHandleKey(void* userData, if (action == GLFW_PRESS) { - const GLFWbool shouldRepeat = inputText(window, scancode); + inputText(window, scancode); - if (shouldRepeat && _glfw.wl.keyboardRepeatRate > 0) + const xkb_keycode_t keycode = scancode + 8; + + if (xkb_keymap_key_repeats(_glfw.wl.xkb.keymap, keycode) && + _glfw.wl.keyRepeatRate > 0) { - _glfw.wl.keyboardLastKey = key; - _glfw.wl.keyboardLastScancode = scancode; - if (_glfw.wl.keyboardRepeatRate > 1) - timer.it_interval.tv_nsec = 1000000000 / _glfw.wl.keyboardRepeatRate; + _glfw.wl.keyRepeatScancode = scancode; + if (_glfw.wl.keyRepeatRate > 1) + timer.it_interval.tv_nsec = 1000000000 / _glfw.wl.keyRepeatRate; else timer.it_interval.tv_sec = 1; - timer.it_value.tv_sec = _glfw.wl.keyboardRepeatDelay / 1000; - timer.it_value.tv_nsec = (_glfw.wl.keyboardRepeatDelay % 1000) * 1000000; + timer.it_value.tv_sec = _glfw.wl.keyRepeatDelay / 1000; + timer.it_value.tv_nsec = (_glfw.wl.keyRepeatDelay % 1000) * 1000000; } } - timerfd_settime(_glfw.wl.timerfd, 0, &timer, NULL); + timerfd_settime(_glfw.wl.keyRepeatTimerfd, 0, &timer, NULL); } static void keyboardHandleModifiers(void* userData, @@ -1550,8 +1550,8 @@ static void keyboardHandleRepeatInfo(void* userData, if (keyboard != _glfw.wl.keyboard) return; - _glfw.wl.keyboardRepeatRate = rate; - _glfw.wl.keyboardRepeatDelay = delay; + _glfw.wl.keyRepeatRate = rate; + _glfw.wl.keyRepeatDelay = delay; } #endif From 40b5a8a37cb4770ff5d307beb660fadc64be1265 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Wed, 13 Jul 2022 12:54:24 +0200 Subject: [PATCH 081/117] Wayland: Fix reappearing key repeat If the key or character callback performs actions that indirectly updates the key repeat timer, those changes would be undone once the key callback returned. This fixes the order of operations so that key repeat is fully set up before the key related events are emitted. --- src/wl_window.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/wl_window.c b/src/wl_window.c index 87de85d9..16491cde 100644 --- a/src/wl_window.c +++ b/src/wl_window.c @@ -1466,14 +1466,11 @@ static void keyboardHandleKey(void* userData, state == WL_KEYBOARD_KEY_STATE_PRESSED ? GLFW_PRESS : GLFW_RELEASE; _glfw.wl.serial = serial; - _glfwInputKey(window, key, scancode, action, _glfw.wl.xkb.modifiers); struct itimerspec timer = {0}; if (action == GLFW_PRESS) { - inputText(window, scancode); - const xkb_keycode_t keycode = scancode + 8; if (xkb_keymap_key_repeats(_glfw.wl.xkb.keymap, keycode) && @@ -1491,6 +1488,11 @@ static void keyboardHandleKey(void* userData, } timerfd_settime(_glfw.wl.keyRepeatTimerfd, 0, &timer, NULL); + + _glfwInputKey(window, key, scancode, action, _glfw.wl.xkb.modifiers); + + if (action == GLFW_PRESS) + inputText(window, scancode); } static void keyboardHandleModifiers(void* userData, From c50d53160fa9b579dda0d0a4f9a7c2512940df8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Wed, 13 Jul 2022 21:46:14 +0200 Subject: [PATCH 082/117] Make events test window appear on Wayland --- tests/events.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/events.c b/tests/events.c index a9d4023d..60d4fc89 100644 --- a/tests/events.c +++ b/tests/events.c @@ -642,7 +642,7 @@ int main(int argc, char** argv) glfwMakeContextCurrent(slots[i].window); gladLoadGL(glfwGetProcAddress); - glfwSwapInterval(1); + glfwSwapBuffers(slots[i].window); } printf("Main loop starting\n"); From c424fe55892e7ac7c849989b9ab5e143825fdd4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Hempel?= Date: Sun, 6 Feb 2022 13:32:10 +0100 Subject: [PATCH 083/117] Linux: Fix joystick without buttons being ignored Joysticks in Linux without buttons were ignored by device enumeration. Remove the mandatory button attribute from detection. Fixes #2042 Closes #2043 --- src/linux_joystick.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/linux_joystick.c b/src/linux_joystick.c index fd5dabdf..366bda2d 100644 --- a/src/linux_joystick.c +++ b/src/linux_joystick.c @@ -157,7 +157,7 @@ static GLFWbool openJoystickDevice(const char* path) } // Ensure this device supports the events expected of a joystick - if (!isBitSet(EV_KEY, evBits) || !isBitSet(EV_ABS, evBits)) + if (!isBitSet(EV_ABS, evBits)) { close(linjs.fd); return GLFW_FALSE; From 91a96ed4343944add92bc02619319bb9ae9379fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Fri, 15 Jul 2022 15:54:35 +0200 Subject: [PATCH 084/117] Update changelog and add credit Related to #2042 Related to #2043 --- CONTRIBUTORS.md | 1 + README.md | 1 + 2 files changed, 2 insertions(+) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 2548dea2..153c38d2 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -82,6 +82,7 @@ video tutorials. - Jonathan Hale - hdf89shfdfs - Sylvain Hellegouarch + - Björn Hempel - Matthew Henry - heromyth - Lucas Hinderberger diff --git a/README.md b/README.md index 452577de..b0405480 100644 --- a/README.md +++ b/README.md @@ -374,6 +374,7 @@ information on what to include when reporting a bug. decorations - [POSIX] Removed use of deprecated function `gettimeofday` - [POSIX] Bugfix: `CLOCK_MONOTONIC` was not correctly tested for or enabled + - [Linux] Bugfix: Joysticks without buttons were ignored (#2042,#2043) - [WGL] Disabled the DWM swap interval hack for Windows 8 and later (#1072) - [NSGL] Removed enforcement of forward-compatible flag for core contexts - [NSGL] Bugfix: `GLFW_COCOA_RETINA_FRAMEBUFFER` had no effect on newer From 7cc8b053b81ecbb32c013d47b8554c0ed116c820 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Fri, 15 Jul 2022 12:50:18 +0200 Subject: [PATCH 085/117] Wayland: Clean up shared memory buffer creation --- src/wl_window.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/wl_window.c b/src/wl_window.c index 16491cde..5df692e3 100644 --- a/src/wl_window.c +++ b/src/wl_window.c @@ -142,11 +142,8 @@ static int createAnonymousFile(off_t size) static struct wl_buffer* createShmBuffer(const GLFWimage* image) { - struct wl_shm_pool* pool; - struct wl_buffer* buffer; - int stride = image->width * 4; - int length = image->width * image->height * 4; - void* data; + const int stride = image->width * 4; + const int length = image->width * image->height * 4; const int fd = createAnonymousFile(length); if (fd < 0) @@ -157,7 +154,7 @@ static struct wl_buffer* createShmBuffer(const GLFWimage* image) return NULL; } - data = mmap(NULL, length, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); + void* data = mmap(NULL, length, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); if (data == MAP_FAILED) { _glfwInputError(GLFW_PLATFORM_ERROR, @@ -166,9 +163,10 @@ static struct wl_buffer* createShmBuffer(const GLFWimage* image) return NULL; } - pool = wl_shm_create_pool(_glfw.wl.shm, fd, length); + struct wl_shm_pool* pool = wl_shm_create_pool(_glfw.wl.shm, fd, length); close(fd); + unsigned char* source = (unsigned char*) image->pixels; unsigned char* target = data; for (int i = 0; i < image->width * image->height; i++, source += 4) @@ -181,7 +179,7 @@ static struct wl_buffer* createShmBuffer(const GLFWimage* image) *target++ = (unsigned char) alpha; } - buffer = + struct wl_buffer* buffer = wl_shm_pool_create_buffer(pool, 0, image->width, image->height, From 71be34a6c30825aef502b652c86cc31fdcbb5457 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Fri, 15 Jul 2022 13:12:58 +0200 Subject: [PATCH 086/117] Wayland: Fix crash if mouse connected after init The cursor theme was only loaded if the chosen seat had a mouse (wl_pointer) during initialization. If a mouse was connected only after glfwInit, there would be no cursor theme but the rest of the cursor related code assumed one had already been loaded. This also moves the details of cursor theme loading out into a separate function to declutter platform init. Because the original cursor theme loading code checked whether we got a wl_shm, and because the rest of the code just assumes we have a wl_shm, initialization will now fail if there isn't one. Fixes #1450 --- CONTRIBUTORS.md | 1 + README.md | 1 + src/wl_init.c | 73 ++++++++++++++++++++++++++++--------------------- 3 files changed, 44 insertions(+), 31 deletions(-) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 153c38d2..673db319 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -187,6 +187,7 @@ video tutorials. - Philip Rideout - Eddie Ringle - Max Risuhin + - Joe Roback - Jorge Rodriguez - Jari Ronkainen - Luca Rood diff --git a/README.md b/README.md index b0405480..5b56b3eb 100644 --- a/README.md +++ b/README.md @@ -372,6 +372,7 @@ information on what to include when reporting a bug. wlroots compositors (#1268) - [Wayland] Bugfix: `GLFW_DECORATED` was ignored when showing a window with XDG decorations + - [Wayland] Bugfix: Connecting a mouse after `glfwInit` would segfault (#1450) - [POSIX] Removed use of deprecated function `gettimeofday` - [POSIX] Bugfix: `CLOCK_MONOTONIC` was not correctly tested for or enabled - [Linux] Bugfix: Joysticks without buttons were ignored (#2042,#2043) diff --git a/src/wl_init.c b/src/wl_init.c index 06928a04..3883b405 100644 --- a/src/wl_init.c +++ b/src/wl_init.c @@ -335,6 +335,41 @@ static void createKeyTables(void) } } +static GLFWbool loadCursorTheme(void) +{ + const char* cursorTheme; + const char* cursorSizeStr; + char* cursorSizeEnd; + long cursorSizeLong; + int cursorSize; + + cursorTheme = getenv("XCURSOR_THEME"); + cursorSizeStr = getenv("XCURSOR_SIZE"); + cursorSize = 32; + if (cursorSizeStr) + { + errno = 0; + cursorSizeLong = strtol(cursorSizeStr, &cursorSizeEnd, 10); + if (!*cursorSizeEnd && !errno && cursorSizeLong > 0 && cursorSizeLong <= INT_MAX) + cursorSize = (int)cursorSizeLong; + } + _glfw.wl.cursorTheme = + wl_cursor_theme_load(cursorTheme, cursorSize, _glfw.wl.shm); + if (!_glfw.wl.cursorTheme) + { + _glfwInputError(GLFW_PLATFORM_ERROR, + "Wayland: Failed to load default cursor theme"); + return GLFW_FALSE; + } + // If this happens to be NULL, we just fallback to the scale=1 version. + _glfw.wl.cursorThemeHiDPI = + wl_cursor_theme_load(cursorTheme, 2 * cursorSize, _glfw.wl.shm); + _glfw.wl.cursorSurface = + wl_compositor_create_surface(_glfw.wl.compositor); + _glfw.wl.cursorTimerfd = timerfd_create(CLOCK_MONOTONIC, TFD_CLOEXEC | TFD_NONBLOCK); + return GLFW_TRUE; +} + ////////////////////////////////////////////////////////////////////////// ////// GLFW platform API ////// @@ -471,12 +506,6 @@ GLFWbool _glfwConnectWayland(int platformID, _GLFWplatform* platform) int _glfwInitWayland(void) { - const char* cursorTheme; - const char* cursorSizeStr; - char* cursorSizeEnd; - long cursorSizeLong; - int cursorSize; - // These must be set before any failure checks _glfw.wl.keyRepeatTimerfd = -1; _glfw.wl.cursorTimerfd = -1; @@ -652,34 +681,16 @@ int _glfwInitWayland(void) return GLFW_FALSE; } - if (_glfw.wl.pointer && _glfw.wl.shm) + if (!_glfw.wl.shm) { - cursorTheme = getenv("XCURSOR_THEME"); - cursorSizeStr = getenv("XCURSOR_SIZE"); - cursorSize = 32; - if (cursorSizeStr) - { - errno = 0; - cursorSizeLong = strtol(cursorSizeStr, &cursorSizeEnd, 10); - if (!*cursorSizeEnd && !errno && cursorSizeLong > 0 && cursorSizeLong <= INT_MAX) - cursorSize = (int)cursorSizeLong; - } - _glfw.wl.cursorTheme = - wl_cursor_theme_load(cursorTheme, cursorSize, _glfw.wl.shm); - if (!_glfw.wl.cursorTheme) - { - _glfwInputError(GLFW_PLATFORM_ERROR, - "Wayland: Failed to load default cursor theme"); - return GLFW_FALSE; - } - // If this happens to be NULL, we just fallback to the scale=1 version. - _glfw.wl.cursorThemeHiDPI = - wl_cursor_theme_load(cursorTheme, 2 * cursorSize, _glfw.wl.shm); - _glfw.wl.cursorSurface = - wl_compositor_create_surface(_glfw.wl.compositor); - _glfw.wl.cursorTimerfd = timerfd_create(CLOCK_MONOTONIC, TFD_CLOEXEC | TFD_NONBLOCK); + _glfwInputError(GLFW_PLATFORM_ERROR, + "Wayland: Failed to find wl_shm in your compositor"); + return GLFW_FALSE; } + if (!loadCursorTheme()) + return GLFW_FALSE; + if (_glfw.wl.seat && _glfw.wl.dataDeviceManager) { _glfw.wl.dataDevice = From 6987294df91d9b9be03a796174863cb9d1a06d62 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Fri, 15 Jul 2022 13:30:14 +0200 Subject: [PATCH 087/117] Wayland: Clean up cursor theme loading --- src/wl_init.c | 31 ++++++++++++++----------------- 1 file changed, 14 insertions(+), 17 deletions(-) diff --git a/src/wl_init.c b/src/wl_init.c index 3883b405..8cbcc6e8 100644 --- a/src/wl_init.c +++ b/src/wl_init.c @@ -337,35 +337,32 @@ static void createKeyTables(void) static GLFWbool loadCursorTheme(void) { - const char* cursorTheme; - const char* cursorSizeStr; - char* cursorSizeEnd; - long cursorSizeLong; - int cursorSize; + int cursorSize = 32; - cursorTheme = getenv("XCURSOR_THEME"); - cursorSizeStr = getenv("XCURSOR_SIZE"); - cursorSize = 32; - if (cursorSizeStr) + const char* sizeString = getenv("XCURSOR_SIZE"); + if (sizeString) { errno = 0; - cursorSizeLong = strtol(cursorSizeStr, &cursorSizeEnd, 10); - if (!*cursorSizeEnd && !errno && cursorSizeLong > 0 && cursorSizeLong <= INT_MAX) - cursorSize = (int)cursorSizeLong; + const long cursorSizeLong = strtol(sizeString, NULL, 10); + if (errno == 0 && cursorSizeLong > 0 && cursorSizeLong < INT_MAX) + cursorSize = (int) cursorSizeLong; } - _glfw.wl.cursorTheme = - wl_cursor_theme_load(cursorTheme, cursorSize, _glfw.wl.shm); + + const char* themeName = getenv("XCURSOR_THEME"); + + _glfw.wl.cursorTheme = wl_cursor_theme_load(themeName, cursorSize, _glfw.wl.shm); if (!_glfw.wl.cursorTheme) { _glfwInputError(GLFW_PLATFORM_ERROR, "Wayland: Failed to load default cursor theme"); return GLFW_FALSE; } + // If this happens to be NULL, we just fallback to the scale=1 version. _glfw.wl.cursorThemeHiDPI = - wl_cursor_theme_load(cursorTheme, 2 * cursorSize, _glfw.wl.shm); - _glfw.wl.cursorSurface = - wl_compositor_create_surface(_glfw.wl.compositor); + wl_cursor_theme_load(themeName, cursorSize * 2, _glfw.wl.shm); + + _glfw.wl.cursorSurface = wl_compositor_create_surface(_glfw.wl.compositor); _glfw.wl.cursorTimerfd = timerfd_create(CLOCK_MONOTONIC, TFD_CLOEXEC | TFD_NONBLOCK); return GLFW_TRUE; } From 26b85215c07a32f860326bf02ef68f31c5e30837 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Thu, 14 Jul 2022 11:52:55 +0200 Subject: [PATCH 088/117] Wayland: Static function more static when static --- src/wl_window.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wl_window.c b/src/wl_window.c index 5df692e3..ef935d33 100644 --- a/src/wl_window.c +++ b/src/wl_window.c @@ -847,7 +847,7 @@ static xkb_keysym_t composeSymbol(xkb_keysym_t sym) } } -void inputText(_GLFWwindow* window, uint32_t scancode) +static void inputText(_GLFWwindow* window, uint32_t scancode) { const xkb_keysym_t* keysyms; const xkb_keycode_t keycode = scancode + 8; From b9ed25d2e991944acb51dedc63f3fe68e24c02c9 Mon Sep 17 00:00:00 2001 From: Michael Pennington Date: Thu, 26 May 2022 20:33:28 -0400 Subject: [PATCH 089/117] Wayland: Add GLFW_WAYLAND_APP_ID window hint This adds a window hint string for the xdg_toplevel::app_id, which is used by desktop environments to connect windows with application icons and other information. This is similar to the WM_CLASS property on X11. A few very minor fixes were done by @elmindreda during merge. Fixes #2121 Closes #2122 --- CONTRIBUTORS.md | 1 + README.md | 2 ++ docs/news.dox | 6 ++++++ docs/window.dox | 8 ++++++++ include/GLFW/glfw3.h | 6 ++++++ src/internal.h | 3 +++ src/window.c | 4 ++++ src/wl_platform.h | 1 + src/wl_window.c | 5 +++++ 9 files changed, 36 insertions(+) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 673db319..9c4964c0 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -166,6 +166,7 @@ video tutorials. - Peoro - Braden Pellett - Christopher Pelloux + - Michael Pennington - Arturo J. Pérez - Vladimir Perminov - Olivier Perret diff --git a/README.md b/README.md index 5b56b3eb..66af82e5 100644 --- a/README.md +++ b/README.md @@ -142,6 +142,8 @@ information on what to include when reporting a bug. - Added `GLFW_PLATFORM_UNAVAILABLE` error for platform detection failures (#1958) - Added `GLFW_FEATURE_UNAVAILABLE` error for platform limitations (#1692) - Added `GLFW_FEATURE_UNIMPLEMENTED` error for incomplete backends (#1692) + - Added `GLFW_WAYLAND_APP_ID` window hint string for Wayland app\_id selection + (#2121,#2122) - Added `GLFW_ANGLE_PLATFORM_TYPE` init hint and `GLFW_ANGLE_PLATFORM_TYPE_*` values to select ANGLE backend (#1380) - Added `GLFW_X11_XCB_VULKAN_SURFACE` init hint for selecting X11 Vulkan diff --git a/docs/news.dox b/docs/news.dox index fbf60319..98daa3a2 100644 --- a/docs/news.dox +++ b/docs/news.dox @@ -43,6 +43,12 @@ to whatever window is behind it. This can also be changed after window creation with the matching [window attribute](@ref GLFW_MOUSE_PASSTHROUGH_attrib). +@subsubsection wayland_app_id_34 Wayland app_id specification + +GLFW now supports specifying the app_id for a Wayland window using the +[GLFW_WAYLAND_APP_ID](@ref GLFW_WAYLAND_APP_ID_hint) window hint string. + + @subsubsection features_34_angle_backend Support for ANGLE rendering backend selection GLFW now provides the diff --git a/docs/window.dox b/docs/window.dox index 32271e3a..451aca73 100644 --- a/docs/window.dox +++ b/docs/window.dox @@ -492,6 +492,13 @@ __GLFW_X11_CLASS_NAME__ and __GLFW_X11_INSTANCE_NAME__ specifies the desired ASCII encoded class and instance parts of the ICCCM `WM_CLASS` window property. These are set with @ref glfwWindowHintString. +@subsubsection window_hints_wayland Wayland specific window hints + +@anchor GLFW_WAYLAND_APP_ID_hint +__GLFW_WAYLAND_APP_ID__ specifies the Wayland app_id for a window, used +by window managers to identify types of windows. This is set with +@ref glfwWindowHintString. + @subsubsection window_hints_values Supported and default values @@ -540,6 +547,7 @@ GLFW_COCOA_FRAME_NAME | `""` | A UTF-8 encoded fr GLFW_COCOA_GRAPHICS_SWITCHING | `GLFW_FALSE` | `GLFW_TRUE` or `GLFW_FALSE` GLFW_X11_CLASS_NAME | `""` | An ASCII encoded `WM_CLASS` class name GLFW_X11_INSTANCE_NAME | `""` | An ASCII encoded `WM_CLASS` instance name +GLFW_WAYLAND_APP_ID | `""` | An ASCII encoded Wayland `app_id` name @section window_events Window event processing diff --git a/include/GLFW/glfw3.h b/include/GLFW/glfw3.h index aa6ddc33..8f481790 100644 --- a/include/GLFW/glfw3.h +++ b/include/GLFW/glfw3.h @@ -1105,6 +1105,12 @@ extern "C" { */ #define GLFW_X11_INSTANCE_NAME 0x00024002 #define GLFW_WIN32_KEYBOARD_MENU 0x00025001 +/*! @brief Wayland specific + * [window hint](@ref GLFW_WAYLAND_APP_ID_hint). + * + * Allows specification of the Wayland app_id. + */ +#define GLFW_WAYLAND_APP_ID 0x00026001 /*! @} */ #define GLFW_NO_API 0 diff --git a/src/internal.h b/src/internal.h index 89a18628..8d576d1d 100644 --- a/src/internal.h +++ b/src/internal.h @@ -421,6 +421,9 @@ struct _GLFWwndconfig struct { GLFWbool keymenu; } win32; + struct { + char appId[256]; + } wl; }; // Context configuration diff --git a/src/window.c b/src/window.c index ebbc6dca..f740580a 100644 --- a/src/window.c +++ b/src/window.c @@ -447,6 +447,10 @@ GLFWAPI void glfwWindowHintString(int hint, const char* value) strncpy(_glfw.hints.window.x11.instanceName, value, sizeof(_glfw.hints.window.x11.instanceName) - 1); return; + case GLFW_WAYLAND_APP_ID: + strncpy(_glfw.hints.window.wl.appId, value, + sizeof(_glfw.hints.window.wl.appId) - 1); + return; } _glfwInputError(GLFW_INVALID_ENUM, "Invalid window hint string 0x%08X", hint); diff --git a/src/wl_platform.h b/src/wl_platform.h index f65bcb11..73639de1 100644 --- a/src/wl_platform.h +++ b/src/wl_platform.h @@ -258,6 +258,7 @@ typedef struct _GLFWwindowWayland double cursorPosX, cursorPosY; char* title; + char* appId; // We need to track the monitors the window spans on to calculate the // optimal scaling factor. diff --git a/src/wl_window.c b/src/wl_window.c index ef935d33..900c877d 100644 --- a/src/wl_window.c +++ b/src/wl_window.c @@ -614,6 +614,9 @@ static GLFWbool createShellObjects(_GLFWwindow* window) xdg_toplevel_add_listener(window->wl.xdg.toplevel, &xdgToplevelListener, window); + if (window->wl.appId) + xdg_toplevel_set_app_id(window->wl.xdg.toplevel, window->wl.appId); + if (window->wl.title) xdg_toplevel_set_title(window->wl.xdg.toplevel, window->wl.title); @@ -728,6 +731,7 @@ static GLFWbool createNativeSurface(_GLFWwindow* window, window->wl.height = wndconfig->height; window->wl.scale = 1; window->wl.title = _glfw_strdup(wndconfig->title); + window->wl.appId = _glfw_strdup(wndconfig->wl.appId); window->wl.maximized = wndconfig->maximized; @@ -1865,6 +1869,7 @@ void _glfwDestroyWindowWayland(_GLFWwindow* window) wl_surface_destroy(window->wl.surface); _glfw_free(window->wl.title); + _glfw_free(window->wl.appId); _glfw_free(window->wl.monitors); } From e85b645b8adbbc565c9e9fccbf474705f453d1c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Sun, 24 Jul 2022 22:27:22 +0200 Subject: [PATCH 090/117] Wayland: Clean up pointer locking Shorten names and allow C99 declarations. Replace helper function with the NULL check it was hiding. Separate cursor hiding from pointer locking. --- src/wl_platform.h | 6 ++-- src/wl_window.c | 88 +++++++++++++++++++---------------------------- 2 files changed, 37 insertions(+), 57 deletions(-) diff --git a/src/wl_platform.h b/src/wl_platform.h index 73639de1..f2bf8f03 100644 --- a/src/wl_platform.h +++ b/src/wl_platform.h @@ -267,10 +267,8 @@ typedef struct _GLFWwindowWayland int monitorsCount; int monitorsSize; - struct { - struct zwp_relative_pointer_v1* relativePointer; - struct zwp_locked_pointer_v1* lockedPointer; - } pointerLock; + struct zwp_relative_pointer_v1* relativePointer; + struct zwp_locked_pointer_v1* lockedPointer; struct zwp_idle_inhibitor_v1* idleInhibitor; diff --git a/src/wl_window.c b/src/wl_window.c index 900c877d..c25edf71 100644 --- a/src/wl_window.c +++ b/src/wl_window.c @@ -2241,15 +2241,14 @@ void _glfwGetCursorPosWayland(_GLFWwindow* window, double* xpos, double* ypos) *ypos = window->wl.cursorPosY; } -static GLFWbool isPointerLocked(_GLFWwindow* window); - void _glfwSetCursorPosWayland(_GLFWwindow* window, double x, double y) { - if (isPointerLocked(window)) + if (window->wl.lockedPointer) { zwp_locked_pointer_v1_set_cursor_position_hint( - window->wl.pointerLock.lockedPointer, - wl_fixed_from_double(x), wl_fixed_from_double(y)); + window->wl.lockedPointer, + wl_fixed_from_double(x), + wl_fixed_from_double(y)); } } @@ -2486,20 +2485,13 @@ static void lockedPointerHandleLocked(void* userData, static void unlockPointer(_GLFWwindow* window) { - struct zwp_relative_pointer_v1* relativePointer = - window->wl.pointerLock.relativePointer; - struct zwp_locked_pointer_v1* lockedPointer = - window->wl.pointerLock.lockedPointer; + zwp_relative_pointer_v1_destroy(window->wl.relativePointer); + window->wl.relativePointer = NULL; - zwp_relative_pointer_v1_destroy(relativePointer); - zwp_locked_pointer_v1_destroy(lockedPointer); - - window->wl.pointerLock.relativePointer = NULL; - window->wl.pointerLock.lockedPointer = NULL; + zwp_locked_pointer_v1_destroy(window->wl.lockedPointer); + window->wl.lockedPointer = NULL; } -static void lockPointer(_GLFWwindow* window); - static void lockedPointerHandleUnlocked(void* userData, struct zwp_locked_pointer_v1* lockedPointer) { @@ -2513,9 +2505,6 @@ static const struct zwp_locked_pointer_v1_listener lockedPointerListener = static void lockPointer(_GLFWwindow* window) { - struct zwp_relative_pointer_v1* relativePointer; - struct zwp_locked_pointer_v1* lockedPointer; - if (!_glfw.wl.relativePointerManager) { _glfwInputError(GLFW_PLATFORM_ERROR, @@ -2523,42 +2512,28 @@ static void lockPointer(_GLFWwindow* window) return; } - relativePointer = + window->wl.relativePointer = zwp_relative_pointer_manager_v1_get_relative_pointer( _glfw.wl.relativePointerManager, _glfw.wl.pointer); - zwp_relative_pointer_v1_add_listener(relativePointer, + zwp_relative_pointer_v1_add_listener(window->wl.relativePointer, &relativePointerListener, window); - lockedPointer = + window->wl.lockedPointer = zwp_pointer_constraints_v1_lock_pointer( _glfw.wl.pointerConstraints, window->wl.surface, _glfw.wl.pointer, NULL, ZWP_POINTER_CONSTRAINTS_V1_LIFETIME_PERSISTENT); - zwp_locked_pointer_v1_add_listener(lockedPointer, + zwp_locked_pointer_v1_add_listener(window->wl.lockedPointer, &lockedPointerListener, window); - - window->wl.pointerLock.relativePointer = relativePointer; - window->wl.pointerLock.lockedPointer = lockedPointer; - - wl_pointer_set_cursor(_glfw.wl.pointer, _glfw.wl.pointerEnterSerial, - NULL, 0, 0); -} - -static GLFWbool isPointerLocked(_GLFWwindow* window) -{ - return window->wl.pointerLock.lockedPointer != NULL; } void _glfwSetCursorWayland(_GLFWwindow* window, _GLFWcursor* cursor) { - struct wl_cursor* defaultCursor; - struct wl_cursor* defaultCursorHiDPI = NULL; - if (!_glfw.wl.pointer) return; @@ -2569,9 +2544,17 @@ void _glfwSetCursorWayland(_GLFWwindow* window, _GLFWcursor* cursor) if (window != _glfw.wl.pointerFocus || window->wl.decorations.focus != mainWindow) return; - // Unlock possible pointer lock if no longer disabled. - if (window->cursorMode != GLFW_CURSOR_DISABLED && isPointerLocked(window)) - unlockPointer(window); + // Update pointer lock to match cursor mode + if (window->cursorMode == GLFW_CURSOR_DISABLED) + { + if (!window->wl.lockedPointer) + lockPointer(window); + } + else + { + if (window->wl.lockedPointer) + unlockPointer(window); + } if (window->cursorMode == GLFW_CURSOR_NORMAL) { @@ -2579,19 +2562,24 @@ void _glfwSetCursorWayland(_GLFWwindow* window, _GLFWcursor* cursor) setCursorImage(window, &cursor->wl); else { - defaultCursor = wl_cursor_theme_get_cursor(_glfw.wl.cursorTheme, - "left_ptr"); + struct wl_cursor* defaultCursor = + wl_cursor_theme_get_cursor(_glfw.wl.cursorTheme, "left_ptr"); if (!defaultCursor) { _glfwInputError(GLFW_PLATFORM_ERROR, "Wayland: Standard cursor not found"); return; } + + struct wl_cursor* defaultCursorHiDPI = NULL; if (_glfw.wl.cursorThemeHiDPI) + { defaultCursorHiDPI = - wl_cursor_theme_get_cursor(_glfw.wl.cursorThemeHiDPI, - "left_ptr"); - _GLFWcursorWayland cursorWayland = { + wl_cursor_theme_get_cursor(_glfw.wl.cursorThemeHiDPI, "left_ptr"); + } + + _GLFWcursorWayland cursorWayland = + { defaultCursor, defaultCursorHiDPI, NULL, @@ -2599,18 +2587,12 @@ void _glfwSetCursorWayland(_GLFWwindow* window, _GLFWcursor* cursor) 0, 0, 0 }; + setCursorImage(window, &cursorWayland); } } - else if (window->cursorMode == GLFW_CURSOR_DISABLED) - { - if (!isPointerLocked(window)) - lockPointer(window); - } - else if (window->cursorMode == GLFW_CURSOR_HIDDEN) - { + else wl_pointer_set_cursor(_glfw.wl.pointer, _glfw.wl.pointerEnterSerial, NULL, 0, 0); - } } static void dataSourceHandleTarget(void* userData, From 09ebf3f0bfe5a5e819fd51f0995ca928b27185bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Sun, 24 Jul 2022 22:28:32 +0200 Subject: [PATCH 091/117] Wayland: Fix error for missing protocol A protocol not being available is not a platform error. The platform is doing fine; we're just sad that it lacks a feature we want. --- src/wl_window.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/wl_window.c b/src/wl_window.c index c25edf71..27203e76 100644 --- a/src/wl_window.c +++ b/src/wl_window.c @@ -2507,8 +2507,8 @@ static void lockPointer(_GLFWwindow* window) { if (!_glfw.wl.relativePointerManager) { - _glfwInputError(GLFW_PLATFORM_ERROR, - "Wayland: no relative pointer manager"); + _glfwInputError(GLFW_FEATURE_UNAVAILABLE, + "Wayland: The compositor does not support pointer locking"); return; } From 03af6b3d4c2dbd763fbf32927c44fe6fd517991c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Mon, 25 Jul 2022 17:40:22 +0200 Subject: [PATCH 092/117] Wayland: Fix leaks of pointer related objects --- src/wl_window.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/wl_window.c b/src/wl_window.c index 27203e76..ef346655 100644 --- a/src/wl_window.c +++ b/src/wl_window.c @@ -1854,6 +1854,12 @@ void _glfwDestroyWindowWayland(_GLFWwindow* window) if (window->wl.idleInhibitor) zwp_idle_inhibitor_v1_destroy(window->wl.idleInhibitor); + if (window->wl.relativePointer) + zwp_relative_pointer_v1_destroy(window->wl.relativePointer); + + if (window->wl.lockedPointer) + zwp_locked_pointer_v1_destroy(window->wl.lockedPointer); + if (window->context.destroy) window->context.destroy(window); From a46f829de8d90d6932a696fd397479042ec1071d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Mon, 8 Jul 2019 14:45:31 +0200 Subject: [PATCH 093/117] Refactor cursor mode paths This is the refactoring part of adding GLFW_CURSOR_CAPTURED, separated out to help keep 3.3-stable similar to the main branch. Related to #58. --- src/win32_platform.h | 2 ++ src/win32_window.c | 83 +++++++++++++++++++++++++++++++------------- src/wl_window.c | 8 +++-- src/x11_window.c | 70 ++++++++++++++++++++++++++++--------- 4 files changed, 120 insertions(+), 43 deletions(-) diff --git a/src/win32_platform.h b/src/win32_platform.h index c2158943..82b34bb9 100644 --- a/src/win32_platform.h +++ b/src/win32_platform.h @@ -452,6 +452,8 @@ typedef struct _GLFWlibraryWin32 double restoreCursorPosX, restoreCursorPosY; // The window whose disabled cursor mode is active _GLFWwindow* disabledCursorWindow; + // The window the cursor is captured in + _GLFWwindow* capturedCursorWindow; RAWINPUT* rawInput; int rawInputSize; UINT mouseTrailSize; diff --git a/src/win32_window.c b/src/win32_window.c index 168529e2..4cf25640 100644 --- a/src/win32_window.c +++ b/src/win32_window.c @@ -249,20 +249,24 @@ static void updateCursorImage(_GLFWwindow* window) SetCursor(NULL); } -// Updates the cursor clip rect +// Sets the cursor clip rect to the window content area // -static void updateClipRect(_GLFWwindow* window) +static void captureCursor(_GLFWwindow* window) { - if (window) - { - RECT clipRect; - GetClientRect(window->win32.handle, &clipRect); - ClientToScreen(window->win32.handle, (POINT*) &clipRect.left); - ClientToScreen(window->win32.handle, (POINT*) &clipRect.right); - ClipCursor(&clipRect); - } - else - ClipCursor(NULL); + RECT clipRect; + GetClientRect(window->win32.handle, &clipRect); + ClientToScreen(window->win32.handle, (POINT*) &clipRect.left); + ClientToScreen(window->win32.handle, (POINT*) &clipRect.right); + ClipCursor(&clipRect); + _glfw.win32.capturedCursorWindow = window; +} + +// Disabled clip cursor +// +static void releaseCursor(void) +{ + ClipCursor(NULL); + _glfw.win32.capturedCursorWindow = NULL; } // Enables WM_INPUT messages for the mouse for the specified window @@ -301,7 +305,7 @@ static void disableCursor(_GLFWwindow* window) &_glfw.win32.restoreCursorPosY); updateCursorImage(window); _glfwCenterCursorInContentArea(window); - updateClipRect(window); + captureCursor(window); if (window->rawMouseMotion) enableRawMouseMotion(window); @@ -315,7 +319,7 @@ static void enableCursor(_GLFWwindow* window) disableRawMouseMotion(window); _glfw.win32.disabledCursorWindow = NULL; - updateClipRect(NULL); + releaseCursor(); _glfwSetCursorPosWin32(window, _glfw.win32.restoreCursorPosX, _glfw.win32.restoreCursorPosY); @@ -1004,8 +1008,8 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM l (window->win32.maximized && wParam != SIZE_RESTORED); - if (_glfw.win32.disabledCursorWindow == window) - updateClipRect(window); + if (_glfw.win32.capturedCursorWindow == window) + captureCursor(window); if (window->win32.iconified != iconified) _glfwInputWindowIconify(window, iconified); @@ -1040,8 +1044,8 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM l case WM_MOVE: { - if (_glfw.win32.disabledCursorWindow == window) - updateClipRect(window); + if (_glfw.win32.capturedCursorWindow == window) + captureCursor(window); // NOTE: This cannot use LOWORD/HIWORD recommended by MSDN, as // those macros do not handle negative window positions correctly @@ -1495,7 +1499,10 @@ void _glfwDestroyWindowWin32(_GLFWwindow* window) window->context.destroy(window); if (_glfw.win32.disabledCursorWindow == window) - _glfw.win32.disabledCursorWindow = NULL; + enableCursor(window); + + if (_glfw.win32.capturedCursorWindow == window) + releaseCursor(); if (window->win32.handle) { @@ -2142,14 +2149,40 @@ void _glfwSetCursorPosWin32(_GLFWwindow* window, double xpos, double ypos) void _glfwSetCursorModeWin32(_GLFWwindow* window, int mode) { - if (mode == GLFW_CURSOR_DISABLED) + if (_glfwWindowFocusedWin32(window)) { - if (_glfwWindowFocusedWin32(window)) - disableCursor(window); + if (mode == GLFW_CURSOR_DISABLED) + { + _glfwGetCursorPosWin32(window, + &_glfw.win32.restoreCursorPosX, + &_glfw.win32.restoreCursorPosY); + _glfwCenterCursorInContentArea(window); + if (window->rawMouseMotion) + enableRawMouseMotion(window); + } + else if (_glfw.win32.disabledCursorWindow == window) + { + if (window->rawMouseMotion) + disableRawMouseMotion(window); + } + + if (mode == GLFW_CURSOR_DISABLED) + captureCursor(window); + else + releaseCursor(); + + if (mode == GLFW_CURSOR_DISABLED) + _glfw.win32.disabledCursorWindow = window; + else if (_glfw.win32.disabledCursorWindow == window) + { + _glfw.win32.disabledCursorWindow = NULL; + _glfwSetCursorPosWin32(window, + _glfw.win32.restoreCursorPosX, + _glfw.win32.restoreCursorPosY); + } } - else if (_glfw.win32.disabledCursorWindow == window) - enableCursor(window); - else if (cursorInContentArea(window)) + + if (cursorInContentArea(window)) updateCursorImage(window); } diff --git a/src/wl_window.c b/src/wl_window.c index ef346655..b4b49b94 100644 --- a/src/wl_window.c +++ b/src/wl_window.c @@ -2556,7 +2556,8 @@ void _glfwSetCursorWayland(_GLFWwindow* window, _GLFWcursor* cursor) if (!window->wl.lockedPointer) lockPointer(window); } - else + else if (window->cursorMode == GLFW_CURSOR_NORMAL || + window->cursorMode == GLFW_CURSOR_HIDDEN) { if (window->wl.lockedPointer) unlockPointer(window); @@ -2597,8 +2598,11 @@ void _glfwSetCursorWayland(_GLFWwindow* window, _GLFWcursor* cursor) setCursorImage(window, &cursorWayland); } } - else + else if (window->cursorMode == GLFW_CURSOR_HIDDEN || + window->cursorMode == GLFW_CURSOR_DISABLED) + { wl_pointer_set_cursor(_glfw.wl.pointer, _glfw.wl.pointerEnterSerial, NULL, 0, 0); + } } static void dataSourceHandleTarget(void* userData, diff --git a/src/x11_window.c b/src/x11_window.c index 98f990b2..f323db6c 100644 --- a/src/x11_window.c +++ b/src/x11_window.c @@ -470,6 +470,25 @@ static void updateCursorImage(_GLFWwindow* window) } } +// Grabs the cursor and confines it to the window +// +static void captureCursor(_GLFWwindow* window) +{ + XGrabPointer(_glfw.x11.display, window->x11.handle, True, + ButtonPressMask | ButtonReleaseMask | PointerMotionMask, + GrabModeAsync, GrabModeAsync, + window->x11.handle, + None, + CurrentTime); +} + +// Ungrabs the cursor +// +static void releaseCursor(void) +{ + XUngrabPointer(_glfw.x11.display, CurrentTime); +} + // Enable XI2 raw mouse motion events // static void enableRawMouseMotion(_GLFWwindow* window) @@ -512,12 +531,7 @@ static void disableCursor(_GLFWwindow* window) &_glfw.x11.restoreCursorPosY); updateCursorImage(window); _glfwCenterCursorInContentArea(window); - XGrabPointer(_glfw.x11.display, window->x11.handle, True, - ButtonPressMask | ButtonReleaseMask | PointerMotionMask, - GrabModeAsync, GrabModeAsync, - window->x11.handle, - _glfw.x11.hiddenCursorHandle, - CurrentTime); + captureCursor(window); } // Exit disabled cursor mode for the specified window @@ -528,7 +542,7 @@ static void enableCursor(_GLFWwindow* window) disableRawMouseMotion(window); _glfw.x11.disabledCursorWindow = NULL; - XUngrabPointer(_glfw.x11.display, CurrentTime); + releaseCursor(); _glfwSetCursorPosX11(window, _glfw.x11.restoreCursorPosX, _glfw.x11.restoreCursorPosY); @@ -1986,7 +2000,7 @@ GLFWbool _glfwCreateWindowX11(_GLFWwindow* window, void _glfwDestroyWindowX11(_GLFWwindow* window) { if (_glfw.x11.disabledCursorWindow == window) - _glfw.x11.disabledCursorWindow = NULL; + enableCursor(window); if (window->monitor) releaseMonitor(window); @@ -2800,16 +2814,40 @@ void _glfwSetCursorPosX11(_GLFWwindow* window, double x, double y) void _glfwSetCursorModeX11(_GLFWwindow* window, int mode) { - if (mode == GLFW_CURSOR_DISABLED) + if (_glfwWindowFocusedX11(window)) { - if (_glfwWindowFocusedX11(window)) - disableCursor(window); - } - else if (_glfw.x11.disabledCursorWindow == window) - enableCursor(window); - else - updateCursorImage(window); + if (mode == GLFW_CURSOR_DISABLED) + { + _glfwGetCursorPosX11(window, + &_glfw.x11.restoreCursorPosX, + &_glfw.x11.restoreCursorPosY); + _glfwCenterCursorInContentArea(window); + if (window->rawMouseMotion) + enableRawMouseMotion(window); + } + else if (_glfw.x11.disabledCursorWindow == window) + { + if (window->rawMouseMotion) + disableRawMouseMotion(window); + } + if (mode == GLFW_CURSOR_DISABLED) + captureCursor(window); + else + releaseCursor(); + + if (mode == GLFW_CURSOR_DISABLED) + _glfw.x11.disabledCursorWindow = window; + else if (_glfw.x11.disabledCursorWindow == window) + { + _glfw.x11.disabledCursorWindow = NULL; + _glfwSetCursorPosX11(window, + _glfw.x11.restoreCursorPosX, + _glfw.x11.restoreCursorPosY); + } + } + + updateCursorImage(window); XFlush(_glfw.x11.display); } From 488008e0a22d10c337ef6e910b57a52cecb6bb46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Tue, 3 Dec 2019 17:58:20 +0100 Subject: [PATCH 094/117] Add cursor mode GLFW_CURSOR_CAPTURED This adds a cursor mode that provides a visible cursor confined to the content area of the window. Fixes #58 --- README.md | 2 ++ docs/input.dox | 12 ++++++++++ docs/news.dox | 9 ++++++++ include/GLFW/glfw3.h | 3 +++ src/cocoa_window.m | 8 +++++++ src/input.c | 3 ++- src/win32_window.c | 15 ++++++++++-- src/wl_platform.h | 1 + src/wl_window.c | 54 +++++++++++++++++++++++++++++++++++++++++++- src/x11_window.c | 12 +++++++--- tests/cursor.c | 8 ++++++- 11 files changed, 119 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 66af82e5..c84f8cb5 100644 --- a/README.md +++ b/README.md @@ -139,6 +139,8 @@ information on what to include when reporting a bug. - Added `GLFW_POINTING_HAND_CURSOR` alias for `GLFW_HAND_CURSOR` (#427) - Added `GLFW_MOUSE_PASSTHROUGH` window hint for letting mouse input pass through the window (#1236,#1568) + - Added `GLFW_CURSOR_CAPTURED` cursor mode to confine the cursor to the window + content area (#58) - Added `GLFW_PLATFORM_UNAVAILABLE` error for platform detection failures (#1958) - Added `GLFW_FEATURE_UNAVAILABLE` error for platform limitations (#1692) - Added `GLFW_FEATURE_UNIMPLEMENTED` error for incomplete backends (#1692) diff --git a/docs/input.dox b/docs/input.dox index 41508e7b..dfb06a43 100644 --- a/docs/input.dox +++ b/docs/input.dox @@ -312,6 +312,16 @@ glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_HIDDEN); This mode puts no limit on the motion of the cursor. +If you wish the cursor to be visible but confined to the content area of the +window, set the cursor mode to `GLFW_CURSOR_CAPTURED`. + +@code +glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_CAPTURED); +@endcode + +The cursor will behave normally inside the content area but will not be able to +leave unless the window loses focus. + To exit out of either of these special modes, restore the `GLFW_CURSOR_NORMAL` cursor mode. @@ -319,6 +329,8 @@ cursor mode. glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_NORMAL); @endcode +If the cursor was disabled, this will move it back to its last visible position. + @anchor GLFW_RAW_MOUSE_MOTION @subsection raw_mouse_motion Raw mouse motion diff --git a/docs/news.dox b/docs/news.dox index 98daa3a2..1ff534b8 100644 --- a/docs/news.dox +++ b/docs/news.dox @@ -58,6 +58,14 @@ requesting a specific rendering backend when using contexts. +@subsubsection captured_cursor_34 Captured cursor mode + +GLFW now supports confining the cursor to the window content area with the @ref +GLFW_CURSOR_CAPTURED cursor mode. + +For more information see @ref cursor_mode. + + @subsubsection features_34_init_allocator Support for custom memory allocator GLFW now supports plugging a custom memory allocator at initialization with @ref @@ -234,6 +242,7 @@ then GLFW will fail to initialize. - @ref GLFW_ANGLE_PLATFORM_TYPE_VULKAN - @ref GLFW_ANGLE_PLATFORM_TYPE_METAL - @ref GLFW_X11_XCB_VULKAN_SURFACE + - @ref GLFW_CURSOR_CAPTURED @section news_archive Release notes for earlier versions diff --git a/include/GLFW/glfw3.h b/include/GLFW/glfw3.h index 8f481790..8a43134c 100644 --- a/include/GLFW/glfw3.h +++ b/include/GLFW/glfw3.h @@ -1134,6 +1134,7 @@ extern "C" { #define GLFW_CURSOR_NORMAL 0x00034001 #define GLFW_CURSOR_HIDDEN 0x00034002 #define GLFW_CURSOR_DISABLED 0x00034003 +#define GLFW_CURSOR_CAPTURED 0x00034004 #define GLFW_ANY_RELEASE_BEHAVIOR 0 #define GLFW_RELEASE_BEHAVIOR_FLUSH 0x00035001 @@ -4566,6 +4567,8 @@ GLFWAPI int glfwGetInputMode(GLFWwindow* window, int mode); * - `GLFW_CURSOR_DISABLED` hides and grabs the cursor, providing virtual * and unlimited cursor movement. This is useful for implementing for * example 3D camera controls. + * - `GLFW_CURSOR_CAPTURED` makes the cursor visible and confines it to the + * content area of the window. * * If the mode is `GLFW_STICKY_KEYS`, the value must be either `GLFW_TRUE` to * enable sticky keys, or `GLFW_FALSE` to disable it. If sticky keys are diff --git a/src/cocoa_window.m b/src/cocoa_window.m index 5bb1289b..42782280 100644 --- a/src/cocoa_window.m +++ b/src/cocoa_window.m @@ -1619,8 +1619,16 @@ void _glfwSetCursorPosCocoa(_GLFWwindow* window, double x, double y) void _glfwSetCursorModeCocoa(_GLFWwindow* window, int mode) { @autoreleasepool { + + if (mode == GLFW_CURSOR_CAPTURED) + { + _glfwInputError(GLFW_FEATURE_UNIMPLEMENTED, + "Cocoa: Captured cursor mode not yet implemented"); + } + if (_glfwWindowFocusedCocoa(window)) updateCursorMode(window); + } // autoreleasepool } diff --git a/src/input.c b/src/input.c index c2a7a86d..36128e10 100644 --- a/src/input.c +++ b/src/input.c @@ -596,7 +596,8 @@ GLFWAPI void glfwSetInputMode(GLFWwindow* handle, int mode, int value) { if (value != GLFW_CURSOR_NORMAL && value != GLFW_CURSOR_HIDDEN && - value != GLFW_CURSOR_DISABLED) + value != GLFW_CURSOR_DISABLED && + value != GLFW_CURSOR_CAPTURED) { _glfwInputError(GLFW_INVALID_ENUM, "Invalid cursor mode 0x%08X", diff --git a/src/win32_window.c b/src/win32_window.c index 4cf25640..f069c115 100644 --- a/src/win32_window.c +++ b/src/win32_window.c @@ -238,7 +238,8 @@ static void applyAspectRatio(_GLFWwindow* window, int edge, RECT* area) // static void updateCursorImage(_GLFWwindow* window) { - if (window->cursorMode == GLFW_CURSOR_NORMAL) + if (window->cursorMode == GLFW_CURSOR_NORMAL || + window->cursorMode == GLFW_CURSOR_CAPTURED) { if (window->cursor) SetCursor(window->cursor->win32.handle); @@ -586,6 +587,8 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM l { if (window->cursorMode == GLFW_CURSOR_DISABLED) disableCursor(window); + else if (window->cursorMode == GLFW_CURSOR_CAPTURED) + captureCursor(window); window->win32.frameAction = GLFW_FALSE; } @@ -604,6 +607,8 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM l if (window->cursorMode == GLFW_CURSOR_DISABLED) disableCursor(window); + else if (window->cursorMode == GLFW_CURSOR_CAPTURED) + captureCursor(window); return 0; } @@ -612,6 +617,8 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM l { if (window->cursorMode == GLFW_CURSOR_DISABLED) enableCursor(window); + else if (window->cursorMode == GLFW_CURSOR_CAPTURED) + releaseCursor(); if (window->monitor && window->autoIconify) _glfwIconifyWindowWin32(window); @@ -981,6 +988,8 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM l // resizing the window or using the window menu if (window->cursorMode == GLFW_CURSOR_DISABLED) enableCursor(window); + else if (window->cursorMode == GLFW_CURSOR_CAPTURED) + releaseCursor(); break; } @@ -995,6 +1004,8 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM l // resizing the window or using the menu if (window->cursorMode == GLFW_CURSOR_DISABLED) disableCursor(window); + else if (window->cursorMode == GLFW_CURSOR_CAPTURED) + captureCursor(window); break; } @@ -2166,7 +2177,7 @@ void _glfwSetCursorModeWin32(_GLFWwindow* window, int mode) disableRawMouseMotion(window); } - if (mode == GLFW_CURSOR_DISABLED) + if (mode == GLFW_CURSOR_DISABLED || mode == GLFW_CURSOR_CAPTURED) captureCursor(window); else releaseCursor(); diff --git a/src/wl_platform.h b/src/wl_platform.h index f2bf8f03..238e1ed4 100644 --- a/src/wl_platform.h +++ b/src/wl_platform.h @@ -269,6 +269,7 @@ typedef struct _GLFWwindowWayland struct zwp_relative_pointer_v1* relativePointer; struct zwp_locked_pointer_v1* lockedPointer; + struct zwp_confined_pointer_v1* confinedPointer; struct zwp_idle_inhibitor_v1* idleInhibitor; diff --git a/src/wl_window.c b/src/wl_window.c index b4b49b94..cd39c140 100644 --- a/src/wl_window.c +++ b/src/wl_window.c @@ -1860,6 +1860,9 @@ void _glfwDestroyWindowWayland(_GLFWwindow* window) if (window->wl.lockedPointer) zwp_locked_pointer_v1_destroy(window->wl.lockedPointer); + if (window->wl.confinedPointer) + zwp_confined_pointer_v1_destroy(window->wl.confinedPointer); + if (window->context.destroy) window->context.destroy(window); @@ -2538,6 +2541,43 @@ static void lockPointer(_GLFWwindow* window) window); } +static void confinedPointerHandleConfined(void* userData, + struct zwp_confined_pointer_v1* confinedPointer) +{ +} + +static void confinedPointerHandleUnconfined(void* userData, + struct zwp_confined_pointer_v1* confinedPointer) +{ +} + +static const struct zwp_confined_pointer_v1_listener confinedPointerListener = +{ + confinedPointerHandleConfined, + confinedPointerHandleUnconfined +}; + +static void confinePointer(_GLFWwindow* window) +{ + window->wl.confinedPointer = + zwp_pointer_constraints_v1_confine_pointer( + _glfw.wl.pointerConstraints, + window->wl.surface, + _glfw.wl.pointer, + NULL, + ZWP_POINTER_CONSTRAINTS_V1_LIFETIME_PERSISTENT); + + zwp_confined_pointer_v1_add_listener(window->wl.confinedPointer, + &confinedPointerListener, + window); +} + +static void unconfinePointer(_GLFWwindow* window) +{ + zwp_confined_pointer_v1_destroy(window->wl.confinedPointer); + window->wl.confinedPointer = NULL; +} + void _glfwSetCursorWayland(_GLFWwindow* window, _GLFWcursor* cursor) { if (!_glfw.wl.pointer) @@ -2553,17 +2593,29 @@ void _glfwSetCursorWayland(_GLFWwindow* window, _GLFWcursor* cursor) // Update pointer lock to match cursor mode if (window->cursorMode == GLFW_CURSOR_DISABLED) { + if (window->wl.confinedPointer) + unconfinePointer(window); if (!window->wl.lockedPointer) lockPointer(window); } + else if (window->cursorMode == GLFW_CURSOR_CAPTURED) + { + if (window->wl.lockedPointer) + unlockPointer(window); + if (!window->wl.confinedPointer) + confinePointer(window); + } else if (window->cursorMode == GLFW_CURSOR_NORMAL || window->cursorMode == GLFW_CURSOR_HIDDEN) { if (window->wl.lockedPointer) unlockPointer(window); + else if (window->wl.confinedPointer) + unconfinePointer(window); } - if (window->cursorMode == GLFW_CURSOR_NORMAL) + if (window->cursorMode == GLFW_CURSOR_NORMAL || + window->cursorMode == GLFW_CURSOR_CAPTURED) { if (cursor) setCursorImage(window, &cursor->wl); diff --git a/src/x11_window.c b/src/x11_window.c index f323db6c..4f605771 100644 --- a/src/x11_window.c +++ b/src/x11_window.c @@ -453,7 +453,8 @@ static char* convertLatin1toUTF8(const char* source) // static void updateCursorImage(_GLFWwindow* window) { - if (window->cursorMode == GLFW_CURSOR_NORMAL) + if (window->cursorMode == GLFW_CURSOR_NORMAL || + window->cursorMode == GLFW_CURSOR_CAPTURED) { if (window->cursor) { @@ -1705,6 +1706,8 @@ static void processEvent(XEvent *event) if (window->cursorMode == GLFW_CURSOR_DISABLED) disableCursor(window); + else if (window->cursorMode == GLFW_CURSOR_CAPTURED) + captureCursor(window); if (window->x11.ic) XSetICFocus(window->x11.ic); @@ -1725,6 +1728,8 @@ static void processEvent(XEvent *event) if (window->cursorMode == GLFW_CURSOR_DISABLED) enableCursor(window); + else if (window->cursorMode == GLFW_CURSOR_CAPTURED) + releaseCursor(); if (window->x11.ic) XUnsetICFocus(window->x11.ic); @@ -2831,7 +2836,7 @@ void _glfwSetCursorModeX11(_GLFWwindow* window, int mode) disableRawMouseMotion(window); } - if (mode == GLFW_CURSOR_DISABLED) + if (mode == GLFW_CURSOR_DISABLED || mode == GLFW_CURSOR_CAPTURED) captureCursor(window); else releaseCursor(); @@ -3003,7 +3008,8 @@ void _glfwDestroyCursorX11(_GLFWcursor* cursor) void _glfwSetCursorX11(_GLFWwindow* window, _GLFWcursor* cursor) { - if (window->cursorMode == GLFW_CURSOR_NORMAL) + if (window->cursorMode == GLFW_CURSOR_NORMAL || + window->cursorMode == GLFW_CURSOR_CAPTURED) { updateCursorImage(window); XFlush(_glfw.x11.display); diff --git a/tests/cursor.c b/tests/cursor.c index 9be42748..37f3299c 100644 --- a/tests/cursor.c +++ b/tests/cursor.c @@ -172,7 +172,8 @@ static void key_callback(GLFWwindow* window, int key, int scancode, int action, case GLFW_KEY_ESCAPE: { - if (glfwGetInputMode(window, GLFW_CURSOR) != GLFW_CURSOR_DISABLED) + const int mode = glfwGetInputMode(window, GLFW_CURSOR); + if (mode != GLFW_CURSOR_DISABLED && mode != GLFW_CURSOR_CAPTURED) { glfwSetWindowShouldClose(window, GLFW_TRUE); break; @@ -197,6 +198,11 @@ static void key_callback(GLFWwindow* window, int key, int scancode, int action, printf("(( cursor is hidden ))\n"); break; + case GLFW_KEY_C: + glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_CAPTURED); + printf("(( cursor is captured ))\n"); + break; + case GLFW_KEY_R: if (!glfwRawMouseMotionSupported()) break; From 7be6a2cabec3a50419448cc618792d2949d988fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Mon, 25 Jul 2022 13:04:21 +0200 Subject: [PATCH 095/117] Wayland: Clean up pointer helper function order --- src/wl_window.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/wl_window.c b/src/wl_window.c index cd39c140..b5989086 100644 --- a/src/wl_window.c +++ b/src/wl_window.c @@ -2492,15 +2492,6 @@ static void lockedPointerHandleLocked(void* userData, { } -static void unlockPointer(_GLFWwindow* window) -{ - zwp_relative_pointer_v1_destroy(window->wl.relativePointer); - window->wl.relativePointer = NULL; - - zwp_locked_pointer_v1_destroy(window->wl.lockedPointer); - window->wl.lockedPointer = NULL; -} - static void lockedPointerHandleUnlocked(void* userData, struct zwp_locked_pointer_v1* lockedPointer) { @@ -2541,6 +2532,15 @@ static void lockPointer(_GLFWwindow* window) window); } +static void unlockPointer(_GLFWwindow* window) +{ + zwp_relative_pointer_v1_destroy(window->wl.relativePointer); + window->wl.relativePointer = NULL; + + zwp_locked_pointer_v1_destroy(window->wl.lockedPointer); + window->wl.lockedPointer = NULL; +} + static void confinedPointerHandleConfined(void* userData, struct zwp_confined_pointer_v1* confinedPointer) { From 3a5c726d1bd485e63219c2a6c3e377f434d6ee10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Mon, 25 Jul 2022 16:28:23 +0200 Subject: [PATCH 096/117] Wayland: Remove unreachable code This platform function is only called if the cursor is enabled. --- src/wl_window.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/src/wl_window.c b/src/wl_window.c index b5989086..fc5e5783 100644 --- a/src/wl_window.c +++ b/src/wl_window.c @@ -2252,13 +2252,6 @@ void _glfwGetCursorPosWayland(_GLFWwindow* window, double* xpos, double* ypos) void _glfwSetCursorPosWayland(_GLFWwindow* window, double x, double y) { - if (window->wl.lockedPointer) - { - zwp_locked_pointer_v1_set_cursor_position_hint( - window->wl.lockedPointer, - wl_fixed_from_double(x), - wl_fixed_from_double(y)); - } } void _glfwSetCursorModeWayland(_GLFWwindow* window, int mode) From 3a60992a418aad88717db32353bec22e8bb7dab3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Mon, 25 Jul 2022 16:30:11 +0200 Subject: [PATCH 097/117] Wayland: Add error for unsupported feature --- src/wl_window.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/wl_window.c b/src/wl_window.c index fc5e5783..76d5f15b 100644 --- a/src/wl_window.c +++ b/src/wl_window.c @@ -2252,6 +2252,8 @@ void _glfwGetCursorPosWayland(_GLFWwindow* window, double* xpos, double* ypos) void _glfwSetCursorPosWayland(_GLFWwindow* window, double x, double y) { + _glfwInputError(GLFW_FEATURE_UNAVAILABLE, + "Wayland: The platform does not support setting the cursor position"); } void _glfwSetCursorModeWayland(_GLFWwindow* window, int mode) From 2e12ef00bb4b96c7b4c6ea14f594cc8f50ea718f Mon Sep 17 00:00:00 2001 From: TheChocolateOre <50585073+TheChocolateOre@users.noreply.github.com> Date: Thu, 28 Jul 2022 16:56:18 +0300 Subject: [PATCH 098/117] Fix typos and other issues in docs This fixes spelling, grammar and punctuation issues, missing words and stray words across the documentation. A confusing sentence was removed from the tutorial. Closes #2085 --- docs/build.dox | 2 +- docs/compat.dox | 6 +++--- docs/compile.dox | 14 +++++++------- docs/context.dox | 6 +++--- docs/input.dox | 4 ++-- docs/intro.dox | 16 ++++++++-------- docs/monitor.dox | 4 ++-- docs/moving.dox | 6 +++--- docs/news.dox | 8 ++++---- docs/quick.dox | 6 +----- docs/vulkan.dox | 2 +- 11 files changed, 35 insertions(+), 39 deletions(-) diff --git a/docs/build.dox b/docs/build.dox index c7677037..a1625d60 100644 --- a/docs/build.dox +++ b/docs/build.dox @@ -26,7 +26,7 @@ GLFW. @endcode This header defines all the constants and declares all the types and function -prototypes of the GLFW API. By default it also includes the OpenGL header from +prototypes of the GLFW API. By default, it also includes the OpenGL header from your development environment. See [option macros](@ref build_macros) below for how to select OpenGL ES headers and more. diff --git a/docs/compat.dox b/docs/compat.dox index 989c4c19..94372197 100644 --- a/docs/compat.dox +++ b/docs/compat.dox @@ -152,7 +152,7 @@ formats. If GLX 1.3 is not supported, @ref glfwInit will fail. GLFW uses the `GLX_MESA_swap_control,` `GLX_EXT_swap_control` and `GLX_SGI_swap_control` extensions to provide vertical retrace synchronization -(or _vsync_), in that order of preference. Where none of these extension are +(or _vsync_), in that order of preference. When none of these extensions are available, calling @ref glfwSwapInterval will have no effect. GLFW uses the `GLX_ARB_multisample` extension to create contexts with @@ -219,8 +219,8 @@ extension is unavailable, the `GLFW_CONTEXT_RELEASE_BEHAVIOR` hint will have no effect and the context will always be flushed when released. GLFW uses the `WGL_ARB_framebuffer_sRGB` and `WGL_EXT_framebuffer_sRGB` -extensions to provide support for sRGB framebuffers. Where both of these -extension are unavailable, the `GLFW_SRGB_CAPABLE` hint will have no effect. +extensions to provide support for sRGB framebuffers. When both of these +extensions are unavailable, the `GLFW_SRGB_CAPABLE` hint will have no effect. @section compat_osx OpenGL on macOS diff --git a/docs/compile.dox b/docs/compile.dox index 925ab1ab..3490eb15 100644 --- a/docs/compile.dox +++ b/docs/compile.dox @@ -45,7 +45,7 @@ Linux and FreeBSD you will need a few extra packages. To compile GLFW for X11, you need to have the X11 development packages installed. They are not needed to build or run programs that use GLFW. -On Debian and derivates like Ubuntu and Linux Mint the `xorg-dev` meta-package +On Debian and derivatives like Ubuntu and Linux Mint the `xorg-dev` meta-package pulls in the development packages for all of X11. @code{.sh} @@ -83,7 +83,7 @@ development packages installed. They are not needed to build or run programs th GLFW. You will also need to set the @ref GLFW_BUILD_WAYLAND CMake option in the next step when generating build files. -On Debian and derivates like Ubuntu and Linux Mint you will need the `libwayland-dev`, +On Debian and derivatives like Ubuntu and Linux Mint you will need the `libwayland-dev`, `libxkbcommon-dev` and `wayland-protocols` packages and the `xorg-dev` meta-package. These will pull in all other dependencies. @@ -142,7 +142,7 @@ If you wish change any CMake variables in the list, press _Configure_ and then _Generate_ to have the new values take effect. The variable list will be populated after the first configure step. -By default GLFW will use X11 on Linux and other Unix-like systems other than macOS. To +By default, GLFW will use X11 on Linux and other Unix-like systems other than macOS. To include support for Wayland as well, set the @ref GLFW_BUILD_WAYLAND option in the GLFW section of the variable list, then apply the new value as described above. @@ -176,7 +176,7 @@ flag. cmake -S path/to/glfw -B path/to/build -G Xcode @endcode -By default GLFW will use X11 on Linux and other Unix-like systems other +By default, GLFW will use X11 on Linux and other Unix-like systems other than macOS. To also include support for Wayland, set the @ref GLFW_BUILD_WAYLAND CMake option. @@ -263,12 +263,12 @@ build GLFW as a static library, `SHARED` to build it as a shared library @anchor GLFW_BUILD_EXAMPLES __GLFW_BUILD_EXAMPLES__ determines whether the GLFW examples are built along with the library. This is enabled by default unless GLFW is being built -as a sub-project of a larger CMake project. +as a subproject of a larger CMake project. @anchor GLFW_BUILD_TESTS __GLFW_BUILD_TESTS__ determines whether the GLFW test programs are built along with the library. This is enabled by default unless GLFW is being -built as a sub-project of a larger CMake project. +built as a subproject of a larger CMake project. @anchor GLFW_BUILD_DOCS __GLFW_BUILD_DOCS__ determines whether the GLFW documentation is built along @@ -358,7 +358,7 @@ For more details see the @section compile_manual Compiling GLFW manually If you wish to compile GLFW without its CMake build environment then you will have to do -at least some of the platform detection yourself. There are preprocessor macros for +at least some platform-detection yourself. There are preprocessor macros for enabling support for the platforms (window systems) available. There are also optional, platform-specific macros for various features. diff --git a/docs/context.dox b/docs/context.dox index c51e268c..c64a0709 100644 --- a/docs/context.dox +++ b/docs/context.dox @@ -61,7 +61,7 @@ information. The name and number of this chapter unfortunately varies between versions and APIs, but has at times been named _Shared Objects and Multiple Contexts_. -GLFW comes with a barebones object sharing example program called `sharing`. +GLFW comes with a bare-bones object sharing example program called `sharing`. @subsection context_offscreen Offscreen contexts @@ -189,7 +189,7 @@ it suppresses the development environment's OpenGL or OpenGL ES header. #include @endcode -Finally you need to initialize glad once you have a suitable current context. +Finally, you need to initialize glad once you have a suitable current context. @code window = glfwCreateWindow(640, 480, "My Window", NULL, NULL); @@ -205,7 +205,7 @@ gladLoadGLLoader((GLADloadproc) glfwGetProcAddress); Once glad has been loaded, you have access to all OpenGL core and extension functions supported by both the context you created and the glad loader you -generated and you are ready to start rendering. +generated. After that, you are ready to start rendering. You can specify a minimum required OpenGL or OpenGL ES version with [context hints](@ref window_hints_ctx). If your needs are more complex, you can diff --git a/docs/input.dox b/docs/input.dox index dfb06a43..d3904f46 100644 --- a/docs/input.dox +++ b/docs/input.dox @@ -24,7 +24,7 @@ All input callbacks receive a window handle. By using the or objects from your callbacks. To get a better feel for how the various events callbacks behave, run the -`events` test program. It register every callback supported by GLFW and prints +`events` test program. It registers every callback supported by GLFW and prints out all arguments provided for every event, along with time and sequence information. @@ -394,7 +394,7 @@ sequential rows, starting from the top-left corner. @subsubsection cursor_standard Standard cursor creation A cursor with a [standard shape](@ref shapes) from the current system cursor -theme can be can be created with @ref glfwCreateStandardCursor. +theme can be created with @ref glfwCreateStandardCursor. @code GLFWcursor* url_cursor = glfwCreateStandardCursor(GLFW_POINTING_HAND_CURSOR); diff --git a/docs/intro.dox b/docs/intro.dox index 5cbd7eb0..79348323 100644 --- a/docs/intro.dox +++ b/docs/intro.dox @@ -162,7 +162,7 @@ GLFW can be compiled for more than one platform (window system) at once. This l a single library binary support both X11 and Wayland on Linux and other Unix-like systems. You can control platform selection via the @ref GLFW_PLATFORM initialization hint. By -default this is set to @ref GLFW_ANY_PLATFORM, which will look for supported window +default, this is set to @ref GLFW_ANY_PLATFORM, which will look for supported window systems in order of priority and select the first one it finds. It can also be set to any specific platform to have GLFW only look for that one. @@ -269,9 +269,9 @@ This will destroy any remaining window, monitor and cursor objects, restore any modified gamma ramps, re-enable the screensaver if it had been disabled and free any other resources allocated by GLFW. -Once the library is terminated, it is as if it had never been initialized and +Once the library is terminated, it is as if it had never been initialized, therefore you will need to initialize it again before being able to use GLFW. If the -library was not initialized or had already been terminated, it return +library was not initialized or had already been terminated, it returns immediately. @@ -391,14 +391,14 @@ which monitor the window is currently considered to be on. This section describes the conditions under which GLFW can be expected to function, barring bugs in the operating system or drivers. Use of GLFW outside -of these limits may work on some platforms, or on some machines, or some of the +these limits may work on some platforms, or on some machines, or some of the time, or on some versions of GLFW, but it may break at any time and this will not be considered a bug. @subsection lifetime Pointer lifetimes -GLFW will never free any pointer you provide to it and you must never free any +GLFW will never free any pointer you provide to it, and you must never free any pointer it provides to you. Many GLFW functions return pointers to dynamically allocated structures, strings @@ -602,15 +602,15 @@ The format of the string is as follows: - The names of the always supported context creation APIs EGL and OSMesa - Any additional compile-time options, APIs and (on Windows) what compiler was used -For example, GLFW 3.4 compiled as a DLL for Windows with MinGW may have a version string +For example, compiling GLFW 3.4 with MinGW as a DLL for Windows, may result in a version string like this: @code 3.4.0 Win32 WGL Null EGL OSMesa MinGW DLL @endcode -While GLFW compiled as as static library for Linux with both Wayland and X11 enabled may -have a version string like this: +Compiling GLFW as a static library for Linux, with both Wayland and X11 enabled, may +result in a version string like this: @code 3.4.0 Wayland X11 GLX Null EGL OSMesa monotonic diff --git a/docs/monitor.dox b/docs/monitor.dox index 86eb4540..b4099dbf 100644 --- a/docs/monitor.dox +++ b/docs/monitor.dox @@ -138,7 +138,7 @@ glfwGetMonitorPhysicalSize(monitor, &width_mm, &height_mm); @endcode While this can be used to calculate the raw DPI of a monitor, this is often not -useful. Instead use the [monitor content scale](@ref monitor_scale) and +useful. Instead, use the [monitor content scale](@ref monitor_scale) and [window content scale](@ref window_scale) to scale your content. @@ -261,7 +261,7 @@ To experiment with gamma correction via the @ref glfwSetGamma function, run the `gamma` test program. @note The software controlled gamma ramp is applied _in addition_ to the -hardware gamma correction, which today is usually an approximation of sRGB +hardware gamma correction, which today is typically an approximation of sRGB gamma. This means that setting a perfectly linear ramp, or gamma 1.0, will produce the default (usually sRGB-like) behavior. diff --git a/docs/moving.dox b/docs/moving.dox index b80d84a2..705b4fa8 100644 --- a/docs/moving.dox +++ b/docs/moving.dox @@ -243,7 +243,7 @@ while (!glfwWindowShouldClose(window)) @endcode The close callback no longer returns a value. Instead, it is called after the -close flag has been set so it can override its value, if it chooses to, before +close flag has been set, so it can optionally override its value, before event processing completes. You may however not call @ref glfwDestroyWindow from the close callback (or any other window related callback). @@ -350,11 +350,11 @@ from a repeat. Note that @ref glfwGetKey still returns only `GLFW_PRESS` or GLFW 3 key tokens map to physical keys, unlike in GLFW 2 where they mapped to the values generated by the current keyboard layout. The tokens are named -according to the values they would have using the standard US layout, but this +according to the values they would have in the standard US layout, but this is only a convenience, as most programmers are assumed to know that layout. This means that (for example) `GLFW_KEY_LEFT_BRACKET` is always a single key and is the same key in the same place regardless of what keyboard layouts the users -of your program has. +of your program have. The key input facility was never meant for text input, although using it that way worked slightly better in GLFW 2. If you were using it to input text, you diff --git a/docs/news.dox b/docs/news.dox index 1ff534b8..38110b14 100644 --- a/docs/news.dox +++ b/docs/news.dox @@ -21,7 +21,7 @@ support for a given platform is compiled in with @ref glfwPlatformSupported. GLFW now provides the standard cursor shapes @ref GLFW_RESIZE_NWSE_CURSOR and @ref GLFW_RESIZE_NESW_CURSOR for diagonal resizing, @ref GLFW_RESIZE_ALL_CURSOR -for omni-directional resizing and @ref GLFW_NOT_ALLOWED_CURSOR for showing an +for omnidirectional resizing and @ref GLFW_NOT_ALLOWED_CURSOR for showing an action is not allowed. Unlike the original set, these shapes may not be available everywhere and @@ -92,7 +92,7 @@ applications. Because GLFW now supports runtime selection of platform (window system), a library binary may export native access functions for multiple platforms. Starting with version 3.4 you must not assume that GLFW is running on a platform just because it exports native access -functions for it. After initialization you can query the selected platform with @ref +functions for it. After initialization, you can query the selected platform with @ref glfwGetPlatform. @@ -118,7 +118,7 @@ To work around this, call any joystick function before waiting for events, for example by setting a [joystick callback](@ref joystick_event). -@subsubsection standalone_34 Tests and examples are disabled when built as a sub-project +@subsubsection standalone_34 Tests and examples are disabled when built as a subproject GLFW now does not build the tests and examples when it is added as a subdirectory of another CMake project. To enable these, set the @ref @@ -152,7 +152,7 @@ GLFW_TRANSPARENT_FRAMEBUFFER on Windows 7 if DWM transparency is off (the Transparency setting under Personalization > Window Color). -@subsubsection emptyevents_34 Empty events on X11 no longer roundtrip to server +@subsubsection emptyevents_34 Empty events on X11 no longer round-trip to server Events posted with @ref glfwPostEmptyEvent now use a separate unnamed pipe instead of sending an X11 client event to the helper window. diff --git a/docs/quick.dox b/docs/quick.dox index c3f47aa1..8824ff5b 100644 --- a/docs/quick.dox +++ b/docs/quick.dox @@ -149,10 +149,6 @@ if (!window) } @endcode -The window handle is passed to all window related functions and is provided to -along to all window related callbacks, so they can tell which window received -the event. - When a window and context is no longer needed, destroy it. @code @@ -238,7 +234,7 @@ events as described below. @subsection quick_render Rendering with OpenGL Once you have a current OpenGL context, you can use OpenGL normally. In this -tutorial, a multi-colored rotating triangle will be rendered. The framebuffer +tutorial, a multicolored rotating triangle will be rendered. The framebuffer size needs to be retrieved for `glViewport`. @code diff --git a/docs/vulkan.dox b/docs/vulkan.dox index 8e9821ca..5e38c014 100644 --- a/docs/vulkan.dox +++ b/docs/vulkan.dox @@ -142,7 +142,7 @@ PFN_vkGetDeviceProcAddr pfnGetDeviceProcAddr = (PFN_vkGetDeviceProcAddr) glfwGetInstanceProcAddress(instance, "vkGetDeviceProcAddr"); @endcode -Device-specific functions may execute a little bit faster, due to not having to +Device-specific functions may execute a little faster, due to not having to dispatch internally based on the device passed to them. For more information about `vkGetDeviceProcAddr`, see the Vulkan documentation. From 2efc598d70be92267a97c95ac08668565784ab19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Tue, 26 Jul 2022 19:21:07 +0200 Subject: [PATCH 099/117] Fix native access macros being mutually exclusive The documentation was updated with the introduction of run-time platform selection, but the preprocessor logic was not. --- include/GLFW/glfw3native.h | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/include/GLFW/glfw3native.h b/include/GLFW/glfw3native.h index 36934120..171abe36 100644 --- a/include/GLFW/glfw3native.h +++ b/include/GLFW/glfw3native.h @@ -103,17 +103,23 @@ extern "C" { #undef GLFW_APIENTRY_DEFINED #endif #include - #elif defined(GLFW_EXPOSE_NATIVE_COCOA) || defined(GLFW_EXPOSE_NATIVE_NSGL) + #endif + + #if defined(GLFW_EXPOSE_NATIVE_COCOA) || defined(GLFW_EXPOSE_NATIVE_NSGL) #if defined(__OBJC__) #import #else #include #include #endif - #elif defined(GLFW_EXPOSE_NATIVE_X11) || defined(GLFW_EXPOSE_NATIVE_GLX) + #endif + + #if defined(GLFW_EXPOSE_NATIVE_X11) || defined(GLFW_EXPOSE_NATIVE_GLX) #include #include - #elif defined(GLFW_EXPOSE_NATIVE_WAYLAND) + #endif + + #if defined(GLFW_EXPOSE_NATIVE_WAYLAND) #include #endif From 7d73629e5071b0baea87135f01a4335b10740068 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Tue, 26 Oct 2021 20:30:29 +0200 Subject: [PATCH 100/117] X11: Preserve unrelated values in WM_NORMAL_HINTS This stops GLFW overwriting the whole WM_NORMAL_HINTS property every time it updates size-related parts of it. --- src/x11_window.c | 31 +++++++++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/src/x11_window.c b/src/x11_window.c index 4f605771..b4ce8669 100644 --- a/src/x11_window.c +++ b/src/x11_window.c @@ -270,6 +270,11 @@ static void updateNormalHints(_GLFWwindow* window, int width, int height) { XSizeHints* hints = XAllocSizeHints(); + long supplied; + XGetWMNormalHints(_glfw.x11.display, window->x11.handle, hints, &supplied); + + hints->flags &= ~(PMinSize | PMaxSize | PAspect); + if (!window->monitor) { if (window->resizable) @@ -306,9 +311,6 @@ static void updateNormalHints(_GLFWwindow* window, int width, int height) } } - hints->flags |= PWinGravity; - hints->win_gravity = StaticGravity; - XSetWMNormalHints(_glfw.x11.display, window->x11.handle, hints); XFree(hints); } @@ -696,7 +698,28 @@ static GLFWbool createNativeWindow(_GLFWwindow* window, XFree(hints); } - updateNormalHints(window, width, height); + // Set ICCCM WM_NORMAL_HINTS property + { + XSizeHints* hints = XAllocSizeHints(); + if (!hints) + { + _glfwInputError(GLFW_OUT_OF_MEMORY, "X11: Failed to allocate size hints"); + return GLFW_FALSE; + } + + if (!wndconfig->resizable) + { + hints->flags |= (PMinSize | PMaxSize); + hints->min_width = hints->max_width = width; + hints->min_height = hints->max_height = height; + } + + hints->flags |= PWinGravity; + hints->win_gravity = StaticGravity; + + XSetWMNormalHints(_glfw.x11.display, window->x11.handle, hints); + XFree(hints); + } // Set ICCCM WM_CLASS property { From 0f9a9578f38518317d0b3305dd816ba7b400972d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Tue, 26 Oct 2021 14:25:03 +0200 Subject: [PATCH 101/117] Add window hints for initial position This adds window hints for the initial position, in screen coordinates, of a window. The special value GLFW_ANY_POSITION means the window manager will be allowed to position the window. It is not possible to set window positions on Wayland and GLFW will always behave as if these hints are set to GLFW_ANY_POSITION. Fixes #1603 Fixes #1747 --- README.md | 3 +++ docs/news.dox | 11 +++++++++++ docs/window.dox | 25 ++++++++++++++++++++++++- examples/windows.c | 10 +++------- include/GLFW/glfw3.h | 22 ++++++++++++++++++---- src/cocoa_window.m | 26 +++++++++++++++++++++----- src/internal.h | 2 ++ src/null_window.c | 13 +++++++++++-- src/win32_window.c | 22 ++++++++++++++++------ src/window.c | 8 ++++++++ src/x11_window.c | 19 ++++++++++++++++++- tests/threads.c | 8 +++----- 12 files changed, 138 insertions(+), 31 deletions(-) diff --git a/README.md b/README.md index c84f8cb5..db76a6fa 100644 --- a/README.md +++ b/README.md @@ -141,6 +141,9 @@ information on what to include when reporting a bug. through the window (#1236,#1568) - Added `GLFW_CURSOR_CAPTURED` cursor mode to confine the cursor to the window content area (#58) + - Added `GLFW_POSITION_X` and `GLFW_POSITION_Y` window hints for initial position + (#1603,#1747) + - Added `GLFW_ANY_POSITION` hint value for letting the window manager choose (#1603,#1747) - Added `GLFW_PLATFORM_UNAVAILABLE` error for platform detection failures (#1958) - Added `GLFW_FEATURE_UNAVAILABLE` error for platform limitations (#1692) - Added `GLFW_FEATURE_UNIMPLEMENTED` error for incomplete backends (#1692) diff --git a/docs/news.dox b/docs/news.dox index 38110b14..8601d6c3 100644 --- a/docs/news.dox +++ b/docs/news.dox @@ -76,6 +76,14 @@ function pointers corresponding to the standard library functions `malloc`, For more information see @ref init_allocator. +@subsubsection features_34_position_hint Window hints for initial position + +GLFW now provides the @ref GLFW_POSITION_X and @ref GLFW_POSITION_Y window hints for +specifying the initial position of the window. This removes the need to create a hidden +window, move it and then show it. The default value of these hints is +`GLFW_ANY_POSITION`, which selects the previous behavior. + + @subsubsection features_34_win32_keymenu Support for keyboard access to Windows window menu GLFW now provides the @@ -243,6 +251,9 @@ then GLFW will fail to initialize. - @ref GLFW_ANGLE_PLATFORM_TYPE_METAL - @ref GLFW_X11_XCB_VULKAN_SURFACE - @ref GLFW_CURSOR_CAPTURED + - @ref GLFW_POSITION_X + - @ref GLFW_POSITION_Y + - @ref GLFW_ANY_POSITION @section news_archive Release notes for earlier versions diff --git a/docs/window.dox b/docs/window.dox index 451aca73..2852a809 100644 --- a/docs/window.dox +++ b/docs/window.dox @@ -256,6 +256,14 @@ This is only supported for undecorated windows. Decorated windows with this enabled will behave differently between platforms. Possible values are `GLFW_TRUE` and `GLFW_FALSE`. +@anchor GLFW_POSITION_X +@anchor GLFW_POSITION_Y +__GLFW_POSITION_X__ and __GLFW_POSITION_Y__ specify the desired initial position +of the window. The window manager may modify or ignore these coordinates. If +either or both of these hints are set to `GLFW_ANY_POSITION` then the window +manager will position the window where it thinks the user will prefer it. +Possible values are any valid screen coordinates and `GLFW_ANY_POSITION`. + @subsubsection window_hints_fb Framebuffer related hints @@ -516,6 +524,8 @@ GLFW_TRANSPARENT_FRAMEBUFFER | `GLFW_FALSE` | `GLFW_TRUE` or `GL GLFW_FOCUS_ON_SHOW | `GLFW_TRUE` | `GLFW_TRUE` or `GLFW_FALSE` GLFW_SCALE_TO_MONITOR | `GLFW_FALSE` | `GLFW_TRUE` or `GLFW_FALSE` GLFW_MOUSE_PASSTHROUGH | `GLFW_FALSE` | `GLFW_TRUE` or `GLFW_FALSE` +GLFW_POSITION_X | `GLFW_ANY_POSITION` | Any valid screen x-coordinate or `GLFW_ANY_POSITION` +GLFW_POSITION_Y | `GLFW_ANY_POSITION` | Any valid screen y-coordinate or `GLFW_ANY_POSITION` GLFW_RED_BITS | 8 | 0 to `INT_MAX` or `GLFW_DONT_CARE` GLFW_GREEN_BITS | 8 | 0 to `INT_MAX` or `GLFW_DONT_CARE` GLFW_BLUE_BITS | 8 | 0 to `INT_MAX` or `GLFW_DONT_CARE` @@ -798,7 +808,20 @@ are undefined if they conflict. @subsection window_pos Window position -The position of a windowed-mode window can be changed with @ref +By default, the window manager chooses the position of new windowed mode +windows, based on its size and which monitor the user appears to be working on. +This is most often the right choice. If you need to create a window at +a specific position, you can set the desired position with the @ref +GLFW_POSITION_X and @ref GLFW_POSITION_Y window hints. + +@code +glfwWindowHint(GLFW_POSITION_X, 70); +glfwWindowHint(GLFW_POSITION_Y, 83); +@endcode + +To restore the previous behavior, set these hints to `GLFW_ANY_POSITION`. + +The position of a windowed mode window can be changed with @ref glfwSetWindowPos. This moves the window so that the upper-left corner of its content area has the specified [screen coordinates](@ref coordinate_systems). The window system may put limitations on window placement. diff --git a/examples/windows.c b/examples/windows.c index 598e5218..1589ffbf 100644 --- a/examples/windows.c +++ b/examples/windows.c @@ -44,7 +44,6 @@ int main(int argc, char** argv) exit(EXIT_FAILURE); } - glfwWindowHint(GLFW_VISIBLE, GLFW_FALSE); glfwWindowHint(GLFW_DECORATED, GLFW_FALSE); glfwGetMonitorWorkarea(glfwGetPrimaryMonitor(), &xpos, &ypos, NULL, &height); @@ -66,6 +65,9 @@ int main(int argc, char** argv) if (i > 0) glfwWindowHint(GLFW_FOCUS_ON_SHOW, GLFW_FALSE); + glfwWindowHint(GLFW_POSITION_X, xpos + size * (1 + (i & 1))); + glfwWindowHint(GLFW_POSITION_Y, ypos + size * (1 + (i >> 1))); + windows[i] = glfwCreateWindow(size, size, "Multi-Window Example", NULL, NULL); if (!windows[i]) { @@ -75,9 +77,6 @@ int main(int argc, char** argv) exit(EXIT_FAILURE); } - glfwSetWindowPos(windows[i], - xpos + size * (1 + (i & 1)), - ypos + size * (1 + (i >> 1))); glfwSetInputMode(windows[i], GLFW_STICKY_KEYS, GLFW_TRUE); glfwMakeContextCurrent(windows[i]); @@ -85,9 +84,6 @@ int main(int argc, char** argv) glClearColor(colors[i].r, colors[i].g, colors[i].b, 1.f); } - for (int i = 0; i < 4; i++) - glfwShowWindow(windows[i]); - for (;;) { for (int i = 0; i < 4; i++) diff --git a/include/GLFW/glfw3.h b/include/GLFW/glfw3.h index 8a43134c..26875465 100644 --- a/include/GLFW/glfw3.h +++ b/include/GLFW/glfw3.h @@ -927,6 +927,18 @@ extern "C" { */ #define GLFW_MOUSE_PASSTHROUGH 0x0002000D +/*! @brief Initial position x-coordinate window hint. + * + * Initial position x-coordinate [window hint](@ref GLFW_POSITION_X). + */ +#define GLFW_POSITION_X 0x0002000E + +/*! @brief Initial position y-coordinate window hint. + * + * Initial position y-coordinate [window hint](@ref GLFW_POSITION_Y). + */ +#define GLFW_POSITION_Y 0x0002000F + /*! @brief Framebuffer bit depth hint. * * Framebuffer bit depth [hint](@ref GLFW_RED_BITS). @@ -1152,6 +1164,8 @@ extern "C" { #define GLFW_ANGLE_PLATFORM_TYPE_VULKAN 0x00037007 #define GLFW_ANGLE_PLATFORM_TYPE_METAL 0x00037008 +#define GLFW_ANY_POSITION 0x80000000 + /*! @defgroup shapes Standard cursor shapes * @brief Standard system cursor shapes. * @@ -3036,10 +3050,10 @@ GLFWAPI void glfwWindowHintString(int hint, const char* value); * OpenGL or OpenGL ES context. * * By default, newly created windows use the placement recommended by the - * window system. To create the window at a specific position, make it - * initially invisible using the [GLFW_VISIBLE](@ref GLFW_VISIBLE_hint) window - * hint, set its [position](@ref window_pos) and then [show](@ref window_hide) - * it. + * window system. To create the window at a specific position, set the @ref + * GLFW_POSITION_X and @ref GLFW_POSITION_Y window hints before creation. To + * restore the default behavior, set either or both hints back to + * `GLFW_ANY_POSITION`. * * As long as at least one full screen window is not iconified, the screensaver * is prohibited from starting. diff --git a/src/cocoa_window.m b/src/cocoa_window.m index 42782280..daac39b3 100644 --- a/src/cocoa_window.m +++ b/src/cocoa_window.m @@ -791,7 +791,19 @@ static GLFWbool createNativeWindow(_GLFWwindow* window, contentRect = NSMakeRect(xpos, ypos, mode.width, mode.height); } else - contentRect = NSMakeRect(0, 0, wndconfig->width, wndconfig->height); + { + if (wndconfig->xpos == GLFW_ANY_POSITION || + wndconfig->ypos == GLFW_ANY_POSITION) + { + contentRect = NSMakeRect(0, 0, wndconfig->width, wndconfig->height); + } + else + { + const int xpos = wndconfig->xpos; + const int ypos = _glfwTransformYCocoa(wndconfig->ypos + wndconfig->height - 1); + contentRect = NSMakeRect(xpos, ypos, wndconfig->width, wndconfig->height); + } + } NSUInteger styleMask = NSWindowStyleMaskMiniaturizable; @@ -821,10 +833,14 @@ static GLFWbool createNativeWindow(_GLFWwindow* window, [window->ns.object setLevel:NSMainMenuWindowLevel + 1]; else { - [(NSWindow*) window->ns.object center]; - _glfw.ns.cascadePoint = - NSPointToCGPoint([window->ns.object cascadeTopLeftFromPoint: - NSPointFromCGPoint(_glfw.ns.cascadePoint)]); + if (wndconfig->xpos == GLFW_ANY_POSITION || + wndconfig->ypos == GLFW_ANY_POSITION) + { + [(NSWindow*) window->ns.object center]; + _glfw.ns.cascadePoint = + NSPointToCGPoint([window->ns.object cascadeTopLeftFromPoint: + NSPointFromCGPoint(_glfw.ns.cascadePoint)]); + } if (wndconfig->resizable) { diff --git a/src/internal.h b/src/internal.h index 8d576d1d..5aa22f59 100644 --- a/src/internal.h +++ b/src/internal.h @@ -396,6 +396,8 @@ struct _GLFWinitconfig // struct _GLFWwndconfig { + int xpos; + int ypos; int width; int height; const char* title; diff --git a/src/null_window.c b/src/null_window.c index 8a7cae41..5cdf3e23 100644 --- a/src/null_window.c +++ b/src/null_window.c @@ -82,8 +82,17 @@ static int createNativeWindow(_GLFWwindow* window, fitToMonitor(window); else { - window->null.xpos = 17; - window->null.ypos = 17; + if (wndconfig->xpos == GLFW_ANY_POSITION && wndconfig->ypos == GLFW_ANY_POSITION) + { + window->null.xpos = 17; + window->null.ypos = 17; + } + else + { + window->null.xpos = wndconfig->xpos; + window->null.ypos = wndconfig->ypos; + } + window->null.width = wndconfig->width; window->null.height = wndconfig->height; } diff --git a/src/win32_window.c b/src/win32_window.c index f069c115..69fb6422 100644 --- a/src/win32_window.c +++ b/src/win32_window.c @@ -1316,17 +1316,27 @@ static int createNativeWindow(_GLFWwindow* window, } else { - xpos = CW_USEDEFAULT; - ypos = CW_USEDEFAULT; + RECT rect = { 0, 0, wndconfig->width, wndconfig->height }; window->win32.maximized = wndconfig->maximized; if (wndconfig->maximized) style |= WS_MAXIMIZE; - getFullWindowSize(style, exStyle, - wndconfig->width, wndconfig->height, - &fullWidth, &fullHeight, - USER_DEFAULT_SCREEN_DPI); + AdjustWindowRectEx(&rect, style, FALSE, exStyle); + + if (wndconfig->xpos == GLFW_ANY_POSITION && wndconfig->ypos == GLFW_ANY_POSITION) + { + xpos = CW_USEDEFAULT; + ypos = CW_USEDEFAULT; + } + else + { + xpos = wndconfig->xpos + rect.left; + ypos = wndconfig->ypos + rect.top; + } + + fullWidth = rect.right - rect.left; + fullHeight = rect.bottom - rect.top; } wideTitle = _glfwCreateWideStringFromUTF8Win32(wndconfig->title); diff --git a/src/window.c b/src/window.c index f740580a..1c8519ff 100644 --- a/src/window.c +++ b/src/window.c @@ -274,6 +274,8 @@ void glfwDefaultWindowHints(void) _glfw.hints.window.autoIconify = GLFW_TRUE; _glfw.hints.window.centerCursor = GLFW_TRUE; _glfw.hints.window.focusOnShow = GLFW_TRUE; + _glfw.hints.window.xpos = GLFW_ANY_POSITION; + _glfw.hints.window.ypos = GLFW_ANY_POSITION; // The default is 24 bits of color, 24 bits of depth and 8 bits of stencil, // double buffered @@ -368,6 +370,12 @@ GLFWAPI void glfwWindowHint(int hint, int value) case GLFW_VISIBLE: _glfw.hints.window.visible = value ? GLFW_TRUE : GLFW_FALSE; return; + case GLFW_POSITION_X: + _glfw.hints.window.xpos = value; + return; + case GLFW_POSITION_Y: + _glfw.hints.window.ypos = value; + return; case GLFW_COCOA_RETINA_FRAMEBUFFER: _glfw.hints.window.ns.retina = value ? GLFW_TRUE : GLFW_FALSE; return; diff --git a/src/x11_window.c b/src/x11_window.c index b4ce8669..8a689ed1 100644 --- a/src/x11_window.c +++ b/src/x11_window.c @@ -575,6 +575,14 @@ static GLFWbool createNativeWindow(_GLFWwindow* window, height *= _glfw.x11.contentScaleY; } + int xpos = 0, ypos = 0; + + if (wndconfig->xpos != GLFW_ANY_POSITION && wndconfig->ypos != GLFW_ANY_POSITION) + { + xpos = wndconfig->xpos; + ypos = wndconfig->ypos; + } + // Create a colormap based on the visual used by the current context window->x11.colormap = XCreateColormap(_glfw.x11.display, _glfw.x11.root, @@ -595,7 +603,7 @@ static GLFWbool createNativeWindow(_GLFWwindow* window, window->x11.parent = _glfw.x11.root; window->x11.handle = XCreateWindow(_glfw.x11.display, _glfw.x11.root, - 0, 0, // Position + xpos, ypos, width, height, 0, // Border width depth, // Color depth @@ -714,6 +722,15 @@ static GLFWbool createNativeWindow(_GLFWwindow* window, hints->min_height = hints->max_height = height; } + // HACK: Explicitly setting PPosition to any value causes some WMs, notably + // Compiz and Metacity, to honor the position of unmapped windows + if (wndconfig->xpos != GLFW_ANY_POSITION && wndconfig->ypos != GLFW_ANY_POSITION) + { + hints->flags |= PPosition; + hints->x = 0; + hints->y = 0; + } + hints->flags |= PWinGravity; hints->win_gravity = StaticGravity; diff --git a/tests/threads.c b/tests/threads.c index ec13b001..a2caea56 100644 --- a/tests/threads.c +++ b/tests/threads.c @@ -96,10 +96,11 @@ int main(void) if (!glfwInit()) exit(EXIT_FAILURE); - glfwWindowHint(GLFW_VISIBLE, GLFW_FALSE); - for (i = 0; i < count; i++) { + glfwWindowHint(GLFW_POSITION_X, 200 + 250 * i); + glfwWindowHint(GLFW_POSITION_Y, 200); + threads[i].window = glfwCreateWindow(200, 200, threads[i].title, NULL, NULL); @@ -110,9 +111,6 @@ int main(void) } glfwSetKeyCallback(threads[i].window, key_callback); - - glfwSetWindowPos(threads[i].window, 200 + 250 * i, 200); - glfwShowWindow(threads[i].window); } glfwMakeContextCurrent(threads[0].window); From 55aad3c37b67f17279378db52da0a3ab81bbf26d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Wed, 27 Jul 2022 15:03:16 +0200 Subject: [PATCH 102/117] EGL: Add support for loading glvnd libOpenGL --- README.md | 1 + src/egl_context.c | 1 + 2 files changed, 2 insertions(+) diff --git a/README.md b/README.md index db76a6fa..15ab9914 100644 --- a/README.md +++ b/README.md @@ -394,6 +394,7 @@ information on what to include when reporting a bug. (#442) - [EGL] Added ANGLE backend selection via `EGL_ANGLE_platform_angle` extension (#1380) + [EGL] Added loading of glvnd `libOpenGL.so.0` where available for OpenGL - [EGL] Bugfix: The `GLFW_DOUBLEBUFFER` context attribute was ignored (#1843) - [GLX] Bugfix: Context creation failed if GLX 1.4 was not exported by GLX library diff --git a/src/egl_context.c b/src/egl_context.c index f8850fa2..490770cd 100644 --- a/src/egl_context.c +++ b/src/egl_context.c @@ -737,6 +737,7 @@ GLFWbool _glfwCreateContextEGL(_GLFWwindow* window, #elif defined(__OpenBSD__) || defined(__NetBSD__) "libGL.so", #else + "libOpenGL.so.0", "libGL.so.1", #endif NULL From c18851f52ec9704eb06464058a600845ec1eada1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Wed, 27 Jul 2022 15:05:23 +0200 Subject: [PATCH 103/117] GLX: Add support for loading glvnd libGLX --- README.md | 1 + src/glx_context.c | 4 ++++ src/x11_platform.h | 1 - 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 15ab9914..73dbb79a 100644 --- a/README.md +++ b/README.md @@ -396,6 +396,7 @@ information on what to include when reporting a bug. (#1380) [EGL] Added loading of glvnd `libOpenGL.so.0` where available for OpenGL - [EGL] Bugfix: The `GLFW_DOUBLEBUFFER` context attribute was ignored (#1843) + - [GLX] Added loading of glvnd `libGLX.so.0` where available - [GLX] Bugfix: Context creation failed if GLX 1.4 was not exported by GLX library diff --git a/src/glx_context.c b/src/glx_context.c index 872612d1..3c38807f 100644 --- a/src/glx_context.c +++ b/src/glx_context.c @@ -226,7 +226,10 @@ static GLFWglproc getProcAddressGLX(const char* procname) else if (_glfw.glx.GetProcAddressARB) return _glfw.glx.GetProcAddressARB((const GLubyte*) procname); else + { + // NOTE: glvnd provides GLX 1.4, so this can only happen with libGL return _glfwPlatformGetModuleSymbol(_glfw.glx.handle, procname); + } } static void destroyContextGLX(_GLFWwindow* window) @@ -262,6 +265,7 @@ GLFWbool _glfwInitGLX(void) #elif defined(__OpenBSD__) || defined(__NetBSD__) "libGL.so", #else + "libGLX.so.0", "libGL.so.1", "libGL.so", #endif diff --git a/src/x11_platform.h b/src/x11_platform.h index ecaa0fa4..cdea3957 100644 --- a/src/x11_platform.h +++ b/src/x11_platform.h @@ -480,7 +480,6 @@ typedef struct _GLFWlibraryGLX int eventBase; int errorBase; - // dlopen handle for libGL.so.1 void* handle; // GLX 1.3 functions From ef6c9d8b4f957c2a53374558e393bdb5c4264fa5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Mon, 25 Jul 2022 20:33:47 +0200 Subject: [PATCH 104/117] Wayland: Fix window opacity on older systems On systems lacking the EGL_EXT_present_opaque extension, some compositors treat any buffer with an alpha channel as per-pixel transparent. This commit ignores any EGLConfig with an alpha channel if the extension is missing and the window is created with GLFW_TRANSPARENT_FRAMEBUFFER set to false. This is technically not a breaking change since GLFW_ALPHA_BITS is not a hard constraint, but it is still going to inconvenience anyone using the framebuffer alpa channel to store other kinds of data. Related to #1895 --- CONTRIBUTORS.md | 1 + README.md | 2 ++ docs/news.dox | 13 +++++++++++++ src/egl_context.c | 15 +++++++++++++++ 4 files changed, 31 insertions(+) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 9c4964c0..d938afae 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -185,6 +185,7 @@ video tutorials. - pthom - Martin Pulec - Guillaume Racicot + - Christian Rauch - Philip Rideout - Eddie Ringle - Max Risuhin diff --git a/README.md b/README.md index 73dbb79a..8b4a1546 100644 --- a/README.md +++ b/README.md @@ -315,6 +315,8 @@ information on what to include when reporting a bug. - [Wayland] Added support for key names via xkbcommon - [Wayland] Added support for file path drop events (#2040) - [Wayland] Added support for more human-readable monitor names where available + - [Wayland] Disabled alpha channel for opaque windows on systems lacking + `EGL_EXT_present_opaque` (#1895) - [Wayland] Removed support for `wl_shell` (#1443) - [Wayland] Bugfix: The `GLFW_HAND_CURSOR` shape used the wrong image (#1432) - [Wayland] Bugfix: `CLOCK_MONOTONIC` was not correctly enabled diff --git a/docs/news.dox b/docs/news.dox index 8601d6c3..b8854a0a 100644 --- a/docs/news.dox +++ b/docs/news.dox @@ -126,6 +126,19 @@ To work around this, call any joystick function before waiting for events, for example by setting a [joystick callback](@ref joystick_event). +@subsubsection wayland_alpha_34 Frambuffer may lack alpha channel on older Wayland systems + +On Wayland, when creating an EGL context on a machine lacking the new +`EGL_EXT_present_opaque` extension, the @ref GLFW_ALPHA_BITS window hint will be +ignored and the framebuffer will have no alpha channel. This is because some +Wayland compositors treat any buffer with an alpha channel as per-pixel +transparent. + +If you want a per-pixel transparent window, see the +[GLFW_TRANSPARENT_FRAMEBUFFER](@ref GLFW_TRANSPARENT_FRAMEBUFFER_hint) window +hint. + + @subsubsection standalone_34 Tests and examples are disabled when built as a subproject GLFW now does not build the tests and examples when it is added as diff --git a/src/egl_context.c b/src/egl_context.c index 490770cd..bc5f3e60 100644 --- a/src/egl_context.c +++ b/src/egl_context.c @@ -173,6 +173,21 @@ static GLFWbool chooseEGLConfig(const _GLFWctxconfig* ctxconfig, u->depthBits = getEGLConfigAttrib(n, EGL_DEPTH_SIZE); u->stencilBits = getEGLConfigAttrib(n, EGL_STENCIL_SIZE); +#if defined(_GLFW_WAYLAND) + if (_glfw.platform.platformID == GLFW_PLATFORM_WAYLAND) + { + // NOTE: The wl_surface opaque region is no guarantee that its buffer + // is presented as opaque, if it also has an alpha channel + // HACK: If EGL_EXT_present_opaque is unavailable, ignore any config + // with an alpha channel to ensure the buffer is opaque + if (!_glfw.egl.EXT_present_opaque) + { + if (!desired->transparent && u->alphaBits > 0) + continue; + } + } +#endif // _GLFW_WAYLAND + u->samples = getEGLConfigAttrib(n, EGL_SAMPLES); u->doublebuffer = desired->doublebuffer; From 2c0f34b60f7c7a07183ed71754b0156ece3b6c1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Sun, 24 Apr 2022 22:31:28 +0200 Subject: [PATCH 105/117] WGL: Fix count of displayable pixel formats We only care about displayable pixel formats (as defined in WGL_ARB_pixel_format) for window context creation. This changes pixel format enumeration to ignore non-displayable formats, which are specified to be listed after displayable ones, by always using the return value of DescribePixelFormat as the pixel format count. --- src/wgl_context.c | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-) diff --git a/src/wgl_context.c b/src/wgl_context.c index a82c736b..4a5e77a8 100644 --- a/src/wgl_context.c +++ b/src/wgl_context.c @@ -72,18 +72,13 @@ static int choosePixelFormatWGL(_GLFWwindow* window, int attribs[40]; int values[sizeof(attribs) / sizeof(attribs[0])]; + nativeCount = DescribePixelFormat(window->context.wgl.dc, + 1, + sizeof(PIXELFORMATDESCRIPTOR), + NULL); + if (_glfw.wgl.ARB_pixel_format) { - const int attrib = WGL_NUMBER_PIXEL_FORMATS_ARB; - - if (!wglGetPixelFormatAttribivARB(window->context.wgl.dc, - 1, 0, 1, &attrib, &nativeCount)) - { - _glfwInputErrorWin32(GLFW_PLATFORM_ERROR, - "WGL: Failed to retrieve pixel format attribute"); - return 0; - } - ADD_ATTRIB(WGL_SUPPORT_OPENGL_ARB); ADD_ATTRIB(WGL_DRAW_TO_WINDOW_ARB); ADD_ATTRIB(WGL_PIXEL_TYPE_ARB); @@ -121,13 +116,6 @@ static int choosePixelFormatWGL(_GLFWwindow* window, ADD_ATTRIB(WGL_COLORSPACE_EXT); } } - else - { - nativeCount = DescribePixelFormat(window->context.wgl.dc, - 1, - sizeof(PIXELFORMATDESCRIPTOR), - NULL); - } usableConfigs = _glfw_calloc(nativeCount, sizeof(_GLFWfbconfig)); From 6b57e08bb0078c9834889eab871bac2368198c15 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Mon, 15 Aug 2022 23:29:10 +0200 Subject: [PATCH 106/117] Check if context creation APIs match when sharing --- src/context.c | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/src/context.c b/src/context.c index 7e0449b4..33b399c9 100644 --- a/src/context.c +++ b/src/context.c @@ -48,16 +48,6 @@ // GLFWbool _glfwIsValidContextConfig(const _GLFWctxconfig* ctxconfig) { - if (ctxconfig->share) - { - if (ctxconfig->client == GLFW_NO_API || - ctxconfig->share->context.client == GLFW_NO_API) - { - _glfwInputError(GLFW_NO_WINDOW_CONTEXT, NULL); - return GLFW_FALSE; - } - } - if (ctxconfig->source != GLFW_NATIVE_CONTEXT_API && ctxconfig->source != GLFW_EGL_CONTEXT_API && ctxconfig->source != GLFW_OSMESA_CONTEXT_API) @@ -78,6 +68,23 @@ GLFWbool _glfwIsValidContextConfig(const _GLFWctxconfig* ctxconfig) return GLFW_FALSE; } + if (ctxconfig->share) + { + if (ctxconfig->client == GLFW_NO_API || + ctxconfig->share->context.client == GLFW_NO_API) + { + _glfwInputError(GLFW_NO_WINDOW_CONTEXT, NULL); + return GLFW_FALSE; + } + + if (ctxconfig->source != ctxconfig->share->context.source) + { + _glfwInputError(GLFW_INVALID_ENUM, + "Context creation APIs do not match between contexts"); + return GLFW_FALSE; + } + } + if (ctxconfig->client == GLFW_OPENGL_API) { if ((ctxconfig->major < 1 || ctxconfig->minor < 0) || From e0576666426ff321414f54aefc7583cf457865fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Fri, 26 Aug 2022 18:16:29 +0200 Subject: [PATCH 107/117] EGL: Add better errors for client API mismatch Because EGL ties client API support to configs, attempts to create a context with an unavailable client API will fail with the unhelpful "failed to find suitable config" error description. This attempts to detect cases where there are usable configs for the other client API and emit a hopefully more helpful error. Related to #2173 --- src/egl_context.c | 69 ++++++++++++++++++++++++++++++----------------- 1 file changed, 44 insertions(+), 25 deletions(-) diff --git a/src/egl_context.c b/src/egl_context.c index bc5f3e60..d806e417 100644 --- a/src/egl_context.c +++ b/src/egl_context.c @@ -94,7 +94,18 @@ static GLFWbool chooseEGLConfig(const _GLFWctxconfig* ctxconfig, EGLConfig* nativeConfigs; _GLFWfbconfig* usableConfigs; const _GLFWfbconfig* closest; - int i, nativeCount, usableCount; + int i, nativeCount, usableCount, apiBit; + GLFWbool wrongApiAvailable = GLFW_FALSE; + + if (ctxconfig->client == GLFW_OPENGL_ES_API) + { + if (ctxconfig->major == 1) + apiBit = EGL_OPENGL_ES_BIT; + else + apiBit = EGL_OPENGL_ES2_BIT; + } + else + apiBit = EGL_OPENGL_BIT; eglGetConfigs(_glfw.egl.display, NULL, 0, &nativeCount); if (!nativeCount) @@ -146,23 +157,10 @@ static GLFWbool chooseEGLConfig(const _GLFWctxconfig* ctxconfig, } #endif // _GLFW_X11 - if (ctxconfig->client == GLFW_OPENGL_ES_API) + if (!(getEGLConfigAttrib(n, EGL_RENDERABLE_TYPE) & apiBit)) { - if (ctxconfig->major == 1) - { - if (!(getEGLConfigAttrib(n, EGL_RENDERABLE_TYPE) & EGL_OPENGL_ES_BIT)) - continue; - } - else - { - if (!(getEGLConfigAttrib(n, EGL_RENDERABLE_TYPE) & EGL_OPENGL_ES2_BIT)) - continue; - } - } - else if (ctxconfig->client == GLFW_OPENGL_API) - { - if (!(getEGLConfigAttrib(n, EGL_RENDERABLE_TYPE) & EGL_OPENGL_BIT)) - continue; + wrongApiAvailable = GLFW_TRUE; + continue; } u->redBits = getEGLConfigAttrib(n, EGL_RED_SIZE); @@ -198,6 +196,35 @@ static GLFWbool chooseEGLConfig(const _GLFWctxconfig* ctxconfig, closest = _glfwChooseFBConfig(desired, usableConfigs, usableCount); if (closest) *result = (EGLConfig) closest->handle; + else + { + if (wrongApiAvailable) + { + if (ctxconfig->client == GLFW_OPENGL_ES_API) + { + if (ctxconfig->major == 1) + { + _glfwInputError(GLFW_API_UNAVAILABLE, + "EGL: Failed to find support for OpenGL ES 1.x"); + } + else + { + _glfwInputError(GLFW_API_UNAVAILABLE, + "EGL: Failed to find support for OpenGL ES 2 or later"); + } + } + else + { + _glfwInputError(GLFW_API_UNAVAILABLE, + "EGL: Failed to find support for OpenGL"); + } + } + else + { + _glfwInputError(GLFW_FORMAT_UNAVAILABLE, + "EGL: Failed to find a suitable EGLConfig"); + } + } _glfw_free(nativeConfigs); _glfw_free(usableConfigs); @@ -550,11 +577,7 @@ GLFWbool _glfwCreateContextEGL(_GLFWwindow* window, share = ctxconfig->share->context.egl.handle; if (!chooseEGLConfig(ctxconfig, fbconfig, &config)) - { - _glfwInputError(GLFW_FORMAT_UNAVAILABLE, - "EGL: Failed to find a suitable EGLConfig"); return GLFW_FALSE; - } if (ctxconfig->client == GLFW_OPENGL_ES_API) { @@ -815,11 +838,7 @@ GLFWbool _glfwChooseVisualEGL(const _GLFWwndconfig* wndconfig, const long vimask = VisualScreenMask | VisualIDMask; if (!chooseEGLConfig(ctxconfig, fbconfig, &native)) - { - _glfwInputError(GLFW_FORMAT_UNAVAILABLE, - "EGL: Failed to find a suitable EGLConfig"); return GLFW_FALSE; - } eglGetConfigAttrib(_glfw.egl.display, native, EGL_NATIVE_VISUAL_ID, &visualID); From 93e93135f22c27a0120c5b0c7f2242901c8b1b52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Fri, 26 Aug 2022 19:00:08 +0200 Subject: [PATCH 108/117] EGL: Add better error for no stereo --- src/egl_context.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/egl_context.c b/src/egl_context.c index d806e417..acf217b2 100644 --- a/src/egl_context.c +++ b/src/egl_context.c @@ -107,6 +107,12 @@ static GLFWbool chooseEGLConfig(const _GLFWctxconfig* ctxconfig, else apiBit = EGL_OPENGL_BIT; + if (desired->stereo) + { + _glfwInputError(GLFW_FORMAT_UNAVAILABLE, "EGL: Stereo rendering not supported"); + return GLFW_FALSE; + } + eglGetConfigs(_glfw.egl.display, NULL, 0, &nativeCount); if (!nativeCount) { From ab1b1edfd08352da95e84118b1c91bf612117f56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Fri, 26 Aug 2022 19:08:18 +0200 Subject: [PATCH 109/117] EGL: Cleanup Both config parameters are "desired", but one is older and never had its name updated. This commit at least makes it clearer that they are similar. --- src/egl_context.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/egl_context.c b/src/egl_context.c index acf217b2..64dcdd6f 100644 --- a/src/egl_context.c +++ b/src/egl_context.c @@ -88,7 +88,7 @@ static int getEGLConfigAttrib(EGLConfig config, int attrib) // Return the EGLConfig most closely matching the specified hints // static GLFWbool chooseEGLConfig(const _GLFWctxconfig* ctxconfig, - const _GLFWfbconfig* desired, + const _GLFWfbconfig* fbconfig, EGLConfig* result) { EGLConfig* nativeConfigs; @@ -107,7 +107,7 @@ static GLFWbool chooseEGLConfig(const _GLFWctxconfig* ctxconfig, else apiBit = EGL_OPENGL_BIT; - if (desired->stereo) + if (fbconfig->stereo) { _glfwInputError(GLFW_FORMAT_UNAVAILABLE, "EGL: Stereo rendering not supported"); return GLFW_FALSE; @@ -149,7 +149,7 @@ static GLFWbool chooseEGLConfig(const _GLFWctxconfig* ctxconfig, if (!vi.visualid) continue; - if (desired->transparent) + if (fbconfig->transparent) { int count; XVisualInfo* vis = @@ -186,20 +186,20 @@ static GLFWbool chooseEGLConfig(const _GLFWctxconfig* ctxconfig, // with an alpha channel to ensure the buffer is opaque if (!_glfw.egl.EXT_present_opaque) { - if (!desired->transparent && u->alphaBits > 0) + if (!fbconfig->transparent && u->alphaBits > 0) continue; } } #endif // _GLFW_WAYLAND u->samples = getEGLConfigAttrib(n, EGL_SAMPLES); - u->doublebuffer = desired->doublebuffer; + u->doublebuffer = fbconfig->doublebuffer; u->handle = (uintptr_t) n; usableCount++; } - closest = _glfwChooseFBConfig(desired, usableConfigs, usableCount); + closest = _glfwChooseFBConfig(fbconfig, usableConfigs, usableCount); if (closest) *result = (EGLConfig) closest->handle; else From 8a72918bcd2bac52ce733c4a973209afb9a5020a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Sun, 4 Sep 2022 22:24:12 +0200 Subject: [PATCH 110/117] Move helper macros to single point of use --- src/internal.h | 7 ------- src/platform.c | 8 +++++++- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/internal.h b/src/internal.h index 5aa22f59..781c8cdc 100644 --- a/src/internal.h +++ b/src/internal.h @@ -330,13 +330,6 @@ typedef VkResult (APIENTRY * PFN_vkEnumerateInstanceExtensionProperties)(const c #include "platform.h" -// Constructs a version number string from the public header macros -#define _GLFW_CONCAT_VERSION(m, n, r) #m "." #n "." #r -#define _GLFW_MAKE_VERSION(m, n, r) _GLFW_CONCAT_VERSION(m, n, r) -#define _GLFW_VERSION_NUMBER _GLFW_MAKE_VERSION(GLFW_VERSION_MAJOR, \ - GLFW_VERSION_MINOR, \ - GLFW_VERSION_REVISION) - // Checks for whether the library has been initialized #define _GLFW_REQUIRE_INIT() \ if (!_glfw.initialized) \ diff --git a/src/platform.c b/src/platform.c index d0bbd06d..c5966ae7 100644 --- a/src/platform.c +++ b/src/platform.c @@ -29,6 +29,10 @@ #include "internal.h" +// These construct a string literal from individual numeric constants +#define _GLFW_CONCAT_VERSION(m, n, r) #m "." #n "." #r +#define _GLFW_MAKE_VERSION(m, n, r) _GLFW_CONCAT_VERSION(m, n, r) + ////////////////////////////////////////////////////////////////////////// ////// GLFW internal API ////// ////////////////////////////////////////////////////////////////////////// @@ -146,7 +150,9 @@ GLFWAPI int glfwPlatformSupported(int platformID) GLFWAPI const char* glfwGetVersionString(void) { - return _GLFW_VERSION_NUMBER + return _GLFW_MAKE_VERSION(GLFW_VERSION_MAJOR, + GLFW_VERSION_MINOR, + GLFW_VERSION_REVISION) #if defined(_GLFW_WIN32) " Win32 WGL" #endif From c812b9d87cb4afaae44ca7e9e6f40ddd35cce44f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Tue, 9 Nov 2021 19:44:00 +0100 Subject: [PATCH 111/117] Add conditional compilation for platform units This is a step towards being able to compile GLFW manually without needing to duplicate a lot of platform- or OS-specific logic. --- CONTRIBUTORS.md | 1 + src/cocoa_init.m | 5 +++++ src/cocoa_joystick.h | 2 -- src/cocoa_joystick.m | 4 ++++ src/cocoa_monitor.m | 4 ++++ src/cocoa_time.c | 4 ++++ src/cocoa_window.m | 4 ++++ src/glx_context.c | 4 ++++ src/linux_joystick.c | 4 ++++ src/linux_joystick.h | 2 -- src/mappings.h | 12 ++++++------ src/mappings.h.in | 12 ++++++------ src/nsgl_context.m | 4 ++++ src/platform.h | 46 +++++++++++++++++++++++++++++++++++++++++--- src/posix_module.c | 4 ++++ src/posix_poll.c | 4 ++++ src/posix_thread.c | 4 ++++ src/posix_time.c | 4 ++++ src/wgl_context.c | 4 ++++ src/win32_init.c | 4 ++++ src/win32_joystick.c | 4 ++++ src/win32_joystick.h | 2 -- src/win32_module.c | 4 ++++ src/win32_monitor.c | 4 ++++ src/win32_thread.c | 4 ++++ src/win32_time.c | 3 +++ src/win32_window.c | 4 ++++ src/wl_init.c | 6 +++++- src/wl_monitor.c | 4 ++++ src/wl_window.c | 4 ++++ src/x11_init.c | 6 +++++- src/x11_monitor.c | 4 ++++ src/x11_window.c | 8 ++++++-- src/xkb_unicode.c | 3 +++ 34 files changed, 167 insertions(+), 25 deletions(-) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index d938afae..e0bb9368 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -243,6 +243,7 @@ video tutorials. - Torsten Walluhn - Patrick Walton - Xo Wang + - Andre Weissflog - Jay Weisskopf - Frank Wille - Andy Williams diff --git a/src/cocoa_init.m b/src/cocoa_init.m index aa369f9c..b3831df1 100644 --- a/src/cocoa_init.m +++ b/src/cocoa_init.m @@ -27,6 +27,9 @@ //======================================================================== #include "internal.h" + +#if defined(_GLFW_COCOA) + #include // For MAXPATHLEN // Needed for _NSGetProgname @@ -690,3 +693,5 @@ void _glfwTerminateCocoa(void) } // autoreleasepool } +#endif // _GLFW_COCOA + diff --git a/src/cocoa_joystick.h b/src/cocoa_joystick.h index fc7ba7a2..2f46dfcb 100644 --- a/src/cocoa_joystick.h +++ b/src/cocoa_joystick.h @@ -31,8 +31,6 @@ #define GLFW_COCOA_JOYSTICK_STATE _GLFWjoystickNS ns; #define GLFW_COCOA_LIBRARY_JOYSTICK_STATE -#define GLFW_BUILD_COCOA_MAPPINGS - // Cocoa-specific per-joystick data // typedef struct _GLFWjoystickNS diff --git a/src/cocoa_joystick.m b/src/cocoa_joystick.m index ebcf5fdb..865adac7 100644 --- a/src/cocoa_joystick.m +++ b/src/cocoa_joystick.m @@ -29,6 +29,8 @@ #include "internal.h" +#if defined(_GLFW_COCOA) + #include #include #include @@ -476,3 +478,5 @@ void _glfwUpdateGamepadGUIDCocoa(char* guid) } } +#endif // _GLFW_COCOA + diff --git a/src/cocoa_monitor.m b/src/cocoa_monitor.m index 64d9eb2c..6c7315bd 100644 --- a/src/cocoa_monitor.m +++ b/src/cocoa_monitor.m @@ -29,6 +29,8 @@ #include "internal.h" +#if defined(_GLFW_COCOA) + #include #include #include @@ -625,3 +627,5 @@ GLFWAPI CGDirectDisplayID glfwGetCocoaMonitor(GLFWmonitor* handle) return monitor->ns.displayID; } +#endif // _GLFW_COCOA + diff --git a/src/cocoa_time.c b/src/cocoa_time.c index c2bf8eda..8da367aa 100644 --- a/src/cocoa_time.c +++ b/src/cocoa_time.c @@ -28,6 +28,8 @@ #include "internal.h" +#if defined(GLFW_BUILD_COCOA_TIMER) + #include @@ -53,3 +55,5 @@ uint64_t _glfwPlatformGetTimerFrequency(void) return _glfw.timer.ns.frequency; } +#endif // GLFW_BUILD_COCOA_TIMER + diff --git a/src/cocoa_window.m b/src/cocoa_window.m index daac39b3..6f8aa978 100644 --- a/src/cocoa_window.m +++ b/src/cocoa_window.m @@ -28,6 +28,8 @@ #include "internal.h" +#if defined(_GLFW_COCOA) + #include #include @@ -2047,3 +2049,5 @@ GLFWAPI id glfwGetCocoaWindow(GLFWwindow* handle) return window->ns.object; } +#endif // _GLFW_COCOA + diff --git a/src/glx_context.c b/src/glx_context.c index 3c38807f..4406dfd3 100644 --- a/src/glx_context.c +++ b/src/glx_context.c @@ -29,6 +29,8 @@ #include "internal.h" +#if defined(_GLFW_X11) + #include #include #include @@ -714,3 +716,5 @@ GLFWAPI GLXWindow glfwGetGLXWindow(GLFWwindow* handle) return window->context.glx.window; } +#endif // _GLFW_X11 + diff --git a/src/linux_joystick.c b/src/linux_joystick.c index 366bda2d..26db853e 100644 --- a/src/linux_joystick.c +++ b/src/linux_joystick.c @@ -29,6 +29,8 @@ #include "internal.h" +#if defined(GLFW_BUILD_LINUX_JOYSTICK) + #include #include #include @@ -429,3 +431,5 @@ void _glfwUpdateGamepadGUIDLinux(char* guid) { } +#endif // GLFW_BUILD_LINUX_JOYSTICK + diff --git a/src/linux_joystick.h b/src/linux_joystick.h index f898b2b9..df605e72 100644 --- a/src/linux_joystick.h +++ b/src/linux_joystick.h @@ -31,8 +31,6 @@ #define GLFW_LINUX_JOYSTICK_STATE _GLFWjoystickLinux linjs; #define GLFW_LINUX_LIBRARY_JOYSTICK_STATE _GLFWlibraryLinux linjs; -#define GLFW_BUILD_LINUX_MAPPINGS - // Linux-specific joystick data // typedef struct _GLFWjoystickLinux diff --git a/src/mappings.h b/src/mappings.h index 553fe2a2..270fa4cd 100644 --- a/src/mappings.h +++ b/src/mappings.h @@ -60,7 +60,7 @@ const char* _glfwDefaultMappings[] = { -#if defined(GLFW_BUILD_WIN32_MAPPINGS) +#if defined(_GLFW_WIN32) "03000000fa2d00000100000000000000,3DRUDDER,leftx:a0,lefty:a1,rightx:a5,righty:a2,platform:Windows,", "03000000c82d00002038000000000000,8bitdo,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b2,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b4,y:b3,platform:Windows,", "03000000c82d00000951000000000000,8BitDo Dogbone Modkit,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,start:b11,platform:Windows,", @@ -426,9 +426,9 @@ const char* _glfwDefaultMappings[] = "78696e70757405000000000000000000,XInput Dance Pad (GLFW),platform:Windows,a:b0,b:b1,x:b2,y:b3,leftshoulder:b4,rightshoulder:b5,back:b6,start:b7,leftstick:b8,rightstick:b9,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,dpup:h0.1,dpright:h0.2,dpdown:h0.4,dpleft:h0.8,", "78696e70757406000000000000000000,XInput Guitar (GLFW),platform:Windows,a:b0,b:b1,x:b2,y:b3,leftshoulder:b4,rightshoulder:b5,back:b6,start:b7,leftstick:b8,rightstick:b9,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,dpup:h0.1,dpright:h0.2,dpdown:h0.4,dpleft:h0.8,", "78696e70757408000000000000000000,XInput Drum Kit (GLFW),platform:Windows,a:b0,b:b1,x:b2,y:b3,leftshoulder:b4,rightshoulder:b5,back:b6,start:b7,leftstick:b8,rightstick:b9,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,dpup:h0.1,dpright:h0.2,dpdown:h0.4,dpleft:h0.8,", -#endif // GLFW_BUILD_WIN32_MAPPINGS +#endif // _GLFW_WIN32 -#if defined(GLFW_BUILD_COCOA_MAPPINGS) +#if defined(_GLFW_COCOA) "030000008f0e00000300000009010000,2In1 USB Joystick,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,platform:Mac OS X,", "03000000c82d00000090000001000000,8BitDo FC30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a5,rightx:a2,righty:a3,start:b11,x:b4,y:b3,platform:Mac OS X,", "03000000c82d00001038000000010000,8BitDo FC30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b4,y:b3,platform:Mac OS X,", @@ -598,9 +598,9 @@ const char* _glfwDefaultMappings[] = "03000000172700004431000029010000,XiaoMi Game Controller,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b15,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a6,rightx:a2,righty:a5,start:b11,x:b3,y:b4,platform:Mac OS X,", "03000000120c0000100e000000010000,ZEROPLUS P4 Gamepad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Mac OS X,", "03000000120c0000101e000000010000,ZEROPLUS P4 Wired Gamepad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Mac OS X,", -#endif // GLFW_BUILD_COCOA_MAPPINGS +#endif // _GLFW_COCOA -#if defined(GLFW_BUILD_LINUX_MAPPINGS) +#if defined(GLFW_BUILD_LINUX_JOYSTICK) "03000000c82d00000090000011010000,8BitDo FC30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a5,rightx:a2,righty:a3,start:b11,x:b4,y:b3,platform:Linux,", "05000000c82d00001038000000010000,8Bitdo FC30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a3,start:b11,x:b4,y:b3,platform:Linux,", "05000000c82d00005106000000010000,8BitDo M30,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b8,lefttrigger:b9,leftx:a0,lefty:a1,rightshoulder:b6,righttrigger:b7,start:b11,x:b3,y:b4,platform:Linux,", @@ -996,6 +996,6 @@ const char* _glfwDefaultMappings[] = "03000000c0160000e105000001010000,Xin-Mo Xin-Mo Dual Arcade,a:b4,b:b3,back:b6,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b9,leftshoulder:b2,leftx:a0,lefty:a1,rightshoulder:b5,start:b7,x:b1,y:b0,platform:Linux,", "03000000120c0000100e000011010000,ZEROPLUS P4 Gamepad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Linux,", "03000000120c0000101e000011010000,ZEROPLUS P4 Wired Gamepad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Linux,", -#endif // GLFW_BUILD_LINUX_MAPPINGS +#endif // GLFW_BUILD_LINUX_JOYSTICK }; diff --git a/src/mappings.h.in b/src/mappings.h.in index f2604390..ed623680 100644 --- a/src/mappings.h.in +++ b/src/mappings.h.in @@ -60,7 +60,7 @@ const char* _glfwDefaultMappings[] = { -#if defined(GLFW_BUILD_WIN32_MAPPINGS) +#if defined(_GLFW_WIN32) @GLFW_WIN32_MAPPINGS@ "78696e70757401000000000000000000,XInput Gamepad (GLFW),platform:Windows,a:b0,b:b1,x:b2,y:b3,leftshoulder:b4,rightshoulder:b5,back:b6,start:b7,leftstick:b8,rightstick:b9,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,dpup:h0.1,dpright:h0.2,dpdown:h0.4,dpleft:h0.8,", "78696e70757402000000000000000000,XInput Wheel (GLFW),platform:Windows,a:b0,b:b1,x:b2,y:b3,leftshoulder:b4,rightshoulder:b5,back:b6,start:b7,leftstick:b8,rightstick:b9,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,dpup:h0.1,dpright:h0.2,dpdown:h0.4,dpleft:h0.8,", @@ -69,14 +69,14 @@ const char* _glfwDefaultMappings[] = "78696e70757405000000000000000000,XInput Dance Pad (GLFW),platform:Windows,a:b0,b:b1,x:b2,y:b3,leftshoulder:b4,rightshoulder:b5,back:b6,start:b7,leftstick:b8,rightstick:b9,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,dpup:h0.1,dpright:h0.2,dpdown:h0.4,dpleft:h0.8,", "78696e70757406000000000000000000,XInput Guitar (GLFW),platform:Windows,a:b0,b:b1,x:b2,y:b3,leftshoulder:b4,rightshoulder:b5,back:b6,start:b7,leftstick:b8,rightstick:b9,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,dpup:h0.1,dpright:h0.2,dpdown:h0.4,dpleft:h0.8,", "78696e70757408000000000000000000,XInput Drum Kit (GLFW),platform:Windows,a:b0,b:b1,x:b2,y:b3,leftshoulder:b4,rightshoulder:b5,back:b6,start:b7,leftstick:b8,rightstick:b9,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,dpup:h0.1,dpright:h0.2,dpdown:h0.4,dpleft:h0.8,", -#endif // GLFW_BUILD_WIN32_MAPPINGS +#endif // _GLFW_WIN32 -#if defined(GLFW_BUILD_COCOA_MAPPINGS) +#if defined(_GLFW_COCOA) @GLFW_COCOA_MAPPINGS@ -#endif // GLFW_BUILD_COCOA_MAPPINGS +#endif // _GLFW_COCOA -#if defined(GLFW_BUILD_LINUX_MAPPINGS) +#if defined(GLFW_BUILD_LINUX_JOYSTICK) @GLFW_LINUX_MAPPINGS@ -#endif // GLFW_BUILD_LINUX_MAPPINGS +#endif // GLFW_BUILD_LINUX_JOYSTICK }; diff --git a/src/nsgl_context.m b/src/nsgl_context.m index fc1f7521..878f32ed 100644 --- a/src/nsgl_context.m +++ b/src/nsgl_context.m @@ -28,6 +28,8 @@ #include "internal.h" +#if defined(_GLFW_COCOA) + #include #include @@ -374,3 +376,5 @@ GLFWAPI id glfwGetNSGLContext(GLFWwindow* handle) return window->context.nsgl.object; } +#endif // _GLFW_COCOA + diff --git a/src/platform.h b/src/platform.h index 0c593676..4e924a69 100644 --- a/src/platform.h +++ b/src/platform.h @@ -25,6 +25,18 @@ // //======================================================================== +#if defined(GLFW_BUILD_WIN32_TIMER) || \ + defined(GLFW_BUILD_WIN32_MODULE) || \ + defined(GLFW_BUILD_WIN32_THREAD) || \ + defined(GLFW_BUILD_COCOA_TIMER) || \ + defined(GLFW_BUILD_POSIX_TIMER) || \ + defined(GLFW_BUILD_POSIX_MODULE) || \ + defined(GLFW_BUILD_POSIX_THREAD) || \ + defined(GLFW_BUILD_POSIX_POLL) || \ + defined(GLFW_BUILD_LINUX_JOYSTICK) + #error "You must not define these; define zero or more _GLFW_ macros instead" +#endif + #include "null_platform.h" #if defined(_GLFW_WIN32) @@ -86,6 +98,10 @@ #endif #if (defined(_GLFW_X11) || defined(_GLFW_WAYLAND)) && defined(__linux__) + #define GLFW_BUILD_LINUX_JOYSTICK +#endif + +#if defined(GLFW_BUILD_LINUX_JOYSTICK) #include "linux_joystick.h" #else #define GLFW_LINUX_JOYSTICK_STATE @@ -141,23 +157,47 @@ GLFW_GLX_LIBRARY_CONTEXT_STATE #if defined(_WIN32) + #define GLFW_BUILD_WIN32_THREAD +#else + #define GLFW_BUILD_POSIX_THREAD +#endif + +#if defined(GLFW_BUILD_WIN32_THREAD) #include "win32_thread.h" #define GLFW_PLATFORM_TLS_STATE GLFW_WIN32_TLS_STATE #define GLFW_PLATFORM_MUTEX_STATE GLFW_WIN32_MUTEX_STATE -#else +#elif defined(GLFW_BUILD_POSIX_THREAD) #include "posix_thread.h" #define GLFW_PLATFORM_TLS_STATE GLFW_POSIX_TLS_STATE #define GLFW_PLATFORM_MUTEX_STATE GLFW_POSIX_MUTEX_STATE #endif #if defined(_WIN32) + #define GLFW_BUILD_WIN32_TIMER +#elif defined(__APPLE__) + #define GLFW_BUILD_COCOA_TIMER +#else + #define GLFW_BUILD_POSIX_TIMER +#endif + +#if defined(GLFW_BUILD_WIN32_TIMER) #include "win32_time.h" #define GLFW_PLATFORM_LIBRARY_TIMER_STATE GLFW_WIN32_LIBRARY_TIMER_STATE -#elif defined(__APPLE__) +#elif defined(GLFW_BUILD_COCOA_TIMER) #include "cocoa_time.h" #define GLFW_PLATFORM_LIBRARY_TIMER_STATE GLFW_COCOA_LIBRARY_TIMER_STATE -#else +#elif defined(GLFW_BUILD_POSIX_TIMER) #include "posix_time.h" #define GLFW_PLATFORM_LIBRARY_TIMER_STATE GLFW_POSIX_LIBRARY_TIMER_STATE #endif +#if defined(_WIN32) + #define GLFW_BUILD_WIN32_MODULE +#else + #define GLFW_BUILD_POSIX_MODULE +#endif + +#if defined(_GLFW_WAYLAND) || defined(_GLFW_X11) + #define GLFW_BUILD_POSIX_POLL +#endif + diff --git a/src/posix_module.c b/src/posix_module.c index 7079e5b4..ba5024a3 100644 --- a/src/posix_module.c +++ b/src/posix_module.c @@ -28,6 +28,8 @@ #include "internal.h" +#if defined(GLFW_BUILD_POSIX_MODULE) + #include ////////////////////////////////////////////////////////////////////////// @@ -49,3 +51,5 @@ GLFWproc _glfwPlatformGetModuleSymbol(void* module, const char* name) return dlsym(module, name); } +#endif // GLFW_BUILD_POSIX_MODULE + diff --git a/src/posix_poll.c b/src/posix_poll.c index 676a8a51..a5016a13 100644 --- a/src/posix_poll.c +++ b/src/posix_poll.c @@ -30,6 +30,8 @@ #include "internal.h" +#if defined(GLFW_BUILD_POSIX_POLL) + #include #include #include @@ -79,3 +81,5 @@ GLFWbool _glfwPollPOSIX(struct pollfd* fds, nfds_t count, double* timeout) } } +#endif // GLFW_BUILD_POSIX_POLL + diff --git a/src/posix_thread.c b/src/posix_thread.c index 02361457..4ce55526 100644 --- a/src/posix_thread.c +++ b/src/posix_thread.c @@ -29,6 +29,8 @@ #include "internal.h" +#if defined(GLFW_BUILD_POSIX_THREAD) + #include #include @@ -103,3 +105,5 @@ void _glfwPlatformUnlockMutex(_GLFWmutex* mutex) pthread_mutex_unlock(&mutex->posix.handle); } +#endif // GLFW_BUILD_POSIX_THREAD + diff --git a/src/posix_time.c b/src/posix_time.c index f134be47..caed678e 100644 --- a/src/posix_time.c +++ b/src/posix_time.c @@ -29,6 +29,8 @@ #include "internal.h" +#if defined(GLFW_BUILD_POSIX_TIMER) + #include #include @@ -61,3 +63,5 @@ uint64_t _glfwPlatformGetTimerFrequency(void) return _glfw.timer.posix.frequency; } +#endif // GLFW_BUILD_POSIX_TIMER + diff --git a/src/wgl_context.c b/src/wgl_context.c index 4a5e77a8..cfe24b27 100644 --- a/src/wgl_context.c +++ b/src/wgl_context.c @@ -29,6 +29,8 @@ #include "internal.h" +#if defined(_GLFW_WIN32) + #include #include @@ -776,3 +778,5 @@ GLFWAPI HGLRC glfwGetWGLContext(GLFWwindow* handle) return window->context.wgl.handle; } +#endif // _GLFW_WIN32 + diff --git a/src/win32_init.c b/src/win32_init.c index 8704150c..64393e77 100644 --- a/src/win32_init.c +++ b/src/win32_init.c @@ -29,6 +29,8 @@ #include "internal.h" +#if defined(_GLFW_WIN32) + #include static const GUID _glfw_GUID_DEVINTERFACE_HID = @@ -725,3 +727,5 @@ void _glfwTerminateWin32(void) freeLibraries(); } +#endif // _GLFW_WIN32 + diff --git a/src/win32_joystick.c b/src/win32_joystick.c index 3a28943b..4e83577a 100644 --- a/src/win32_joystick.c +++ b/src/win32_joystick.c @@ -29,6 +29,8 @@ #include "internal.h" +#if defined(_GLFW_WIN32) + #include #include @@ -756,3 +758,5 @@ void _glfwUpdateGamepadGUIDWin32(char* guid) } } +#endif // _GLFW_WIN32 + diff --git a/src/win32_joystick.h b/src/win32_joystick.h index d7c2bb6f..9ab6438b 100644 --- a/src/win32_joystick.h +++ b/src/win32_joystick.h @@ -27,8 +27,6 @@ #define GLFW_WIN32_JOYSTICK_STATE _GLFWjoystickWin32 win32; #define GLFW_WIN32_LIBRARY_JOYSTICK_STATE -#define GLFW_BUILD_WIN32_MAPPINGS - // Joystick element (axis, button or slider) // typedef struct _GLFWjoyobjectWin32 diff --git a/src/win32_module.c b/src/win32_module.c index 35bdd71d..9c2b6d24 100644 --- a/src/win32_module.c +++ b/src/win32_module.c @@ -28,6 +28,8 @@ #include "internal.h" +#if defined(GLFW_BUILD_WIN32_MODULE) + ////////////////////////////////////////////////////////////////////////// ////// GLFW platform API ////// ////////////////////////////////////////////////////////////////////////// @@ -47,3 +49,5 @@ GLFWproc _glfwPlatformGetModuleSymbol(void* module, const char* name) return (GLFWproc) GetProcAddress((HMODULE) module, name); } +#endif // GLFW_BUILD_WIN32_MODULE + diff --git a/src/win32_monitor.c b/src/win32_monitor.c index 57b44af3..2935ac28 100644 --- a/src/win32_monitor.c +++ b/src/win32_monitor.c @@ -29,6 +29,8 @@ #include "internal.h" +#if defined(_GLFW_WIN32) + #include #include #include @@ -545,3 +547,5 @@ GLFWAPI const char* glfwGetWin32Monitor(GLFWmonitor* handle) return monitor->win32.publicDisplayName; } +#endif // _GLFW_WIN32 + diff --git a/src/win32_thread.c b/src/win32_thread.c index 35b8f99e..db997915 100644 --- a/src/win32_thread.c +++ b/src/win32_thread.c @@ -29,6 +29,8 @@ #include "internal.h" +#if defined(GLFW_BUILD_WIN32_THREAD) + #include @@ -96,3 +98,5 @@ void _glfwPlatformUnlockMutex(_GLFWmutex* mutex) LeaveCriticalSection(&mutex->win32.section); } +#endif // GLFW_BUILD_WIN32_THREAD + diff --git a/src/win32_time.c b/src/win32_time.c index a1c64141..fcfe2005 100644 --- a/src/win32_time.c +++ b/src/win32_time.c @@ -29,6 +29,7 @@ #include "internal.h" +#if defined(GLFW_BUILD_WIN32_TIMER) ////////////////////////////////////////////////////////////////////////// ////// GLFW platform API ////// @@ -51,3 +52,5 @@ uint64_t _glfwPlatformGetTimerFrequency(void) return _glfw.timer.win32.frequency; } +#endif // GLFW_BUILD_WIN32_TIMER + diff --git a/src/win32_window.c b/src/win32_window.c index 69fb6422..e9be2b86 100644 --- a/src/win32_window.c +++ b/src/win32_window.c @@ -29,6 +29,8 @@ #include "internal.h" +#if defined(_GLFW_WIN32) + #include #include #include @@ -2510,3 +2512,5 @@ GLFWAPI HWND glfwGetWin32Window(GLFWwindow* handle) return window->win32.handle; } +#endif // _GLFW_WIN32 + diff --git a/src/wl_init.c b/src/wl_init.c index 8cbcc6e8..4e6b4294 100644 --- a/src/wl_init.c +++ b/src/wl_init.c @@ -28,6 +28,8 @@ #include "internal.h" +#if defined(_GLFW_WAYLAND) + #include #include #include @@ -392,7 +394,7 @@ GLFWbool _glfwConnectWayland(int platformID, _GLFWplatform* platform) _glfwGetKeyScancodeWayland, _glfwSetClipboardStringWayland, _glfwGetClipboardStringWayland, -#if defined(__linux__) +#if defined(_GLFW_LINUX_JOYSTICK) _glfwInitJoysticksLinux, _glfwTerminateJoysticksLinux, _glfwPollJoystickLinux, @@ -791,3 +793,5 @@ void _glfwTerminateWayland(void) _glfw_free(_glfw.wl.clipboardString); } +#endif // _GLFW_WAYLAND + diff --git a/src/wl_monitor.c b/src/wl_monitor.c index 336681fd..3d4fcbb8 100644 --- a/src/wl_monitor.c +++ b/src/wl_monitor.c @@ -28,6 +28,8 @@ #include "internal.h" +#if defined(_GLFW_WAYLAND) + #include #include #include @@ -270,3 +272,5 @@ GLFWAPI struct wl_output* glfwGetWaylandMonitor(GLFWmonitor* handle) return monitor->wl.output; } +#endif // _GLFW_WAYLAND + diff --git a/src/wl_window.c b/src/wl_window.c index 76d5f15b..c4d097b7 100644 --- a/src/wl_window.c +++ b/src/wl_window.c @@ -30,6 +30,8 @@ #include "internal.h" +#if defined(_GLFW_WAYLAND) + #include #include #include @@ -2887,3 +2889,5 @@ GLFWAPI struct wl_surface* glfwGetWaylandWindow(GLFWwindow* handle) return window->wl.surface; } +#endif // _GLFW_WAYLAND + diff --git a/src/x11_init.c b/src/x11_init.c index 11aeb9e5..1c69c0f6 100644 --- a/src/x11_init.c +++ b/src/x11_init.c @@ -29,6 +29,8 @@ #include "internal.h" +#if defined(_GLFW_X11) + #include #include #include @@ -1182,7 +1184,7 @@ GLFWbool _glfwConnectX11(int platformID, _GLFWplatform* platform) _glfwGetKeyScancodeX11, _glfwSetClipboardStringX11, _glfwGetClipboardStringX11, -#if defined(__linux__) +#if defined(_GLFW_LINUX_JOYSTICK) _glfwInitJoysticksLinux, _glfwTerminateJoysticksLinux, _glfwPollJoystickLinux, @@ -1652,3 +1654,5 @@ void _glfwTerminateX11(void) } } +#endif // _GLFW_X11 + diff --git a/src/x11_monitor.c b/src/x11_monitor.c index b031c83c..3183630b 100644 --- a/src/x11_monitor.c +++ b/src/x11_monitor.c @@ -29,6 +29,8 @@ #include "internal.h" +#if defined(_GLFW_X11) + #include #include #include @@ -614,3 +616,5 @@ GLFWAPI RROutput glfwGetX11Monitor(GLFWmonitor* handle) return monitor->x11.output; } +#endif // _GLFW_X11 + diff --git a/src/x11_window.c b/src/x11_window.c index 8a689ed1..2c46bfff 100644 --- a/src/x11_window.c +++ b/src/x11_window.c @@ -29,6 +29,8 @@ #include "internal.h" +#if defined(_GLFW_X11) + #include #include @@ -86,7 +88,7 @@ static GLFWbool waitForAnyEvent(double* timeout) { _glfw.x11.emptyEventPipe[0], POLLIN } }; -#if defined(__linux__) +#if defined(_GLFW_LINUX_JOYSTICK) if (_glfw.joysticksInitialized) fds[count++] = (struct pollfd) { _glfw.linjs.inotify, POLLIN }; #endif @@ -2781,7 +2783,7 @@ void _glfwPollEventsX11(void) { drainEmptyEvents(); -#if defined(__linux__) +#if defined(_GLFW_LINUX_JOYSTICK) if (_glfw.joysticksInitialized) _glfwDetectJoystickConnectionLinux(); #endif @@ -3349,3 +3351,5 @@ GLFWAPI const char* glfwGetX11SelectionString(void) return getSelectionString(_glfw.x11.PRIMARY); } +#endif // _GLFW_X11 + diff --git a/src/xkb_unicode.c b/src/xkb_unicode.c index 1b2482cd..a516af00 100644 --- a/src/xkb_unicode.c +++ b/src/xkb_unicode.c @@ -29,6 +29,7 @@ #include "internal.h" +#if defined(_GLFW_X11) || defined(_GLFW_WAYLAND) /* * Marcus: This code was originally written by Markus G. Kuhn. @@ -940,3 +941,5 @@ uint32_t _glfwKeySym2Unicode(unsigned int keysym) return GLFW_INVALID_CODEPOINT; } +#endif // _GLFW_WAYLAND or _GLFW_X11 + From ab3ea8ac9f1b3dbe6aaf2e830d35e93c30657064 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Thu, 21 Apr 2022 19:26:05 +0200 Subject: [PATCH 112/117] Win32: Remove unhelpful helper function --- src/win32_window.c | 94 ++++++++++++++++++++-------------------------- 1 file changed, 41 insertions(+), 53 deletions(-) diff --git a/src/win32_window.c b/src/win32_window.c index e9be2b86..676640bf 100644 --- a/src/win32_window.c +++ b/src/win32_window.c @@ -186,53 +186,38 @@ static HICON createIcon(const GLFWimage* image, int xhot, int yhot, GLFWbool ico return handle; } -// Translate content area size to full window size according to styles and DPI -// -static void getFullWindowSize(DWORD style, DWORD exStyle, - int contentWidth, int contentHeight, - int* fullWidth, int* fullHeight, - UINT dpi) -{ - RECT rect = { 0, 0, contentWidth, contentHeight }; - - if (_glfwIsWindows10Version1607OrGreaterWin32()) - AdjustWindowRectExForDpi(&rect, style, FALSE, exStyle, dpi); - else - AdjustWindowRectEx(&rect, style, FALSE, exStyle); - - *fullWidth = rect.right - rect.left; - *fullHeight = rect.bottom - rect.top; -} - // Enforce the content area aspect ratio based on which edge is being dragged // static void applyAspectRatio(_GLFWwindow* window, int edge, RECT* area) { - int xoff, yoff; - UINT dpi = USER_DEFAULT_SCREEN_DPI; + RECT frame = {0}; const float ratio = (float) window->numer / (float) window->denom; + const DWORD style = getWindowStyle(window); + const DWORD exStyle = getWindowExStyle(window); if (_glfwIsWindows10Version1607OrGreaterWin32()) - dpi = GetDpiForWindow(window->win32.handle); - - getFullWindowSize(getWindowStyle(window), getWindowExStyle(window), - 0, 0, &xoff, &yoff, dpi); + { + AdjustWindowRectExForDpi(&frame, style, FALSE, exStyle, + GetDpiForWindow(window->win32.handle)); + } + else + AdjustWindowRectEx(&frame, style, FALSE, exStyle); if (edge == WMSZ_LEFT || edge == WMSZ_BOTTOMLEFT || edge == WMSZ_RIGHT || edge == WMSZ_BOTTOMRIGHT) { - area->bottom = area->top + yoff + - (int) ((area->right - area->left - xoff) / ratio); + area->bottom = area->top + (frame.bottom - frame.top) + + (int) (((area->right - area->left) - (frame.right - frame.left)) / ratio); } else if (edge == WMSZ_TOPLEFT || edge == WMSZ_TOPRIGHT) { - area->top = area->bottom - yoff - - (int) ((area->right - area->left - xoff) / ratio); + area->top = area->bottom - (frame.bottom - frame.top) - + (int) (((area->right - area->left) - (frame.right - frame.left)) / ratio); } else if (edge == WMSZ_TOP || edge == WMSZ_BOTTOM) { - area->right = area->left + xoff + - (int) ((area->bottom - area->top - yoff) * ratio); + area->right = area->left + (frame.right - frame.left) + + (int) (((area->bottom - area->top) - (frame.bottom - frame.top)) * ratio); } } @@ -1082,31 +1067,34 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM l case WM_GETMINMAXINFO: { - int xoff, yoff; - UINT dpi = USER_DEFAULT_SCREEN_DPI; + RECT frame = {0}; MINMAXINFO* mmi = (MINMAXINFO*) lParam; + const DWORD style = getWindowStyle(window); + const DWORD exStyle = getWindowExStyle(window); if (window->monitor) break; if (_glfwIsWindows10Version1607OrGreaterWin32()) - dpi = GetDpiForWindow(window->win32.handle); - - getFullWindowSize(getWindowStyle(window), getWindowExStyle(window), - 0, 0, &xoff, &yoff, dpi); + { + AdjustWindowRectExForDpi(&frame, style, FALSE, exStyle, + GetDpiForWindow(window->win32.handle)); + } + else + AdjustWindowRectEx(&frame, style, FALSE, exStyle); if (window->minwidth != GLFW_DONT_CARE && window->minheight != GLFW_DONT_CARE) { - mmi->ptMinTrackSize.x = window->minwidth + xoff; - mmi->ptMinTrackSize.y = window->minheight + yoff; + mmi->ptMinTrackSize.x = window->minwidth + frame.right - frame.left; + mmi->ptMinTrackSize.y = window->minheight + frame.bottom - frame.top; } if (window->maxwidth != GLFW_DONT_CARE && window->maxheight != GLFW_DONT_CARE) { - mmi->ptMaxTrackSize.x = window->maxwidth + xoff; - mmi->ptMaxTrackSize.y = window->maxheight + yoff; + mmi->ptMaxTrackSize.x = window->maxwidth + frame.right - frame.left; + mmi->ptMaxTrackSize.y = window->maxheight + frame.bottom - frame.top; } if (!window->decorated) @@ -1265,7 +1253,7 @@ static int createNativeWindow(_GLFWwindow* window, const _GLFWwndconfig* wndconfig, const _GLFWfbconfig* fbconfig) { - int xpos, ypos, fullWidth, fullHeight; + int frameX, frameY, frameWidth, frameHeight; WCHAR* wideTitle; DWORD style = getWindowStyle(window); DWORD exStyle = getWindowExStyle(window); @@ -1311,10 +1299,10 @@ static int createNativeWindow(_GLFWwindow* window, // NOTE: This window placement is temporary and approximate, as the // correct position and size cannot be known until the monitor // video mode has been picked in _glfwSetVideoModeWin32 - xpos = mi.rcMonitor.left; - ypos = mi.rcMonitor.top; - fullWidth = mi.rcMonitor.right - mi.rcMonitor.left; - fullHeight = mi.rcMonitor.bottom - mi.rcMonitor.top; + frameX = mi.rcMonitor.left; + frameY = mi.rcMonitor.top; + frameWidth = mi.rcMonitor.right - mi.rcMonitor.left; + frameHeight = mi.rcMonitor.bottom - mi.rcMonitor.top; } else { @@ -1328,17 +1316,17 @@ static int createNativeWindow(_GLFWwindow* window, if (wndconfig->xpos == GLFW_ANY_POSITION && wndconfig->ypos == GLFW_ANY_POSITION) { - xpos = CW_USEDEFAULT; - ypos = CW_USEDEFAULT; + frameX = CW_USEDEFAULT; + frameY = CW_USEDEFAULT; } else { - xpos = wndconfig->xpos + rect.left; - ypos = wndconfig->ypos + rect.top; + frameX = wndconfig->xpos + rect.left; + frameY = wndconfig->ypos + rect.top; } - fullWidth = rect.right - rect.left; - fullHeight = rect.bottom - rect.top; + frameWidth = rect.right - rect.left; + frameHeight = rect.bottom - rect.top; } wideTitle = _glfwCreateWideStringFromUTF8Win32(wndconfig->title); @@ -1349,8 +1337,8 @@ static int createNativeWindow(_GLFWwindow* window, MAKEINTATOM(_glfw.win32.mainWindowClass), wideTitle, style, - xpos, ypos, - fullWidth, fullHeight, + frameX, frameY, + frameWidth, frameHeight, NULL, // No parent window NULL, // No window menu _glfw.win32.instance, From ed1d9e1ca75600d80f9956bc3de333987a777cfa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Fri, 9 Sep 2022 17:35:48 +0200 Subject: [PATCH 113/117] Document X11 WM_CLASS hint behavior Fixes #2180 --- CONTRIBUTORS.md | 1 + docs/window.dox | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index e0bb9368..01d13725 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -126,6 +126,7 @@ video tutorials. - lukect - Tristam MacDonald - Hans Mackowiak + - Ramiro Magno - Дмитри Малышев - Zbigniew Mandziejewicz - Adam Marcus diff --git a/docs/window.dox b/docs/window.dox index 2852a809..3cec6358 100644 --- a/docs/window.dox +++ b/docs/window.dox @@ -497,7 +497,8 @@ should also declare this in its `Info.plist` by setting the @anchor GLFW_X11_CLASS_NAME_hint @anchor GLFW_X11_INSTANCE_NAME_hint __GLFW_X11_CLASS_NAME__ and __GLFW_X11_INSTANCE_NAME__ specifies the desired -ASCII encoded class and instance parts of the ICCCM `WM_CLASS` window property. +ASCII encoded class and instance parts of the ICCCM `WM_CLASS` window property. Both +hints need to be set to something other than an empty string for them to take effect. These are set with @ref glfwWindowHintString. @subsubsection window_hints_wayland Wayland specific window hints From d299d9f78857e921b66bdab42c7ea27fe2e31810 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Tue, 13 Sep 2022 22:01:38 +0200 Subject: [PATCH 114/117] Remove Doxyfile tags deprecated by Doxygen 1.9.5 --- docs/Doxyfile.in | 40 ---------------------------------------- 1 file changed, 40 deletions(-) diff --git a/docs/Doxyfile.in b/docs/Doxyfile.in index 812eec5d..a452b6ed 100644 --- a/docs/Doxyfile.in +++ b/docs/Doxyfile.in @@ -1494,17 +1494,6 @@ HTML_FORMULA_FORMAT = png FORMULA_FONTSIZE = 10 -# Use the FORMULA_TRANSPARENT tag to determine whether or not the images -# generated for formulas are transparent PNGs. Transparent PNGs are not -# supported properly for IE 6.0, but are supported on all modern browsers. -# -# Note that when changing this option you need to delete any form_*.png files in -# the HTML output directory before the changes have effect. -# The default value is: YES. -# This tag requires that the tag GENERATE_HTML is set to YES. - -FORMULA_TRANSPARENT = YES - # The FORMULA_MACROFILE can contain LaTeX \newcommand and \renewcommand commands # to create new LaTeX commands to be used in formulas as building blocks. See # the section "Including formulas" for details. @@ -2199,23 +2188,6 @@ HAVE_DOT = NO DOT_NUM_THREADS = 0 -# When you want a differently looking font in the dot files that doxygen -# generates you can specify the font name using DOT_FONTNAME. You need to make -# sure dot is able to find the font, which can be done by putting it in a -# standard location or by setting the DOTFONTPATH environment variable or by -# setting DOT_FONTPATH to the directory containing the font. -# The default value is: Helvetica. -# This tag requires that the tag HAVE_DOT is set to YES. - -DOT_FONTNAME = Helvetica - -# The DOT_FONTSIZE tag can be used to set the size (in points) of the font of -# dot graphs. -# Minimum value: 4, maximum value: 24, default value: 10. -# This tag requires that the tag HAVE_DOT is set to YES. - -DOT_FONTSIZE = 10 - # By default doxygen will tell dot to use the default font as specified with # DOT_FONTNAME. If you specify a different font using DOT_FONTNAME you can set # the path where dot can find it using this tag. @@ -2428,18 +2400,6 @@ DOT_GRAPH_MAX_NODES = 50 MAX_DOT_GRAPH_DEPTH = 0 -# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent -# background. This is disabled by default, because dot on Windows does not seem -# to support this out of the box. -# -# Warning: Depending on the platform used, enabling this option may lead to -# badly anti-aliased labels on the edges of a graph (i.e. they become hard to -# read). -# The default value is: NO. -# This tag requires that the tag HAVE_DOT is set to YES. - -DOT_TRANSPARENT = NO - # Set the DOT_MULTI_TARGETS tag to YES to allow dot to generate multiple output # files in one run (i.e. multiple -o and -T options on the command line). This # makes dot run faster, but since only newer versions of dot (>1.8.10) support From b2b087cd8e9521746563acfdb8b9ea3e7d91f09a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Tue, 20 Sep 2022 16:17:22 +0200 Subject: [PATCH 115/117] Fix documented errors for gamma ramp functions Fixes #2186 --- CONTRIBUTORS.md | 1 + include/GLFW/glfw3.h | 18 +++++++++--------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 01d13725..110ed4cd 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -33,6 +33,7 @@ video tutorials. - Arturo Castro - Chi-kwan Chan - TheChocolateOre + - Ali Chraghi - Joseph Chua - Ian Clarkson - Michał Cichoń diff --git a/include/GLFW/glfw3.h b/include/GLFW/glfw3.h index 26875465..9ca3036d 100644 --- a/include/GLFW/glfw3.h +++ b/include/GLFW/glfw3.h @@ -2835,11 +2835,11 @@ GLFWAPI const GLFWvidmode* glfwGetVideoMode(GLFWmonitor* monitor); * @param[in] monitor The monitor whose gamma ramp to set. * @param[in] gamma The desired exponent. * - * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref - * GLFW_INVALID_VALUE and @ref GLFW_PLATFORM_ERROR. + * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref GLFW_INVALID_VALUE, + * @ref GLFW_PLATFORM_ERROR and @ref GLFW_FEATURE_UNAVAILABLE (see remarks). * * @remark @wayland Gamma handling is a privileged protocol, this function - * will thus never be implemented and emits @ref GLFW_PLATFORM_ERROR. + * will thus never be implemented and emits @ref GLFW_FEATURE_UNAVAILABLE. * * @thread_safety This function must only be called from the main thread. * @@ -2859,11 +2859,11 @@ GLFWAPI void glfwSetGamma(GLFWmonitor* monitor, float gamma); * @return The current gamma ramp, or `NULL` if an * [error](@ref error_handling) occurred. * - * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref - * GLFW_PLATFORM_ERROR. + * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref GLFW_PLATFORM_ERROR + * and @ref GLFW_FEATURE_UNAVAILABLE (see remarks). * * @remark @wayland Gamma handling is a privileged protocol, this function - * will thus never be implemented and emits @ref GLFW_PLATFORM_ERROR while + * will thus never be implemented and emits @ref GLFW_FEATURE_UNAVAILABLE while * returning `NULL`. * * @pointer_lifetime The returned structure and its arrays are allocated and @@ -2898,8 +2898,8 @@ GLFWAPI const GLFWgammaramp* glfwGetGammaRamp(GLFWmonitor* monitor); * @param[in] monitor The monitor whose gamma ramp to set. * @param[in] ramp The gamma ramp to use. * - * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref - * GLFW_PLATFORM_ERROR. + * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref GLFW_PLATFORM_ERROR + * and @ref GLFW_FEATURE_UNAVAILABLE (see remarks). * * @remark The size of the specified gamma ramp should match the size of the * current ramp for that monitor. @@ -2907,7 +2907,7 @@ GLFWAPI const GLFWgammaramp* glfwGetGammaRamp(GLFWmonitor* monitor); * @remark @win32 The gamma ramp size must be 256. * * @remark @wayland Gamma handling is a privileged protocol, this function - * will thus never be implemented and emits @ref GLFW_PLATFORM_ERROR. + * will thus never be implemented and emits @ref GLFW_FEATURE_UNAVAILABLE. * * @pointer_lifetime The specified gamma ramp is copied before this function * returns. From 97b9e49637d14b625eeb6fd400a5e0e673b66e7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Tue, 20 Sep 2022 17:03:30 +0200 Subject: [PATCH 116/117] Documentation work --- include/GLFW/glfw3.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/include/GLFW/glfw3.h b/include/GLFW/glfw3.h index 9ca3036d..d4b40dd4 100644 --- a/include/GLFW/glfw3.h +++ b/include/GLFW/glfw3.h @@ -4030,7 +4030,8 @@ GLFWAPI int glfwGetWindowAttrib(GLFWwindow* window, int attrib); * @param[in] value `GLFW_TRUE` or `GLFW_FALSE`. * * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref - * GLFW_INVALID_ENUM, @ref GLFW_INVALID_VALUE and @ref GLFW_PLATFORM_ERROR. + * GLFW_INVALID_ENUM, @ref GLFW_INVALID_VALUE, @ref GLFW_PLATFORM_ERROR and @ref + * GLFW_FEATURE_UNAVAILABLE. * * @remark Calling @ref glfwGetWindowAttrib will always return the latest * value, even if that value is ignored by the current mode of the window. @@ -4881,11 +4882,11 @@ GLFWAPI void glfwGetCursorPos(GLFWwindow* window, double* xpos, double* ypos); * @param[in] ypos The desired y-coordinate, relative to the top edge of the * content area. * - * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref - * GLFW_PLATFORM_ERROR. + * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref + * GLFW_PLATFORM_ERROR and @ref GLFW_FEATURE_UNAVAILABLE (see remarks). * * @remark @wayland This function will only work when the cursor mode is - * `GLFW_CURSOR_DISABLED`, otherwise it will do nothing. + * `GLFW_CURSOR_DISABLED`, otherwise it will emit @ref GLFW_FEATURE_UNAVAILABLE. * * @thread_safety This function must only be called from the main thread. * From dd8a678a66f1967372e5a5e3deac41ebf65ee127 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Tue, 20 Sep 2022 17:40:36 +0200 Subject: [PATCH 117/117] Update Doxyfile template for Doxygen 1.9.5 This is mostly to disable Doxygen HTML output dark mode (for now). --- docs/Doxyfile.in | 508 ++++++++++++++++++++++++++++++++++++----------- 1 file changed, 387 insertions(+), 121 deletions(-) diff --git a/docs/Doxyfile.in b/docs/Doxyfile.in index a452b6ed..6505aa33 100644 --- a/docs/Doxyfile.in +++ b/docs/Doxyfile.in @@ -1,4 +1,4 @@ -# Doxyfile 1.8.18 +# Doxyfile 1.9.5 # This file describes the settings to be used by the documentation system # doxygen (www.doxygen.org) for a project. @@ -12,6 +12,16 @@ # For lists, items can also be appended using: # TAG += value [value, ...] # Values that contain spaces should be placed between quotes (\" \"). +# +# Note: +# +# Use doxygen to compare the used configuration file with the template +# configuration file: +# doxygen -x [configFile] +# Use doxygen to compare the used configuration file with the template +# configuration file without replacing the environment variables or CMake type +# replacement variables: +# doxygen -x_noenv [configFile] #--------------------------------------------------------------------------- # Project related configuration options @@ -60,16 +70,28 @@ PROJECT_LOGO = OUTPUT_DIRECTORY = "@GLFW_BINARY_DIR@/docs" -# If the CREATE_SUBDIRS tag is set to YES then doxygen will create 4096 sub- -# directories (in 2 levels) under the output directory of each output format and -# will distribute the generated files over these directories. Enabling this +# If the CREATE_SUBDIRS tag is set to YES then doxygen will create up to 4096 +# sub-directories (in 2 levels) under the output directory of each output format +# and will distribute the generated files over these directories. Enabling this # option can be useful when feeding doxygen a huge amount of source files, where # putting all generated files in the same directory would otherwise causes -# performance problems for the file system. +# performance problems for the file system. Adapt CREATE_SUBDIRS_LEVEL to +# control the number of sub-directories. # The default value is: NO. CREATE_SUBDIRS = NO +# Controls the number of sub-directories that will be created when +# CREATE_SUBDIRS tag is set to YES. Level 0 represents 16 directories, and every +# level increment doubles the number of directories, resulting in 4096 +# directories at level 8 which is the default and also the maximum value. The +# sub-directories are organized in 2 levels, the first level always has a fixed +# numer of 16 directories. +# Minimum value: 0, maximum value: 8, default value: 8. +# This tag requires that the tag CREATE_SUBDIRS is set to YES. + +CREATE_SUBDIRS_LEVEL = 8 + # If the ALLOW_UNICODE_NAMES tag is set to YES, doxygen will allow non-ASCII # characters to appear in the names of generated files. If set to NO, non-ASCII # characters will be escaped, for example _xE3_x81_x84 will be used for Unicode @@ -81,14 +103,14 @@ ALLOW_UNICODE_NAMES = NO # The OUTPUT_LANGUAGE tag is used to specify the language in which all # documentation generated by doxygen is written. Doxygen will use this # information to generate all constant output in the proper language. -# Possible values are: Afrikaans, Arabic, Armenian, Brazilian, Catalan, Chinese, -# Chinese-Traditional, Croatian, Czech, Danish, Dutch, English (United States), -# Esperanto, Farsi (Persian), Finnish, French, German, Greek, Hungarian, -# Indonesian, Italian, Japanese, Japanese-en (Japanese with English messages), -# Korean, Korean-en (Korean with English messages), Latvian, Lithuanian, -# Macedonian, Norwegian, Persian (Farsi), Polish, Portuguese, Romanian, Russian, -# Serbian, Serbian-Cyrillic, Slovak, Slovene, Spanish, Swedish, Turkish, -# Ukrainian and Vietnamese. +# Possible values are: Afrikaans, Arabic, Armenian, Brazilian, Bulgarian, +# Catalan, Chinese, Chinese-Traditional, Croatian, Czech, Danish, Dutch, English +# (United States), Esperanto, Farsi (Persian), Finnish, French, German, Greek, +# Hindi, Hungarian, Indonesian, Italian, Japanese, Japanese-en (Japanese with +# English messages), Korean, Korean-en (Korean with English messages), Latvian, +# Lithuanian, Macedonian, Norwegian, Persian (Farsi), Polish, Portuguese, +# Romanian, Russian, Serbian, Serbian-Cyrillic, Slovak, Slovene, Spanish, +# Swedish, Turkish, Ukrainian and Vietnamese. # The default value is: English. OUTPUT_LANGUAGE = English @@ -209,6 +231,14 @@ QT_AUTOBRIEF = NO MULTILINE_CPP_IS_BRIEF = NO +# By default Python docstrings are displayed as preformatted text and doxygen's +# special commands cannot be used. By setting PYTHON_DOCSTRING to NO the +# doxygen's special commands can be used and the contents of the docstring +# documentation blocks is shown as doxygen documentation. +# The default value is: YES. + +PYTHON_DOCSTRING = YES + # If the INHERIT_DOCS tag is set to YES then an undocumented member inherits the # documentation from any documented member that it re-implements. # The default value is: YES. @@ -232,16 +262,16 @@ TAB_SIZE = 8 # the documentation. An alias has the form: # name=value # For example adding -# "sideeffect=@par Side Effects:\n" +# "sideeffect=@par Side Effects:^^" # will allow you to put the command \sideeffect (or @sideeffect) in the # documentation, which will result in a user-defined paragraph with heading -# "Side Effects:". You can put \n's in the value part of an alias to insert -# newlines (in the resulting output). You can put ^^ in the value part of an -# alias to insert a newline as if a physical newline was in the original file. -# When you need a literal { or } or , in the value part of an alias you have to -# escape them by means of a backslash (\), this can lead to conflicts with the -# commands \{ and \} for these it is advised to use the version @{ and @} or use -# a double escape (\\{ and \\}) +# "Side Effects:". Note that you cannot put \n's in the value part of an alias +# to insert newlines (in the resulting output). You can put ^^ in the value part +# of an alias to insert a newline as if a physical newline was in the original +# file. When you need a literal { or } or , in the value part of an alias you +# have to escape them by means of a backslash (\), this can lead to conflicts +# with the commands \{ and \} for these it is advised to use the version @{ and +# @} or use a double escape (\\{ and \\}) ALIASES = "thread_safety=@par Thread safety^^" \ "pointer_lifetime=@par Pointer lifetime^^" \ @@ -297,8 +327,8 @@ OPTIMIZE_OUTPUT_SLICE = NO # extension. Doxygen has a built-in mapping, but you can override or extend it # using this tag. The format is ext=language, where ext is a file extension, and # language is one of the parsers supported by doxygen: IDL, Java, JavaScript, -# Csharp (C#), C, C++, D, PHP, md (Markdown), Objective-C, Python, Slice, VHDL, -# Fortran (fixed format Fortran: FortranFixed, free formatted Fortran: +# Csharp (C#), C, C++, Lex, D, PHP, md (Markdown), Objective-C, Python, Slice, +# VHDL, Fortran (fixed format Fortran: FortranFixed, free formatted Fortran: # FortranFree, unknown formatted Fortran: Fortran. In the later case the parser # tries to guess whether the code is fixed or free formatted code, this is the # default for Fortran type files). For instance to make doxygen treat .inc files @@ -308,7 +338,10 @@ OPTIMIZE_OUTPUT_SLICE = NO # Note: For files without extension you can use no_extension as a placeholder. # # Note that for custom extensions you also need to set FILE_PATTERNS otherwise -# the files are not read by doxygen. +# the files are not read by doxygen. When specifying no_extension you should add +# * to the FILE_PATTERNS. +# +# Note see also the list of default file extension mappings. EXTENSION_MAPPING = @@ -442,6 +475,19 @@ TYPEDEF_HIDES_STRUCT = NO LOOKUP_CACHE_SIZE = 0 +# The NUM_PROC_THREADS specifies the number of threads doxygen is allowed to use +# during processing. When set to 0 doxygen will based this on the number of +# cores available in the system. You can set it explicitly to a value larger +# than 0 to get more control over the balance between CPU load and processing +# speed. At this moment only the input processing can be done using multiple +# threads. Since this is still an experimental feature the default is set to 1, +# which effectively disables parallel processing. Please report any issues you +# encounter. Generating dot graphs in parallel is controlled by the +# DOT_NUM_THREADS setting. +# Minimum value: 0, maximum value: 32, default value: 1. + +NUM_PROC_THREADS = 1 + #--------------------------------------------------------------------------- # Build related configuration options #--------------------------------------------------------------------------- @@ -505,6 +551,13 @@ EXTRACT_LOCAL_METHODS = NO EXTRACT_ANON_NSPACES = NO +# If this flag is set to YES, the name of an unnamed parameter in a declaration +# will be determined by the corresponding definition. By default unnamed +# parameters remain unnamed in the output. +# The default value is: YES. + +RESOLVE_UNNAMED_PARAMS = YES + # If the HIDE_UNDOC_MEMBERS tag is set to YES, doxygen will hide all # undocumented members inside documented classes or files. If set to NO these # members will be included in the various overviews, but no documentation @@ -542,14 +595,22 @@ HIDE_IN_BODY_DOCS = NO INTERNAL_DOCS = NO -# If the CASE_SENSE_NAMES tag is set to NO then doxygen will only generate file -# names in lower-case letters. If set to YES, upper-case letters are also -# allowed. This is useful if you have classes or files whose names only differ -# in case and if your file system supports case sensitive file names. Windows -# (including Cygwin) ands Mac users are advised to set this option to NO. -# The default value is: system dependent. +# With the correct setting of option CASE_SENSE_NAMES doxygen will better be +# able to match the capabilities of the underlying filesystem. In case the +# filesystem is case sensitive (i.e. it supports files in the same directory +# whose names only differ in casing), the option must be set to YES to properly +# deal with such files in case they appear in the input. For filesystems that +# are not case sensitive the option should be set to NO to properly deal with +# output files written for symbols that only differ in casing, such as for two +# classes, one named CLASS and the other named Class, and to also support +# references to files without having to specify the exact matching casing. On +# Windows (including Cygwin) and MacOS, users should typically set this option +# to NO, whereas on Linux or other Unix flavors it should typically be set to +# YES. +# Possible values are: SYSTEM, NO and YES. +# The default value is: SYSTEM. -CASE_SENSE_NAMES = YES +CASE_SENSE_NAMES = SYSTEM # If the HIDE_SCOPE_NAMES tag is set to NO then doxygen will show members with # their full class and namespace scopes in the documentation. If set to YES, the @@ -565,6 +626,12 @@ HIDE_SCOPE_NAMES = NO HIDE_COMPOUND_REFERENCE= NO +# If the SHOW_HEADERFILE tag is set to YES then the documentation for a class +# will show which file needs to be included to use the class. +# The default value is: YES. + +SHOW_HEADERFILE = NO + # If the SHOW_INCLUDE_FILES tag is set to YES then doxygen will put a list of # the files that are included by a file in the documentation of that file. # The default value is: YES. @@ -722,7 +789,8 @@ FILE_VERSION_FILTER = # output files in an output format independent way. To create the layout file # that represents doxygen's defaults, run doxygen with the -l option. You can # optionally specify a file name after the option, if omitted DoxygenLayout.xml -# will be used as the name of the layout file. +# will be used as the name of the layout file. See also section "Changing the +# layout of pages" for information. # # Note that if you run doxygen from a directory containing a file called # DoxygenLayout.xml, doxygen will parse it automatically even if the LAYOUT_FILE @@ -768,24 +836,35 @@ WARNINGS = YES WARN_IF_UNDOCUMENTED = YES # If the WARN_IF_DOC_ERROR tag is set to YES, doxygen will generate warnings for -# potential errors in the documentation, such as not documenting some parameters -# in a documented function, or documenting parameters that don't exist or using -# markup commands wrongly. +# potential errors in the documentation, such as documenting some parameters in +# a documented function twice, or documenting parameters that don't exist or +# using markup commands wrongly. # The default value is: YES. WARN_IF_DOC_ERROR = YES +# If WARN_IF_INCOMPLETE_DOC is set to YES, doxygen will warn about incomplete +# function parameter documentation. If set to NO, doxygen will accept that some +# parameters have no documentation without warning. +# The default value is: YES. + +WARN_IF_INCOMPLETE_DOC = YES + # This WARN_NO_PARAMDOC option can be enabled to get warnings for functions that # are documented, but have no documentation for their parameters or return -# value. If set to NO, doxygen will only warn about wrong or incomplete -# parameter documentation, but not about the absence of documentation. If -# EXTRACT_ALL is set to YES then this flag will automatically be disabled. +# value. If set to NO, doxygen will only warn about wrong parameter +# documentation, but not about the absence of documentation. If EXTRACT_ALL is +# set to YES then this flag will automatically be disabled. See also +# WARN_IF_INCOMPLETE_DOC # The default value is: NO. WARN_NO_PARAMDOC = YES # If the WARN_AS_ERROR tag is set to YES then doxygen will immediately stop when -# a warning is encountered. +# a warning is encountered. If the WARN_AS_ERROR tag is set to FAIL_ON_WARNINGS +# then doxygen will continue running as if WARN_AS_ERROR tag is set to NO, but +# at the end of the doxygen process doxygen will return with a non-zero status. +# Possible values are: NO, YES and FAIL_ON_WARNINGS. # The default value is: NO. WARN_AS_ERROR = NO @@ -796,13 +875,27 @@ WARN_AS_ERROR = NO # and the warning text. Optionally the format may contain $version, which will # be replaced by the version of the file (if it could be obtained via # FILE_VERSION_FILTER) +# See also: WARN_LINE_FORMAT # The default value is: $file:$line: $text. WARN_FORMAT = "$file:$line: $text" +# In the $text part of the WARN_FORMAT command it is possible that a reference +# to a more specific place is given. To make it easier to jump to this place +# (outside of doxygen) the user can define a custom "cut" / "paste" string. +# Example: +# WARN_LINE_FORMAT = "'vi $file +$line'" +# See also: WARN_FORMAT +# The default value is: at line $line of file $file. + +WARN_LINE_FORMAT = "at line $line of file $file" + # The WARN_LOGFILE tag can be used to specify a file to which warning and error # messages should be written. If left blank the output is written to standard -# error (stderr). +# error (stderr). In case the file specified cannot be opened for writing the +# warning and error messages are written to standard error. When as file - is +# specified the warning and error messages are written to standard output +# (stdout). WARN_LOGFILE = "@GLFW_BINARY_DIR@/docs/warnings.txt" @@ -821,12 +914,23 @@ INPUT = @GLFW_DOXYGEN_INPUT@ # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses # libiconv (or the iconv built into libc) for the transcoding. See the libiconv -# documentation (see: https://www.gnu.org/software/libiconv/) for the list of -# possible encodings. +# documentation (see: +# https://www.gnu.org/software/libiconv/) for the list of possible encodings. +# See also: INPUT_FILE_ENCODING # The default value is: UTF-8. INPUT_ENCODING = UTF-8 +# This tag can be used to specify the character encoding of the source files +# that doxygen parses The INPUT_FILE_ENCODING tag can be used to specify +# character encoding on a per file pattern basis. Doxygen will compare the file +# name with each pattern and apply the encoding instead of the default +# INPUT_ENCODING) if there is a match. The character encodings are a list of the +# form: pattern=encoding (like *.php=ISO-8859-1). See cfg_input_encoding +# "INPUT_ENCODING" for further information on supported encodings. + +INPUT_FILE_ENCODING = + # If the value of the INPUT tag contains directories, you can use the # FILE_PATTERNS tag to specify one or more wildcard patterns (like *.cpp and # *.h) to filter out the source-files in the directories. @@ -835,12 +939,14 @@ INPUT_ENCODING = UTF-8 # need to set EXTENSION_MAPPING for the extension otherwise the files are not # read by doxygen. # +# Note the list of default checked file patterns might differ from the list of +# default file extension mappings. +# # If left blank the following patterns are tested:*.c, *.cc, *.cxx, *.cpp, # *.c++, *.java, *.ii, *.ixx, *.ipp, *.i++, *.inl, *.idl, *.ddl, *.odl, *.h, -# *.hh, *.hxx, *.hpp, *.h++, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, *.inc, -# *.m, *.markdown, *.md, *.mm, *.dox (to be provided as doxygen C comment), -# *.doc (to be provided as doxygen C comment), *.txt (to be provided as doxygen -# C comment), *.py, *.pyw, *.f90, *.f95, *.f03, *.f08, *.f18, *.f, *.for, *.vhd, +# *.hh, *.hxx, *.hpp, *.h++, *.l, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, +# *.inc, *.m, *.markdown, *.md, *.mm, *.dox (to be provided as doxygen C +# comment), *.py, *.pyw, *.f90, *.f95, *.f03, *.f08, *.f18, *.f, *.for, *.vhd, # *.vhdl, *.ucf, *.qsf and *.ice. FILE_PATTERNS = *.h *.dox @@ -880,7 +986,7 @@ EXCLUDE_PATTERNS = # (namespaces, classes, functions, etc.) that should be excluded from the # output. The symbol name can be a fully qualified name, a word, or if the # wildcard * is used, a substring. Examples: ANamespace, AClass, -# AClass::ANamespace, ANamespace::*Test +# ANamespace::AClass, ANamespace::*Test # # Note that the wildcards are matched against the file with absolute path, so to # exclude all test directories use the pattern */test/* @@ -928,6 +1034,11 @@ IMAGE_PATH = # code is scanned, but not when the output code is generated. If lines are added # or removed, the anchors will not be placed correctly. # +# Note that doxygen will use the data processed and written to standard output +# for further processing, therefore nothing else, like debug statements or used +# commands (so in case of a Windows batch file always use @echo OFF), should be +# written to standard output. +# # Note that for custom extensions or not directly supported extensions you also # need to set EXTENSION_MAPPING for the extension otherwise the files are not # properly processed by doxygen. @@ -969,6 +1080,15 @@ FILTER_SOURCE_PATTERNS = USE_MDFILE_AS_MAINPAGE = +# The Fortran standard specifies that for fixed formatted Fortran code all +# characters from position 72 are to be considered as comment. A common +# extension is to allow longer lines before the automatic comment starts. The +# setting FORTRAN_COMMENT_AFTER will also make it possible that longer lines can +# be processed before the automatic comment starts. +# Minimum value: 7, maximum value: 10000, default value: 72. + +FORTRAN_COMMENT_AFTER = 72 + #--------------------------------------------------------------------------- # Configuration options related to source browsing #--------------------------------------------------------------------------- @@ -1163,9 +1283,26 @@ HTML_EXTRA_STYLESHEET = "@GLFW_SOURCE_DIR@/docs/extra.css" HTML_EXTRA_FILES = "@GLFW_SOURCE_DIR@/docs/spaces.svg" +# The HTML_COLORSTYLE tag can be used to specify if the generated HTML output +# should be rendered with a dark or light theme. Default setting AUTO_LIGHT +# enables light output unless the user preference is dark output. Other options +# are DARK to always use dark mode, LIGHT to always use light mode, AUTO_DARK to +# default to dark mode unless the user prefers light mode, and TOGGLE to let the +# user toggle between dark and light mode via a button. +# Possible values are: LIGHT Always generate light output., DARK Always generate +# dark output., AUTO_LIGHT Automatically set the mode according to the user +# preference, use light mode if no preference is set (the default)., AUTO_DARK +# Automatically set the mode according to the user preference, use dark mode if +# no preference is set. and TOGGLE Allow to user to switch between light and +# dark mode via a button.. +# The default value is: AUTO_LIGHT. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_COLORSTYLE = LIGHT + # The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen # will adjust the colors in the style sheet and background images according to -# this color. Hue is specified as an angle on a colorwheel, see +# this color. Hue is specified as an angle on a color-wheel, see # https://en.wikipedia.org/wiki/Hue for more information. For instance the value # 0 represents red, 60 is yellow, 120 is green, 180 is cyan, 240 is blue, 300 # purple, and 360 is red again. @@ -1175,7 +1312,7 @@ HTML_EXTRA_FILES = "@GLFW_SOURCE_DIR@/docs/spaces.svg" HTML_COLORSTYLE_HUE = 220 # The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of the colors -# in the HTML output. For a value of 0 the output will use grayscales only. A +# in the HTML output. For a value of 0 the output will use gray-scales only. A # value of 255 will produce the most vivid colors. # Minimum value: 0, maximum value: 255, default value: 100. # This tag requires that the tag GENERATE_HTML is set to YES. @@ -1236,10 +1373,11 @@ HTML_INDEX_NUM_ENTRIES = 100 # If the GENERATE_DOCSET tag is set to YES, additional index files will be # generated that can be used as input for Apple's Xcode 3 integrated development -# environment (see: https://developer.apple.com/xcode/), introduced with OSX -# 10.5 (Leopard). To create a documentation set, doxygen will generate a -# Makefile in the HTML output directory. Running make will produce the docset in -# that directory and running make install will install the docset in +# environment (see: +# https://developer.apple.com/xcode/), introduced with OSX 10.5 (Leopard). To +# create a documentation set, doxygen will generate a Makefile in the HTML +# output directory. Running make will produce the docset in that directory and +# running make install will install the docset in # ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find it at # startup. See https://developer.apple.com/library/archive/featuredarticles/Doxy # genXcode/_index.html for more information. @@ -1256,6 +1394,13 @@ GENERATE_DOCSET = NO DOCSET_FEEDNAME = "Doxygen generated docs" +# This tag determines the URL of the docset feed. A documentation feed provides +# an umbrella under which multiple documentation sets from a single provider +# (such as a company or product suite) can be grouped. +# This tag requires that the tag GENERATE_DOCSET is set to YES. + +DOCSET_FEEDURL = + # This tag specifies a string that should uniquely identify the documentation # set bundle. This should be a reverse domain-name style string, e.g. # com.mycompany.MyDocSet. Doxygen will append .docset to the name. @@ -1281,8 +1426,12 @@ DOCSET_PUBLISHER_NAME = Publisher # If the GENERATE_HTMLHELP tag is set to YES then doxygen generates three # additional HTML index files: index.hhp, index.hhc, and index.hhk. The # index.hhp is a project file that can be read by Microsoft's HTML Help Workshop -# (see: https://www.microsoft.com/en-us/download/details.aspx?id=21138) on -# Windows. +# on Windows. In the beginning of 2021 Microsoft took the original page, with +# a.o. the download links, offline the HTML help workshop was already many years +# in maintenance mode). You can download the HTML help workshop from the web +# archives at Installation executable (see: +# http://web.archive.org/web/20160201063255/http://download.microsoft.com/downlo +# ad/0/A/9/0A939EF6-E31C-430F-A3DF-DFAE7960D564/htmlhelp.exe). # # The HTML Help Workshop contains a compiler that can convert all HTML output # generated by doxygen into a single compiled HTML file (.chm). Compiled HTML @@ -1312,7 +1461,7 @@ CHM_FILE = HHC_LOCATION = # The GENERATE_CHI flag controls if a separate .chi index file is generated -# (YES) or that it should be included in the master .chm file (NO). +# (YES) or that it should be included in the main .chm file (NO). # The default value is: NO. # This tag requires that the tag GENERATE_HTMLHELP is set to YES. @@ -1357,7 +1506,8 @@ QCH_FILE = # The QHP_NAMESPACE tag specifies the namespace to use when generating Qt Help # Project output. For more information please see Qt Help Project / Namespace -# (see: https://doc.qt.io/archives/qt-4.8/qthelpproject.html#namespace). +# (see: +# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#namespace). # The default value is: org.doxygen.Project. # This tag requires that the tag GENERATE_QHP is set to YES. @@ -1365,8 +1515,8 @@ QHP_NAMESPACE = org.doxygen.Project # The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating Qt # Help Project output. For more information please see Qt Help Project / Virtual -# Folders (see: https://doc.qt.io/archives/qt-4.8/qthelpproject.html#virtual- -# folders). +# Folders (see: +# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#virtual-folders). # The default value is: doc. # This tag requires that the tag GENERATE_QHP is set to YES. @@ -1374,16 +1524,16 @@ QHP_VIRTUAL_FOLDER = doc # If the QHP_CUST_FILTER_NAME tag is set, it specifies the name of a custom # filter to add. For more information please see Qt Help Project / Custom -# Filters (see: https://doc.qt.io/archives/qt-4.8/qthelpproject.html#custom- -# filters). +# Filters (see: +# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#custom-filters). # This tag requires that the tag GENERATE_QHP is set to YES. QHP_CUST_FILTER_NAME = # The QHP_CUST_FILTER_ATTRS tag specifies the list of the attributes of the # custom filter to add. For more information please see Qt Help Project / Custom -# Filters (see: https://doc.qt.io/archives/qt-4.8/qthelpproject.html#custom- -# filters). +# Filters (see: +# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#custom-filters). # This tag requires that the tag GENERATE_QHP is set to YES. QHP_CUST_FILTER_ATTRS = @@ -1395,9 +1545,9 @@ QHP_CUST_FILTER_ATTRS = QHP_SECT_FILTER_ATTRS = -# The QHG_LOCATION tag can be used to specify the location of Qt's -# qhelpgenerator. If non-empty doxygen will try to run qhelpgenerator on the -# generated .qhp file. +# The QHG_LOCATION tag can be used to specify the location (absolute path +# including file name) of Qt's qhelpgenerator. If non-empty doxygen will try to +# run qhelpgenerator on the generated .qhp file. # This tag requires that the tag GENERATE_QHP is set to YES. QHG_LOCATION = @@ -1440,16 +1590,28 @@ DISABLE_INDEX = NO # to work a browser that supports JavaScript, DHTML, CSS and frames is required # (i.e. any modern browser). Windows users are probably better off using the # HTML help feature. Via custom style sheets (see HTML_EXTRA_STYLESHEET) one can -# further fine-tune the look of the index. As an example, the default style -# sheet generated by doxygen has an example that shows how to put an image at -# the root of the tree instead of the PROJECT_NAME. Since the tree basically has -# the same information as the tab index, you could consider setting -# DISABLE_INDEX to YES when enabling this option. +# further fine tune the look of the index (see "Fine-tuning the output"). As an +# example, the default style sheet generated by doxygen has an example that +# shows how to put an image at the root of the tree instead of the PROJECT_NAME. +# Since the tree basically has the same information as the tab index, you could +# consider setting DISABLE_INDEX to YES when enabling this option. # The default value is: NO. # This tag requires that the tag GENERATE_HTML is set to YES. GENERATE_TREEVIEW = NO +# When both GENERATE_TREEVIEW and DISABLE_INDEX are set to YES, then the +# FULL_SIDEBAR option determines if the side bar is limited to only the treeview +# area (value NO) or if it should extend to the full height of the window (value +# YES). Setting this to YES gives a layout similar to +# https://docs.readthedocs.io with more room for contents, but less room for the +# project logo, title, and description. If either GENERATE_TREEVIEW or +# DISABLE_INDEX is set to NO, this option has no effect. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +FULL_SIDEBAR = NO + # The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values that # doxygen will group on one line in the generated HTML documentation. # @@ -1474,12 +1636,19 @@ TREEVIEW_WIDTH = 300 EXT_LINKS_IN_WINDOW = NO +# If the OBFUSCATE_EMAILS tag is set to YES, doxygen will obfuscate email +# addresses. +# The default value is: YES. +# This tag requires that the tag GENERATE_HTML is set to YES. + +OBFUSCATE_EMAILS = YES + # If the HTML_FORMULA_FORMAT option is set to svg, doxygen will use the pdf2svg # tool (see https://github.com/dawbarton/pdf2svg) or inkscape (see # https://inkscape.org) to generate formulas as SVG images instead of PNGs for # the HTML output. These images will generally look nicer at scaled resolutions. -# Possible values are: png The default and svg Looks nicer but requires the -# pdf2svg tool. +# Possible values are: png (the default) and svg (looks nicer but requires the +# pdf2svg or inkscape tool). # The default value is: png. # This tag requires that the tag GENERATE_HTML is set to YES. @@ -1511,11 +1680,29 @@ FORMULA_MACROFILE = USE_MATHJAX = NO +# With MATHJAX_VERSION it is possible to specify the MathJax version to be used. +# Note that the different versions of MathJax have different requirements with +# regards to the different settings, so it is possible that also other MathJax +# settings have to be changed when switching between the different MathJax +# versions. +# Possible values are: MathJax_2 and MathJax_3. +# The default value is: MathJax_2. +# This tag requires that the tag USE_MATHJAX is set to YES. + +MATHJAX_VERSION = MathJax_2 + # When MathJax is enabled you can set the default output format to be used for -# the MathJax output. See the MathJax site (see: -# http://docs.mathjax.org/en/latest/output.html) for more details. +# the MathJax output. For more details about the output format see MathJax +# version 2 (see: +# http://docs.mathjax.org/en/v2.7-latest/output.html) and MathJax version 3 +# (see: +# http://docs.mathjax.org/en/latest/web/components/output.html). # Possible values are: HTML-CSS (which is slower, but has the best -# compatibility), NativeMML (i.e. MathML) and SVG. +# compatibility. This is the name for Mathjax version 2, for MathJax version 3 +# this will be translated into chtml), NativeMML (i.e. MathML. Only supported +# for NathJax 2. For MathJax version 3 chtml will be used instead.), chtml (This +# is the name for Mathjax version 3, for MathJax version 2 this will be +# translated into HTML-CSS) and SVG. # The default value is: HTML-CSS. # This tag requires that the tag USE_MATHJAX is set to YES. @@ -1528,22 +1715,29 @@ MATHJAX_FORMAT = HTML-CSS # MATHJAX_RELPATH should be ../mathjax. The default value points to the MathJax # Content Delivery Network so you can quickly see the result without installing # MathJax. However, it is strongly recommended to install a local copy of -# MathJax from https://www.mathjax.org before deployment. -# The default value is: https://cdn.jsdelivr.net/npm/mathjax@2. +# MathJax from https://www.mathjax.org before deployment. The default value is: +# - in case of MathJax version 2: https://cdn.jsdelivr.net/npm/mathjax@2 +# - in case of MathJax version 3: https://cdn.jsdelivr.net/npm/mathjax@3 # This tag requires that the tag USE_MATHJAX is set to YES. -MATHJAX_RELPATH = https://cdn.jsdelivr.net/npm/mathjax@2 +MATHJAX_RELPATH = # The MATHJAX_EXTENSIONS tag can be used to specify one or more MathJax # extension names that should be enabled during MathJax rendering. For example +# for MathJax version 2 (see +# https://docs.mathjax.org/en/v2.7-latest/tex.html#tex-and-latex-extensions): # MATHJAX_EXTENSIONS = TeX/AMSmath TeX/AMSsymbols +# For example for MathJax version 3 (see +# http://docs.mathjax.org/en/latest/input/tex/extensions/index.html): +# MATHJAX_EXTENSIONS = ams # This tag requires that the tag USE_MATHJAX is set to YES. MATHJAX_EXTENSIONS = # The MATHJAX_CODEFILE tag can be used to specify a file with javascript pieces # of code that will be used on startup of the MathJax code. See the MathJax site -# (see: http://docs.mathjax.org/en/latest/output.html) for more details. For an +# (see: +# http://docs.mathjax.org/en/v2.7-latest/output.html) for more details. For an # example see the documentation. # This tag requires that the tag USE_MATHJAX is set to YES. @@ -1590,7 +1784,8 @@ SERVER_BASED_SEARCH = NO # # Doxygen ships with an example indexer (doxyindexer) and search engine # (doxysearch.cgi) which are based on the open source search engine library -# Xapian (see: https://xapian.org/). +# Xapian (see: +# https://xapian.org/). # # See the section "External Indexing and Searching" for details. # The default value is: NO. @@ -1603,8 +1798,9 @@ EXTERNAL_SEARCH = NO # # Doxygen ships with an example indexer (doxyindexer) and search engine # (doxysearch.cgi) which are based on the open source search engine library -# Xapian (see: https://xapian.org/). See the section "External Indexing and -# Searching" for details. +# Xapian (see: +# https://xapian.org/). See the section "External Indexing and Searching" for +# details. # This tag requires that the tag SEARCHENGINE is set to YES. SEARCHENGINE_URL = @@ -1713,29 +1909,31 @@ PAPER_TYPE = a4 EXTRA_PACKAGES = -# The LATEX_HEADER tag can be used to specify a personal LaTeX header for the -# generated LaTeX document. The header should contain everything until the first -# chapter. If it is left blank doxygen will generate a standard header. See -# section "Doxygen usage" for information on how to let doxygen write the -# default header to a separate file. +# The LATEX_HEADER tag can be used to specify a user-defined LaTeX header for +# the generated LaTeX document. The header should contain everything until the +# first chapter. If it is left blank doxygen will generate a standard header. It +# is highly recommended to start with a default header using +# doxygen -w latex new_header.tex new_footer.tex new_stylesheet.sty +# and then modify the file new_header.tex. See also section "Doxygen usage" for +# information on how to generate the default header that doxygen normally uses. # -# Note: Only use a user-defined header if you know what you are doing! The -# following commands have a special meaning inside the header: $title, -# $datetime, $date, $doxygenversion, $projectname, $projectnumber, -# $projectbrief, $projectlogo. Doxygen will replace $title with the empty -# string, for the replacement values of the other commands the user is referred -# to HTML_HEADER. +# Note: Only use a user-defined header if you know what you are doing! +# Note: The header is subject to change so you typically have to regenerate the +# default header when upgrading to a newer version of doxygen. The following +# commands have a special meaning inside the header (and footer): For a +# description of the possible markers and block names see the documentation. # This tag requires that the tag GENERATE_LATEX is set to YES. LATEX_HEADER = -# The LATEX_FOOTER tag can be used to specify a personal LaTeX footer for the -# generated LaTeX document. The footer should contain everything after the last -# chapter. If it is left blank doxygen will generate a standard footer. See +# The LATEX_FOOTER tag can be used to specify a user-defined LaTeX footer for +# the generated LaTeX document. The footer should contain everything after the +# last chapter. If it is left blank doxygen will generate a standard footer. See # LATEX_HEADER for more information on how to generate a default footer and what -# special commands can be used inside the footer. -# -# Note: Only use a user-defined footer if you know what you are doing! +# special commands can be used inside the footer. See also section "Doxygen +# usage" for information on how to generate the default footer that doxygen +# normally uses. Note: Only use a user-defined footer if you know what you are +# doing! # This tag requires that the tag GENERATE_LATEX is set to YES. LATEX_FOOTER = @@ -1768,9 +1966,11 @@ LATEX_EXTRA_FILES = PDF_HYPERLINKS = YES -# If the USE_PDFLATEX tag is set to YES, doxygen will use pdflatex to generate -# the PDF file directly from the LaTeX files. Set this option to YES, to get a -# higher quality PDF documentation. +# If the USE_PDFLATEX tag is set to YES, doxygen will use the engine as +# specified with LATEX_CMD_NAME to generate the PDF file directly from the LaTeX +# files. Set this option to YES, to get a higher quality PDF documentation. +# +# See also section LATEX_CMD_NAME for selecting the engine. # The default value is: YES. # This tag requires that the tag GENERATE_LATEX is set to YES. @@ -1778,8 +1978,7 @@ USE_PDFLATEX = YES # If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \batchmode # command to the generated LaTeX files. This will instruct LaTeX to keep running -# if errors occur, instead of asking the user for help. This option is also used -# when generating formulas in HTML. +# if errors occur, instead of asking the user for help. # The default value is: NO. # This tag requires that the tag GENERATE_LATEX is set to YES. @@ -2054,7 +2253,8 @@ SEARCH_INCLUDES = YES # The INCLUDE_PATH tag can be used to specify one or more directories that # contain include files that are not input files but should be processed by the -# preprocessor. +# preprocessor. Note that the INCLUDE_PATH is not recursive, so the setting of +# RECURSIVE has no effect here. # This tag requires that the tag SEARCH_INCLUDES is set to YES. INCLUDE_PATH = @@ -2188,18 +2388,50 @@ HAVE_DOT = NO DOT_NUM_THREADS = 0 -# By default doxygen will tell dot to use the default font as specified with -# DOT_FONTNAME. If you specify a different font using DOT_FONTNAME you can set -# the path where dot can find it using this tag. +# DOT_COMMON_ATTR is common attributes for nodes, edges and labels of +# subgraphs. When you want a differently looking font in the dot files that +# doxygen generates you can specify fontname, fontcolor and fontsize attributes. +# For details please see Node, +# Edge and Graph Attributes specification You need to make sure dot is able +# to find the font, which can be done by putting it in a standard location or by +# setting the DOTFONTPATH environment variable or by setting DOT_FONTPATH to the +# directory containing the font. Default graphviz fontsize is 14. +# The default value is: fontname=Helvetica,fontsize=10. +# This tag requires that the tag HAVE_DOT is set to YES. + +DOT_COMMON_ATTR = "fontname=Helvetica,fontsize=10" + +# DOT_EDGE_ATTR is concatenated with DOT_COMMON_ATTR. For elegant style you can +# add 'arrowhead=open, arrowtail=open, arrowsize=0.5'. Complete documentation about +# arrows shapes. +# The default value is: labelfontname=Helvetica,labelfontsize=10. +# This tag requires that the tag HAVE_DOT is set to YES. + +DOT_EDGE_ATTR = "labelfontname=Helvetica,labelfontsize=10" + +# DOT_NODE_ATTR is concatenated with DOT_COMMON_ATTR. For view without boxes +# around nodes set 'shape=plain' or 'shape=plaintext' Shapes specification +# The default value is: shape=box,height=0.2,width=0.4. +# This tag requires that the tag HAVE_DOT is set to YES. + +DOT_NODE_ATTR = "shape=box,height=0.2,width=0.4" + +# You can set the path where dot can find font specified with fontname in +# DOT_COMMON_ATTR and others dot attributes. # This tag requires that the tag HAVE_DOT is set to YES. DOT_FONTPATH = -# If the CLASS_GRAPH tag is set to YES then doxygen will generate a graph for -# each documented class showing the direct and indirect inheritance relations. -# Setting this tag to YES will force the CLASS_DIAGRAMS tag to NO. +# If the CLASS_GRAPH tag is set to YES (or GRAPH) then doxygen will generate a +# graph for each documented class showing the direct and indirect inheritance +# relations. In case HAVE_DOT is set as well dot will be used to draw the graph, +# otherwise the built-in generator will be used. If the CLASS_GRAPH tag is set +# to TEXT the direct and indirect inheritance relations will be shown as texts / +# links. +# Possible values are: NO, YES, TEXT and GRAPH. # The default value is: YES. -# This tag requires that the tag HAVE_DOT is set to YES. CLASS_GRAPH = YES @@ -2213,7 +2445,8 @@ CLASS_GRAPH = YES COLLABORATION_GRAPH = YES # If the GROUP_GRAPHS tag is set to YES then doxygen will generate a graph for -# groups, showing the direct groups dependencies. +# groups, showing the direct groups dependencies. See also the chapter Grouping +# in the manual. # The default value is: YES. # This tag requires that the tag HAVE_DOT is set to YES. @@ -2236,10 +2469,32 @@ UML_LOOK = NO # but if the number exceeds 15, the total amount of fields shown is limited to # 10. # Minimum value: 0, maximum value: 100, default value: 10. -# This tag requires that the tag HAVE_DOT is set to YES. +# This tag requires that the tag UML_LOOK is set to YES. UML_LIMIT_NUM_FIELDS = 10 +# If the DOT_UML_DETAILS tag is set to NO, doxygen will show attributes and +# methods without types and arguments in the UML graphs. If the DOT_UML_DETAILS +# tag is set to YES, doxygen will add type and arguments for attributes and +# methods in the UML graphs. If the DOT_UML_DETAILS tag is set to NONE, doxygen +# will not generate fields with class member information in the UML graphs. The +# class diagrams will look similar to the default class diagrams but using UML +# notation for the relationships. +# Possible values are: NO, YES and NONE. +# The default value is: NO. +# This tag requires that the tag UML_LOOK is set to YES. + +DOT_UML_DETAILS = NO + +# The DOT_WRAP_THRESHOLD tag can be used to set the maximum number of characters +# to display on a single line. If the actual line length exceeds this threshold +# significantly it will wrapped across multiple lines. Some heuristics are apply +# to avoid ugly line breaks. +# Minimum value: 0, maximum value: 1000, default value: 17. +# This tag requires that the tag HAVE_DOT is set to YES. + +DOT_WRAP_THRESHOLD = 17 + # If the TEMPLATE_RELATIONS tag is set to YES then the inheritance and # collaboration graphs will show the relations between templates and their # instances. @@ -2306,6 +2561,13 @@ GRAPHICAL_HIERARCHY = YES DIRECTORY_GRAPH = YES +# The DIR_GRAPH_MAX_DEPTH tag can be used to limit the maximum number of levels +# of child directories generated in directory dependency graphs by dot. +# Minimum value: 1, maximum value: 25, default value: 1. +# This tag requires that the tag DIRECTORY_GRAPH is set to YES. + +DIR_GRAPH_MAX_DEPTH = 1 + # The DOT_IMAGE_FORMAT tag can be used to set the image format of the images # generated by dot. For an explanation of the image formats see the section # output formats in the documentation of the dot tool (Graphviz (see: @@ -2359,10 +2621,10 @@ MSCFILE_DIRS = DIAFILE_DIRS = # When using plantuml, the PLANTUML_JAR_PATH tag should be used to specify the -# path where java can find the plantuml.jar file. If left blank, it is assumed -# PlantUML is not used or called during a preprocessing step. Doxygen will -# generate a warning when it encounters a \startuml command in this case and -# will not generate output for the diagram. +# path where java can find the plantuml.jar file or to the filename of jar file +# to be used. If left blank, it is assumed PlantUML is not used or called during +# a preprocessing step. Doxygen will generate a warning when it encounters a +# \startuml command in this case and will not generate output for the diagram. PLANTUML_JAR_PATH = @@ -2412,14 +2674,18 @@ DOT_MULTI_TARGETS = NO # If the GENERATE_LEGEND tag is set to YES doxygen will generate a legend page # explaining the meaning of the various boxes and arrows in the dot generated # graphs. +# Note: This tag requires that UML_LOOK isn't set, i.e. the doxygen internal +# graphical representation for inheritance and collaboration diagrams is used. # The default value is: YES. # This tag requires that the tag HAVE_DOT is set to YES. GENERATE_LEGEND = YES -# If the DOT_CLEANUP tag is set to YES, doxygen will remove the intermediate dot +# If the DOT_CLEANUP tag is set to YES, doxygen will remove the intermediate # files that are used to generate the various graphs. +# +# Note: This setting is not only used for dot files but also for msc temporary +# files. # The default value is: YES. -# This tag requires that the tag HAVE_DOT is set to YES. DOT_CLEANUP = YES