Compare commits

..

116 Commits

Author SHA1 Message Date
Camilla Löwy 7482de6071 Documentation work
Fixes #1596

(cherry picked from commit aa80d24d01)
2022-07-15 00:11:23 +02:00
Camilla Löwy 0f341802e1 Win32: Fix right Shift scancode when using CJK IME
Fixes #2050

(cherry picked from commit 6dd526fb1a)
2022-07-15 00:11:23 +02:00
Camilla Löwy 935d7098b6 Documentation work
(cherry picked from commit 2796e61af7)
2022-07-15 00:11:23 +02:00
Camilla Löwy 5937eec914 Wayland: Cleanup
(cherry picked from commit 88a39006e3)
2022-07-15 00:11:23 +02:00
Camilla Löwy 20d11f7f97 Wayland: Fix comment typo
(cherry picked from commit 5c948a6e6e)
2022-07-15 00:11:23 +02:00
Camilla Löwy 8d989cdc41 Add credit
Related to #2150

(cherry picked from commit 8e725338bf)
2022-07-15 00:11:23 +02:00
JoelNiemela 5324177d90 Fix typos in docs
Closes #2150

(cherry picked from commit 060631c965)
2022-07-15 00:11:23 +02:00
Camilla Löwy 2f3c6aa150 Cocoa: Cleanup
(cherry picked from commit 2db528d8cd)
2022-07-15 00:11:23 +02:00
Camilla Löwy 8c63c935ea Documentation work
Related to #2113
Related to #2120

(cherry picked from commit 78b19548d9)
2022-07-15 00:11:23 +02:00
Camilla Löwy 876a177f6c Update changelog and add credit
Related to #2113
Related to #2120

(cherry picked from commit dfb26023fc)
2022-07-15 00:11:23 +02:00
Nikita Fediuchin 1e49024e76 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

(cherry picked from commit 9b7713cf92)
2022-07-15 00:11:23 +02:00
Camilla Löwy 109f836675 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.

This was adapted to 3.3-stable from
3b3d58df47 and
84e165ef64.
2022-07-15 00:09:48 +02:00
Camilla Löwy 2568d703cd Update glad to include Vulkan 1.3 2022-07-13 23:27:23 +02:00
Camilla Löwy 9950cc52df 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

(cherry picked from commit 0d599026d0)
2022-07-13 23:20:54 +02:00
Camilla Löwy e50ee39eac 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.

(cherry picked from commit 6f8ec4075b)
2022-07-13 23:16:01 +02:00
Camilla Löwy 70a024232a Cocoa: Disable macOS fullscreen when non-resizable
Windows with GLFW_RESIZABLE set to false should not be resizable by the
user.

This is adapted to 3.3-stable from
98d6e8485b and
36f0bf00a9.
2022-07-13 23:14:20 +02:00
Camilla Löwy 0cd8813e82 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.

(cherry picked from commit da6713cd09)
2022-07-13 22:48:35 +02:00
Camilla Löwy e541b7969a Wayland: Only create EGL window if using EGL
(cherry picked from commit d578c2ddfe)
2022-07-13 22:48:35 +02:00
Camilla Löwy be333cf0fd 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.

(cherry picked from commit 74b4ceb835)
2022-07-13 22:48:35 +02:00
Camilla Löwy 758d4b1987 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).

(cherry picked from commit c4fbe80d90)
2022-07-13 22:48:35 +02:00
Camilla Löwy 1ac6fbc499 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.

(cherry picked from commit be7f4513c0)
2022-07-13 22:48:35 +02:00
Camilla Löwy 75b37bd2d7 Wayland: Rename function to its purpose
(cherry picked from commit 47193f15de)
2022-07-13 22:48:35 +02:00
Camilla Löwy 7b65ecf77c Wayland: Use enum type to store enum value
(cherry picked from commit 80dc0533cf)
2022-07-13 22:48:35 +02:00
Camilla Löwy aef1d4584f Wayland: Fix transition to server-side decorations
(cherry picked from commit 29b7669bc6)
2022-07-13 22:48:35 +02:00
Camilla Löwy 17959aad33 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.

(cherry picked from commit f35e2274cb)
2022-07-13 22:48:35 +02:00
Camilla Löwy 8f9ddfe3c2 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.

(cherry picked from commit 3203599cac)
2022-07-13 22:48:35 +02:00
Camilla Löwy 4c7f6ada0c 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.

(cherry picked from commit 2df0ce07fa)
2022-07-13 22:48:35 +02:00
Camilla Löwy c807f386c2 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

(cherry picked from commit 83a134a92f)
2022-07-13 22:48:35 +02:00
Camilla Löwy fae1d349d3 Wayland: Rename fallback decoration functions
We are soon going to have three kinds of decorations; XDG, libdecor and
our last resort fallback ones.

(cherry picked from commit eb9c3bee71)
2022-07-13 22:48:35 +02:00
Camilla Löwy 593b85380e Wayland: Remove function only called once
(cherry picked from commit 0cd1916de3)
2022-07-13 22:48:35 +02:00
Camilla Löwy a0259b9426 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.

(cherry picked from commit 77819c0c54)
2022-07-13 22:48:35 +02:00
Camilla Löwy e79d6fe40a 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.

(cherry picked from commit 85f5a51912)
2022-07-13 22:48:35 +02:00
Camilla Löwy 498a4d0635 Wayland: Fix missing error reporting
(cherry picked from commit 9ad9f5c52a)
2022-07-13 22:48:35 +02:00
Camilla Löwy 35fd90aff1 Wayland: Cleanup
Make Wayland code use 'native' in the same senses as the rest of GLFW.

(cherry picked from commit 5002522f73)
2022-07-13 22:48:35 +02:00
Camilla Löwy 6b9087c575 Wayland: Fix error from glfwSetWindowAspectRatio
The aspect ratio was applied during resize but any call to
glfwSetWindowAspectRatio emitted a GLFW_FEATURE_UNIMPLEMENTED error.

(cherry picked from commit 91f18fb576)
2022-07-13 22:48:35 +02:00
Camilla Löwy 48e0e0acf5 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.

(cherry picked from commit e37ba80b13)
2022-07-13 22:48:35 +02:00
Camilla Löwy 557da4cdc4 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.

(cherry picked from commit c3ad3d49ed)
2022-07-13 22:48:35 +02:00
Camilla Löwy 50ea41cb04 Wayland: Add support for wl_output::name
We now use wl_output::name as the GLFW monitor name, on compositors that
provide this event.

(cherry picked from commit 209f6cf093)
2022-07-13 22:48:28 +02:00
Camilla Löwy 2529e663d7 Wayland: Cleanup
(cherry picked from commit 33d37782c6)
2022-07-13 22:47:03 +02:00
Camilla Löwy 8b26801a30 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.

(cherry picked from commit 229d628ec4)
2022-07-13 22:47:03 +02:00
Camilla Löwy e04a7d152a Wayland: Remove duplicate fullscreen check
This check is already performed in shared code.

(cherry picked from commit c28d420060)
2022-07-13 22:47:03 +02:00
Camilla Löwy 8de0c1cdc1 Wayland: Cleanup
(cherry picked from commit 18df0baea6)
2022-07-13 22:47:03 +02:00
Camilla Löwy fead23153e 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

(cherry picked from commit a7b6f35500)
2022-07-13 22:47:03 +02:00
Camilla Löwy cdbcb8c5a7 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

(cherry picked from commit 0f5b095042)
2022-07-13 22:47:03 +02:00
Camilla Löwy 4ba1208239 Wayland: Rename window frame size constants
(cherry picked from commit 24cdc5afda)
2022-07-13 22:47:03 +02:00
Camilla Löwy 941744a59a Wayland: Remove unused code path
(cherry picked from commit 75295f4878)
2022-07-13 22:47:03 +02:00
Camilla Löwy f454410b79 Wayland: Cleanup
(cherry picked from commit 040712ce99)
2022-07-13 22:47:03 +02:00
Camilla Löwy 5feaa33529 Wayland: Remove superfluous comments
These are just repeating parts of the identifier.

(cherry picked from commit 2877fea550)
2022-07-13 22:47:03 +02:00
Camilla Löwy e894bf71a2 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.

(cherry picked from commit e33db6d7aa)
2022-07-13 22:47:03 +02:00
Camilla Löwy ebe2b648ea Wayland: Add tracking of XDG fullscreen state
(cherry picked from commit afb127769a)
2022-07-13 22:47:03 +02:00
Camilla Löwy 51018f19d0 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.

(cherry picked from commit ed39ff43f9)
2022-07-13 22:47:03 +02:00
Camilla Löwy 1ad9c2d5dd Wayland: Cleanup
(cherry picked from commit 98c9961f32)
2022-07-13 22:47:03 +02:00
Camilla Löwy 1c4284e449 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.

(cherry picked from commit 3bbb41eacc)
2022-07-13 22:47:03 +02:00
Camilla Löwy 608007673f 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.

(cherry picked from commit 0b76e3a6f1)
2022-07-13 22:47:03 +02:00
Camilla Löwy 589385aada Wayland: Fix glfwSetWindowSize resizing fs windows
glfwSetWindowSize would change the size of fullscreen mode windows as
if they were windowed mode.

(cherry picked from commit 6857995498)
2022-07-13 22:47:03 +02:00
Camilla Löwy 15050f5711 Wayland: Fix missing fullscreen code path
glfwRestoreWindow assumed it was only called in windowed mode.

(cherry picked from commit fdc72edf81)
2022-07-13 22:47:03 +02:00
Camilla Löwy 562eca6f28 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.

(cherry picked from commit f39ffefb6a)
2022-07-13 22:47:03 +02:00
Camilla Löwy dea602623d 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

(cherry picked from commit ddd087d662)
2022-07-13 22:47:03 +02:00
Emmanuel Gil Peyrot 581fed38be Wayland: Remove support for wl_shell
This is adapted to 3.3-stable from
599fb3de34 and
27295b508f.
2022-07-13 22:40:46 +02:00
Camilla Löwy 9f8ec83411 Wayland: Cleanup
(cherry picked from commit 523fdf50c1)
2022-07-12 20:29:22 +02:00
Camilla Löwy 3ec59687f1 Add credit
Related to #2108

(cherry picked from commit d3ede7b684)
2022-07-12 20:29:22 +02:00
Camilla Löwy aa1efada52 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

(cherry picked from commit 05f6c13d11)
2022-07-12 20:29:22 +02:00
Camilla Löwy b86fcd7cd0 Cocoa: Use system header to declare id type
Related to #1348

(cherry picked from commit edec334b32)
2022-07-12 20:29:22 +02:00
Camilla Löwy 631da8cc2f 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

(cherry picked from commit 26920a1a38)
2022-07-12 20:29:22 +02:00
Camilla Löwy 416f7828ff 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

This is adapted to 3.3-stable from
2c204ab52e and
fd7e737216.
2022-07-12 20:27:34 +02:00
Camilla Löwy 6de6446aca 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.

(cherry picked from commit e9c58bc181)
2022-06-10 17:11:25 +02:00
Camilla Löwy 2a6d25d1aa Win32: Add comment clarifying use of ToUnicode
Fixes #2100

(cherry picked from commit 62e175ef9f)
2022-06-10 17:11:13 +02:00
Camilla Löwy f4e36e5389 Win32: Make monitor area retrieval more consistent
The rest of this file uses GetMonitorInfoW to retrieve this information.

(cherry picked from commit 7dfd84c458)
2022-06-10 17:11:13 +02:00
Camilla Löwy f001aa3490 Fix and clarify comments for GLFWAPI
(cherry picked from commit 685de9089f)
2022-06-10 17:11:13 +02:00
Camilla Löwy b9ea733ca8 Move last bits of window setup to platform code
This avoids glfwCreateWindow emitting GLFW_PLATFORM_ERROR on Wayland
because shared code was calling unimplemented or unavailable platform
functions during final setup.

It also makes it consistent with the final setup of full screen windows.

This is adapted to 3.3-stable from
09653b8c54.
2022-06-10 17:11:01 +02:00
Camilla Löwy c8be8606f0 Win32: Fix message reported by VS 2022
(cherry picked from commit acf0c10e7a)
2022-06-09 19:55:34 +02:00
Camilla Löwy 1b3b2108e3 Win32: Remove superfluous cast
(cherry picked from commit 80e31ce9e1)
2022-06-09 19:55:30 +02:00
Camilla Löwy af9eb79de4 Move CODEOWNERS to .github directory
This slightly de-clutters a directory mostly intended for human-readable
documentation.

(cherry picked from commit d3c2121221)
2022-06-09 19:55:25 +02:00
Camilla Löwy 65b8c4a46b X11: Fix segfault on malformed INCR response
The code assumed that at least some data would be received via the INCR
mechanism and that, as a result, the string buffer would be allocated.

Bug found by Clang static analysis.

(cherry picked from commit 23e6e8e4b7)
2022-06-09 19:55:18 +02:00
Camilla Löwy 946312fe93 X11: Fix returned clipboard string freed too early
The clipboard string should not be freed on SelectionClear.  The user
may have received it from glfwGetClipboardString and it should remain
valid until the next call to a public clipboard string function.

(cherry picked from commit f60547ac80)
2022-06-09 19:53:23 +02:00
Camilla Löwy bf5529512c Document delayed initialization of EGL display
(cherry picked from commit 06089a91a6)
2022-06-09 19:50:00 +02:00
Camilla Löwy 0052ddc5e3 Update stb_image_write.h to version 1.16
(cherry picked from commit 82ccbb3ef0)
2022-06-09 19:49:34 +02:00
Camilla Löwy 53d40878c8 X11: Fix OSMesa library not being unloaded
(cherry picked from commit a8d8b760fb)
2022-06-09 19:49:15 +02:00
Camilla Löwy 6dd9bf0bef Wayland: Fix OSMesa library not being unloaded
(cherry picked from commit 2d281d7928)
2022-06-09 19:48:31 +02:00
Camilla Löwy 6d08e52bcf Cocoa: Fix EGL and OSMesa not being unloaded
(cherry picked from commit 89514cf0fc)
2022-06-09 19:47:36 +02:00
Camilla Löwy 3d9d4e311c Win32: Fix OSMesa library not being unloaded
(cherry picked from commit 10e9033a29)
2022-06-09 19:42:44 +02:00
Camilla Löwy af612103d0 Fix order of error checks in glfwSetGammaRamp
Initialization should be checked before arguments.

(cherry picked from commit 29523dbfbf)
2022-06-09 19:41:56 +02:00
Camilla Löwy 4143d96228 Fix glfwMakeContextCurrent using uninitialized TLS
Issue reported by danhambleton on the GLFW forum:
https://discourse.glfw.org/t/posix-thread-local-storage-tls-error-when-making-context-current/2034

(cherry picked from commit f843d53333)
2022-06-09 19:41:10 +02:00
Camilla Löwy 05422e2824 Wayland: Add support for file drop events
This adds support for file path drop events in text/uri-list format.

It is based on work by Pilzschaf in #2040.

Closes #2040

(cherry picked from commit 4cb36872a5)
2022-06-09 19:39:28 +02:00
Camilla Löwy 2b504e41d5 Wayland: Clean up listener struct initialization
Adapt style to match the rest of the project.

(cherry picked from commit 0f38382e25)
2022-06-09 19:34:29 +02:00
Camilla Löwy 50d5de7cd4 Wayland: Make data offer reading a generic utility
This will be needed for drag and drop reception as well.

(cherry picked from commit f010335b8c)
2022-06-09 19:32:18 +02:00
Camilla Löwy 4d0e98d90c Wayland: Move window related code to window module
The Wayland backend was the only one where half the window and input
related code was in the init module.  As those bits want to share more
utility code with the window module, the interface between them grows.

To prevent that, this gathers nearly all window and input related code
into the window module.

This is adapted to 3.3-stable from
b7a3af9b79.
2022-06-09 19:29:12 +02:00
Camilla Löwy c0c0d172a1 Wayland: Remove check for error that cannot happen
Famous last words.

(cherry picked from commit 967282c2e6)
2022-05-06 19:34:06 +02:00
Camilla Löwy 9e852ec39e Wayland: Remove error reporting of external bugs
Not sure that GLFW should be reporting that another client has made an
invalid receive request.

(cherry picked from commit 8d216054ad)
2022-05-06 19:34:06 +02:00
Camilla Löwy 4d68daedc9 Wayland: Clean up clipboard writing
(cherry picked from commit 34418951cc)
2022-05-06 19:34:06 +02:00
Camilla Löwy ea1b6b9638 Move URI list parsing to shared code
This will soon be used by the Wayland backend.

(cherry picked from commit ad4a9e42f0)
2022-05-06 19:34:06 +02:00
Camilla Löwy f145e1f930 Wayland: Add strerror output to error descriptions
(cherry picked from commit e0889736fd)
2022-05-06 19:34:06 +02:00
Camilla Löwy 915e43885c Wayland: Clean up clipboard reading
(cherry picked from commit c132135332)
2022-05-06 19:34:06 +02:00
Camilla Löwy 857fae4920 Wayland: Simplify clipboard string allocation
(cherry picked from commit 4651165272)
2022-05-06 19:34:06 +02:00
Camilla Löwy a31c648127 Wayland: Improve handling of pending data offers
The code assumed that all data offers were selections that supported
plaintext UTF-8.

The initial data offer events are now handled almost tolerably.  Only
selection data offers are used for clipboard string and only if they
provide plaintext UTF-8.  Drag and drop data offers are now rejected as
soon as they enter a surface.

Related to #2040

(cherry picked from commit 8d87be1268)
2022-05-06 19:34:06 +02:00
Camilla Löwy c89899a428 Wayland: Return our clipboard without roundtrips
(cherry picked from commit 89d3ea8d69)
2022-05-06 19:34:06 +02:00
Camilla Löwy 75b27849f6 Wayland: Fix error paths not closing sending fd
Whatever error happens on our end, we should still close the fd so the
other end can move on.

(cherry picked from commit 990dc4b388)
2022-05-06 19:34:05 +02:00
Camilla Löwy f51ec79951 Wayland: Rename listener user data parameters
(cherry picked from commit a4460b694e)
2022-05-06 19:34:05 +02:00
Camilla Löwy 3599fe4a78 Wayland: Clean up pointer declarations
Adapt style to match the rest of the project.

(cherry picked from commit 4506175023)
2022-05-06 19:34:05 +02:00
Camilla Löwy 1ee540bf48 Wayland: Rename data transfer parameters
No rationale beyond personal preference.

(cherry picked from commit ba11e60859)
2022-05-06 19:34:05 +02:00
Camilla Löwy 32bedd9a94 Wayland: Fix phrasing of error messages
This is adapted to 3.3-stable from
2d45681bc3.
2022-05-06 19:34:05 +02:00
Camilla Löwy 25db8f8014 Wayland: Fix partial writes of clipboard string
The string pointer used to write the contents of our clipboard data
offer was never updated, causing it to repeat parts of the beginning of
the string until the correct number of bytes had been written.

(cherry picked from commit 4c110bba41)
2022-05-06 19:34:05 +02:00
Camilla Löwy 2430d6b7f7 Wayland: Remove superfluous global struct member
It seems unlikely that strlen will be a bottleneck when sending
clipboard contents.

(cherry picked from commit 738b1c73b5)
2022-05-06 19:34:05 +02:00
Camilla Löwy 53bd67ccfe Wayland: Fix double free on data source error
If data source creation fails, the string containing the data for it
would be freed a second time during termination.

(cherry picked from commit b386371f57)
2022-05-06 19:34:05 +02:00
Camilla Löwy 22f718dcf4 Wayland: Fix handling of clipboard set to self
Passing any part of the result of glfwGetClipboardString to
glfwSetClipboardString would result in, at best, a use-after-free error.

(cherry picked from commit 9c95cfb9f1)
2022-05-06 19:34:05 +02:00
Camilla Löwy f93751ce68 Fix missing newline
(cherry picked from commit 920d110b6c)
2022-05-06 19:34:05 +02:00
Camilla Löwy 8897c8a1cb POSIX: Fix data type of return values
(cherry picked from commit 554cbdb205)
2022-05-06 19:34:05 +02:00
Camilla Löwy 307ccd68a5 Cocoa: Fix AirPlay causing harmless init error
Emitting an error for one specific type of failure in retrieving the
correct name for a display is not very useful, especially when
initialization is otherwise unaffected.

There should be a path for information like that but this isn't it.

Fixes #1791

(cherry picked from commit 955fbd9d26)
2022-05-06 19:34:05 +02:00
Camilla Löwy de550b60e5 Win32: Fix using executable instance and not ours
Operations that take an instance handle should be passed the handle of
whatever module we are inside instead of blindly passing the handle of
the executable.

This commit makes GLFW retrieve its own instance on initialization.

This makes the most difference for window classes, which are
per-instance.  Using the executable instance led to name conflicts if
there were several copies of GLFW in a single process.

Note that having this is still a bad idea unless you know what things to
avoid, and those things are mostly platform-specific.  This is partly
because the library wasn't designed for it and partly because it needs
to save, update and restore various per-process and per-session settings
like current context and video mode.

However, multiple simultaneous copies of GLFW in a single Win32 process
should now at least initialize, like is already the case on other
platforms.

Fixes #469
Fixes #1296
Fixes #1395
Related to #927
Related to #1885

(cherry picked from commit 07a5518c3e)
2022-05-06 19:34:05 +02:00
Camilla Löwy 802882f7cb Add checks for some invalid values to public API
There were no checks for invalid values or asserts for all invalid NULL
pointers to glfwSetWindowIcon or glfwCreateCursor.

Fixes #1862

(cherry picked from commit 66a4882eb1)
2022-05-06 19:34:05 +02:00
Camilla Löwy c2ccf6f919 Win32: Fix glfwGetKeyScancode for GLFW_KEY_PAUSE
The bug described in 03cfe957e7 was
already present for another key where modifiers changes its scancode.

Related to #1993

(cherry picked from commit 8d9231fe5e)
2022-05-06 19:34:04 +02:00
Camilla Löwy 32df2ed716 Win32: Fix scancode and key for Alt+PrtSc events
Alt+PrtSc emits a different scancode than just PrtSc.  Since the GLFW
API assumes each key corresponds to only one scancode, this cannot be
added to the keycodes array.

Instead we replace the scancode at the point of entry.

Fixes #1993

(cherry picked from commit 03cfe957e7)
2022-05-06 19:34:04 +02:00
Camilla Löwy c2188e2d0a Fix accidental C99 in C89 header
(cherry picked from commit add0521efb)
2022-05-06 19:34:04 +02:00
Camilla Löwy e7a81f8aaa Fix GLAPIENTRY redefinition warning
On a Unix system, if you define GLFW_INCLUDE_NONE and
GLFW_EXPOSE_NATIVE_GLX, then include glfw3.h and glfw3native.h, you will
get a redefinition warning for GLAPIENTRY.

The glfw3.h header defines GLAPIENTRY as a service for OpenGL related
headers that assume it's already defined.  However, glx.h includes gl.h,
which defines GLAPIENTRY unconditionally.

If not for Hyrum's law, the better solution would have been not to
define GLAPIENTRY if GLFW_INCLUDE_NONE is defined.

Fixes #2010

This is adapted to 3.3-stable from
535c3ce632 and
ce85c7dcaf.
2022-05-06 19:33:08 +02:00
Camilla Löwy 3006c02bc2 Add shared min and max functions for int
(cherry picked from commit 3ee5031fd7)
2022-05-03 15:33:08 +02:00
Camilla Löwy b43c122dd1 Start 3.3.8 2022-04-05 19:54:09 +02:00
41 changed files with 5736 additions and 2459 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.0...3.20 FATAL_ERROR) cmake_minimum_required(VERSION 3.0...3.20 FATAL_ERROR)
project(GLFW VERSION 3.3.7 LANGUAGES C) project(GLFW VERSION 3.3.8 LANGUAGES C)
set(CMAKE_LEGACY_CYGWIN_WIN32 OFF) set(CMAKE_LEGACY_CYGWIN_WIN32 OFF)
+17
View File
@@ -18,11 +18,13 @@ video tutorials.
- Nevyn Bengtsson - Nevyn Bengtsson
- Niklas Bergström - Niklas Bergström
- Denis Bernard - Denis Bernard
- BiBi
- Doug Binks - Doug Binks
- blanco - blanco
- Waris Boonyasiriwat - Waris Boonyasiriwat
- Kyle Brenneman - Kyle Brenneman
- Rok Breulj - Rok Breulj
- TheBrokenRail
- Kai Burjack - Kai Burjack
- Martin Capitanio - Martin Capitanio
- Nicolas Caramelli - Nicolas Caramelli
@@ -43,6 +45,7 @@ video tutorials.
- Noel Cower - Noel Cower
- CuriouserThing - CuriouserThing
- Jason Daly - Jason Daly
- danhambleton
- Jarrod Davis - Jarrod Davis
- Olivier Delannoy - Olivier Delannoy
- Paul R. Deppe - Paul R. Deppe
@@ -57,6 +60,7 @@ video tutorials.
- Jan Ekström - Jan Ekström
- Siavash Eliasi - Siavash Eliasi
- TheExileFox - TheExileFox
- Nikita Fediuchin
- Felipe Ferreira - Felipe Ferreira
- Michael Fogleman - Michael Fogleman
- Jason Francis - Jason Francis
@@ -69,6 +73,7 @@ video tutorials.
- Ryan C. Gordon - Ryan C. Gordon
- Stephen Gowen - Stephen Gowen
- Kovid Goyal - Kovid Goyal
- Kevin Grandemange
- Eloi Marín Gratacós - Eloi Marín Gratacós
- Stefan Gustavson - Stefan Gustavson
- Andrew Gutekanst - Andrew Gutekanst
@@ -80,13 +85,17 @@ video tutorials.
- heromyth - heromyth
- Lucas Hinderberger - Lucas Hinderberger
- Paul Holden - Paul Holden
- Hajime Hoshi
- Warren Hu - Warren Hu
- Charles Huber - Charles Huber
- Brent Huisman
- illustris - illustris
- InKryption - InKryption
- IntellectualKitty - IntellectualKitty
- Aaron Jacobs - Aaron Jacobs
- JannikGM
- Erik S. V. Jansson - Erik S. V. Jansson
- jjYBdx4IL
- Toni Jovanoski - Toni Jovanoski
- Arseny Kapoulkine - Arseny Kapoulkine
- Cem Karan - Cem Karan
@@ -131,15 +140,19 @@ video tutorials.
- Kenneth Miller - Kenneth Miller
- Bruce Mitchener - Bruce Mitchener
- Jack Moffitt - Jack Moffitt
- Ravi Mohan
- Jeff Molofee - Jeff Molofee
- Alexander Monakov - Alexander Monakov
- Pierre Morel - Pierre Morel
- Jon Morton - Jon Morton
- Pierre Moulon - Pierre Moulon
- Martins Mozeiko - Martins Mozeiko
- James Murphy
- Julian Møller - Julian Møller
- ndogxj - ndogxj
- F. Nedelec
- Kristian Nielsen - Kristian Nielsen
- Joel Niemelä
- Kamil Nowakowski - Kamil Nowakowski
- onox - onox
- Denis Ovod - Denis Ovod
@@ -150,10 +163,12 @@ video tutorials.
- Christopher Pelloux - Christopher Pelloux
- Arturo J. Pérez - Arturo J. Pérez
- Vladimir Perminov - Vladimir Perminov
- Olivier Perret
- Anthony Pesch - Anthony Pesch
- Orson Peters - Orson Peters
- Emmanuel Gil Peyrot - Emmanuel Gil Peyrot
- Cyril Pichard - Cyril Pichard
- Pilzschaf
- Keith Pitt - Keith Pitt
- Stanislav Podgorskiy - Stanislav Podgorskiy
- Konstantin Podsvirov - Konstantin Podsvirov
@@ -162,6 +177,7 @@ video tutorials.
- Pablo Prietz - Pablo Prietz
- przemekmirek - przemekmirek
- pthom - pthom
- Martin Pulec
- Guillaume Racicot - Guillaume Racicot
- Philip Rideout - Philip Rideout
- Eddie Ringle - Eddie Ringle
@@ -201,6 +217,7 @@ video tutorials.
- TTK-Bandit - TTK-Bandit
- Sergey Tikhomirov - Sergey Tikhomirov
- Arthur Tombs - Arthur Tombs
- TronicLabs
- Ioannis Tsakpinis - Ioannis Tsakpinis
- Samuli Tuomola - Samuli Tuomola
- Matthew Turner - Matthew Turner
+68 -27
View File
@@ -123,33 +123,74 @@ information on what to include when reporting a bug.
## Changelog ## Changelog
- [Win32] Bugfix: A window created maximized and undecorated would cover the whole - Added `GLFW_NATIVE_INCLUDE_NONE` for disabling inclusion of native headers (#1348)
monitor (#1806) - Bugfix: `glfwMakeContextCurrent` would access TLS slot before initialization
- [Win32] Bugfix: The default restored window position was lost when creating a maximized - Bugfix: `glfwSetGammaRamp` could emit `GLFW_INVALID_VALUE` before initialization
window - Bugfix: `glfwGetJoystickUserPointer` returned `NULL` during disconnection (#2092)
- [Win32] Bugfix: `glfwMaximizeWindow` would make a hidden window visible - [Win32] Bugfix: `Alt+PrtSc` would emit `GLFW_KEY_UNKNOWN` and a different
- [Cocoa] Bugfix: `kUTTypeURL` was deprecated in macOS 12.0 (#2003) scancode than `PrtSc` (#1993)
- [X11] Bugfix: Dynamic loading on OpenBSD failed due to soname differences - [Win32] Bugfix: `GLFW_KEY_PAUSE` scancode from `glfwGetKeyScancode` did not
- [X11] Bugfix: Waiting for events would fail if file descriptor was too large match event scancode (#1993)
(#2024) - [Win32] Bugfix: Instance-local operations used executable instance (#469,#1296,#1395)
- [X11] Bugfix: Joystick events could lead to busy-waiting (#1872) - [Win32] Bugfix: The OSMesa library was not unloaded on termination
- [X11] Bugfix: `glfwWaitEvents*` did not continue for joystick events - [Win32] Bugfix: Right shift emitted `GLFW_KEY_UNKNOWN` when using a CJK IME (#2050)
- [X11] Bugfix: `glfwPostEmptyEvent` could be ignored due to race condition - [Cocoa] Disabled macOS fullscreen when `GLFW_RESIZABLE` is false
(#379,#1281,#1285,#2033) - [Cocoa] Bugfix: A connected Apple AirPlay would emit a useless error (#1791)
- [X11] Bugfix: Dynamic loading on NetBSD failed due to soname differences - [Cocoa] Bugfix: The EGL and OSMesa libraries were not unloaded on termination
- [X11] Bugfix: Left shift of int constant relied on undefined behavior (#1951) - [Cocoa] Bugfix: `GLFW_MAXIMIZED` was always true when `GLFW_RESIZABLE` was false
- [Wayland] Added support for key names via xkbcommon - [Cocoa] Bugfix: Changing `GLFW_DECORATED` in macOS fullscreen would abort
- [Wayland] Bugfix: Key repeat could lead to a race condition (#1710) application (#1886)
- [Wayland] Bugfix: Activating a window would emit two input focus events - [Cocoa] Bugfix: Setting a monitor from macOS fullscreen would abort
- [Wayland] Bugfix: Disable key repeat mechanism when window loses input focus application (#2110)
- [Wayland] Bugfix: Window hiding and showing did not work (#1492,#1731) - [Cocoa] Bugfix: The Vulkan loader was not loaded from the `Frameworks` bundle
- [Wayland] Bugfix: A key being repeated was not released when window lost focus subdirectory (#2113,#2120)
- [Wayland] Bugfix: Showing a hidden window did not emit a window refresh event - [X11] Bugfix: The OSMesa libray was not unloaded on termination
- [Wayland] Bugfix: Full screen window creation did not ignore `GLFW_VISIBLE` - [X11] Bugfix: A malformed response during selection transfer could cause a segfault
- [Wayland] Bugfix: Some keys were reported as wrong key or `GLFW_KEY_UNKNOWN` - [X11] Bugfix: Some calls would reset Xlib to the default error handler (#2108)
- [Wayland] Bugfix: Text input did not repeat along with key repeat - [Wayland] Added support for file path drop events (#2040)
- [Wayland] Bugfix: `glfwPostEmptyEvent` sometimes had no effect (#1520,#1521) - [Wayland] Added support for more human-readable monitor names where available
- [GLX] Bugfix: Context creation failed if GLX 1.4 was not exported by GLX library - [Wayland] Removed support for the deprecated wl\_shell protocol
- [Wayland] Bugfix: `glfwSetClipboardString` would fail if set to result of
`glfwGetClipboardString`
- [Wayland] Bugfix: Data source creation error would cause double free at termination
- [Wayland] Bugfix: Partial writes of clipboard string would cause beginning to repeat
- [Wayland] Bugfix: Some errors would cause clipboard string transfer to hang
- [Wayland] Bugfix: Drag and drop data was misinterpreted as clipboard string
- [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_PLATFORM_ERROR`
- [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
- [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
- [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
- [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
- [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
- [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
- [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)
- [Wayland] Bugfix: `GLFW_DECORATED` was ignored when showing a window with XDG
decorations
## Contact ## Contact
+6 -14
View File
@@ -2,19 +2,9 @@
/* File: vk_platform.h */ /* File: vk_platform.h */
/* */ /* */
/* /*
** Copyright (c) 2014-2017 The Khronos Group Inc. ** Copyright 2014-2022 The Khronos Group Inc.
** **
** Licensed under the Apache License, Version 2.0 (the "License"); ** SPDX-License-Identifier: Apache-2.0
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/ */
@@ -52,7 +42,7 @@ extern "C"
#define VKAPI_CALL __stdcall #define VKAPI_CALL __stdcall
#define VKAPI_PTR VKAPI_CALL #define VKAPI_PTR VKAPI_CALL
#elif defined(__ANDROID__) && defined(__ARM_ARCH) && __ARM_ARCH < 7 #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) #elif defined(__ANDROID__) && defined(__ARM_ARCH) && __ARM_ARCH >= 7 && defined(__ARM_32BIT_STATE)
/* On Android 32-bit ARM targets, Vulkan functions use the "hardfloat" */ /* On Android 32-bit ARM targets, Vulkan functions use the "hardfloat" */
/* calling convention, i.e. float parameters are passed in registers. This */ /* calling convention, i.e. float parameters are passed in registers. This */
@@ -68,7 +58,9 @@ extern "C"
#define VKAPI_PTR #define VKAPI_PTR
#endif #endif
#include <stddef.h> #if !defined(VK_NO_STDDEF_H)
#include <stddef.h>
#endif /* !defined(VK_NO_STDDEF_H) */
#if !defined(VK_NO_STDINT_H) #if !defined(VK_NO_STDINT_H)
#if defined(_MSC_VER) && (_MSC_VER < 1600) #if defined(_MSC_VER) && (_MSC_VER < 1600)
+2382 -354
View File
File diff suppressed because it is too large Load Diff
+348 -208
View File
@@ -14,10 +14,18 @@
#endif /* GLAD_IMPL_UTIL_C_ */ #endif /* GLAD_IMPL_UTIL_C_ */
#ifdef __cplusplus
extern "C" {
#endif
int GLAD_VK_VERSION_1_0 = 0; int GLAD_VK_VERSION_1_0 = 0;
int GLAD_VK_VERSION_1_1 = 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_EXT_debug_report = 0;
int GLAD_VK_KHR_portability_enumeration = 0;
int GLAD_VK_KHR_surface = 0; int GLAD_VK_KHR_surface = 0;
int GLAD_VK_KHR_swapchain = 0; int GLAD_VK_KHR_swapchain = 0;
@@ -35,18 +43,26 @@ PFN_vkBindImageMemory glad_vkBindImageMemory = NULL;
PFN_vkBindImageMemory2 glad_vkBindImageMemory2 = NULL; PFN_vkBindImageMemory2 glad_vkBindImageMemory2 = NULL;
PFN_vkCmdBeginQuery glad_vkCmdBeginQuery = NULL; PFN_vkCmdBeginQuery glad_vkCmdBeginQuery = NULL;
PFN_vkCmdBeginRenderPass glad_vkCmdBeginRenderPass = NULL; PFN_vkCmdBeginRenderPass glad_vkCmdBeginRenderPass = NULL;
PFN_vkCmdBeginRenderPass2 glad_vkCmdBeginRenderPass2 = NULL;
PFN_vkCmdBeginRendering glad_vkCmdBeginRendering = NULL;
PFN_vkCmdBindDescriptorSets glad_vkCmdBindDescriptorSets = NULL; PFN_vkCmdBindDescriptorSets glad_vkCmdBindDescriptorSets = NULL;
PFN_vkCmdBindIndexBuffer glad_vkCmdBindIndexBuffer = NULL; PFN_vkCmdBindIndexBuffer glad_vkCmdBindIndexBuffer = NULL;
PFN_vkCmdBindPipeline glad_vkCmdBindPipeline = NULL; PFN_vkCmdBindPipeline glad_vkCmdBindPipeline = NULL;
PFN_vkCmdBindVertexBuffers glad_vkCmdBindVertexBuffers = NULL; PFN_vkCmdBindVertexBuffers glad_vkCmdBindVertexBuffers = NULL;
PFN_vkCmdBindVertexBuffers2 glad_vkCmdBindVertexBuffers2 = NULL;
PFN_vkCmdBlitImage glad_vkCmdBlitImage = NULL; PFN_vkCmdBlitImage glad_vkCmdBlitImage = NULL;
PFN_vkCmdBlitImage2 glad_vkCmdBlitImage2 = NULL;
PFN_vkCmdClearAttachments glad_vkCmdClearAttachments = NULL; PFN_vkCmdClearAttachments glad_vkCmdClearAttachments = NULL;
PFN_vkCmdClearColorImage glad_vkCmdClearColorImage = NULL; PFN_vkCmdClearColorImage glad_vkCmdClearColorImage = NULL;
PFN_vkCmdClearDepthStencilImage glad_vkCmdClearDepthStencilImage = NULL; PFN_vkCmdClearDepthStencilImage glad_vkCmdClearDepthStencilImage = NULL;
PFN_vkCmdCopyBuffer glad_vkCmdCopyBuffer = NULL; PFN_vkCmdCopyBuffer glad_vkCmdCopyBuffer = NULL;
PFN_vkCmdCopyBuffer2 glad_vkCmdCopyBuffer2 = NULL;
PFN_vkCmdCopyBufferToImage glad_vkCmdCopyBufferToImage = NULL; PFN_vkCmdCopyBufferToImage glad_vkCmdCopyBufferToImage = NULL;
PFN_vkCmdCopyBufferToImage2 glad_vkCmdCopyBufferToImage2 = NULL;
PFN_vkCmdCopyImage glad_vkCmdCopyImage = NULL; PFN_vkCmdCopyImage glad_vkCmdCopyImage = NULL;
PFN_vkCmdCopyImage2 glad_vkCmdCopyImage2 = NULL;
PFN_vkCmdCopyImageToBuffer glad_vkCmdCopyImageToBuffer = NULL; PFN_vkCmdCopyImageToBuffer glad_vkCmdCopyImageToBuffer = NULL;
PFN_vkCmdCopyImageToBuffer2 glad_vkCmdCopyImageToBuffer2 = NULL;
PFN_vkCmdCopyQueryPoolResults glad_vkCmdCopyQueryPoolResults = NULL; PFN_vkCmdCopyQueryPoolResults glad_vkCmdCopyQueryPoolResults = NULL;
PFN_vkCmdDispatch glad_vkCmdDispatch = NULL; PFN_vkCmdDispatch glad_vkCmdDispatch = NULL;
PFN_vkCmdDispatchBase glad_vkCmdDispatchBase = NULL; PFN_vkCmdDispatchBase glad_vkCmdDispatchBase = NULL;
@@ -54,31 +70,56 @@ PFN_vkCmdDispatchIndirect glad_vkCmdDispatchIndirect = NULL;
PFN_vkCmdDraw glad_vkCmdDraw = NULL; PFN_vkCmdDraw glad_vkCmdDraw = NULL;
PFN_vkCmdDrawIndexed glad_vkCmdDrawIndexed = NULL; PFN_vkCmdDrawIndexed glad_vkCmdDrawIndexed = NULL;
PFN_vkCmdDrawIndexedIndirect glad_vkCmdDrawIndexedIndirect = NULL; PFN_vkCmdDrawIndexedIndirect glad_vkCmdDrawIndexedIndirect = NULL;
PFN_vkCmdDrawIndexedIndirectCount glad_vkCmdDrawIndexedIndirectCount = NULL;
PFN_vkCmdDrawIndirect glad_vkCmdDrawIndirect = NULL; PFN_vkCmdDrawIndirect glad_vkCmdDrawIndirect = NULL;
PFN_vkCmdDrawIndirectCount glad_vkCmdDrawIndirectCount = NULL;
PFN_vkCmdEndQuery glad_vkCmdEndQuery = NULL; PFN_vkCmdEndQuery glad_vkCmdEndQuery = NULL;
PFN_vkCmdEndRenderPass glad_vkCmdEndRenderPass = NULL; PFN_vkCmdEndRenderPass glad_vkCmdEndRenderPass = NULL;
PFN_vkCmdEndRenderPass2 glad_vkCmdEndRenderPass2 = NULL;
PFN_vkCmdEndRendering glad_vkCmdEndRendering = NULL;
PFN_vkCmdExecuteCommands glad_vkCmdExecuteCommands = NULL; PFN_vkCmdExecuteCommands glad_vkCmdExecuteCommands = NULL;
PFN_vkCmdFillBuffer glad_vkCmdFillBuffer = NULL; PFN_vkCmdFillBuffer glad_vkCmdFillBuffer = NULL;
PFN_vkCmdNextSubpass glad_vkCmdNextSubpass = NULL; PFN_vkCmdNextSubpass glad_vkCmdNextSubpass = NULL;
PFN_vkCmdNextSubpass2 glad_vkCmdNextSubpass2 = NULL;
PFN_vkCmdPipelineBarrier glad_vkCmdPipelineBarrier = NULL; PFN_vkCmdPipelineBarrier glad_vkCmdPipelineBarrier = NULL;
PFN_vkCmdPipelineBarrier2 glad_vkCmdPipelineBarrier2 = NULL;
PFN_vkCmdPushConstants glad_vkCmdPushConstants = NULL; PFN_vkCmdPushConstants glad_vkCmdPushConstants = NULL;
PFN_vkCmdResetEvent glad_vkCmdResetEvent = NULL; PFN_vkCmdResetEvent glad_vkCmdResetEvent = NULL;
PFN_vkCmdResetEvent2 glad_vkCmdResetEvent2 = NULL;
PFN_vkCmdResetQueryPool glad_vkCmdResetQueryPool = NULL; PFN_vkCmdResetQueryPool glad_vkCmdResetQueryPool = NULL;
PFN_vkCmdResolveImage glad_vkCmdResolveImage = NULL; PFN_vkCmdResolveImage glad_vkCmdResolveImage = NULL;
PFN_vkCmdResolveImage2 glad_vkCmdResolveImage2 = NULL;
PFN_vkCmdSetBlendConstants glad_vkCmdSetBlendConstants = NULL; PFN_vkCmdSetBlendConstants glad_vkCmdSetBlendConstants = NULL;
PFN_vkCmdSetCullMode glad_vkCmdSetCullMode = NULL;
PFN_vkCmdSetDepthBias glad_vkCmdSetDepthBias = NULL; PFN_vkCmdSetDepthBias glad_vkCmdSetDepthBias = NULL;
PFN_vkCmdSetDepthBiasEnable glad_vkCmdSetDepthBiasEnable = NULL;
PFN_vkCmdSetDepthBounds glad_vkCmdSetDepthBounds = 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_vkCmdSetDeviceMask glad_vkCmdSetDeviceMask = NULL;
PFN_vkCmdSetEvent glad_vkCmdSetEvent = NULL; PFN_vkCmdSetEvent glad_vkCmdSetEvent = NULL;
PFN_vkCmdSetEvent2 glad_vkCmdSetEvent2 = NULL;
PFN_vkCmdSetFrontFace glad_vkCmdSetFrontFace = NULL;
PFN_vkCmdSetLineWidth glad_vkCmdSetLineWidth = 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_vkCmdSetScissor glad_vkCmdSetScissor = NULL;
PFN_vkCmdSetScissorWithCount glad_vkCmdSetScissorWithCount = NULL;
PFN_vkCmdSetStencilCompareMask glad_vkCmdSetStencilCompareMask = NULL; PFN_vkCmdSetStencilCompareMask glad_vkCmdSetStencilCompareMask = NULL;
PFN_vkCmdSetStencilOp glad_vkCmdSetStencilOp = NULL;
PFN_vkCmdSetStencilReference glad_vkCmdSetStencilReference = NULL; PFN_vkCmdSetStencilReference glad_vkCmdSetStencilReference = NULL;
PFN_vkCmdSetStencilTestEnable glad_vkCmdSetStencilTestEnable = NULL;
PFN_vkCmdSetStencilWriteMask glad_vkCmdSetStencilWriteMask = NULL; PFN_vkCmdSetStencilWriteMask glad_vkCmdSetStencilWriteMask = NULL;
PFN_vkCmdSetViewport glad_vkCmdSetViewport = NULL; PFN_vkCmdSetViewport glad_vkCmdSetViewport = NULL;
PFN_vkCmdSetViewportWithCount glad_vkCmdSetViewportWithCount = NULL;
PFN_vkCmdUpdateBuffer glad_vkCmdUpdateBuffer = NULL; PFN_vkCmdUpdateBuffer glad_vkCmdUpdateBuffer = NULL;
PFN_vkCmdWaitEvents glad_vkCmdWaitEvents = NULL; PFN_vkCmdWaitEvents glad_vkCmdWaitEvents = NULL;
PFN_vkCmdWaitEvents2 glad_vkCmdWaitEvents2 = NULL;
PFN_vkCmdWriteTimestamp glad_vkCmdWriteTimestamp = NULL; PFN_vkCmdWriteTimestamp glad_vkCmdWriteTimestamp = NULL;
PFN_vkCmdWriteTimestamp2 glad_vkCmdWriteTimestamp2 = NULL;
PFN_vkCreateBuffer glad_vkCreateBuffer = NULL; PFN_vkCreateBuffer glad_vkCreateBuffer = NULL;
PFN_vkCreateBufferView glad_vkCreateBufferView = NULL; PFN_vkCreateBufferView glad_vkCreateBufferView = NULL;
PFN_vkCreateCommandPool glad_vkCreateCommandPool = NULL; PFN_vkCreateCommandPool glad_vkCreateCommandPool = NULL;
@@ -97,8 +138,10 @@ PFN_vkCreateImageView glad_vkCreateImageView = NULL;
PFN_vkCreateInstance glad_vkCreateInstance = NULL; PFN_vkCreateInstance glad_vkCreateInstance = NULL;
PFN_vkCreatePipelineCache glad_vkCreatePipelineCache = NULL; PFN_vkCreatePipelineCache glad_vkCreatePipelineCache = NULL;
PFN_vkCreatePipelineLayout glad_vkCreatePipelineLayout = NULL; PFN_vkCreatePipelineLayout glad_vkCreatePipelineLayout = NULL;
PFN_vkCreatePrivateDataSlot glad_vkCreatePrivateDataSlot = NULL;
PFN_vkCreateQueryPool glad_vkCreateQueryPool = NULL; PFN_vkCreateQueryPool glad_vkCreateQueryPool = NULL;
PFN_vkCreateRenderPass glad_vkCreateRenderPass = NULL; PFN_vkCreateRenderPass glad_vkCreateRenderPass = NULL;
PFN_vkCreateRenderPass2 glad_vkCreateRenderPass2 = NULL;
PFN_vkCreateSampler glad_vkCreateSampler = NULL; PFN_vkCreateSampler glad_vkCreateSampler = NULL;
PFN_vkCreateSamplerYcbcrConversion glad_vkCreateSamplerYcbcrConversion = NULL; PFN_vkCreateSamplerYcbcrConversion glad_vkCreateSamplerYcbcrConversion = NULL;
PFN_vkCreateSemaphore glad_vkCreateSemaphore = NULL; PFN_vkCreateSemaphore glad_vkCreateSemaphore = NULL;
@@ -122,6 +165,7 @@ PFN_vkDestroyInstance glad_vkDestroyInstance = NULL;
PFN_vkDestroyPipeline glad_vkDestroyPipeline = NULL; PFN_vkDestroyPipeline glad_vkDestroyPipeline = NULL;
PFN_vkDestroyPipelineCache glad_vkDestroyPipelineCache = NULL; PFN_vkDestroyPipelineCache glad_vkDestroyPipelineCache = NULL;
PFN_vkDestroyPipelineLayout glad_vkDestroyPipelineLayout = NULL; PFN_vkDestroyPipelineLayout glad_vkDestroyPipelineLayout = NULL;
PFN_vkDestroyPrivateDataSlot glad_vkDestroyPrivateDataSlot = NULL;
PFN_vkDestroyQueryPool glad_vkDestroyQueryPool = NULL; PFN_vkDestroyQueryPool glad_vkDestroyQueryPool = NULL;
PFN_vkDestroyRenderPass glad_vkDestroyRenderPass = NULL; PFN_vkDestroyRenderPass glad_vkDestroyRenderPass = NULL;
PFN_vkDestroySampler glad_vkDestroySampler = NULL; PFN_vkDestroySampler glad_vkDestroySampler = NULL;
@@ -143,13 +187,19 @@ PFN_vkFlushMappedMemoryRanges glad_vkFlushMappedMemoryRanges = NULL;
PFN_vkFreeCommandBuffers glad_vkFreeCommandBuffers = NULL; PFN_vkFreeCommandBuffers glad_vkFreeCommandBuffers = NULL;
PFN_vkFreeDescriptorSets glad_vkFreeDescriptorSets = NULL; PFN_vkFreeDescriptorSets glad_vkFreeDescriptorSets = NULL;
PFN_vkFreeMemory glad_vkFreeMemory = NULL; PFN_vkFreeMemory glad_vkFreeMemory = NULL;
PFN_vkGetBufferDeviceAddress glad_vkGetBufferDeviceAddress = NULL;
PFN_vkGetBufferMemoryRequirements glad_vkGetBufferMemoryRequirements = NULL; PFN_vkGetBufferMemoryRequirements glad_vkGetBufferMemoryRequirements = NULL;
PFN_vkGetBufferMemoryRequirements2 glad_vkGetBufferMemoryRequirements2 = NULL; PFN_vkGetBufferMemoryRequirements2 glad_vkGetBufferMemoryRequirements2 = NULL;
PFN_vkGetBufferOpaqueCaptureAddress glad_vkGetBufferOpaqueCaptureAddress = NULL;
PFN_vkGetDescriptorSetLayoutSupport glad_vkGetDescriptorSetLayoutSupport = NULL; PFN_vkGetDescriptorSetLayoutSupport glad_vkGetDescriptorSetLayoutSupport = NULL;
PFN_vkGetDeviceBufferMemoryRequirements glad_vkGetDeviceBufferMemoryRequirements = NULL;
PFN_vkGetDeviceGroupPeerMemoryFeatures glad_vkGetDeviceGroupPeerMemoryFeatures = NULL; PFN_vkGetDeviceGroupPeerMemoryFeatures glad_vkGetDeviceGroupPeerMemoryFeatures = NULL;
PFN_vkGetDeviceGroupPresentCapabilitiesKHR glad_vkGetDeviceGroupPresentCapabilitiesKHR = NULL; PFN_vkGetDeviceGroupPresentCapabilitiesKHR glad_vkGetDeviceGroupPresentCapabilitiesKHR = NULL;
PFN_vkGetDeviceGroupSurfacePresentModesKHR glad_vkGetDeviceGroupSurfacePresentModesKHR = NULL; PFN_vkGetDeviceGroupSurfacePresentModesKHR glad_vkGetDeviceGroupSurfacePresentModesKHR = NULL;
PFN_vkGetDeviceImageMemoryRequirements glad_vkGetDeviceImageMemoryRequirements = NULL;
PFN_vkGetDeviceImageSparseMemoryRequirements glad_vkGetDeviceImageSparseMemoryRequirements = NULL;
PFN_vkGetDeviceMemoryCommitment glad_vkGetDeviceMemoryCommitment = NULL; PFN_vkGetDeviceMemoryCommitment glad_vkGetDeviceMemoryCommitment = NULL;
PFN_vkGetDeviceMemoryOpaqueCaptureAddress glad_vkGetDeviceMemoryOpaqueCaptureAddress = NULL;
PFN_vkGetDeviceProcAddr glad_vkGetDeviceProcAddr = NULL; PFN_vkGetDeviceProcAddr glad_vkGetDeviceProcAddr = NULL;
PFN_vkGetDeviceQueue glad_vkGetDeviceQueue = NULL; PFN_vkGetDeviceQueue glad_vkGetDeviceQueue = NULL;
PFN_vkGetDeviceQueue2 glad_vkGetDeviceQueue2 = NULL; PFN_vkGetDeviceQueue2 glad_vkGetDeviceQueue2 = NULL;
@@ -183,9 +233,12 @@ PFN_vkGetPhysicalDeviceSurfaceCapabilitiesKHR glad_vkGetPhysicalDeviceSurfaceCap
PFN_vkGetPhysicalDeviceSurfaceFormatsKHR glad_vkGetPhysicalDeviceSurfaceFormatsKHR = NULL; PFN_vkGetPhysicalDeviceSurfaceFormatsKHR glad_vkGetPhysicalDeviceSurfaceFormatsKHR = NULL;
PFN_vkGetPhysicalDeviceSurfacePresentModesKHR glad_vkGetPhysicalDeviceSurfacePresentModesKHR = NULL; PFN_vkGetPhysicalDeviceSurfacePresentModesKHR glad_vkGetPhysicalDeviceSurfacePresentModesKHR = NULL;
PFN_vkGetPhysicalDeviceSurfaceSupportKHR glad_vkGetPhysicalDeviceSurfaceSupportKHR = NULL; PFN_vkGetPhysicalDeviceSurfaceSupportKHR glad_vkGetPhysicalDeviceSurfaceSupportKHR = NULL;
PFN_vkGetPhysicalDeviceToolProperties glad_vkGetPhysicalDeviceToolProperties = NULL;
PFN_vkGetPipelineCacheData glad_vkGetPipelineCacheData = NULL; PFN_vkGetPipelineCacheData glad_vkGetPipelineCacheData = NULL;
PFN_vkGetPrivateData glad_vkGetPrivateData = NULL;
PFN_vkGetQueryPoolResults glad_vkGetQueryPoolResults = NULL; PFN_vkGetQueryPoolResults glad_vkGetQueryPoolResults = NULL;
PFN_vkGetRenderAreaGranularity glad_vkGetRenderAreaGranularity = NULL; PFN_vkGetRenderAreaGranularity glad_vkGetRenderAreaGranularity = NULL;
PFN_vkGetSemaphoreCounterValue glad_vkGetSemaphoreCounterValue = NULL;
PFN_vkGetSwapchainImagesKHR glad_vkGetSwapchainImagesKHR = NULL; PFN_vkGetSwapchainImagesKHR glad_vkGetSwapchainImagesKHR = NULL;
PFN_vkInvalidateMappedMemoryRanges glad_vkInvalidateMappedMemoryRanges = NULL; PFN_vkInvalidateMappedMemoryRanges glad_vkInvalidateMappedMemoryRanges = NULL;
PFN_vkMapMemory glad_vkMapMemory = NULL; PFN_vkMapMemory glad_vkMapMemory = NULL;
@@ -193,216 +246,277 @@ PFN_vkMergePipelineCaches glad_vkMergePipelineCaches = NULL;
PFN_vkQueueBindSparse glad_vkQueueBindSparse = NULL; PFN_vkQueueBindSparse glad_vkQueueBindSparse = NULL;
PFN_vkQueuePresentKHR glad_vkQueuePresentKHR = NULL; PFN_vkQueuePresentKHR glad_vkQueuePresentKHR = NULL;
PFN_vkQueueSubmit glad_vkQueueSubmit = NULL; PFN_vkQueueSubmit glad_vkQueueSubmit = NULL;
PFN_vkQueueSubmit2 glad_vkQueueSubmit2 = NULL;
PFN_vkQueueWaitIdle glad_vkQueueWaitIdle = NULL; PFN_vkQueueWaitIdle glad_vkQueueWaitIdle = NULL;
PFN_vkResetCommandBuffer glad_vkResetCommandBuffer = NULL; PFN_vkResetCommandBuffer glad_vkResetCommandBuffer = NULL;
PFN_vkResetCommandPool glad_vkResetCommandPool = NULL; PFN_vkResetCommandPool glad_vkResetCommandPool = NULL;
PFN_vkResetDescriptorPool glad_vkResetDescriptorPool = NULL; PFN_vkResetDescriptorPool glad_vkResetDescriptorPool = NULL;
PFN_vkResetEvent glad_vkResetEvent = NULL; PFN_vkResetEvent glad_vkResetEvent = NULL;
PFN_vkResetFences glad_vkResetFences = NULL; PFN_vkResetFences glad_vkResetFences = NULL;
PFN_vkResetQueryPool glad_vkResetQueryPool = NULL;
PFN_vkSetEvent glad_vkSetEvent = NULL; PFN_vkSetEvent glad_vkSetEvent = NULL;
PFN_vkSetPrivateData glad_vkSetPrivateData = NULL;
PFN_vkSignalSemaphore glad_vkSignalSemaphore = NULL;
PFN_vkTrimCommandPool glad_vkTrimCommandPool = NULL; PFN_vkTrimCommandPool glad_vkTrimCommandPool = NULL;
PFN_vkUnmapMemory glad_vkUnmapMemory = NULL; PFN_vkUnmapMemory glad_vkUnmapMemory = NULL;
PFN_vkUpdateDescriptorSetWithTemplate glad_vkUpdateDescriptorSetWithTemplate = NULL; PFN_vkUpdateDescriptorSetWithTemplate glad_vkUpdateDescriptorSetWithTemplate = NULL;
PFN_vkUpdateDescriptorSets glad_vkUpdateDescriptorSets = NULL; PFN_vkUpdateDescriptorSets glad_vkUpdateDescriptorSets = NULL;
PFN_vkWaitForFences glad_vkWaitForFences = NULL; PFN_vkWaitForFences glad_vkWaitForFences = NULL;
PFN_vkWaitSemaphores glad_vkWaitSemaphores = NULL;
static void glad_vk_load_VK_VERSION_1_0( GLADuserptrloadfunc load, void* userptr) { static void glad_vk_load_VK_VERSION_1_0( GLADuserptrloadfunc load, void* userptr) {
if(!GLAD_VK_VERSION_1_0) return; if(!GLAD_VK_VERSION_1_0) return;
vkAllocateCommandBuffers = (PFN_vkAllocateCommandBuffers) load("vkAllocateCommandBuffers", userptr); glad_vkAllocateCommandBuffers = (PFN_vkAllocateCommandBuffers) load(userptr, "vkAllocateCommandBuffers");
vkAllocateDescriptorSets = (PFN_vkAllocateDescriptorSets) load("vkAllocateDescriptorSets", userptr); glad_vkAllocateDescriptorSets = (PFN_vkAllocateDescriptorSets) load(userptr, "vkAllocateDescriptorSets");
vkAllocateMemory = (PFN_vkAllocateMemory) load("vkAllocateMemory", userptr); glad_vkAllocateMemory = (PFN_vkAllocateMemory) load(userptr, "vkAllocateMemory");
vkBeginCommandBuffer = (PFN_vkBeginCommandBuffer) load("vkBeginCommandBuffer", userptr); glad_vkBeginCommandBuffer = (PFN_vkBeginCommandBuffer) load(userptr, "vkBeginCommandBuffer");
vkBindBufferMemory = (PFN_vkBindBufferMemory) load("vkBindBufferMemory", userptr); glad_vkBindBufferMemory = (PFN_vkBindBufferMemory) load(userptr, "vkBindBufferMemory");
vkBindImageMemory = (PFN_vkBindImageMemory) load("vkBindImageMemory", userptr); glad_vkBindImageMemory = (PFN_vkBindImageMemory) load(userptr, "vkBindImageMemory");
vkCmdBeginQuery = (PFN_vkCmdBeginQuery) load("vkCmdBeginQuery", userptr); glad_vkCmdBeginQuery = (PFN_vkCmdBeginQuery) load(userptr, "vkCmdBeginQuery");
vkCmdBeginRenderPass = (PFN_vkCmdBeginRenderPass) load("vkCmdBeginRenderPass", userptr); glad_vkCmdBeginRenderPass = (PFN_vkCmdBeginRenderPass) load(userptr, "vkCmdBeginRenderPass");
vkCmdBindDescriptorSets = (PFN_vkCmdBindDescriptorSets) load("vkCmdBindDescriptorSets", userptr); glad_vkCmdBindDescriptorSets = (PFN_vkCmdBindDescriptorSets) load(userptr, "vkCmdBindDescriptorSets");
vkCmdBindIndexBuffer = (PFN_vkCmdBindIndexBuffer) load("vkCmdBindIndexBuffer", userptr); glad_vkCmdBindIndexBuffer = (PFN_vkCmdBindIndexBuffer) load(userptr, "vkCmdBindIndexBuffer");
vkCmdBindPipeline = (PFN_vkCmdBindPipeline) load("vkCmdBindPipeline", userptr); glad_vkCmdBindPipeline = (PFN_vkCmdBindPipeline) load(userptr, "vkCmdBindPipeline");
vkCmdBindVertexBuffers = (PFN_vkCmdBindVertexBuffers) load("vkCmdBindVertexBuffers", userptr); glad_vkCmdBindVertexBuffers = (PFN_vkCmdBindVertexBuffers) load(userptr, "vkCmdBindVertexBuffers");
vkCmdBlitImage = (PFN_vkCmdBlitImage) load("vkCmdBlitImage", userptr); glad_vkCmdBlitImage = (PFN_vkCmdBlitImage) load(userptr, "vkCmdBlitImage");
vkCmdClearAttachments = (PFN_vkCmdClearAttachments) load("vkCmdClearAttachments", userptr); glad_vkCmdClearAttachments = (PFN_vkCmdClearAttachments) load(userptr, "vkCmdClearAttachments");
vkCmdClearColorImage = (PFN_vkCmdClearColorImage) load("vkCmdClearColorImage", userptr); glad_vkCmdClearColorImage = (PFN_vkCmdClearColorImage) load(userptr, "vkCmdClearColorImage");
vkCmdClearDepthStencilImage = (PFN_vkCmdClearDepthStencilImage) load("vkCmdClearDepthStencilImage", userptr); glad_vkCmdClearDepthStencilImage = (PFN_vkCmdClearDepthStencilImage) load(userptr, "vkCmdClearDepthStencilImage");
vkCmdCopyBuffer = (PFN_vkCmdCopyBuffer) load("vkCmdCopyBuffer", userptr); glad_vkCmdCopyBuffer = (PFN_vkCmdCopyBuffer) load(userptr, "vkCmdCopyBuffer");
vkCmdCopyBufferToImage = (PFN_vkCmdCopyBufferToImage) load("vkCmdCopyBufferToImage", userptr); glad_vkCmdCopyBufferToImage = (PFN_vkCmdCopyBufferToImage) load(userptr, "vkCmdCopyBufferToImage");
vkCmdCopyImage = (PFN_vkCmdCopyImage) load("vkCmdCopyImage", userptr); glad_vkCmdCopyImage = (PFN_vkCmdCopyImage) load(userptr, "vkCmdCopyImage");
vkCmdCopyImageToBuffer = (PFN_vkCmdCopyImageToBuffer) load("vkCmdCopyImageToBuffer", userptr); glad_vkCmdCopyImageToBuffer = (PFN_vkCmdCopyImageToBuffer) load(userptr, "vkCmdCopyImageToBuffer");
vkCmdCopyQueryPoolResults = (PFN_vkCmdCopyQueryPoolResults) load("vkCmdCopyQueryPoolResults", userptr); glad_vkCmdCopyQueryPoolResults = (PFN_vkCmdCopyQueryPoolResults) load(userptr, "vkCmdCopyQueryPoolResults");
vkCmdDispatch = (PFN_vkCmdDispatch) load("vkCmdDispatch", userptr); glad_vkCmdDispatch = (PFN_vkCmdDispatch) load(userptr, "vkCmdDispatch");
vkCmdDispatchIndirect = (PFN_vkCmdDispatchIndirect) load("vkCmdDispatchIndirect", userptr); glad_vkCmdDispatchIndirect = (PFN_vkCmdDispatchIndirect) load(userptr, "vkCmdDispatchIndirect");
vkCmdDraw = (PFN_vkCmdDraw) load("vkCmdDraw", userptr); glad_vkCmdDraw = (PFN_vkCmdDraw) load(userptr, "vkCmdDraw");
vkCmdDrawIndexed = (PFN_vkCmdDrawIndexed) load("vkCmdDrawIndexed", userptr); glad_vkCmdDrawIndexed = (PFN_vkCmdDrawIndexed) load(userptr, "vkCmdDrawIndexed");
vkCmdDrawIndexedIndirect = (PFN_vkCmdDrawIndexedIndirect) load("vkCmdDrawIndexedIndirect", userptr); glad_vkCmdDrawIndexedIndirect = (PFN_vkCmdDrawIndexedIndirect) load(userptr, "vkCmdDrawIndexedIndirect");
vkCmdDrawIndirect = (PFN_vkCmdDrawIndirect) load("vkCmdDrawIndirect", userptr); glad_vkCmdDrawIndirect = (PFN_vkCmdDrawIndirect) load(userptr, "vkCmdDrawIndirect");
vkCmdEndQuery = (PFN_vkCmdEndQuery) load("vkCmdEndQuery", userptr); glad_vkCmdEndQuery = (PFN_vkCmdEndQuery) load(userptr, "vkCmdEndQuery");
vkCmdEndRenderPass = (PFN_vkCmdEndRenderPass) load("vkCmdEndRenderPass", userptr); glad_vkCmdEndRenderPass = (PFN_vkCmdEndRenderPass) load(userptr, "vkCmdEndRenderPass");
vkCmdExecuteCommands = (PFN_vkCmdExecuteCommands) load("vkCmdExecuteCommands", userptr); glad_vkCmdExecuteCommands = (PFN_vkCmdExecuteCommands) load(userptr, "vkCmdExecuteCommands");
vkCmdFillBuffer = (PFN_vkCmdFillBuffer) load("vkCmdFillBuffer", userptr); glad_vkCmdFillBuffer = (PFN_vkCmdFillBuffer) load(userptr, "vkCmdFillBuffer");
vkCmdNextSubpass = (PFN_vkCmdNextSubpass) load("vkCmdNextSubpass", userptr); glad_vkCmdNextSubpass = (PFN_vkCmdNextSubpass) load(userptr, "vkCmdNextSubpass");
vkCmdPipelineBarrier = (PFN_vkCmdPipelineBarrier) load("vkCmdPipelineBarrier", userptr); glad_vkCmdPipelineBarrier = (PFN_vkCmdPipelineBarrier) load(userptr, "vkCmdPipelineBarrier");
vkCmdPushConstants = (PFN_vkCmdPushConstants) load("vkCmdPushConstants", userptr); glad_vkCmdPushConstants = (PFN_vkCmdPushConstants) load(userptr, "vkCmdPushConstants");
vkCmdResetEvent = (PFN_vkCmdResetEvent) load("vkCmdResetEvent", userptr); glad_vkCmdResetEvent = (PFN_vkCmdResetEvent) load(userptr, "vkCmdResetEvent");
vkCmdResetQueryPool = (PFN_vkCmdResetQueryPool) load("vkCmdResetQueryPool", userptr); glad_vkCmdResetQueryPool = (PFN_vkCmdResetQueryPool) load(userptr, "vkCmdResetQueryPool");
vkCmdResolveImage = (PFN_vkCmdResolveImage) load("vkCmdResolveImage", userptr); glad_vkCmdResolveImage = (PFN_vkCmdResolveImage) load(userptr, "vkCmdResolveImage");
vkCmdSetBlendConstants = (PFN_vkCmdSetBlendConstants) load("vkCmdSetBlendConstants", userptr); glad_vkCmdSetBlendConstants = (PFN_vkCmdSetBlendConstants) load(userptr, "vkCmdSetBlendConstants");
vkCmdSetDepthBias = (PFN_vkCmdSetDepthBias) load("vkCmdSetDepthBias", userptr); glad_vkCmdSetDepthBias = (PFN_vkCmdSetDepthBias) load(userptr, "vkCmdSetDepthBias");
vkCmdSetDepthBounds = (PFN_vkCmdSetDepthBounds) load("vkCmdSetDepthBounds", userptr); glad_vkCmdSetDepthBounds = (PFN_vkCmdSetDepthBounds) load(userptr, "vkCmdSetDepthBounds");
vkCmdSetEvent = (PFN_vkCmdSetEvent) load("vkCmdSetEvent", userptr); glad_vkCmdSetEvent = (PFN_vkCmdSetEvent) load(userptr, "vkCmdSetEvent");
vkCmdSetLineWidth = (PFN_vkCmdSetLineWidth) load("vkCmdSetLineWidth", userptr); glad_vkCmdSetLineWidth = (PFN_vkCmdSetLineWidth) load(userptr, "vkCmdSetLineWidth");
vkCmdSetScissor = (PFN_vkCmdSetScissor) load("vkCmdSetScissor", userptr); glad_vkCmdSetScissor = (PFN_vkCmdSetScissor) load(userptr, "vkCmdSetScissor");
vkCmdSetStencilCompareMask = (PFN_vkCmdSetStencilCompareMask) load("vkCmdSetStencilCompareMask", userptr); glad_vkCmdSetStencilCompareMask = (PFN_vkCmdSetStencilCompareMask) load(userptr, "vkCmdSetStencilCompareMask");
vkCmdSetStencilReference = (PFN_vkCmdSetStencilReference) load("vkCmdSetStencilReference", userptr); glad_vkCmdSetStencilReference = (PFN_vkCmdSetStencilReference) load(userptr, "vkCmdSetStencilReference");
vkCmdSetStencilWriteMask = (PFN_vkCmdSetStencilWriteMask) load("vkCmdSetStencilWriteMask", userptr); glad_vkCmdSetStencilWriteMask = (PFN_vkCmdSetStencilWriteMask) load(userptr, "vkCmdSetStencilWriteMask");
vkCmdSetViewport = (PFN_vkCmdSetViewport) load("vkCmdSetViewport", userptr); glad_vkCmdSetViewport = (PFN_vkCmdSetViewport) load(userptr, "vkCmdSetViewport");
vkCmdUpdateBuffer = (PFN_vkCmdUpdateBuffer) load("vkCmdUpdateBuffer", userptr); glad_vkCmdUpdateBuffer = (PFN_vkCmdUpdateBuffer) load(userptr, "vkCmdUpdateBuffer");
vkCmdWaitEvents = (PFN_vkCmdWaitEvents) load("vkCmdWaitEvents", userptr); glad_vkCmdWaitEvents = (PFN_vkCmdWaitEvents) load(userptr, "vkCmdWaitEvents");
vkCmdWriteTimestamp = (PFN_vkCmdWriteTimestamp) load("vkCmdWriteTimestamp", userptr); glad_vkCmdWriteTimestamp = (PFN_vkCmdWriteTimestamp) load(userptr, "vkCmdWriteTimestamp");
vkCreateBuffer = (PFN_vkCreateBuffer) load("vkCreateBuffer", userptr); glad_vkCreateBuffer = (PFN_vkCreateBuffer) load(userptr, "vkCreateBuffer");
vkCreateBufferView = (PFN_vkCreateBufferView) load("vkCreateBufferView", userptr); glad_vkCreateBufferView = (PFN_vkCreateBufferView) load(userptr, "vkCreateBufferView");
vkCreateCommandPool = (PFN_vkCreateCommandPool) load("vkCreateCommandPool", userptr); glad_vkCreateCommandPool = (PFN_vkCreateCommandPool) load(userptr, "vkCreateCommandPool");
vkCreateComputePipelines = (PFN_vkCreateComputePipelines) load("vkCreateComputePipelines", userptr); glad_vkCreateComputePipelines = (PFN_vkCreateComputePipelines) load(userptr, "vkCreateComputePipelines");
vkCreateDescriptorPool = (PFN_vkCreateDescriptorPool) load("vkCreateDescriptorPool", userptr); glad_vkCreateDescriptorPool = (PFN_vkCreateDescriptorPool) load(userptr, "vkCreateDescriptorPool");
vkCreateDescriptorSetLayout = (PFN_vkCreateDescriptorSetLayout) load("vkCreateDescriptorSetLayout", userptr); glad_vkCreateDescriptorSetLayout = (PFN_vkCreateDescriptorSetLayout) load(userptr, "vkCreateDescriptorSetLayout");
vkCreateDevice = (PFN_vkCreateDevice) load("vkCreateDevice", userptr); glad_vkCreateDevice = (PFN_vkCreateDevice) load(userptr, "vkCreateDevice");
vkCreateEvent = (PFN_vkCreateEvent) load("vkCreateEvent", userptr); glad_vkCreateEvent = (PFN_vkCreateEvent) load(userptr, "vkCreateEvent");
vkCreateFence = (PFN_vkCreateFence) load("vkCreateFence", userptr); glad_vkCreateFence = (PFN_vkCreateFence) load(userptr, "vkCreateFence");
vkCreateFramebuffer = (PFN_vkCreateFramebuffer) load("vkCreateFramebuffer", userptr); glad_vkCreateFramebuffer = (PFN_vkCreateFramebuffer) load(userptr, "vkCreateFramebuffer");
vkCreateGraphicsPipelines = (PFN_vkCreateGraphicsPipelines) load("vkCreateGraphicsPipelines", userptr); glad_vkCreateGraphicsPipelines = (PFN_vkCreateGraphicsPipelines) load(userptr, "vkCreateGraphicsPipelines");
vkCreateImage = (PFN_vkCreateImage) load("vkCreateImage", userptr); glad_vkCreateImage = (PFN_vkCreateImage) load(userptr, "vkCreateImage");
vkCreateImageView = (PFN_vkCreateImageView) load("vkCreateImageView", userptr); glad_vkCreateImageView = (PFN_vkCreateImageView) load(userptr, "vkCreateImageView");
vkCreateInstance = (PFN_vkCreateInstance) load("vkCreateInstance", userptr); glad_vkCreateInstance = (PFN_vkCreateInstance) load(userptr, "vkCreateInstance");
vkCreatePipelineCache = (PFN_vkCreatePipelineCache) load("vkCreatePipelineCache", userptr); glad_vkCreatePipelineCache = (PFN_vkCreatePipelineCache) load(userptr, "vkCreatePipelineCache");
vkCreatePipelineLayout = (PFN_vkCreatePipelineLayout) load("vkCreatePipelineLayout", userptr); glad_vkCreatePipelineLayout = (PFN_vkCreatePipelineLayout) load(userptr, "vkCreatePipelineLayout");
vkCreateQueryPool = (PFN_vkCreateQueryPool) load("vkCreateQueryPool", userptr); glad_vkCreateQueryPool = (PFN_vkCreateQueryPool) load(userptr, "vkCreateQueryPool");
vkCreateRenderPass = (PFN_vkCreateRenderPass) load("vkCreateRenderPass", userptr); glad_vkCreateRenderPass = (PFN_vkCreateRenderPass) load(userptr, "vkCreateRenderPass");
vkCreateSampler = (PFN_vkCreateSampler) load("vkCreateSampler", userptr); glad_vkCreateSampler = (PFN_vkCreateSampler) load(userptr, "vkCreateSampler");
vkCreateSemaphore = (PFN_vkCreateSemaphore) load("vkCreateSemaphore", userptr); glad_vkCreateSemaphore = (PFN_vkCreateSemaphore) load(userptr, "vkCreateSemaphore");
vkCreateShaderModule = (PFN_vkCreateShaderModule) load("vkCreateShaderModule", userptr); glad_vkCreateShaderModule = (PFN_vkCreateShaderModule) load(userptr, "vkCreateShaderModule");
vkDestroyBuffer = (PFN_vkDestroyBuffer) load("vkDestroyBuffer", userptr); glad_vkDestroyBuffer = (PFN_vkDestroyBuffer) load(userptr, "vkDestroyBuffer");
vkDestroyBufferView = (PFN_vkDestroyBufferView) load("vkDestroyBufferView", userptr); glad_vkDestroyBufferView = (PFN_vkDestroyBufferView) load(userptr, "vkDestroyBufferView");
vkDestroyCommandPool = (PFN_vkDestroyCommandPool) load("vkDestroyCommandPool", userptr); glad_vkDestroyCommandPool = (PFN_vkDestroyCommandPool) load(userptr, "vkDestroyCommandPool");
vkDestroyDescriptorPool = (PFN_vkDestroyDescriptorPool) load("vkDestroyDescriptorPool", userptr); glad_vkDestroyDescriptorPool = (PFN_vkDestroyDescriptorPool) load(userptr, "vkDestroyDescriptorPool");
vkDestroyDescriptorSetLayout = (PFN_vkDestroyDescriptorSetLayout) load("vkDestroyDescriptorSetLayout", userptr); glad_vkDestroyDescriptorSetLayout = (PFN_vkDestroyDescriptorSetLayout) load(userptr, "vkDestroyDescriptorSetLayout");
vkDestroyDevice = (PFN_vkDestroyDevice) load("vkDestroyDevice", userptr); glad_vkDestroyDevice = (PFN_vkDestroyDevice) load(userptr, "vkDestroyDevice");
vkDestroyEvent = (PFN_vkDestroyEvent) load("vkDestroyEvent", userptr); glad_vkDestroyEvent = (PFN_vkDestroyEvent) load(userptr, "vkDestroyEvent");
vkDestroyFence = (PFN_vkDestroyFence) load("vkDestroyFence", userptr); glad_vkDestroyFence = (PFN_vkDestroyFence) load(userptr, "vkDestroyFence");
vkDestroyFramebuffer = (PFN_vkDestroyFramebuffer) load("vkDestroyFramebuffer", userptr); glad_vkDestroyFramebuffer = (PFN_vkDestroyFramebuffer) load(userptr, "vkDestroyFramebuffer");
vkDestroyImage = (PFN_vkDestroyImage) load("vkDestroyImage", userptr); glad_vkDestroyImage = (PFN_vkDestroyImage) load(userptr, "vkDestroyImage");
vkDestroyImageView = (PFN_vkDestroyImageView) load("vkDestroyImageView", userptr); glad_vkDestroyImageView = (PFN_vkDestroyImageView) load(userptr, "vkDestroyImageView");
vkDestroyInstance = (PFN_vkDestroyInstance) load("vkDestroyInstance", userptr); glad_vkDestroyInstance = (PFN_vkDestroyInstance) load(userptr, "vkDestroyInstance");
vkDestroyPipeline = (PFN_vkDestroyPipeline) load("vkDestroyPipeline", userptr); glad_vkDestroyPipeline = (PFN_vkDestroyPipeline) load(userptr, "vkDestroyPipeline");
vkDestroyPipelineCache = (PFN_vkDestroyPipelineCache) load("vkDestroyPipelineCache", userptr); glad_vkDestroyPipelineCache = (PFN_vkDestroyPipelineCache) load(userptr, "vkDestroyPipelineCache");
vkDestroyPipelineLayout = (PFN_vkDestroyPipelineLayout) load("vkDestroyPipelineLayout", userptr); glad_vkDestroyPipelineLayout = (PFN_vkDestroyPipelineLayout) load(userptr, "vkDestroyPipelineLayout");
vkDestroyQueryPool = (PFN_vkDestroyQueryPool) load("vkDestroyQueryPool", userptr); glad_vkDestroyQueryPool = (PFN_vkDestroyQueryPool) load(userptr, "vkDestroyQueryPool");
vkDestroyRenderPass = (PFN_vkDestroyRenderPass) load("vkDestroyRenderPass", userptr); glad_vkDestroyRenderPass = (PFN_vkDestroyRenderPass) load(userptr, "vkDestroyRenderPass");
vkDestroySampler = (PFN_vkDestroySampler) load("vkDestroySampler", userptr); glad_vkDestroySampler = (PFN_vkDestroySampler) load(userptr, "vkDestroySampler");
vkDestroySemaphore = (PFN_vkDestroySemaphore) load("vkDestroySemaphore", userptr); glad_vkDestroySemaphore = (PFN_vkDestroySemaphore) load(userptr, "vkDestroySemaphore");
vkDestroyShaderModule = (PFN_vkDestroyShaderModule) load("vkDestroyShaderModule", userptr); glad_vkDestroyShaderModule = (PFN_vkDestroyShaderModule) load(userptr, "vkDestroyShaderModule");
vkDeviceWaitIdle = (PFN_vkDeviceWaitIdle) load("vkDeviceWaitIdle", userptr); glad_vkDeviceWaitIdle = (PFN_vkDeviceWaitIdle) load(userptr, "vkDeviceWaitIdle");
vkEndCommandBuffer = (PFN_vkEndCommandBuffer) load("vkEndCommandBuffer", userptr); glad_vkEndCommandBuffer = (PFN_vkEndCommandBuffer) load(userptr, "vkEndCommandBuffer");
vkEnumerateDeviceExtensionProperties = (PFN_vkEnumerateDeviceExtensionProperties) load("vkEnumerateDeviceExtensionProperties", userptr); glad_vkEnumerateDeviceExtensionProperties = (PFN_vkEnumerateDeviceExtensionProperties) load(userptr, "vkEnumerateDeviceExtensionProperties");
vkEnumerateDeviceLayerProperties = (PFN_vkEnumerateDeviceLayerProperties) load("vkEnumerateDeviceLayerProperties", userptr); glad_vkEnumerateDeviceLayerProperties = (PFN_vkEnumerateDeviceLayerProperties) load(userptr, "vkEnumerateDeviceLayerProperties");
vkEnumerateInstanceExtensionProperties = (PFN_vkEnumerateInstanceExtensionProperties) load("vkEnumerateInstanceExtensionProperties", userptr); glad_vkEnumerateInstanceExtensionProperties = (PFN_vkEnumerateInstanceExtensionProperties) load(userptr, "vkEnumerateInstanceExtensionProperties");
vkEnumerateInstanceLayerProperties = (PFN_vkEnumerateInstanceLayerProperties) load("vkEnumerateInstanceLayerProperties", userptr); glad_vkEnumerateInstanceLayerProperties = (PFN_vkEnumerateInstanceLayerProperties) load(userptr, "vkEnumerateInstanceLayerProperties");
vkEnumeratePhysicalDevices = (PFN_vkEnumeratePhysicalDevices) load("vkEnumeratePhysicalDevices", userptr); glad_vkEnumeratePhysicalDevices = (PFN_vkEnumeratePhysicalDevices) load(userptr, "vkEnumeratePhysicalDevices");
vkFlushMappedMemoryRanges = (PFN_vkFlushMappedMemoryRanges) load("vkFlushMappedMemoryRanges", userptr); glad_vkFlushMappedMemoryRanges = (PFN_vkFlushMappedMemoryRanges) load(userptr, "vkFlushMappedMemoryRanges");
vkFreeCommandBuffers = (PFN_vkFreeCommandBuffers) load("vkFreeCommandBuffers", userptr); glad_vkFreeCommandBuffers = (PFN_vkFreeCommandBuffers) load(userptr, "vkFreeCommandBuffers");
vkFreeDescriptorSets = (PFN_vkFreeDescriptorSets) load("vkFreeDescriptorSets", userptr); glad_vkFreeDescriptorSets = (PFN_vkFreeDescriptorSets) load(userptr, "vkFreeDescriptorSets");
vkFreeMemory = (PFN_vkFreeMemory) load("vkFreeMemory", userptr); glad_vkFreeMemory = (PFN_vkFreeMemory) load(userptr, "vkFreeMemory");
vkGetBufferMemoryRequirements = (PFN_vkGetBufferMemoryRequirements) load("vkGetBufferMemoryRequirements", userptr); glad_vkGetBufferMemoryRequirements = (PFN_vkGetBufferMemoryRequirements) load(userptr, "vkGetBufferMemoryRequirements");
vkGetDeviceMemoryCommitment = (PFN_vkGetDeviceMemoryCommitment) load("vkGetDeviceMemoryCommitment", userptr); glad_vkGetDeviceMemoryCommitment = (PFN_vkGetDeviceMemoryCommitment) load(userptr, "vkGetDeviceMemoryCommitment");
vkGetDeviceProcAddr = (PFN_vkGetDeviceProcAddr) load("vkGetDeviceProcAddr", userptr); glad_vkGetDeviceProcAddr = (PFN_vkGetDeviceProcAddr) load(userptr, "vkGetDeviceProcAddr");
vkGetDeviceQueue = (PFN_vkGetDeviceQueue) load("vkGetDeviceQueue", userptr); glad_vkGetDeviceQueue = (PFN_vkGetDeviceQueue) load(userptr, "vkGetDeviceQueue");
vkGetEventStatus = (PFN_vkGetEventStatus) load("vkGetEventStatus", userptr); glad_vkGetEventStatus = (PFN_vkGetEventStatus) load(userptr, "vkGetEventStatus");
vkGetFenceStatus = (PFN_vkGetFenceStatus) load("vkGetFenceStatus", userptr); glad_vkGetFenceStatus = (PFN_vkGetFenceStatus) load(userptr, "vkGetFenceStatus");
vkGetImageMemoryRequirements = (PFN_vkGetImageMemoryRequirements) load("vkGetImageMemoryRequirements", userptr); glad_vkGetImageMemoryRequirements = (PFN_vkGetImageMemoryRequirements) load(userptr, "vkGetImageMemoryRequirements");
vkGetImageSparseMemoryRequirements = (PFN_vkGetImageSparseMemoryRequirements) load("vkGetImageSparseMemoryRequirements", userptr); glad_vkGetImageSparseMemoryRequirements = (PFN_vkGetImageSparseMemoryRequirements) load(userptr, "vkGetImageSparseMemoryRequirements");
vkGetImageSubresourceLayout = (PFN_vkGetImageSubresourceLayout) load("vkGetImageSubresourceLayout", userptr); glad_vkGetImageSubresourceLayout = (PFN_vkGetImageSubresourceLayout) load(userptr, "vkGetImageSubresourceLayout");
vkGetInstanceProcAddr = (PFN_vkGetInstanceProcAddr) load("vkGetInstanceProcAddr", userptr); glad_vkGetInstanceProcAddr = (PFN_vkGetInstanceProcAddr) load(userptr, "vkGetInstanceProcAddr");
vkGetPhysicalDeviceFeatures = (PFN_vkGetPhysicalDeviceFeatures) load("vkGetPhysicalDeviceFeatures", userptr); glad_vkGetPhysicalDeviceFeatures = (PFN_vkGetPhysicalDeviceFeatures) load(userptr, "vkGetPhysicalDeviceFeatures");
vkGetPhysicalDeviceFormatProperties = (PFN_vkGetPhysicalDeviceFormatProperties) load("vkGetPhysicalDeviceFormatProperties", userptr); glad_vkGetPhysicalDeviceFormatProperties = (PFN_vkGetPhysicalDeviceFormatProperties) load(userptr, "vkGetPhysicalDeviceFormatProperties");
vkGetPhysicalDeviceImageFormatProperties = (PFN_vkGetPhysicalDeviceImageFormatProperties) load("vkGetPhysicalDeviceImageFormatProperties", userptr); glad_vkGetPhysicalDeviceImageFormatProperties = (PFN_vkGetPhysicalDeviceImageFormatProperties) load(userptr, "vkGetPhysicalDeviceImageFormatProperties");
vkGetPhysicalDeviceMemoryProperties = (PFN_vkGetPhysicalDeviceMemoryProperties) load("vkGetPhysicalDeviceMemoryProperties", userptr); glad_vkGetPhysicalDeviceMemoryProperties = (PFN_vkGetPhysicalDeviceMemoryProperties) load(userptr, "vkGetPhysicalDeviceMemoryProperties");
vkGetPhysicalDeviceProperties = (PFN_vkGetPhysicalDeviceProperties) load("vkGetPhysicalDeviceProperties", userptr); glad_vkGetPhysicalDeviceProperties = (PFN_vkGetPhysicalDeviceProperties) load(userptr, "vkGetPhysicalDeviceProperties");
vkGetPhysicalDeviceQueueFamilyProperties = (PFN_vkGetPhysicalDeviceQueueFamilyProperties) load("vkGetPhysicalDeviceQueueFamilyProperties", userptr); glad_vkGetPhysicalDeviceQueueFamilyProperties = (PFN_vkGetPhysicalDeviceQueueFamilyProperties) load(userptr, "vkGetPhysicalDeviceQueueFamilyProperties");
vkGetPhysicalDeviceSparseImageFormatProperties = (PFN_vkGetPhysicalDeviceSparseImageFormatProperties) load("vkGetPhysicalDeviceSparseImageFormatProperties", userptr); glad_vkGetPhysicalDeviceSparseImageFormatProperties = (PFN_vkGetPhysicalDeviceSparseImageFormatProperties) load(userptr, "vkGetPhysicalDeviceSparseImageFormatProperties");
vkGetPipelineCacheData = (PFN_vkGetPipelineCacheData) load("vkGetPipelineCacheData", userptr); glad_vkGetPipelineCacheData = (PFN_vkGetPipelineCacheData) load(userptr, "vkGetPipelineCacheData");
vkGetQueryPoolResults = (PFN_vkGetQueryPoolResults) load("vkGetQueryPoolResults", userptr); glad_vkGetQueryPoolResults = (PFN_vkGetQueryPoolResults) load(userptr, "vkGetQueryPoolResults");
vkGetRenderAreaGranularity = (PFN_vkGetRenderAreaGranularity) load("vkGetRenderAreaGranularity", userptr); glad_vkGetRenderAreaGranularity = (PFN_vkGetRenderAreaGranularity) load(userptr, "vkGetRenderAreaGranularity");
vkInvalidateMappedMemoryRanges = (PFN_vkInvalidateMappedMemoryRanges) load("vkInvalidateMappedMemoryRanges", userptr); glad_vkInvalidateMappedMemoryRanges = (PFN_vkInvalidateMappedMemoryRanges) load(userptr, "vkInvalidateMappedMemoryRanges");
vkMapMemory = (PFN_vkMapMemory) load("vkMapMemory", userptr); glad_vkMapMemory = (PFN_vkMapMemory) load(userptr, "vkMapMemory");
vkMergePipelineCaches = (PFN_vkMergePipelineCaches) load("vkMergePipelineCaches", userptr); glad_vkMergePipelineCaches = (PFN_vkMergePipelineCaches) load(userptr, "vkMergePipelineCaches");
vkQueueBindSparse = (PFN_vkQueueBindSparse) load("vkQueueBindSparse", userptr); glad_vkQueueBindSparse = (PFN_vkQueueBindSparse) load(userptr, "vkQueueBindSparse");
vkQueueSubmit = (PFN_vkQueueSubmit) load("vkQueueSubmit", userptr); glad_vkQueueSubmit = (PFN_vkQueueSubmit) load(userptr, "vkQueueSubmit");
vkQueueWaitIdle = (PFN_vkQueueWaitIdle) load("vkQueueWaitIdle", userptr); glad_vkQueueWaitIdle = (PFN_vkQueueWaitIdle) load(userptr, "vkQueueWaitIdle");
vkResetCommandBuffer = (PFN_vkResetCommandBuffer) load("vkResetCommandBuffer", userptr); glad_vkResetCommandBuffer = (PFN_vkResetCommandBuffer) load(userptr, "vkResetCommandBuffer");
vkResetCommandPool = (PFN_vkResetCommandPool) load("vkResetCommandPool", userptr); glad_vkResetCommandPool = (PFN_vkResetCommandPool) load(userptr, "vkResetCommandPool");
vkResetDescriptorPool = (PFN_vkResetDescriptorPool) load("vkResetDescriptorPool", userptr); glad_vkResetDescriptorPool = (PFN_vkResetDescriptorPool) load(userptr, "vkResetDescriptorPool");
vkResetEvent = (PFN_vkResetEvent) load("vkResetEvent", userptr); glad_vkResetEvent = (PFN_vkResetEvent) load(userptr, "vkResetEvent");
vkResetFences = (PFN_vkResetFences) load("vkResetFences", userptr); glad_vkResetFences = (PFN_vkResetFences) load(userptr, "vkResetFences");
vkSetEvent = (PFN_vkSetEvent) load("vkSetEvent", userptr); glad_vkSetEvent = (PFN_vkSetEvent) load(userptr, "vkSetEvent");
vkUnmapMemory = (PFN_vkUnmapMemory) load("vkUnmapMemory", userptr); glad_vkUnmapMemory = (PFN_vkUnmapMemory) load(userptr, "vkUnmapMemory");
vkUpdateDescriptorSets = (PFN_vkUpdateDescriptorSets) load("vkUpdateDescriptorSets", userptr); glad_vkUpdateDescriptorSets = (PFN_vkUpdateDescriptorSets) load(userptr, "vkUpdateDescriptorSets");
vkWaitForFences = (PFN_vkWaitForFences) load("vkWaitForFences", userptr); glad_vkWaitForFences = (PFN_vkWaitForFences) load(userptr, "vkWaitForFences");
} }
static void glad_vk_load_VK_VERSION_1_1( GLADuserptrloadfunc load, void* userptr) { static void glad_vk_load_VK_VERSION_1_1( GLADuserptrloadfunc load, void* userptr) {
if(!GLAD_VK_VERSION_1_1) return; if(!GLAD_VK_VERSION_1_1) return;
vkBindBufferMemory2 = (PFN_vkBindBufferMemory2) load("vkBindBufferMemory2", userptr); glad_vkBindBufferMemory2 = (PFN_vkBindBufferMemory2) load(userptr, "vkBindBufferMemory2");
vkBindImageMemory2 = (PFN_vkBindImageMemory2) load("vkBindImageMemory2", userptr); glad_vkBindImageMemory2 = (PFN_vkBindImageMemory2) load(userptr, "vkBindImageMemory2");
vkCmdDispatchBase = (PFN_vkCmdDispatchBase) load("vkCmdDispatchBase", userptr); glad_vkCmdDispatchBase = (PFN_vkCmdDispatchBase) load(userptr, "vkCmdDispatchBase");
vkCmdSetDeviceMask = (PFN_vkCmdSetDeviceMask) load("vkCmdSetDeviceMask", userptr); glad_vkCmdSetDeviceMask = (PFN_vkCmdSetDeviceMask) load(userptr, "vkCmdSetDeviceMask");
vkCreateDescriptorUpdateTemplate = (PFN_vkCreateDescriptorUpdateTemplate) load("vkCreateDescriptorUpdateTemplate", userptr); glad_vkCreateDescriptorUpdateTemplate = (PFN_vkCreateDescriptorUpdateTemplate) load(userptr, "vkCreateDescriptorUpdateTemplate");
vkCreateSamplerYcbcrConversion = (PFN_vkCreateSamplerYcbcrConversion) load("vkCreateSamplerYcbcrConversion", userptr); glad_vkCreateSamplerYcbcrConversion = (PFN_vkCreateSamplerYcbcrConversion) load(userptr, "vkCreateSamplerYcbcrConversion");
vkDestroyDescriptorUpdateTemplate = (PFN_vkDestroyDescriptorUpdateTemplate) load("vkDestroyDescriptorUpdateTemplate", userptr); glad_vkDestroyDescriptorUpdateTemplate = (PFN_vkDestroyDescriptorUpdateTemplate) load(userptr, "vkDestroyDescriptorUpdateTemplate");
vkDestroySamplerYcbcrConversion = (PFN_vkDestroySamplerYcbcrConversion) load("vkDestroySamplerYcbcrConversion", userptr); glad_vkDestroySamplerYcbcrConversion = (PFN_vkDestroySamplerYcbcrConversion) load(userptr, "vkDestroySamplerYcbcrConversion");
vkEnumerateInstanceVersion = (PFN_vkEnumerateInstanceVersion) load("vkEnumerateInstanceVersion", userptr); glad_vkEnumerateInstanceVersion = (PFN_vkEnumerateInstanceVersion) load(userptr, "vkEnumerateInstanceVersion");
vkEnumeratePhysicalDeviceGroups = (PFN_vkEnumeratePhysicalDeviceGroups) load("vkEnumeratePhysicalDeviceGroups", userptr); glad_vkEnumeratePhysicalDeviceGroups = (PFN_vkEnumeratePhysicalDeviceGroups) load(userptr, "vkEnumeratePhysicalDeviceGroups");
vkGetBufferMemoryRequirements2 = (PFN_vkGetBufferMemoryRequirements2) load("vkGetBufferMemoryRequirements2", userptr); glad_vkGetBufferMemoryRequirements2 = (PFN_vkGetBufferMemoryRequirements2) load(userptr, "vkGetBufferMemoryRequirements2");
vkGetDescriptorSetLayoutSupport = (PFN_vkGetDescriptorSetLayoutSupport) load("vkGetDescriptorSetLayoutSupport", userptr); glad_vkGetDescriptorSetLayoutSupport = (PFN_vkGetDescriptorSetLayoutSupport) load(userptr, "vkGetDescriptorSetLayoutSupport");
vkGetDeviceGroupPeerMemoryFeatures = (PFN_vkGetDeviceGroupPeerMemoryFeatures) load("vkGetDeviceGroupPeerMemoryFeatures", userptr); glad_vkGetDeviceGroupPeerMemoryFeatures = (PFN_vkGetDeviceGroupPeerMemoryFeatures) load(userptr, "vkGetDeviceGroupPeerMemoryFeatures");
vkGetDeviceQueue2 = (PFN_vkGetDeviceQueue2) load("vkGetDeviceQueue2", userptr); glad_vkGetDeviceQueue2 = (PFN_vkGetDeviceQueue2) load(userptr, "vkGetDeviceQueue2");
vkGetImageMemoryRequirements2 = (PFN_vkGetImageMemoryRequirements2) load("vkGetImageMemoryRequirements2", userptr); glad_vkGetImageMemoryRequirements2 = (PFN_vkGetImageMemoryRequirements2) load(userptr, "vkGetImageMemoryRequirements2");
vkGetImageSparseMemoryRequirements2 = (PFN_vkGetImageSparseMemoryRequirements2) load("vkGetImageSparseMemoryRequirements2", userptr); glad_vkGetImageSparseMemoryRequirements2 = (PFN_vkGetImageSparseMemoryRequirements2) load(userptr, "vkGetImageSparseMemoryRequirements2");
vkGetPhysicalDeviceExternalBufferProperties = (PFN_vkGetPhysicalDeviceExternalBufferProperties) load("vkGetPhysicalDeviceExternalBufferProperties", userptr); glad_vkGetPhysicalDeviceExternalBufferProperties = (PFN_vkGetPhysicalDeviceExternalBufferProperties) load(userptr, "vkGetPhysicalDeviceExternalBufferProperties");
vkGetPhysicalDeviceExternalFenceProperties = (PFN_vkGetPhysicalDeviceExternalFenceProperties) load("vkGetPhysicalDeviceExternalFenceProperties", userptr); glad_vkGetPhysicalDeviceExternalFenceProperties = (PFN_vkGetPhysicalDeviceExternalFenceProperties) load(userptr, "vkGetPhysicalDeviceExternalFenceProperties");
vkGetPhysicalDeviceExternalSemaphoreProperties = (PFN_vkGetPhysicalDeviceExternalSemaphoreProperties) load("vkGetPhysicalDeviceExternalSemaphoreProperties", userptr); glad_vkGetPhysicalDeviceExternalSemaphoreProperties = (PFN_vkGetPhysicalDeviceExternalSemaphoreProperties) load(userptr, "vkGetPhysicalDeviceExternalSemaphoreProperties");
vkGetPhysicalDeviceFeatures2 = (PFN_vkGetPhysicalDeviceFeatures2) load("vkGetPhysicalDeviceFeatures2", userptr); glad_vkGetPhysicalDeviceFeatures2 = (PFN_vkGetPhysicalDeviceFeatures2) load(userptr, "vkGetPhysicalDeviceFeatures2");
vkGetPhysicalDeviceFormatProperties2 = (PFN_vkGetPhysicalDeviceFormatProperties2) load("vkGetPhysicalDeviceFormatProperties2", userptr); glad_vkGetPhysicalDeviceFormatProperties2 = (PFN_vkGetPhysicalDeviceFormatProperties2) load(userptr, "vkGetPhysicalDeviceFormatProperties2");
vkGetPhysicalDeviceImageFormatProperties2 = (PFN_vkGetPhysicalDeviceImageFormatProperties2) load("vkGetPhysicalDeviceImageFormatProperties2", userptr); glad_vkGetPhysicalDeviceImageFormatProperties2 = (PFN_vkGetPhysicalDeviceImageFormatProperties2) load(userptr, "vkGetPhysicalDeviceImageFormatProperties2");
vkGetPhysicalDeviceMemoryProperties2 = (PFN_vkGetPhysicalDeviceMemoryProperties2) load("vkGetPhysicalDeviceMemoryProperties2", userptr); glad_vkGetPhysicalDeviceMemoryProperties2 = (PFN_vkGetPhysicalDeviceMemoryProperties2) load(userptr, "vkGetPhysicalDeviceMemoryProperties2");
vkGetPhysicalDeviceProperties2 = (PFN_vkGetPhysicalDeviceProperties2) load("vkGetPhysicalDeviceProperties2", userptr); glad_vkGetPhysicalDeviceProperties2 = (PFN_vkGetPhysicalDeviceProperties2) load(userptr, "vkGetPhysicalDeviceProperties2");
vkGetPhysicalDeviceQueueFamilyProperties2 = (PFN_vkGetPhysicalDeviceQueueFamilyProperties2) load("vkGetPhysicalDeviceQueueFamilyProperties2", userptr); glad_vkGetPhysicalDeviceQueueFamilyProperties2 = (PFN_vkGetPhysicalDeviceQueueFamilyProperties2) load(userptr, "vkGetPhysicalDeviceQueueFamilyProperties2");
vkGetPhysicalDeviceSparseImageFormatProperties2 = (PFN_vkGetPhysicalDeviceSparseImageFormatProperties2) load("vkGetPhysicalDeviceSparseImageFormatProperties2", userptr); glad_vkGetPhysicalDeviceSparseImageFormatProperties2 = (PFN_vkGetPhysicalDeviceSparseImageFormatProperties2) load(userptr, "vkGetPhysicalDeviceSparseImageFormatProperties2");
vkTrimCommandPool = (PFN_vkTrimCommandPool) load("vkTrimCommandPool", userptr); glad_vkTrimCommandPool = (PFN_vkTrimCommandPool) load(userptr, "vkTrimCommandPool");
vkUpdateDescriptorSetWithTemplate = (PFN_vkUpdateDescriptorSetWithTemplate) load("vkUpdateDescriptorSetWithTemplate", userptr); 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) { static void glad_vk_load_VK_EXT_debug_report( GLADuserptrloadfunc load, void* userptr) {
if(!GLAD_VK_EXT_debug_report) return; if(!GLAD_VK_EXT_debug_report) return;
vkCreateDebugReportCallbackEXT = (PFN_vkCreateDebugReportCallbackEXT) load("vkCreateDebugReportCallbackEXT", userptr); glad_vkCreateDebugReportCallbackEXT = (PFN_vkCreateDebugReportCallbackEXT) load(userptr, "vkCreateDebugReportCallbackEXT");
vkDebugReportMessageEXT = (PFN_vkDebugReportMessageEXT) load("vkDebugReportMessageEXT", userptr); glad_vkDebugReportMessageEXT = (PFN_vkDebugReportMessageEXT) load(userptr, "vkDebugReportMessageEXT");
vkDestroyDebugReportCallbackEXT = (PFN_vkDestroyDebugReportCallbackEXT) load("vkDestroyDebugReportCallbackEXT", userptr); glad_vkDestroyDebugReportCallbackEXT = (PFN_vkDestroyDebugReportCallbackEXT) load(userptr, "vkDestroyDebugReportCallbackEXT");
} }
static void glad_vk_load_VK_KHR_surface( GLADuserptrloadfunc load, void* userptr) { static void glad_vk_load_VK_KHR_surface( GLADuserptrloadfunc load, void* userptr) {
if(!GLAD_VK_KHR_surface) return; if(!GLAD_VK_KHR_surface) return;
vkDestroySurfaceKHR = (PFN_vkDestroySurfaceKHR) load("vkDestroySurfaceKHR", userptr); glad_vkDestroySurfaceKHR = (PFN_vkDestroySurfaceKHR) load(userptr, "vkDestroySurfaceKHR");
vkGetPhysicalDeviceSurfaceCapabilitiesKHR = (PFN_vkGetPhysicalDeviceSurfaceCapabilitiesKHR) load("vkGetPhysicalDeviceSurfaceCapabilitiesKHR", userptr); glad_vkGetPhysicalDeviceSurfaceCapabilitiesKHR = (PFN_vkGetPhysicalDeviceSurfaceCapabilitiesKHR) load(userptr, "vkGetPhysicalDeviceSurfaceCapabilitiesKHR");
vkGetPhysicalDeviceSurfaceFormatsKHR = (PFN_vkGetPhysicalDeviceSurfaceFormatsKHR) load("vkGetPhysicalDeviceSurfaceFormatsKHR", userptr); glad_vkGetPhysicalDeviceSurfaceFormatsKHR = (PFN_vkGetPhysicalDeviceSurfaceFormatsKHR) load(userptr, "vkGetPhysicalDeviceSurfaceFormatsKHR");
vkGetPhysicalDeviceSurfacePresentModesKHR = (PFN_vkGetPhysicalDeviceSurfacePresentModesKHR) load("vkGetPhysicalDeviceSurfacePresentModesKHR", userptr); glad_vkGetPhysicalDeviceSurfacePresentModesKHR = (PFN_vkGetPhysicalDeviceSurfacePresentModesKHR) load(userptr, "vkGetPhysicalDeviceSurfacePresentModesKHR");
vkGetPhysicalDeviceSurfaceSupportKHR = (PFN_vkGetPhysicalDeviceSurfaceSupportKHR) load("vkGetPhysicalDeviceSurfaceSupportKHR", userptr); glad_vkGetPhysicalDeviceSurfaceSupportKHR = (PFN_vkGetPhysicalDeviceSurfaceSupportKHR) load(userptr, "vkGetPhysicalDeviceSurfaceSupportKHR");
} }
static void glad_vk_load_VK_KHR_swapchain( GLADuserptrloadfunc load, void* userptr) { static void glad_vk_load_VK_KHR_swapchain( GLADuserptrloadfunc load, void* userptr) {
if(!GLAD_VK_KHR_swapchain) return; if(!GLAD_VK_KHR_swapchain) return;
vkAcquireNextImage2KHR = (PFN_vkAcquireNextImage2KHR) load("vkAcquireNextImage2KHR", userptr); glad_vkAcquireNextImage2KHR = (PFN_vkAcquireNextImage2KHR) load(userptr, "vkAcquireNextImage2KHR");
vkAcquireNextImageKHR = (PFN_vkAcquireNextImageKHR) load("vkAcquireNextImageKHR", userptr); glad_vkAcquireNextImageKHR = (PFN_vkAcquireNextImageKHR) load(userptr, "vkAcquireNextImageKHR");
vkCreateSwapchainKHR = (PFN_vkCreateSwapchainKHR) load("vkCreateSwapchainKHR", userptr); glad_vkCreateSwapchainKHR = (PFN_vkCreateSwapchainKHR) load(userptr, "vkCreateSwapchainKHR");
vkDestroySwapchainKHR = (PFN_vkDestroySwapchainKHR) load("vkDestroySwapchainKHR", userptr); glad_vkDestroySwapchainKHR = (PFN_vkDestroySwapchainKHR) load(userptr, "vkDestroySwapchainKHR");
vkGetDeviceGroupPresentCapabilitiesKHR = (PFN_vkGetDeviceGroupPresentCapabilitiesKHR) load("vkGetDeviceGroupPresentCapabilitiesKHR", userptr); glad_vkGetDeviceGroupPresentCapabilitiesKHR = (PFN_vkGetDeviceGroupPresentCapabilitiesKHR) load(userptr, "vkGetDeviceGroupPresentCapabilitiesKHR");
vkGetDeviceGroupSurfacePresentModesKHR = (PFN_vkGetDeviceGroupSurfacePresentModesKHR) load("vkGetDeviceGroupSurfacePresentModesKHR", userptr); glad_vkGetDeviceGroupSurfacePresentModesKHR = (PFN_vkGetDeviceGroupSurfacePresentModesKHR) load(userptr, "vkGetDeviceGroupSurfacePresentModesKHR");
vkGetPhysicalDevicePresentRectanglesKHR = (PFN_vkGetPhysicalDevicePresentRectanglesKHR) load("vkGetPhysicalDevicePresentRectanglesKHR", userptr); glad_vkGetPhysicalDevicePresentRectanglesKHR = (PFN_vkGetPhysicalDevicePresentRectanglesKHR) load(userptr, "vkGetPhysicalDevicePresentRectanglesKHR");
vkGetSwapchainImagesKHR = (PFN_vkGetSwapchainImagesKHR) load("vkGetSwapchainImagesKHR", userptr); glad_vkGetSwapchainImagesKHR = (PFN_vkGetSwapchainImagesKHR) load(userptr, "vkGetSwapchainImagesKHR");
vkQueuePresentKHR = (PFN_vkQueuePresentKHR) load("vkQueuePresentKHR", userptr); glad_vkQueuePresentKHR = (PFN_vkQueuePresentKHR) load(userptr, "vkQueuePresentKHR");
} }
@@ -411,47 +525,49 @@ static int glad_vk_get_extensions( VkPhysicalDevice physical_device, uint32_t *o
uint32_t i; uint32_t i;
uint32_t instance_extension_count = 0; uint32_t instance_extension_count = 0;
uint32_t device_extension_count = 0; uint32_t device_extension_count = 0;
uint32_t max_extension_count; uint32_t max_extension_count = 0;
uint32_t total_extension_count; uint32_t total_extension_count = 0;
char **extensions; char **extensions = NULL;
VkExtensionProperties *ext_properties; VkExtensionProperties *ext_properties = NULL;
VkResult result; VkResult result;
if (vkEnumerateInstanceExtensionProperties == NULL || (physical_device != NULL && vkEnumerateDeviceExtensionProperties == NULL)) { if (glad_vkEnumerateInstanceExtensionProperties == NULL || (physical_device != NULL && glad_vkEnumerateDeviceExtensionProperties == NULL)) {
return 0; return 0;
} }
result = vkEnumerateInstanceExtensionProperties(NULL, &instance_extension_count, NULL); result = glad_vkEnumerateInstanceExtensionProperties(NULL, &instance_extension_count, NULL);
if (result != VK_SUCCESS) { if (result != VK_SUCCESS) {
return 0; return 0;
} }
if (physical_device != NULL) { if (physical_device != NULL) {
result = vkEnumerateDeviceExtensionProperties(physical_device, NULL, &device_extension_count, NULL); result = glad_vkEnumerateDeviceExtensionProperties(physical_device, NULL, &device_extension_count, NULL);
if (result != VK_SUCCESS) { if (result != VK_SUCCESS) {
return 0; return 0;
} }
} }
total_extension_count = instance_extension_count + device_extension_count; total_extension_count = instance_extension_count + device_extension_count;
if (total_extension_count <= 0) {
return 0;
}
max_extension_count = instance_extension_count > device_extension_count max_extension_count = instance_extension_count > device_extension_count
? instance_extension_count : device_extension_count; ? instance_extension_count : device_extension_count;
ext_properties = (VkExtensionProperties*) malloc(max_extension_count * sizeof(VkExtensionProperties)); ext_properties = (VkExtensionProperties*) malloc(max_extension_count * sizeof(VkExtensionProperties));
if (ext_properties == NULL) { if (ext_properties == NULL) {
return 0; goto glad_vk_get_extensions_error;
} }
result = vkEnumerateInstanceExtensionProperties(NULL, &instance_extension_count, ext_properties); result = glad_vkEnumerateInstanceExtensionProperties(NULL, &instance_extension_count, ext_properties);
if (result != VK_SUCCESS) { if (result != VK_SUCCESS) {
free((void*) ext_properties); goto glad_vk_get_extensions_error;
return 0;
} }
extensions = (char**) calloc(total_extension_count, sizeof(char*)); extensions = (char**) calloc(total_extension_count, sizeof(char*));
if (extensions == NULL) { if (extensions == NULL) {
free((void*) ext_properties); goto glad_vk_get_extensions_error;
return 0;
} }
for (i = 0; i < instance_extension_count; ++i) { for (i = 0; i < instance_extension_count; ++i) {
@@ -459,17 +575,16 @@ static int glad_vk_get_extensions( VkPhysicalDevice physical_device, uint32_t *o
size_t extension_name_length = strlen(ext.extensionName) + 1; size_t extension_name_length = strlen(ext.extensionName) + 1;
extensions[i] = (char*) malloc(extension_name_length * sizeof(char)); extensions[i] = (char*) malloc(extension_name_length * sizeof(char));
if (extensions[i] == NULL) {
goto glad_vk_get_extensions_error;
}
memcpy(extensions[i], ext.extensionName, extension_name_length * sizeof(char)); memcpy(extensions[i], ext.extensionName, extension_name_length * sizeof(char));
} }
if (physical_device != NULL) { if (physical_device != NULL) {
result = vkEnumerateDeviceExtensionProperties(physical_device, NULL, &device_extension_count, ext_properties); result = glad_vkEnumerateDeviceExtensionProperties(physical_device, NULL, &device_extension_count, ext_properties);
if (result != VK_SUCCESS) { if (result != VK_SUCCESS) {
for (i = 0; i < instance_extension_count; ++i) { goto glad_vk_get_extensions_error;
free((void*) extensions[i]);
}
free(extensions);
return 0;
} }
for (i = 0; i < device_extension_count; ++i) { for (i = 0; i < device_extension_count; ++i) {
@@ -477,6 +592,9 @@ static int glad_vk_get_extensions( VkPhysicalDevice physical_device, uint32_t *o
size_t extension_name_length = strlen(ext.extensionName) + 1; size_t extension_name_length = strlen(ext.extensionName) + 1;
extensions[instance_extension_count + i] = (char*) malloc(extension_name_length * sizeof(char)); extensions[instance_extension_count + i] = (char*) malloc(extension_name_length * sizeof(char));
if (extensions[instance_extension_count + i] == NULL) {
goto glad_vk_get_extensions_error;
}
memcpy(extensions[instance_extension_count + i], ext.extensionName, extension_name_length * sizeof(char)); memcpy(extensions[instance_extension_count + i], ext.extensionName, extension_name_length * sizeof(char));
} }
} }
@@ -487,6 +605,16 @@ static int glad_vk_get_extensions( VkPhysicalDevice physical_device, uint32_t *o
*out_extensions = extensions; *out_extensions = extensions;
return 1; return 1;
glad_vk_get_extensions_error:
free((void*) ext_properties);
if (extensions != NULL) {
for (i = 0; i < total_extension_count; ++i) {
free((void*) extensions[i]);
}
free(extensions);
}
return 0;
} }
static void glad_vk_free_extensions(uint32_t extension_count, char **extensions) { static void glad_vk_free_extensions(uint32_t extension_count, char **extensions) {
@@ -503,7 +631,7 @@ static int glad_vk_has_extension(const char *name, uint32_t extension_count, cha
uint32_t i; uint32_t i;
for (i = 0; i < extension_count; ++i) { for (i = 0; i < extension_count; ++i) {
if(strcmp(name, extensions[i]) == 0) { if(extensions[i] != NULL && strcmp(name, extensions[i]) == 0) {
return 1; return 1;
} }
} }
@@ -511,7 +639,7 @@ static int glad_vk_has_extension(const char *name, uint32_t extension_count, cha
return 0; return 0;
} }
static GLADapiproc glad_vk_get_proc_from_userptr(const char* name, void *userptr) { static GLADapiproc glad_vk_get_proc_from_userptr(void *userptr, const char* name) {
return (GLAD_GNUC_EXTENSION (GLADapiproc (*)(const char *name)) userptr)(name); return (GLAD_GNUC_EXTENSION (GLADapiproc (*)(const char *name)) userptr)(name);
} }
@@ -521,9 +649,12 @@ static int glad_vk_find_extensions_vulkan( VkPhysicalDevice physical_device) {
if (!glad_vk_get_extensions(physical_device, &extension_count, &extensions)) return 0; 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_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_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); GLAD_VK_KHR_swapchain = glad_vk_has_extension("VK_KHR_swapchain", extension_count, extensions);
(void) glad_vk_has_extension;
glad_vk_free_extensions(extension_count, extensions); glad_vk_free_extensions(extension_count, extensions);
return 1; return 1;
@@ -534,11 +665,11 @@ static int glad_vk_find_core_vulkan( VkPhysicalDevice physical_device) {
int minor = 0; int minor = 0;
#ifdef VK_VERSION_1_1 #ifdef VK_VERSION_1_1
if (vkEnumerateInstanceVersion != NULL) { if (glad_vkEnumerateInstanceVersion != NULL) {
uint32_t version; uint32_t version;
VkResult result; VkResult result;
result = vkEnumerateInstanceVersion(&version); result = glad_vkEnumerateInstanceVersion(&version);
if (result == VK_SUCCESS) { if (result == VK_SUCCESS) {
major = (int) VK_VERSION_MAJOR(version); major = (int) VK_VERSION_MAJOR(version);
minor = (int) VK_VERSION_MINOR(version); minor = (int) VK_VERSION_MINOR(version);
@@ -546,9 +677,9 @@ static int glad_vk_find_core_vulkan( VkPhysicalDevice physical_device) {
} }
#endif #endif
if (physical_device != NULL && vkGetPhysicalDeviceProperties != NULL) { if (physical_device != NULL && glad_vkGetPhysicalDeviceProperties != NULL) {
VkPhysicalDeviceProperties properties; VkPhysicalDeviceProperties properties;
vkGetPhysicalDeviceProperties(physical_device, &properties); glad_vkGetPhysicalDeviceProperties(physical_device, &properties);
major = (int) VK_VERSION_MAJOR(properties.apiVersion); major = (int) VK_VERSION_MAJOR(properties.apiVersion);
minor = (int) VK_VERSION_MINOR(properties.apiVersion); minor = (int) VK_VERSION_MINOR(properties.apiVersion);
@@ -556,6 +687,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_0 = (major == 1 && minor >= 0) || major > 1;
GLAD_VK_VERSION_1_1 = (major == 1 && minor >= 1) || 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); return GLAD_MAKE_VERSION(major, minor);
} }
@@ -564,7 +697,7 @@ int gladLoadVulkanUserPtr( VkPhysicalDevice physical_device, GLADuserptrloadfunc
int version; int version;
#ifdef VK_VERSION_1_1 #ifdef VK_VERSION_1_1
vkEnumerateInstanceVersion = (PFN_vkEnumerateInstanceVersion) load("vkEnumerateInstanceVersion", userptr); glad_vkEnumerateInstanceVersion = (PFN_vkEnumerateInstanceVersion) load(userptr, "vkEnumerateInstanceVersion");
#endif #endif
version = glad_vk_find_core_vulkan( physical_device); version = glad_vk_find_core_vulkan( physical_device);
if (!version) { if (!version) {
@@ -573,6 +706,8 @@ int gladLoadVulkanUserPtr( VkPhysicalDevice physical_device, GLADuserptrloadfunc
glad_vk_load_VK_VERSION_1_0(load, userptr); glad_vk_load_VK_VERSION_1_0(load, userptr);
glad_vk_load_VK_VERSION_1_1(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; if (!glad_vk_find_extensions_vulkan( physical_device)) return 0;
glad_vk_load_VK_EXT_debug_report(load, userptr); glad_vk_load_VK_EXT_debug_report(load, userptr);
@@ -590,4 +725,9 @@ int gladLoadVulkan( VkPhysicalDevice physical_device, GLADloadfunc load) {
#ifdef __cplusplus
}
#endif
+803 -127
View File
File diff suppressed because it is too large Load Diff
+2 -2
View File
@@ -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 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). [experimental branch](https://github.com/glfw/glfw/branches/all).
__There is no preferred patch size__. A one character change is just as welcome __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 as one adding a thousand lines, if that is the appropriate size for the
feature. feature.
In addition to the code, a complete feature includes: In addition to the code, a complete feature includes:
+1 -1
View File
@@ -57,7 +57,7 @@ macros that disable similar headers below it.
Both of these mechanisms depend on the extension loader header defining a known 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 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 including the OpenGL header. This will also allow you to include the two
headers in any order. headers in any order.
+1 -5
View File
@@ -104,11 +104,7 @@ has been configured in the compositor.
GLFW uses the [xdg-shell GLFW uses the [xdg-shell
protocol](https://cgit.freedesktop.org/wayland/wayland-protocols/tree/stable/xdg-shell/xdg-shell.xml) protocol](https://cgit.freedesktop.org/wayland/wayland-protocols/tree/stable/xdg-shell/xdg-shell.xml)
to provide better window management. This protocol is part of to provide better window management. This protocol is part of
wayland-protocols 1.12, and mandatory at build time. If the running compositor wayland-protocols 1.12, and mandatory at build time.
does not support this protocol, the older [wl_shell
interface](https://cgit.freedesktop.org/wayland/wayland/tree/protocol/wayland.xml#n972)
will be used instead. This will result in a worse integration with the
desktop, especially on tiling compositors.
GLFW uses the [relative pointer GLFW uses the [relative pointer
protocol](https://cgit.freedesktop.org/wayland/wayland-protocols/tree/unstable/relative-pointer/relative-pointer-unstable-v1.xml) protocol](https://cgit.freedesktop.org/wayland/wayland-protocols/tree/unstable/relative-pointer/relative-pointer-unstable-v1.xml)
+15 -3
View File
@@ -123,9 +123,21 @@ void key_callback(GLFWwindow* window, int key, int scancode, int action, int mod
} }
@endcode @endcode
The action is one of `GLFW_PRESS`, `GLFW_REPEAT` or `GLFW_RELEASE`. The key The action is one of `GLFW_PRESS`, `GLFW_REPEAT` or `GLFW_RELEASE`. Events with
will be `GLFW_KEY_UNKNOWN` if GLFW lacks a key token for it, for example `GLFW_PRESS` and `GLFW_RELEASE` actions are emitted for every key press. Most
_E-mail_ and _Play_ keys. 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. 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 Scancodes are platform-specific but consistent over time, so keys will have
+7
View File
@@ -378,6 +378,13 @@ Existing projects and makefiles that set the `LIB_SUFFIX` option will use the
suffix chosen by the GNUInstallDirs package and the option will be ignored. suffix chosen by the GNUInstallDirs package and the option will be ignored.
@subsubsection wl_shell_33 Support for the wl_shell protocol
Support for the wl_shell protocol has been removed and GLFW now only supports
the XDG-Shell protocol. If your Wayland compositor does not support XDG-Shell
then GLFW will fail to initialize.
@subsubsection mir_removed_33 Mir support @subsubsection mir_removed_33 Mir support
The experimental Mir support has been completely removed as the Mir project has The experimental Mir support has been completely removed as the Mir project has
+10 -3
View File
@@ -42,9 +42,9 @@ The @ref GLFW_VULKAN_STATIC CMake option makes GLFW call the Vulkan loader
directly instead of dynamically loading it at runtime. Not linking against the directly instead of dynamically loading it at runtime. Not linking against the
Vulkan loader will then be a compile-time error. Vulkan loader will then be a compile-time error.
@macos Because the Vulkan loader and ICD are not installed globally on macOS, @macos To make your application be redistributable you will need to set up the
you need to set up the application bundle according to the LunarG SDK application bundle according to the LunarG SDK documentation. This is explained
documentation. This is explained in more detail in the in more detail in the
[SDK documentation for macOS](https://vulkan.lunarg.com/doc/sdk/latest/mac/getting_started.html). [SDK documentation for macOS](https://vulkan.lunarg.com/doc/sdk/latest/mac/getting_started.html).
@@ -177,6 +177,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 array, as it is an error to specify an extension more than once in the
`VkInstanceCreateInfo` struct. `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 @section vulkan_present Querying for Vulkan presentation support
+19 -20
View File
@@ -262,13 +262,12 @@ extern "C" {
/* We are building GLFW as a Win32 DLL */ /* We are building GLFW as a Win32 DLL */
#define GLFWAPI __declspec(dllexport) #define GLFWAPI __declspec(dllexport)
#elif defined(_WIN32) && defined(GLFW_DLL) #elif defined(_WIN32) && defined(GLFW_DLL)
/* We are calling GLFW as a Win32 DLL */ /* We are calling a GLFW Win32 DLL */
#define GLFWAPI __declspec(dllimport) #define GLFWAPI __declspec(dllimport)
#elif defined(__GNUC__) && defined(_GLFW_BUILD_DLL) #elif defined(__GNUC__) && defined(_GLFW_BUILD_DLL)
/* We are building GLFW as a shared / dynamic library */ /* We are building GLFW as a Unix shared library */
#define GLFWAPI __attribute__((visibility("default"))) #define GLFWAPI __attribute__((visibility("default")))
#else #else
/* We are building or calling GLFW as a static library */
#define GLFWAPI #define GLFWAPI
#endif #endif
@@ -299,7 +298,7 @@ extern "C" {
* release is made that does not contain any API changes. * release is made that does not contain any API changes.
* @ingroup init * @ingroup init
*/ */
#define GLFW_VERSION_REVISION 7 #define GLFW_VERSION_REVISION 8
/*! @} */ /*! @} */
/*! @brief One. /*! @brief One.
@@ -2808,8 +2807,8 @@ GLFWAPI void glfwSetWindowTitle(GLFWwindow* window, const char* title);
* @param[in] images The images to create the icon from. This is ignored if * @param[in] images The images to create the icon from. This is ignored if
* count is zero. * count is zero.
* *
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
* GLFW_PLATFORM_ERROR. * GLFW_INVALID_VALUE and @ref GLFW_PLATFORM_ERROR.
* *
* @pointer_lifetime The specified image data is copied before this function * @pointer_lifetime The specified image data is copied before this function
* returns. * returns.
@@ -3219,18 +3218,15 @@ GLFWAPI void glfwSetWindowOpacity(GLFWwindow* window, float opacity);
* previously restored. If the window is already iconified, this function does * previously restored. If the window is already iconified, this function does
* nothing. * nothing.
* *
* If the specified window is a full screen window, the original monitor * If the specified window is a full screen window, GLFW restores the original
* resolution is restored until the window is restored. * 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. * @param[in] window The window to iconify.
* *
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
* GLFW_PLATFORM_ERROR. * GLFW_PLATFORM_ERROR.
* *
* @remark @wayland There is no concept of iconification in wl_shell, this
* function will emit @ref GLFW_PLATFORM_ERROR when using this deprecated
* protocol.
*
* @thread_safety This function must only be called from the main thread. * @thread_safety This function must only be called from the main thread.
* *
* @sa @ref window_iconify * @sa @ref window_iconify
@@ -3250,8 +3246,8 @@ GLFWAPI void glfwIconifyWindow(GLFWwindow* window);
* (minimized) or maximized. If the window is already restored, this function * (minimized) or maximized. If the window is already restored, this function
* does nothing. * does nothing.
* *
* If the specified window is a full screen window, the resolution chosen for * If the specified window is an iconified full screen window, its desired
* the window is restored on the selected monitor. * video mode is set again for its monitor when the window is restored.
* *
* @param[in] window The window to restore. * @param[in] window The window to restore.
* *
@@ -3519,6 +3515,9 @@ GLFWAPI void glfwSetWindowMonitor(GLFWwindow* window, GLFWmonitor* monitor, int
* errors. However, this function should not fail as long as it is passed * errors. However, this function should not fail as long as it is passed
* valid arguments and the library has been [initialized](@ref intro_init). * 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. * @thread_safety This function must only be called from the main thread.
* *
* @sa @ref window_attribs * @sa @ref window_attribs
@@ -3810,8 +3809,8 @@ GLFWAPI GLFWwindowfocusfun glfwSetWindowFocusCallback(GLFWwindow* window, GLFWwi
* *
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED. * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
* *
* @remark @wayland The wl_shell protocol has no concept of iconification, * @remark @wayland The XDG-shell protocol has no event for iconification, so
* this callback will never be called when using this deprecated protocol. * this callback will never be called.
* *
* @thread_safety This function must only be called from the main thread. * @thread_safety This function must only be called from the main thread.
* *
@@ -4279,8 +4278,7 @@ GLFWAPI int glfwGetKeyScancode(int key);
* *
* This function returns the last state reported for the specified key to the * This function returns the last state reported for the specified key to the
* specified window. The returned state is one of `GLFW_PRESS` or * specified window. The returned state is one of `GLFW_PRESS` or
* `GLFW_RELEASE`. The higher-level action `GLFW_REPEAT` is only reported to * `GLFW_RELEASE`. The action `GLFW_REPEAT` is only reported to the key callback.
* the key callback.
* *
* If the @ref GLFW_STICKY_KEYS input mode is enabled, this function returns * 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 * `GLFW_PRESS` the first time you call it for a key that was pressed, even if
@@ -4441,8 +4439,8 @@ GLFWAPI void glfwSetCursorPos(GLFWwindow* window, double xpos, double ypos);
* @return The handle of the created cursor, or `NULL` if an * @return The handle of the created cursor, or `NULL` if an
* [error](@ref error_handling) occurred. * [error](@ref error_handling) occurred.
* *
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
* GLFW_PLATFORM_ERROR. * GLFW_INVALID_VALUE and @ref GLFW_PLATFORM_ERROR.
* *
* @pointer_lifetime The specified image data is copied before this function * @pointer_lifetime The specified image data is copied before this function
* returns. * returns.
@@ -5900,6 +5898,7 @@ GLFWAPI VkResult glfwCreateWindowSurface(VkInstance instance, GLFWwindow* window
*/ */
#ifndef GLAPIENTRY #ifndef GLAPIENTRY
#define GLAPIENTRY APIENTRY #define GLAPIENTRY APIENTRY
#define GLFW_GLAPIENTRY_DEFINED
#endif #endif
/* -------------------- END SYSTEM/COMPILER SPECIFIC --------------------- */ /* -------------------- END SYSTEM/COMPILER SPECIFIC --------------------- */
+71 -37
View File
@@ -74,6 +74,16 @@ extern "C" {
* and which platform-specific headers to include. It is then up your (by * and which platform-specific headers to include. It is then up your (by
* definition platform-specific) code to handle which of these should be * definition platform-specific) code to handle which of these should be
* defined. * 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 <GLFW/glfw3native.h>
* @endcode
*/ */
@@ -81,44 +91,65 @@ extern "C" {
* System headers and types * System headers and types
*************************************************************************/ *************************************************************************/
#if defined(GLFW_EXPOSE_NATIVE_WIN32) || defined(GLFW_EXPOSE_NATIVE_WGL) #if !defined(GLFW_NATIVE_INCLUDE_NONE)
// 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 <windows.h>
#elif defined(GLFW_EXPOSE_NATIVE_COCOA) || defined(GLFW_EXPOSE_NATIVE_NSGL)
#if defined(__OBJC__)
#import <Cocoa/Cocoa.h>
#else
#include <ApplicationServices/ApplicationServices.h>
typedef void* id;
#endif
#elif defined(GLFW_EXPOSE_NATIVE_X11) || defined(GLFW_EXPOSE_NATIVE_GLX)
#include <X11/Xlib.h>
#include <X11/extensions/Xrandr.h>
#elif defined(GLFW_EXPOSE_NATIVE_WAYLAND)
#include <wayland-client.h>
#endif
#if defined(GLFW_EXPOSE_NATIVE_WGL) #if defined(GLFW_EXPOSE_NATIVE_WIN32) || defined(GLFW_EXPOSE_NATIVE_WGL)
/* WGL is declared by windows.h */ /* This is a workaround for the fact that glfw3.h needs to export APIENTRY (for
#endif * example to allow applications to correctly declare a GL_KHR_debug callback)
#if defined(GLFW_EXPOSE_NATIVE_NSGL) * but windows.h assumes no one will define APIENTRY before it does
/* NSGL is declared by Cocoa.h */ */
#endif #if defined(GLFW_APIENTRY_DEFINED)
#if defined(GLFW_EXPOSE_NATIVE_GLX) #undef APIENTRY
#include <GL/glx.h> #undef GLFW_APIENTRY_DEFINED
#endif #endif
#if defined(GLFW_EXPOSE_NATIVE_EGL) #include <windows.h>
#include <EGL/egl.h> #elif defined(GLFW_EXPOSE_NATIVE_COCOA) || defined(GLFW_EXPOSE_NATIVE_NSGL)
#endif #if defined(__OBJC__)
#if defined(GLFW_EXPOSE_NATIVE_OSMESA) #import <Cocoa/Cocoa.h>
#include <GL/osmesa.h> #else
#endif #include <ApplicationServices/ApplicationServices.h>
#include <objc/objc.h>
#endif
#elif defined(GLFW_EXPOSE_NATIVE_X11) || defined(GLFW_EXPOSE_NATIVE_GLX)
#include <X11/Xlib.h>
#include <X11/extensions/Xrandr.h>
#elif defined(GLFW_EXPOSE_NATIVE_WAYLAND)
#include <wayland-client.h>
#endif
#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
#endif
#include <GL/glx.h>
#endif
#if defined(GLFW_EXPOSE_NATIVE_EGL)
#include <EGL/egl.h>
#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 <GL/osmesa.h>
#endif
#endif /*GLFW_NATIVE_INCLUDE_NONE*/
/************************************************************************* /*************************************************************************
@@ -475,6 +506,9 @@ GLFWAPI struct wl_surface* glfwGetWaylandWindow(GLFWwindow* window);
* *
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED. * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
* *
* @remark Because EGL is initialized on demand, this function will return
* `EGL_NO_DISPLAY` until the first context has been created via EGL.
*
* @thread_safety This function may be called from any thread. Access is not * @thread_safety This function may be called from any thread. Access is not
* synchronized. * synchronized.
* *
+15 -5
View File
@@ -475,18 +475,26 @@ void* _glfwLoadLocalVulkanLoaderNS(void)
if (!bundle) if (!bundle)
return NULL; return NULL;
CFURLRef url = CFURLRef frameworksUrl = CFBundleCopyPrivateFrameworksURL(bundle);
CFBundleCopyAuxiliaryExecutableURL(bundle, CFSTR("libvulkan.1.dylib")); if (!frameworksUrl)
if (!url)
return NULL; return NULL;
CFURLRef loaderUrl = CFURLCreateCopyAppendingPathComponent(
kCFAllocatorDefault, frameworksUrl, CFSTR("libvulkan.1.dylib"), false);
if (!loaderUrl)
{
CFRelease(frameworksUrl);
return NULL;
}
char path[PATH_MAX]; char path[PATH_MAX];
void* handle = NULL; void* handle = NULL;
if (CFURLGetFileSystemRepresentation(url, true, (UInt8*) path, sizeof(path) - 1)) if (CFURLGetFileSystemRepresentation(loaderUrl, true, (UInt8*) path, sizeof(path) - 1))
handle = _glfw_dlopen(path); handle = _glfw_dlopen(path);
CFRelease(url); CFRelease(loaderUrl);
CFRelease(frameworksUrl);
return handle; return handle;
} }
@@ -607,6 +615,8 @@ void _glfwPlatformTerminate(void)
free(_glfw.ns.clipboardString); free(_glfw.ns.clipboardString);
_glfwTerminateNSGL(); _glfwTerminateNSGL();
_glfwTerminateEGL();
_glfwTerminateOSMesa();
_glfwTerminateJoysticksNS(); _glfwTerminateJoysticksNS();
} // autoreleasepool } // autoreleasepool
+8 -7
View File
@@ -98,8 +98,7 @@ static void closeJoystick(_GLFWjoystick* js)
{ {
int i; int i;
if (!js->present) _glfwInputJoystick(js, GLFW_DISCONNECTED);
return;
for (i = 0; i < CFArrayGetCount(js->ns.axes); i++) for (i = 0; i < CFArrayGetCount(js->ns.axes); i++)
free((void*) CFArrayGetValueAtIndex(js->ns.axes, i)); free((void*) CFArrayGetValueAtIndex(js->ns.axes, i));
@@ -114,7 +113,6 @@ static void closeJoystick(_GLFWjoystick* js)
CFRelease(js->ns.hats); CFRelease(js->ns.hats);
_glfwFreeJoystick(js); _glfwFreeJoystick(js);
_glfwInputJoystick(js, GLFW_DISCONNECTED);
} }
// Callback for user-initiated joystick addition // Callback for user-initiated joystick addition
@@ -294,9 +292,9 @@ static void removeCallback(void* context,
for (jid = 0; jid <= GLFW_JOYSTICK_LAST; jid++) for (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; break;
} }
} }
@@ -392,7 +390,10 @@ void _glfwTerminateJoysticksNS(void)
int jid; int jid;
for (jid = 0; jid <= GLFW_JOYSTICK_LAST; jid++) for (jid = 0; jid <= GLFW_JOYSTICK_LAST; jid++)
closeJoystick(_glfw.joysticks + jid); {
if (_glfw.joysticks[jid].connected)
closeJoystick(&_glfw.joysticks[jid]);
}
CFRelease(_glfw.ns.hidManager); CFRelease(_glfw.ns.hidManager);
_glfw.ns.hidManager = NULL; _glfw.ns.hidManager = NULL;
@@ -470,7 +471,7 @@ int _glfwPlatformPollJoystick(_GLFWjoystick* js, int mode)
} }
} }
return js->present; return js->connected;
} }
void _glfwPlatformUpdateGamepadGUID(char* guid) void _glfwPlatformUpdateGamepadGUID(char* guid)
-4
View File
@@ -98,11 +98,7 @@ static char* getMonitorName(CGDirectDisplayID displayID, NSScreen* screen)
IOObjectRelease(it); IOObjectRelease(it);
if (!service) if (!service)
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"Cocoa: Failed to find service port for display");
return _glfw_strdup("Display"); return _glfw_strdup("Display");
}
CFDictionaryRef names = CFDictionaryRef names =
CFDictionaryGetValue(info, CFSTR(kDisplayProductName)); CFDictionaryGetValue(info, CFSTR(kDisplayProductName));
+113 -25
View File
@@ -31,25 +31,9 @@
#include <float.h> #include <float.h>
#include <string.h> #include <string.h>
// Returns the style mask corresponding to the window settings // 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
static NSUInteger getStyleMask(_GLFWwindow* window) #define NSWindowCollectionBehaviorFullScreenNone (1 << 9)
{
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 // Returns whether the cursor is in the content area of the specified window
// //
@@ -809,9 +793,21 @@ static GLFWbool createNativeWindow(_GLFWwindow* window,
else else
contentRect = NSMakeRect(0, 0, wndconfig->width, wndconfig->height); 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] window->ns.object = [[GLFWWindow alloc]
initWithContentRect:contentRect initWithContentRect:contentRect
styleMask:getStyleMask(window) styleMask:styleMask
backing:NSBackingStoreBuffered backing:NSBackingStoreBuffered
defer:NO]; defer:NO];
@@ -837,6 +833,12 @@ static GLFWbool createNativeWindow(_GLFWwindow* window,
NSWindowCollectionBehaviorManaged; NSWindowCollectionBehaviorManaged;
[window->ns.object setCollectionBehavior:behavior]; [window->ns.object setCollectionBehavior:behavior];
} }
else
{
const NSWindowCollectionBehavior behavior =
NSWindowCollectionBehaviorFullScreenNone;
[window->ns.object setCollectionBehavior:behavior];
}
if (wndconfig->floating) if (wndconfig->floating)
[window->ns.object setLevel:NSFloatingWindowLevel]; [window->ns.object setLevel:NSFloatingWindowLevel];
@@ -934,6 +936,9 @@ int _glfwPlatformCreateWindow(_GLFWwindow* window,
if (!_glfwCreateContextOSMesa(window, ctxconfig, fbconfig)) if (!_glfwCreateContextOSMesa(window, ctxconfig, fbconfig))
return GLFW_FALSE; return GLFW_FALSE;
} }
if (!_glfwRefreshContextAttribs(window, ctxconfig))
return GLFW_FALSE;
} }
if (window->monitor) if (window->monitor)
@@ -941,6 +946,18 @@ int _glfwPlatformCreateWindow(_GLFWwindow* window,
_glfwPlatformShowWindow(window); _glfwPlatformShowWindow(window);
_glfwPlatformFocusWindow(window); _glfwPlatformFocusWindow(window);
acquireMonitor(window); acquireMonitor(window);
if (wndconfig->centerCursor)
_glfwCenterCursorInContentArea(window);
}
else
{
if (wndconfig->visible)
{
_glfwPlatformShowWindow(window);
if (wndconfig->focused)
_glfwPlatformFocusWindow(window);
}
} }
return GLFW_TRUE; return GLFW_TRUE;
@@ -1219,9 +1236,10 @@ void _glfwPlatformSetWindowMonitor(_GLFWwindow* window,
{ {
const NSRect contentRect = const NSRect contentRect =
NSMakeRect(xpos, _glfwTransformYNS(ypos + height - 1), width, height); NSMakeRect(xpos, _glfwTransformYNS(ypos + height - 1), width, height);
const NSUInteger styleMask = [window->ns.object styleMask];
const NSRect frameRect = const NSRect frameRect =
[window->ns.object frameRectForContentRect:contentRect [window->ns.object frameRectForContentRect:contentRect
styleMask:getStyleMask(window)]; styleMask:styleMask];
[window->ns.object setFrame:frameRect display:YES]; [window->ns.object setFrame:frameRect display:YES];
} }
@@ -1238,7 +1256,27 @@ void _glfwPlatformSetWindowMonitor(_GLFWwindow* window,
// TODO: Solve this in a less terrible way // TODO: Solve this in a less terrible way
_glfwPlatformPollEvents(); _glfwPlatformPollEvents();
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]; [window->ns.object setStyleMask:styleMask];
// HACK: Changing the style mask can cause the first responder to be cleared // HACK: Changing the style mask can cause the first responder to be cleared
[window->ns.object makeFirstResponder:window->ns.view]; [window->ns.object makeFirstResponder:window->ns.view];
@@ -1284,6 +1322,20 @@ void _glfwPlatformSetWindowMonitor(_GLFWwindow* window,
else else
[window->ns.object setLevel:NSNormalWindowLevel]; [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]; [window->ns.object setHasShadow:YES];
// HACK: Clearing NSWindowStyleMaskTitled resets and disables the window // HACK: Clearing NSWindowStyleMaskTitled resets and disables the window
// title property but the miniwindow title property is unaffected // title property but the miniwindow title property is unaffected
@@ -1317,7 +1369,12 @@ int _glfwPlatformWindowVisible(_GLFWwindow* window)
int _glfwPlatformWindowMaximized(_GLFWwindow* window) int _glfwPlatformWindowMaximized(_GLFWwindow* window)
{ {
@autoreleasepool { @autoreleasepool {
return [window->ns.object isZoomed];
if (window->resizable)
return [window->ns.object isZoomed];
else
return GLFW_FALSE;
} // autoreleasepool } // autoreleasepool
} }
@@ -1349,15 +1406,46 @@ int _glfwPlatformFramebufferTransparent(_GLFWwindow* window)
void _glfwPlatformSetWindowResizable(_GLFWwindow* window, GLFWbool enabled) void _glfwPlatformSetWindowResizable(_GLFWwindow* window, GLFWbool enabled)
{ {
@autoreleasepool { @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;
[window->ns.object setCollectionBehavior:behavior];
}
else
{
[window->ns.object setStyleMask:(styleMask & ~NSWindowStyleMaskResizable)];
const NSWindowCollectionBehavior behavior =
NSWindowCollectionBehaviorFullScreenNone;
[window->ns.object setCollectionBehavior:behavior];
}
} // autoreleasepool } // autoreleasepool
} }
void _glfwPlatformSetWindowDecorated(_GLFWwindow* window, GLFWbool enabled) void _glfwPlatformSetWindowDecorated(_GLFWwindow* window, GLFWbool enabled)
{ {
@autoreleasepool { @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]; [window->ns.object makeFirstResponder:window->ns.view];
} // autoreleasepool } // autoreleasepool
} }
+3 -1
View File
@@ -609,10 +609,12 @@ GLFWbool _glfwStringInExtensionString(const char* string, const char* extensions
GLFWAPI void glfwMakeContextCurrent(GLFWwindow* handle) GLFWAPI void glfwMakeContextCurrent(GLFWwindow* handle)
{ {
_GLFWwindow* window = (_GLFWwindow*) handle; _GLFWwindow* window = (_GLFWwindow*) handle;
_GLFWwindow* previous = _glfwPlatformGetTls(&_glfw.contextSlot); _GLFWwindow* previous;
_GLFW_REQUIRE_INIT(); _GLFW_REQUIRE_INIT();
previous = _glfwPlatformGetTls(&_glfw.contextSlot);
if (window && window->context.client == GLFW_NO_API) if (window && window->context.client == GLFW_NO_API)
{ {
_glfwInputError(GLFW_NO_WINDOW_CONTEXT, _glfwInputError(GLFW_NO_WINDOW_CONTEXT,
+63
View File
@@ -142,6 +142,59 @@ size_t _glfwEncodeUTF8(char* s, uint32_t codepoint)
return count; return count;
} }
// Splits and translates a text/uri-list into separate file paths
// NOTE: This function destroys the provided string
//
char** _glfwParseUriList(char* text, int* count)
{
const char* prefix = "file://";
char** paths = NULL;
char* line;
*count = 0;
while ((line = strtok(text, "\r\n")))
{
char* path;
text = NULL;
if (line[0] == '#')
continue;
if (strncmp(line, prefix, strlen(prefix)) == 0)
{
line += strlen(prefix);
// TODO: Validate hostname
while (*line != '/')
line++;
}
(*count)++;
path = calloc(strlen(line) + 1, 1);
paths = realloc(paths, *count * sizeof(char*));
paths[*count - 1] = path;
while (*line)
{
if (line[0] == '%' && line[1] && line[2])
{
const char digits[3] = { line[1], line[2], '\0' };
*path = (char) strtol(digits, NULL, 16);
line += 2;
}
else
*path = *line;
path++;
line++;
}
}
return paths;
}
char* _glfw_strdup(const char* source) char* _glfw_strdup(const char* source)
{ {
const size_t length = strlen(source); const size_t length = strlen(source);
@@ -150,6 +203,16 @@ char* _glfw_strdup(const char* source)
return result; return result;
} }
int _glfw_min(int a, int b)
{
return a < b ? a : b;
}
int _glfw_max(int a, int b)
{
return a > b ? a : b;
}
float _glfw_fminf(float a, float b) float _glfw_fminf(float a, float b)
{ {
if (a != a) if (a != a)
+28 -15
View File
@@ -360,6 +360,11 @@ void _glfwInputJoystick(_GLFWjoystick* js, int event)
{ {
const int jid = (int) (js - _glfw.joysticks); 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) if (_glfw.callbacks.joystick)
_glfw.callbacks.joystick(jid, event); _glfw.callbacks.joystick(jid, event);
} }
@@ -415,7 +420,7 @@ void _glfwInitGamepadMappings(void)
for (jid = 0; jid <= GLFW_JOYSTICK_LAST; jid++) for (jid = 0; jid <= GLFW_JOYSTICK_LAST; jid++)
{ {
_GLFWjoystick* js = _glfw.joysticks + jid; _GLFWjoystick* js = _glfw.joysticks + jid;
if (js->present) if (js->connected)
js->mapping = findValidMapping(js); js->mapping = findValidMapping(js);
} }
} }
@@ -433,7 +438,7 @@ _GLFWjoystick* _glfwAllocJoystick(const char* name,
for (jid = 0; jid <= GLFW_JOYSTICK_LAST; jid++) for (jid = 0; jid <= GLFW_JOYSTICK_LAST; jid++)
{ {
if (!_glfw.joysticks[jid].present) if (!_glfw.joysticks[jid].allocated)
break; break;
} }
@@ -441,7 +446,7 @@ _GLFWjoystick* _glfwAllocJoystick(const char* name,
return NULL; return NULL;
js = _glfw.joysticks + jid; js = _glfw.joysticks + jid;
js->present = GLFW_TRUE; js->allocated = GLFW_TRUE;
js->axes = calloc(axisCount, sizeof(float)); js->axes = calloc(axisCount, sizeof(float));
js->buttons = calloc(buttonCount + (size_t) hatCount * 4, 1); js->buttons = calloc(buttonCount + (size_t) hatCount * 4, 1);
js->hats = calloc(hatCount, 1); js->hats = calloc(hatCount, 1);
@@ -743,9 +748,16 @@ GLFWAPI GLFWcursor* glfwCreateCursor(const GLFWimage* image, int xhot, int yhot)
_GLFWcursor* cursor; _GLFWcursor* cursor;
assert(image != NULL); assert(image != NULL);
assert(image->pixels != NULL);
_GLFW_REQUIRE_INIT_OR_RETURN(NULL); _GLFW_REQUIRE_INIT_OR_RETURN(NULL);
if (image->width <= 0 || image->height <= 0)
{
_glfwInputError(GLFW_INVALID_VALUE, "Invalid image dimensions for cursor");
return NULL;
}
cursor = calloc(1, sizeof(_GLFWcursor)); cursor = calloc(1, sizeof(_GLFWcursor));
cursor->next = _glfw.cursorListHead; cursor->next = _glfw.cursorListHead;
_glfw.cursorListHead = cursor; _glfw.cursorListHead = cursor;
@@ -937,7 +949,7 @@ GLFWAPI int glfwJoystickPresent(int jid)
} }
js = _glfw.joysticks + jid; js = _glfw.joysticks + jid;
if (!js->present) if (!js->connected)
return GLFW_FALSE; return GLFW_FALSE;
return _glfwPlatformPollJoystick(js, _GLFW_POLL_PRESENCE); return _glfwPlatformPollJoystick(js, _GLFW_POLL_PRESENCE);
@@ -962,7 +974,7 @@ GLFWAPI const float* glfwGetJoystickAxes(int jid, int* count)
} }
js = _glfw.joysticks + jid; js = _glfw.joysticks + jid;
if (!js->present) if (!js->connected)
return NULL; return NULL;
if (!_glfwPlatformPollJoystick(js, _GLFW_POLL_AXES)) if (!_glfwPlatformPollJoystick(js, _GLFW_POLL_AXES))
@@ -991,7 +1003,7 @@ GLFWAPI const unsigned char* glfwGetJoystickButtons(int jid, int* count)
} }
js = _glfw.joysticks + jid; js = _glfw.joysticks + jid;
if (!js->present) if (!js->connected)
return NULL; return NULL;
if (!_glfwPlatformPollJoystick(js, _GLFW_POLL_BUTTONS)) if (!_glfwPlatformPollJoystick(js, _GLFW_POLL_BUTTONS))
@@ -1024,7 +1036,7 @@ GLFWAPI const unsigned char* glfwGetJoystickHats(int jid, int* count)
} }
js = _glfw.joysticks + jid; js = _glfw.joysticks + jid;
if (!js->present) if (!js->connected)
return NULL; return NULL;
if (!_glfwPlatformPollJoystick(js, _GLFW_POLL_BUTTONS)) if (!_glfwPlatformPollJoystick(js, _GLFW_POLL_BUTTONS))
@@ -1050,7 +1062,7 @@ GLFWAPI const char* glfwGetJoystickName(int jid)
} }
js = _glfw.joysticks + jid; js = _glfw.joysticks + jid;
if (!js->present) if (!js->connected)
return NULL; return NULL;
if (!_glfwPlatformPollJoystick(js, _GLFW_POLL_PRESENCE)) if (!_glfwPlatformPollJoystick(js, _GLFW_POLL_PRESENCE))
@@ -1075,7 +1087,7 @@ GLFWAPI const char* glfwGetJoystickGUID(int jid)
} }
js = _glfw.joysticks + jid; js = _glfw.joysticks + jid;
if (!js->present) if (!js->connected)
return NULL; return NULL;
if (!_glfwPlatformPollJoystick(js, _GLFW_POLL_PRESENCE)) if (!_glfwPlatformPollJoystick(js, _GLFW_POLL_PRESENCE))
@@ -1094,7 +1106,7 @@ GLFWAPI void glfwSetJoystickUserPointer(int jid, void* pointer)
_GLFW_REQUIRE_INIT(); _GLFW_REQUIRE_INIT();
js = _glfw.joysticks + jid; js = _glfw.joysticks + jid;
if (!js->present) if (!js->allocated)
return; return;
js->userPointer = pointer; js->userPointer = pointer;
@@ -1110,7 +1122,7 @@ GLFWAPI void* glfwGetJoystickUserPointer(int jid)
_GLFW_REQUIRE_INIT_OR_RETURN(NULL); _GLFW_REQUIRE_INIT_OR_RETURN(NULL);
js = _glfw.joysticks + jid; js = _glfw.joysticks + jid;
if (!js->present) if (!js->allocated)
return NULL; return NULL;
return js->userPointer; return js->userPointer;
@@ -1176,7 +1188,7 @@ GLFWAPI int glfwUpdateGamepadMappings(const char* string)
for (jid = 0; jid <= GLFW_JOYSTICK_LAST; jid++) for (jid = 0; jid <= GLFW_JOYSTICK_LAST; jid++)
{ {
_GLFWjoystick* js = _glfw.joysticks + jid; _GLFWjoystick* js = _glfw.joysticks + jid;
if (js->present) if (js->connected)
js->mapping = findValidMapping(js); js->mapping = findValidMapping(js);
} }
@@ -1199,7 +1211,7 @@ GLFWAPI int glfwJoystickIsGamepad(int jid)
} }
js = _glfw.joysticks + jid; js = _glfw.joysticks + jid;
if (!js->present) if (!js->connected)
return GLFW_FALSE; return GLFW_FALSE;
if (!_glfwPlatformPollJoystick(js, _GLFW_POLL_PRESENCE)) if (!_glfwPlatformPollJoystick(js, _GLFW_POLL_PRESENCE))
@@ -1224,7 +1236,7 @@ GLFWAPI const char* glfwGetGamepadName(int jid)
} }
js = _glfw.joysticks + jid; js = _glfw.joysticks + jid;
if (!js->present) if (!js->connected)
return NULL; return NULL;
if (!_glfwPlatformPollJoystick(js, _GLFW_POLL_PRESENCE)) if (!_glfwPlatformPollJoystick(js, _GLFW_POLL_PRESENCE))
@@ -1256,7 +1268,7 @@ GLFWAPI int glfwGetGamepadState(int jid, GLFWgamepadstate* state)
} }
js = _glfw.joysticks + jid; js = _glfw.joysticks + jid;
if (!js->present) if (!js->connected)
return GLFW_FALSE; return GLFW_FALSE;
if (!_glfwPlatformPollJoystick(js, _GLFW_POLL_ALL)) if (!_glfwPlatformPollJoystick(js, _GLFW_POLL_ALL))
@@ -1365,3 +1377,4 @@ GLFWAPI uint64_t glfwGetTimerFrequency(void)
_GLFW_REQUIRE_INIT_OR_RETURN(0); _GLFW_REQUIRE_INIT_OR_RETURN(0);
return _glfwPlatformGetTimerFrequency(); return _glfwPlatformGetTimerFrequency();
} }
+5 -1
View File
@@ -478,7 +478,8 @@ struct _GLFWmapping
// //
struct _GLFWjoystick struct _GLFWjoystick
{ {
GLFWbool present; GLFWbool allocated;
GLFWbool connected;
float* axes; float* axes;
int axisCount; int axisCount;
unsigned char* buttons; unsigned char* buttons;
@@ -775,8 +776,11 @@ void _glfwTerminateVulkan(void);
const char* _glfwGetVulkanResultString(VkResult result); const char* _glfwGetVulkanResultString(VkResult result);
size_t _glfwEncodeUTF8(char* s, uint32_t codepoint); size_t _glfwEncodeUTF8(char* s, uint32_t codepoint);
char** _glfwParseUriList(char* text, int* count);
char* _glfw_strdup(const char* source); char* _glfw_strdup(const char* source);
int _glfw_min(int a, int b);
int _glfw_max(int a, int b);
float _glfw_fminf(float a, float b); float _glfw_fminf(float a, float b);
float _glfw_fmaxf(float a, float b); float _glfw_fmaxf(float a, float b);
+4 -4
View File
@@ -128,7 +128,7 @@ static GLFWbool openJoystickDevice(const char* path)
{ {
for (int jid = 0; jid <= GLFW_JOYSTICK_LAST; jid++) for (int jid = 0; jid <= GLFW_JOYSTICK_LAST; jid++)
{ {
if (!_glfw.joysticks[jid].present) if (!_glfw.joysticks[jid].connected)
continue; continue;
if (strcmp(_glfw.joysticks[jid].linjs.path, path) == 0) if (strcmp(_glfw.joysticks[jid].linjs.path, path) == 0)
return GLFW_FALSE; return GLFW_FALSE;
@@ -245,9 +245,9 @@ static GLFWbool openJoystickDevice(const char* path)
// //
static void closeJoystick(_GLFWjoystick* js) static void closeJoystick(_GLFWjoystick* js)
{ {
_glfwInputJoystick(js, GLFW_DISCONNECTED);
close(js->linjs.fd); close(js->linjs.fd);
_glfwFreeJoystick(js); _glfwFreeJoystick(js);
_glfwInputJoystick(js, GLFW_DISCONNECTED);
} }
// Lexically compare joysticks by name; used by qsort // Lexically compare joysticks by name; used by qsort
@@ -329,7 +329,7 @@ void _glfwTerminateJoysticksLinux(void)
for (jid = 0; jid <= GLFW_JOYSTICK_LAST; jid++) for (jid = 0; jid <= GLFW_JOYSTICK_LAST; jid++)
{ {
_GLFWjoystick* js = _glfw.joysticks + jid; _GLFWjoystick* js = _glfw.joysticks + jid;
if (js->present) if (js->connected)
closeJoystick(js); closeJoystick(js);
} }
@@ -424,7 +424,7 @@ int _glfwPlatformPollJoystick(_GLFWjoystick* js, int mode)
handleAbsEvent(js, e.code, e.value); handleAbsEvent(js, e.code, e.value);
} }
return js->present; return js->connected;
} }
void _glfwPlatformUpdateGamepadGUID(char* guid) void _glfwPlatformUpdateGamepadGUID(char* guid)
+2 -2
View File
@@ -521,6 +521,8 @@ GLFWAPI void glfwSetGammaRamp(GLFWmonitor* handle, const GLFWgammaramp* ramp)
assert(ramp->green != NULL); assert(ramp->green != NULL);
assert(ramp->blue != NULL); assert(ramp->blue != NULL);
_GLFW_REQUIRE_INIT();
if (ramp->size <= 0) if (ramp->size <= 0)
{ {
_glfwInputError(GLFW_INVALID_VALUE, _glfwInputError(GLFW_INVALID_VALUE,
@@ -529,8 +531,6 @@ GLFWAPI void glfwSetGammaRamp(GLFWmonitor* handle, const GLFWgammaramp* ramp)
return; return;
} }
_GLFW_REQUIRE_INIT();
if (!monitor->originalRamp.size) if (!monitor->originalRamp.size)
{ {
if (!_glfwPlatformGetGammaRamp(monitor, &monitor->originalRamp)) if (!_glfwPlatformGetGammaRamp(monitor, &monitor->originalRamp))
+3
View File
@@ -67,6 +67,9 @@ int _glfwPlatformCreateWindow(_GLFWwindow* window,
_glfwInputError(GLFW_API_UNAVAILABLE, "Null: EGL not available"); _glfwInputError(GLFW_API_UNAVAILABLE, "Null: EGL not available");
return GLFW_FALSE; return GLFW_FALSE;
} }
if (!_glfwRefreshContextAttribs(window, ctxconfig))
return GLFW_FALSE;
} }
return GLFW_TRUE; return GLFW_TRUE;
+14 -2
View File
@@ -72,6 +72,16 @@ BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID reserved)
// //
static GLFWbool loadLibraries(void) static GLFWbool loadLibraries(void)
{ {
if (!GetModuleHandleExW(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS |
GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT,
(const WCHAR*) &_glfw,
(HMODULE*) &_glfw.win32.instance))
{
_glfwInputErrorWin32(GLFW_PLATFORM_ERROR,
"Win32: Failed to retrieve own module handle");
return GLFW_FALSE;
}
_glfw.win32.user32.instance = LoadLibraryA("user32.dll"); _glfw.win32.user32.instance = LoadLibraryA("user32.dll");
if (!_glfw.win32.user32.instance) if (!_glfw.win32.user32.instance)
{ {
@@ -254,7 +264,6 @@ static void createKeyTables(void)
_glfw.win32.keycodes[0x151] = GLFW_KEY_PAGE_DOWN; _glfw.win32.keycodes[0x151] = GLFW_KEY_PAGE_DOWN;
_glfw.win32.keycodes[0x149] = GLFW_KEY_PAGE_UP; _glfw.win32.keycodes[0x149] = GLFW_KEY_PAGE_UP;
_glfw.win32.keycodes[0x045] = GLFW_KEY_PAUSE; _glfw.win32.keycodes[0x045] = GLFW_KEY_PAUSE;
_glfw.win32.keycodes[0x146] = GLFW_KEY_PAUSE;
_glfw.win32.keycodes[0x039] = GLFW_KEY_SPACE; _glfw.win32.keycodes[0x039] = GLFW_KEY_SPACE;
_glfw.win32.keycodes[0x00F] = GLFW_KEY_TAB; _glfw.win32.keycodes[0x00F] = GLFW_KEY_TAB;
_glfw.win32.keycodes[0x03A] = GLFW_KEY_CAPS_LOCK; _glfw.win32.keycodes[0x03A] = GLFW_KEY_CAPS_LOCK;
@@ -336,7 +345,7 @@ static GLFWbool createHelperWindow(void)
WS_CLIPSIBLINGS | WS_CLIPCHILDREN, WS_CLIPSIBLINGS | WS_CLIPCHILDREN,
0, 0, 1, 1, 0, 0, 1, 1,
NULL, NULL, NULL, NULL,
GetModuleHandleW(NULL), _glfw.win32.instance,
NULL); NULL);
if (!_glfw.win32.helperWindowHandle) if (!_glfw.win32.helperWindowHandle)
@@ -494,6 +503,8 @@ void _glfwUpdateKeyNamesWin32(void)
if (length == -1) if (length == -1)
{ {
// This is a dead key, so we need a second simulated key press
// to make it output its own character (usually a diacritic)
length = ToUnicode(vk, scancode, state, length = ToUnicode(vk, scancode, state,
chars, sizeof(chars) / sizeof(WCHAR), chars, sizeof(chars) / sizeof(WCHAR),
0); 0);
@@ -601,6 +612,7 @@ void _glfwPlatformTerminate(void)
_glfwTerminateWGL(); _glfwTerminateWGL();
_glfwTerminateEGL(); _glfwTerminateEGL();
_glfwTerminateOSMesa();
_glfwTerminateJoysticksWin32(); _glfwTerminateJoysticksWin32();
+7 -7
View File
@@ -256,6 +256,8 @@ static GLFWbool supportsXInput(const GUID* guid)
// //
static void closeJoystick(_GLFWjoystick* js) static void closeJoystick(_GLFWjoystick* js)
{ {
_glfwInputJoystick(js, GLFW_DISCONNECTED);
if (js->win32.device) if (js->win32.device)
{ {
IDirectInputDevice8_Unacquire(js->win32.device); IDirectInputDevice8_Unacquire(js->win32.device);
@@ -263,9 +265,7 @@ static void closeJoystick(_GLFWjoystick* js)
} }
free(js->win32.objects); free(js->win32.objects);
_glfwFreeJoystick(js); _glfwFreeJoystick(js);
_glfwInputJoystick(js, GLFW_DISCONNECTED);
} }
// DirectInput device object enumeration callback // 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++) for (jid = 0; jid <= GLFW_JOYSTICK_LAST; jid++)
{ {
js = _glfw.joysticks + jid; js = _glfw.joysticks + jid;
if (js->present) if (js->connected)
{ {
if (memcmp(&js->win32.guid, &di->guidInstance, sizeof(GUID)) == 0) if (memcmp(&js->win32.guid, &di->guidInstance, sizeof(GUID)) == 0)
return DIENUM_CONTINUE; return DIENUM_CONTINUE;
@@ -497,7 +497,7 @@ void _glfwInitJoysticksWin32(void)
{ {
if (_glfw.win32.dinput8.instance) if (_glfw.win32.dinput8.instance)
{ {
if (FAILED(DirectInput8Create(GetModuleHandleW(NULL), if (FAILED(DirectInput8Create(_glfw.win32.instance,
DIRECTINPUT_VERSION, DIRECTINPUT_VERSION,
&IID_IDirectInput8W, &IID_IDirectInput8W,
(void**) &_glfw.win32.dinput8.api, (void**) &_glfw.win32.dinput8.api,
@@ -541,7 +541,7 @@ void _glfwDetectJoystickConnectionWin32(void)
for (jid = 0; jid <= GLFW_JOYSTICK_LAST; jid++) 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.device == NULL &&
_glfw.joysticks[jid].win32.index == index) _glfw.joysticks[jid].win32.index == index)
{ {
@@ -593,7 +593,7 @@ void _glfwDetectJoystickDisconnectionWin32(void)
for (jid = 0; jid <= GLFW_JOYSTICK_LAST; jid++) for (jid = 0; jid <= GLFW_JOYSTICK_LAST; jid++)
{ {
_GLFWjoystick* js = _glfw.joysticks + jid; _GLFWjoystick* js = _glfw.joysticks + jid;
if (js->present) if (js->connected)
_glfwPlatformPollJoystick(js, _GLFW_POLL_PRESENCE); _glfwPlatformPollJoystick(js, _GLFW_POLL_PRESENCE);
} }
} }
@@ -609,7 +609,7 @@ int _glfwPlatformPollJoystick(_GLFWjoystick* js, int mode)
{ {
int i, ai = 0, bi = 0, pi = 0; int i, ai = 0, bi = 0, pi = 0;
HRESULT result; HRESULT result;
DIJOYSTATE state; DIJOYSTATE state = {0};
IDirectInputDevice8_Poll(js->win32.device); IDirectInputDevice8_Poll(js->win32.device);
result = IDirectInputDevice8_GetDeviceState(js->win32.device, result = IDirectInputDevice8_GetDeviceState(js->win32.device,
+1
View File
@@ -334,6 +334,7 @@ typedef struct _GLFWwindowWin32
// //
typedef struct _GLFWlibraryWin32 typedef struct _GLFWlibraryWin32
{ {
HINSTANCE instance;
HWND helperWindowHandle; HWND helperWindowHandle;
HDEVNOTIFY deviceNotificationHandle; HDEVNOTIFY deviceNotificationHandle;
DWORD foregroundLockTimeout; DWORD foregroundLockTimeout;
+41 -16
View File
@@ -504,10 +504,8 @@ static void maximizeWindowManually(_GLFWwindow* window)
if (window->maxwidth != GLFW_DONT_CARE && window->maxheight != GLFW_DONT_CARE) if (window->maxwidth != GLFW_DONT_CARE && window->maxheight != GLFW_DONT_CARE)
{ {
if (rect.right - rect.left > window->maxwidth) rect.right = _glfw_min(rect.right, rect.left + window->maxwidth);
rect.right = rect.left + window->maxwidth; rect.bottom = _glfw_min(rect.bottom, rect.top + window->maxheight);
if (rect.bottom - rect.top > window->maxheight)
rect.bottom = rect.top + window->maxheight;
} }
style = GetWindowLongW(window->win32.handle, GWL_STYLE); style = GetWindowLongW(window->win32.handle, GWL_STYLE);
@@ -530,8 +528,7 @@ static void maximizeWindowManually(_GLFWwindow* window)
OffsetRect(&rect, 0, GetSystemMetrics(SM_CYCAPTION)); OffsetRect(&rect, 0, GetSystemMetrics(SM_CYCAPTION));
} }
if (rect.bottom > mi.rcWork.bottom) rect.bottom = _glfw_min(rect.bottom, mi.rcWork.bottom);
rect.bottom = mi.rcWork.bottom;
} }
SetWindowPos(window->win32.handle, HWND_TOP, SetWindowPos(window->win32.handle, HWND_TOP,
@@ -751,6 +748,18 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
scancode = MapVirtualKeyW((UINT) wParam, MAPVK_VK_TO_VSC); scancode = MapVirtualKeyW((UINT) wParam, MAPVK_VK_TO_VSC);
} }
// HACK: Alt+PrtSc has a different scancode than just PrtSc
if (scancode == 0x54)
scancode = 0x137;
// HACK: Ctrl+Pause has a different scancode than just Pause
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]; key = _glfw.win32.keycodes[scancode];
// The Ctrl keys require special handling // The Ctrl keys require special handling
@@ -1275,15 +1284,16 @@ static int createNativeWindow(_GLFWwindow* window,
if (window->monitor) if (window->monitor)
{ {
GLFWvidmode mode; MONITORINFO mi = { sizeof(mi) };
GetMonitorInfoW(window->monitor->win32.handle, &mi);
// NOTE: This window placement is temporary and approximate, as the // NOTE: This window placement is temporary and approximate, as the
// correct position and size cannot be known until the monitor // correct position and size cannot be known until the monitor
// video mode has been picked in _glfwSetVideoModeWin32 // video mode has been picked in _glfwSetVideoModeWin32
_glfwPlatformGetMonitorPos(window->monitor, &xpos, &ypos); xpos = mi.rcMonitor.left;
_glfwPlatformGetVideoMode(window->monitor, &mode); ypos = mi.rcMonitor.top;
fullWidth = mode.width; fullWidth = mi.rcMonitor.right - mi.rcMonitor.left;
fullHeight = mode.height; fullHeight = mi.rcMonitor.bottom - mi.rcMonitor.top;
} }
else else
{ {
@@ -1312,7 +1322,7 @@ static int createNativeWindow(_GLFWwindow* window,
fullWidth, fullHeight, fullWidth, fullHeight,
NULL, // No parent window NULL, // No parent window
NULL, // No window menu NULL, // No window menu
GetModuleHandleW(NULL), _glfw.win32.instance,
(LPVOID) wndconfig); (LPVOID) wndconfig);
free(wideTitle); free(wideTitle);
@@ -1423,8 +1433,8 @@ GLFWbool _glfwRegisterWindowClassWin32(void)
ZeroMemory(&wc, sizeof(wc)); ZeroMemory(&wc, sizeof(wc));
wc.cbSize = sizeof(wc); wc.cbSize = sizeof(wc);
wc.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC; wc.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC;
wc.lpfnWndProc = (WNDPROC) windowProc; wc.lpfnWndProc = windowProc;
wc.hInstance = GetModuleHandleW(NULL); wc.hInstance = _glfw.win32.instance;
wc.hCursor = LoadCursorW(NULL, IDC_ARROW); wc.hCursor = LoadCursorW(NULL, IDC_ARROW);
wc.lpszClassName = _GLFW_WNDCLASSNAME; wc.lpszClassName = _GLFW_WNDCLASSNAME;
@@ -1454,7 +1464,7 @@ GLFWbool _glfwRegisterWindowClassWin32(void)
// //
void _glfwUnregisterWindowClassWin32(void) void _glfwUnregisterWindowClassWin32(void)
{ {
UnregisterClassW(_GLFW_WNDCLASSNAME, GetModuleHandleW(NULL)); UnregisterClassW(_GLFW_WNDCLASSNAME, _glfw.win32.instance);
} }
@@ -1493,6 +1503,9 @@ int _glfwPlatformCreateWindow(_GLFWwindow* window,
if (!_glfwCreateContextOSMesa(window, ctxconfig, fbconfig)) if (!_glfwCreateContextOSMesa(window, ctxconfig, fbconfig))
return GLFW_FALSE; return GLFW_FALSE;
} }
if (!_glfwRefreshContextAttribs(window, ctxconfig))
return GLFW_FALSE;
} }
if (window->monitor) if (window->monitor)
@@ -1501,6 +1514,18 @@ int _glfwPlatformCreateWindow(_GLFWwindow* window,
_glfwPlatformFocusWindow(window); _glfwPlatformFocusWindow(window);
acquireMonitor(window); acquireMonitor(window);
fitToMonitor(window); fitToMonitor(window);
if (wndconfig->centerCursor)
_glfwCenterCursorInContentArea(window);
}
else
{
if (wndconfig->visible)
{
_glfwPlatformShowWindow(window);
if (wndconfig->focused)
_glfwPlatformFocusWindow(window);
}
} }
return GLFW_TRUE; return GLFW_TRUE;
@@ -2343,7 +2368,7 @@ VkResult _glfwPlatformCreateWindowSurface(VkInstance instance,
memset(&sci, 0, sizeof(sci)); memset(&sci, 0, sizeof(sci));
sci.sType = VK_STRUCTURE_TYPE_WIN32_SURFACE_CREATE_INFO_KHR; sci.sType = VK_STRUCTURE_TYPE_WIN32_SURFACE_CREATE_INFO_KHR;
sci.hinstance = GetModuleHandleW(NULL); sci.hinstance = _glfw.win32.instance;
sci.hwnd = window->win32.handle; sci.hwnd = window->win32.handle;
err = vkCreateWin32SurfaceKHR(instance, &sci, allocator, surface); err = vkCreateWin32SurfaceKHR(instance, &sci, allocator, surface);
+21 -24
View File
@@ -221,30 +221,6 @@ GLFWAPI GLFWwindow* glfwCreateWindow(int width, int height,
return NULL; return NULL;
} }
if (ctxconfig.client != GLFW_NO_API)
{
if (!_glfwRefreshContextAttribs(window, &ctxconfig))
{
glfwDestroyWindow((GLFWwindow*) window);
return NULL;
}
}
if (window->monitor)
{
if (wndconfig.centerCursor)
_glfwCenterCursorInContentArea(window);
}
else
{
if (wndconfig.visible)
{
_glfwPlatformShowWindow(window);
if (wndconfig.focused)
_glfwPlatformFocusWindow(window);
}
}
return (GLFWwindow*) window; return (GLFWwindow*) window;
} }
@@ -504,12 +480,33 @@ GLFWAPI void glfwSetWindowTitle(GLFWwindow* handle, const char* title)
GLFWAPI void glfwSetWindowIcon(GLFWwindow* handle, GLFWAPI void glfwSetWindowIcon(GLFWwindow* handle,
int count, const GLFWimage* images) int count, const GLFWimage* images)
{ {
int i;
_GLFWwindow* window = (_GLFWwindow*) handle; _GLFWwindow* window = (_GLFWwindow*) handle;
assert(window != NULL); assert(window != NULL);
assert(count >= 0); assert(count >= 0);
assert(count == 0 || images != NULL); assert(count == 0 || images != NULL);
_GLFW_REQUIRE_INIT(); _GLFW_REQUIRE_INIT();
if (count < 0)
{
_glfwInputError(GLFW_INVALID_VALUE, "Invalid image count for window icon");
return;
}
for (i = 0; i < count; i++)
{
assert(images[i].pixels != NULL);
if (images[i].width <= 0 || images[i].height <= 0)
{
_glfwInputError(GLFW_INVALID_VALUE,
"Invalid image dimensions for window icon");
return;
}
}
_glfwPlatformSetWindowIcon(window, count, images); _glfwPlatformSetWindowIcon(window, count, images);
} }
+49 -768
View File
@@ -30,7 +30,6 @@
#include "internal.h" #include "internal.h"
#include <assert.h>
#include <errno.h> #include <errno.h>
#include <limits.h> #include <limits.h>
#include <linux/input.h> #include <linux/input.h>
@@ -42,741 +41,19 @@
#include <unistd.h> #include <unistd.h>
#include <wayland-client.h> #include <wayland-client.h>
static void wmBaseHandlePing(void* userData,
static inline int min(int n1, int n2)
{
return n1 < n2 ? n1 : n2;
}
static _GLFWwindow* findWindowFromDecorationSurface(struct wl_surface* surface,
int* which)
{
int focus;
_GLFWwindow* window = _glfw.windowListHead;
if (!which)
which = &focus;
while (window)
{
if (surface == window->wl.decorations.top.surface)
{
*which = topDecoration;
break;
}
if (surface == window->wl.decorations.left.surface)
{
*which = leftDecoration;
break;
}
if (surface == window->wl.decorations.right.surface)
{
*which = rightDecoration;
break;
}
if (surface == window->wl.decorations.bottom.surface)
{
*which = bottomDecoration;
break;
}
window = window->next;
}
return window;
}
static void pointerHandleEnter(void* data,
struct wl_pointer* pointer,
uint32_t serial,
struct wl_surface* surface,
wl_fixed_t sx,
wl_fixed_t sy)
{
// Happens in the case we just destroyed the surface.
if (!surface)
return;
int focus = 0;
_GLFWwindow* window = wl_surface_get_user_data(surface);
if (!window)
{
window = findWindowFromDecorationSurface(surface, &focus);
if (!window)
return;
}
window->wl.decorations.focus = focus;
_glfw.wl.serial = serial;
_glfw.wl.pointerEnterSerial = serial;
_glfw.wl.pointerFocus = window;
window->wl.hovered = GLFW_TRUE;
_glfwPlatformSetCursor(window, window->wl.currentCursor);
_glfwInputCursorEnter(window, GLFW_TRUE);
}
static void pointerHandleLeave(void* data,
struct wl_pointer* pointer,
uint32_t serial,
struct wl_surface* surface)
{
_GLFWwindow* window = _glfw.wl.pointerFocus;
if (!window)
return;
window->wl.hovered = GLFW_FALSE;
_glfw.wl.serial = serial;
_glfw.wl.pointerFocus = NULL;
_glfwInputCursorEnter(window, GLFW_FALSE);
_glfw.wl.cursorPreviousName = NULL;
}
static void setCursor(_GLFWwindow* window, const char* name)
{
struct wl_buffer* buffer;
struct wl_cursor* cursor;
struct wl_cursor_image* image;
struct wl_surface* surface = _glfw.wl.cursorSurface;
struct wl_cursor_theme* theme = _glfw.wl.cursorTheme;
int scale = 1;
if (window->wl.scale > 1 && _glfw.wl.cursorThemeHiDPI)
{
// We only support up to scale=2 for now, since libwayland-cursor
// requires us to load a different theme for each size.
scale = 2;
theme = _glfw.wl.cursorThemeHiDPI;
}
cursor = wl_cursor_theme_get_cursor(theme, name);
if (!cursor)
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"Wayland: Standard cursor not found");
return;
}
// TODO: handle animated cursors too.
image = cursor->images[0];
if (!image)
return;
buffer = wl_cursor_image_get_buffer(image);
if (!buffer)
return;
wl_pointer_set_cursor(_glfw.wl.pointer, _glfw.wl.pointerEnterSerial,
surface,
image->hotspot_x / scale,
image->hotspot_y / scale);
wl_surface_set_buffer_scale(surface, scale);
wl_surface_attach(surface, buffer, 0, 0);
wl_surface_damage(surface, 0, 0,
image->width, image->height);
wl_surface_commit(surface);
_glfw.wl.cursorPreviousName = name;
}
static void pointerHandleMotion(void* data,
struct wl_pointer* pointer,
uint32_t time,
wl_fixed_t sx,
wl_fixed_t sy)
{
_GLFWwindow* window = _glfw.wl.pointerFocus;
const char* cursorName = NULL;
double x, y;
if (!window)
return;
if (window->cursorMode == GLFW_CURSOR_DISABLED)
return;
x = wl_fixed_to_double(sx);
y = wl_fixed_to_double(sy);
window->wl.cursorPosX = x;
window->wl.cursorPosY = y;
switch (window->wl.decorations.focus)
{
case mainWindow:
_glfwInputCursorPos(window, x, y);
_glfw.wl.cursorPreviousName = NULL;
return;
case topDecoration:
if (y < _GLFW_DECORATION_WIDTH)
cursorName = "n-resize";
else
cursorName = "left_ptr";
break;
case leftDecoration:
if (y < _GLFW_DECORATION_WIDTH)
cursorName = "nw-resize";
else
cursorName = "w-resize";
break;
case rightDecoration:
if (y < _GLFW_DECORATION_WIDTH)
cursorName = "ne-resize";
else
cursorName = "e-resize";
break;
case bottomDecoration:
if (x < _GLFW_DECORATION_WIDTH)
cursorName = "sw-resize";
else if (x > window->wl.width + _GLFW_DECORATION_WIDTH)
cursorName = "se-resize";
else
cursorName = "s-resize";
break;
default:
assert(0);
}
if (_glfw.wl.cursorPreviousName != cursorName)
setCursor(window, cursorName);
}
static void pointerHandleButton(void* data,
struct wl_pointer* pointer,
uint32_t serial,
uint32_t time,
uint32_t button,
uint32_t state)
{
_GLFWwindow* window = _glfw.wl.pointerFocus;
int glfwButton;
// Both xdg-shell and wl_shell use the same values.
uint32_t edges = WL_SHELL_SURFACE_RESIZE_NONE;
if (!window)
return;
if (button == BTN_LEFT)
{
switch (window->wl.decorations.focus)
{
case mainWindow:
break;
case topDecoration:
if (window->wl.cursorPosY < _GLFW_DECORATION_WIDTH)
edges = WL_SHELL_SURFACE_RESIZE_TOP;
else
{
if (window->wl.xdg.toplevel)
xdg_toplevel_move(window->wl.xdg.toplevel, _glfw.wl.seat, serial);
else
wl_shell_surface_move(window->wl.shellSurface, _glfw.wl.seat, serial);
}
break;
case leftDecoration:
if (window->wl.cursorPosY < _GLFW_DECORATION_WIDTH)
edges = WL_SHELL_SURFACE_RESIZE_TOP_LEFT;
else
edges = WL_SHELL_SURFACE_RESIZE_LEFT;
break;
case rightDecoration:
if (window->wl.cursorPosY < _GLFW_DECORATION_WIDTH)
edges = WL_SHELL_SURFACE_RESIZE_TOP_RIGHT;
else
edges = WL_SHELL_SURFACE_RESIZE_RIGHT;
break;
case bottomDecoration:
if (window->wl.cursorPosX < _GLFW_DECORATION_WIDTH)
edges = WL_SHELL_SURFACE_RESIZE_BOTTOM_LEFT;
else if (window->wl.cursorPosX > window->wl.width + _GLFW_DECORATION_WIDTH)
edges = WL_SHELL_SURFACE_RESIZE_BOTTOM_RIGHT;
else
edges = WL_SHELL_SURFACE_RESIZE_BOTTOM;
break;
default:
assert(0);
}
if (edges != WL_SHELL_SURFACE_RESIZE_NONE)
{
if (window->wl.xdg.toplevel)
xdg_toplevel_resize(window->wl.xdg.toplevel, _glfw.wl.seat,
serial, edges);
else
wl_shell_surface_resize(window->wl.shellSurface, _glfw.wl.seat,
serial, edges);
return;
}
}
else if (button == BTN_RIGHT)
{
if (window->wl.decorations.focus != mainWindow && window->wl.xdg.toplevel)
{
xdg_toplevel_show_window_menu(window->wl.xdg.toplevel,
_glfw.wl.seat, serial,
window->wl.cursorPosX,
window->wl.cursorPosY);
return;
}
}
// Dont pass the button to the user if it was related to a decoration.
if (window->wl.decorations.focus != mainWindow)
return;
_glfw.wl.serial = serial;
/* Makes left, right and middle 0, 1 and 2. Overall order follows evdev
* codes. */
glfwButton = button - BTN_LEFT;
_glfwInputMouseClick(window,
glfwButton,
state == WL_POINTER_BUTTON_STATE_PRESSED
? GLFW_PRESS
: GLFW_RELEASE,
_glfw.wl.xkb.modifiers);
}
static void pointerHandleAxis(void* data,
struct wl_pointer* pointer,
uint32_t time,
uint32_t axis,
wl_fixed_t value)
{
_GLFWwindow* window = _glfw.wl.pointerFocus;
double x = 0.0, y = 0.0;
// Wayland scroll events are in pointer motion coordinate space (think two
// finger scroll). The factor 10 is commonly used to convert to "scroll
// step means 1.0.
const double scrollFactor = 1.0 / 10.0;
if (!window)
return;
assert(axis == WL_POINTER_AXIS_HORIZONTAL_SCROLL ||
axis == WL_POINTER_AXIS_VERTICAL_SCROLL);
if (axis == WL_POINTER_AXIS_HORIZONTAL_SCROLL)
x = -wl_fixed_to_double(value) * scrollFactor;
else if (axis == WL_POINTER_AXIS_VERTICAL_SCROLL)
y = -wl_fixed_to_double(value) * scrollFactor;
_glfwInputScroll(window, x, y);
}
static const struct wl_pointer_listener pointerListener = {
pointerHandleEnter,
pointerHandleLeave,
pointerHandleMotion,
pointerHandleButton,
pointerHandleAxis,
};
static void keyboardHandleKeymap(void* data,
struct wl_keyboard* keyboard,
uint32_t format,
int fd,
uint32_t size)
{
struct xkb_keymap* keymap;
struct xkb_state* state;
struct xkb_compose_table* composeTable;
struct xkb_compose_state* composeState;
char* mapStr;
const char* locale;
if (format != WL_KEYBOARD_KEYMAP_FORMAT_XKB_V1)
{
close(fd);
return;
}
mapStr = mmap(NULL, size, PROT_READ, MAP_SHARED, fd, 0);
if (mapStr == MAP_FAILED) {
close(fd);
return;
}
keymap = xkb_keymap_new_from_string(_glfw.wl.xkb.context,
mapStr,
XKB_KEYMAP_FORMAT_TEXT_V1,
0);
munmap(mapStr, size);
close(fd);
if (!keymap)
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"Wayland: Failed to compile keymap");
return;
}
state = xkb_state_new(keymap);
if (!state)
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"Wayland: Failed to create XKB state");
xkb_keymap_unref(keymap);
return;
}
// Look up the preferred locale, falling back to "C" as default.
locale = getenv("LC_ALL");
if (!locale)
locale = getenv("LC_CTYPE");
if (!locale)
locale = getenv("LANG");
if (!locale)
locale = "C";
composeTable =
xkb_compose_table_new_from_locale(_glfw.wl.xkb.context, locale,
XKB_COMPOSE_COMPILE_NO_FLAGS);
if (composeTable)
{
composeState =
xkb_compose_state_new(composeTable, XKB_COMPOSE_STATE_NO_FLAGS);
xkb_compose_table_unref(composeTable);
if (composeState)
_glfw.wl.xkb.composeState = composeState;
else
_glfwInputError(GLFW_PLATFORM_ERROR,
"Wayland: Failed to create XKB compose state");
}
else
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"Wayland: Failed to create XKB compose table");
}
xkb_keymap_unref(_glfw.wl.xkb.keymap);
xkb_state_unref(_glfw.wl.xkb.state);
_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");
}
static void keyboardHandleEnter(void* data,
struct wl_keyboard* keyboard,
uint32_t serial,
struct wl_surface* surface,
struct wl_array* keys)
{
// Happens in the case we just destroyed the surface.
if (!surface)
return;
_GLFWwindow* window = wl_surface_get_user_data(surface);
if (!window)
{
window = findWindowFromDecorationSurface(surface, NULL);
if (!window)
return;
}
_glfw.wl.serial = serial;
_glfw.wl.keyboardFocus = window;
_glfwInputWindowFocus(window, GLFW_TRUE);
}
static void keyboardHandleLeave(void* data,
struct wl_keyboard* keyboard,
uint32_t serial,
struct wl_surface* surface)
{
_GLFWwindow* window = _glfw.wl.keyboardFocus;
if (!window)
return;
struct itimerspec timer = {};
timerfd_settime(_glfw.wl.timerfd, 0, &timer, NULL);
_glfw.wl.serial = serial;
_glfw.wl.keyboardFocus = NULL;
_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* data,
struct wl_keyboard* keyboard,
uint32_t serial,
uint32_t time,
uint32_t scancode,
uint32_t state)
{
_GLFWwindow* window = _glfw.wl.keyboardFocus;
if (!window)
return;
const int key = translateKey(scancode);
const int action =
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 = {};
if (action == GLFW_PRESS)
{
const GLFWbool shouldRepeat = _glfwInputTextWayland(window, scancode);
if (shouldRepeat && _glfw.wl.keyboardRepeatRate > 0)
{
_glfw.wl.keyboardLastKey = key;
_glfw.wl.keyboardLastScancode = scancode;
if (_glfw.wl.keyboardRepeatRate > 1)
timer.it_interval.tv_nsec = 1000000000 / _glfw.wl.keyboardRepeatRate;
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;
}
}
timerfd_settime(_glfw.wl.timerfd, 0, &timer, NULL);
}
static void keyboardHandleModifiers(void* data,
struct wl_keyboard* keyboard,
uint32_t serial,
uint32_t modsDepressed,
uint32_t modsLatched,
uint32_t modsLocked,
uint32_t group)
{
_glfw.wl.serial = serial;
if (!_glfw.wl.xkb.keymap)
return;
xkb_state_update_mask(_glfw.wl.xkb.state,
modsDepressed,
modsLatched,
modsLocked,
0,
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)
mods |= GLFW_MOD_CONTROL;
if (mask & _glfw.wl.xkb.altMask)
mods |= GLFW_MOD_ALT;
if (mask & _glfw.wl.xkb.shiftMask)
mods |= GLFW_MOD_SHIFT;
if (mask & _glfw.wl.xkb.superMask)
mods |= GLFW_MOD_SUPER;
if (mask & _glfw.wl.xkb.capsLockMask)
mods |= GLFW_MOD_CAPS_LOCK;
if (mask & _glfw.wl.xkb.numLockMask)
mods |= GLFW_MOD_NUM_LOCK;
_glfw.wl.xkb.modifiers = mods;
}
#ifdef WL_KEYBOARD_REPEAT_INFO_SINCE_VERSION
static void keyboardHandleRepeatInfo(void* data,
struct wl_keyboard* keyboard,
int32_t rate,
int32_t delay)
{
if (keyboard != _glfw.wl.keyboard)
return;
_glfw.wl.keyboardRepeatRate = rate;
_glfw.wl.keyboardRepeatDelay = delay;
}
#endif
static const struct wl_keyboard_listener keyboardListener = {
keyboardHandleKeymap,
keyboardHandleEnter,
keyboardHandleLeave,
keyboardHandleKey,
keyboardHandleModifiers,
#ifdef WL_KEYBOARD_REPEAT_INFO_SINCE_VERSION
keyboardHandleRepeatInfo,
#endif
};
static void seatHandleCapabilities(void* data,
struct wl_seat* seat,
enum wl_seat_capability caps)
{
if ((caps & WL_SEAT_CAPABILITY_POINTER) && !_glfw.wl.pointer)
{
_glfw.wl.pointer = wl_seat_get_pointer(seat);
wl_pointer_add_listener(_glfw.wl.pointer, &pointerListener, NULL);
}
else if (!(caps & WL_SEAT_CAPABILITY_POINTER) && _glfw.wl.pointer)
{
wl_pointer_destroy(_glfw.wl.pointer);
_glfw.wl.pointer = NULL;
}
if ((caps & WL_SEAT_CAPABILITY_KEYBOARD) && !_glfw.wl.keyboard)
{
_glfw.wl.keyboard = wl_seat_get_keyboard(seat);
wl_keyboard_add_listener(_glfw.wl.keyboard, &keyboardListener, NULL);
}
else if (!(caps & WL_SEAT_CAPABILITY_KEYBOARD) && _glfw.wl.keyboard)
{
wl_keyboard_destroy(_glfw.wl.keyboard);
_glfw.wl.keyboard = NULL;
}
}
static void seatHandleName(void* data,
struct wl_seat* seat,
const char* name)
{
}
static const struct wl_seat_listener seatListener = {
seatHandleCapabilities,
seatHandleName,
};
static void dataOfferHandleOffer(void* data,
struct wl_data_offer* dataOffer,
const char* mimeType)
{
}
static const struct wl_data_offer_listener dataOfferListener = {
dataOfferHandleOffer,
};
static void dataDeviceHandleDataOffer(void* data,
struct wl_data_device* dataDevice,
struct wl_data_offer* id)
{
if (_glfw.wl.dataOffer)
wl_data_offer_destroy(_glfw.wl.dataOffer);
_glfw.wl.dataOffer = id;
wl_data_offer_add_listener(_glfw.wl.dataOffer, &dataOfferListener, NULL);
}
static void dataDeviceHandleEnter(void* data,
struct wl_data_device* dataDevice,
uint32_t serial,
struct wl_surface *surface,
wl_fixed_t x,
wl_fixed_t y,
struct wl_data_offer *id)
{
}
static void dataDeviceHandleLeave(void* data,
struct wl_data_device* dataDevice)
{
}
static void dataDeviceHandleMotion(void* data,
struct wl_data_device* dataDevice,
uint32_t time,
wl_fixed_t x,
wl_fixed_t y)
{
}
static void dataDeviceHandleDrop(void* data,
struct wl_data_device* dataDevice)
{
}
static void dataDeviceHandleSelection(void* data,
struct wl_data_device* dataDevice,
struct wl_data_offer* id)
{
}
static const struct wl_data_device_listener dataDeviceListener = {
dataDeviceHandleDataOffer,
dataDeviceHandleEnter,
dataDeviceHandleLeave,
dataDeviceHandleMotion,
dataDeviceHandleDrop,
dataDeviceHandleSelection,
};
static void wmBaseHandlePing(void* data,
struct xdg_wm_base* wmBase, struct xdg_wm_base* wmBase,
uint32_t serial) uint32_t serial)
{ {
xdg_wm_base_pong(wmBase, serial); xdg_wm_base_pong(wmBase, serial);
} }
static const struct xdg_wm_base_listener wmBaseListener = { static const struct xdg_wm_base_listener wmBaseListener =
{
wmBaseHandlePing wmBaseHandlePing
}; };
static void registryHandleGlobal(void* data, static void registryHandleGlobal(void* userData,
struct wl_registry* registry, struct wl_registry* registry,
uint32_t name, uint32_t name,
const char* interface, const char* interface,
@@ -784,7 +61,7 @@ static void registryHandleGlobal(void* data,
{ {
if (strcmp(interface, "wl_compositor") == 0) if (strcmp(interface, "wl_compositor") == 0)
{ {
_glfw.wl.compositorVersion = min(3, version); _glfw.wl.compositorVersion = _glfw_min(3, version);
_glfw.wl.compositor = _glfw.wl.compositor =
wl_registry_bind(registry, name, &wl_compositor_interface, wl_registry_bind(registry, name, &wl_compositor_interface,
_glfw.wl.compositorVersion); _glfw.wl.compositorVersion);
@@ -799,11 +76,6 @@ static void registryHandleGlobal(void* data,
_glfw.wl.shm = _glfw.wl.shm =
wl_registry_bind(registry, name, &wl_shm_interface, 1); wl_registry_bind(registry, name, &wl_shm_interface, 1);
} }
else if (strcmp(interface, "wl_shell") == 0)
{
_glfw.wl.shell =
wl_registry_bind(registry, name, &wl_shell_interface, 1);
}
else if (strcmp(interface, "wl_output") == 0) else if (strcmp(interface, "wl_output") == 0)
{ {
_glfwAddOutputWayland(name, version); _glfwAddOutputWayland(name, version);
@@ -812,11 +84,11 @@ static void registryHandleGlobal(void* data,
{ {
if (!_glfw.wl.seat) if (!_glfw.wl.seat)
{ {
_glfw.wl.seatVersion = min(4, version); _glfw.wl.seatVersion = _glfw_min(4, version);
_glfw.wl.seat = _glfw.wl.seat =
wl_registry_bind(registry, name, &wl_seat_interface, wl_registry_bind(registry, name, &wl_seat_interface,
_glfw.wl.seatVersion); _glfw.wl.seatVersion);
wl_seat_add_listener(_glfw.wl.seat, &seatListener, NULL); _glfwAddSeatListenerWayland(_glfw.wl.seat);
} }
} }
else if (strcmp(interface, "wl_data_device_manager") == 0) else if (strcmp(interface, "wl_data_device_manager") == 0)
@@ -869,16 +141,15 @@ static void registryHandleGlobal(void* data,
} }
} }
static void registryHandleGlobalRemove(void *data, static void registryHandleGlobalRemove(void* userData,
struct wl_registry *registry, struct wl_registry* registry,
uint32_t name) uint32_t name)
{ {
int i; int i;
_GLFWmonitor* monitor;
for (i = 0; i < _glfw.monitorCount; ++i) for (i = 0; i < _glfw.monitorCount; ++i)
{ {
monitor = _glfw.monitors[i]; _GLFWmonitor* monitor = _glfw.monitors[i];
if (monitor->wl.name == name) if (monitor->wl.name == name)
{ {
_glfwInputMonitor(monitor, GLFW_DISCONNECTED, 0); _glfwInputMonitor(monitor, GLFW_DISCONNECTED, 0);
@@ -888,7 +159,8 @@ static void registryHandleGlobalRemove(void *data,
} }
static const struct wl_registry_listener registryListener = { static const struct wl_registry_listener registryListener =
{
registryHandleGlobal, registryHandleGlobal,
registryHandleGlobalRemove registryHandleGlobalRemove
}; };
@@ -1035,17 +307,21 @@ static void createKeyTables(void)
int _glfwPlatformInit(void) int _glfwPlatformInit(void)
{ {
const char *cursorTheme; const char* cursorTheme;
const char *cursorSizeStr; const char* cursorSizeStr;
char *cursorSizeEnd; char* cursorSizeEnd;
long cursorSizeLong; long cursorSizeLong;
int cursorSize; int cursorSize;
// These must be set before any failure checks
_glfw.wl.timerfd = -1;
_glfw.wl.cursorTimerfd = -1;
_glfw.wl.cursor.handle = _glfw_dlopen("libwayland-cursor.so.0"); _glfw.wl.cursor.handle = _glfw_dlopen("libwayland-cursor.so.0");
if (!_glfw.wl.cursor.handle) if (!_glfw.wl.cursor.handle)
{ {
_glfwInputError(GLFW_PLATFORM_ERROR, _glfwInputError(GLFW_PLATFORM_ERROR,
"Wayland: Failed to open libwayland-cursor"); "Wayland: Failed to load libwayland-cursor");
return GLFW_FALSE; return GLFW_FALSE;
} }
@@ -1062,7 +338,7 @@ int _glfwPlatformInit(void)
if (!_glfw.wl.egl.handle) if (!_glfw.wl.egl.handle)
{ {
_glfwInputError(GLFW_PLATFORM_ERROR, _glfwInputError(GLFW_PLATFORM_ERROR,
"Wayland: Failed to open libwayland-egl"); "Wayland: Failed to load libwayland-egl");
return GLFW_FALSE; return GLFW_FALSE;
} }
@@ -1077,7 +353,7 @@ int _glfwPlatformInit(void)
if (!_glfw.wl.xkb.handle) if (!_glfw.wl.xkb.handle)
{ {
_glfwInputError(GLFW_PLATFORM_ERROR, _glfwInputError(GLFW_PLATFORM_ERROR,
"Wayland: Failed to open libxkbcommon"); "Wayland: Failed to load libxkbcommon");
return GLFW_FALSE; return GLFW_FALSE;
} }
@@ -1103,10 +379,10 @@ int _glfwPlatformInit(void)
_glfw_dlsym(_glfw.wl.xkb.handle, "xkb_state_key_get_syms"); _glfw_dlsym(_glfw.wl.xkb.handle, "xkb_state_key_get_syms");
_glfw.wl.xkb.state_update_mask = (PFN_xkb_state_update_mask) _glfw.wl.xkb.state_update_mask = (PFN_xkb_state_update_mask)
_glfw_dlsym(_glfw.wl.xkb.handle, "xkb_state_update_mask"); _glfw_dlsym(_glfw.wl.xkb.handle, "xkb_state_update_mask");
_glfw.wl.xkb.state_serialize_mods = (PFN_xkb_state_serialize_mods)
_glfw_dlsym(_glfw.wl.xkb.handle, "xkb_state_serialize_mods");
_glfw.wl.xkb.state_key_get_layout = (PFN_xkb_state_key_get_layout) _glfw.wl.xkb.state_key_get_layout = (PFN_xkb_state_key_get_layout)
_glfw_dlsym(_glfw.wl.xkb.handle, "xkb_state_key_get_layout"); _glfw_dlsym(_glfw.wl.xkb.handle, "xkb_state_key_get_layout");
_glfw.wl.xkb.state_mod_index_is_active = (PFN_xkb_state_mod_index_is_active)
_glfw_dlsym(_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) _glfw.wl.xkb.compose_table_new_from_locale = (PFN_xkb_compose_table_new_from_locale)
_glfw_dlsym(_glfw.wl.xkb.handle, "xkb_compose_table_new_from_locale"); _glfw_dlsym(_glfw.wl.xkb.handle, "xkb_compose_table_new_from_locale");
@@ -1157,9 +433,17 @@ int _glfwPlatformInit(void)
_glfwInitTimerPOSIX(); _glfwInitTimerPOSIX();
_glfw.wl.timerfd = -1; #ifdef WL_KEYBOARD_REPEAT_INFO_SINCE_VERSION
if (_glfw.wl.seatVersion >= 4) if (_glfw.wl.seatVersion >= WL_KEYBOARD_REPEAT_INFO_SINCE_VERSION)
_glfw.wl.timerfd = timerfd_create(CLOCK_MONOTONIC, TFD_CLOEXEC | TFD_NONBLOCK); _glfw.wl.timerfd = timerfd_create(CLOCK_MONOTONIC, TFD_CLOEXEC | TFD_NONBLOCK);
#endif
if (!_glfw.wl.wmBase)
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"Wayland: Failed to find xdg-shell in your compositor");
return GLFW_FALSE;
}
if (_glfw.wl.pointer && _glfw.wl.shm) if (_glfw.wl.pointer && _glfw.wl.shm)
{ {
@@ -1178,7 +462,7 @@ int _glfwPlatformInit(void)
if (!_glfw.wl.cursorTheme) if (!_glfw.wl.cursorTheme)
{ {
_glfwInputError(GLFW_PLATFORM_ERROR, _glfwInputError(GLFW_PLATFORM_ERROR,
"Wayland: Unable to load default cursor theme"); "Wayland: Failed to load default cursor theme");
return GLFW_FALSE; return GLFW_FALSE;
} }
// If this happens to be NULL, we just fallback to the scale=1 version. // If this happens to be NULL, we just fallback to the scale=1 version.
@@ -1194,16 +478,7 @@ int _glfwPlatformInit(void)
_glfw.wl.dataDevice = _glfw.wl.dataDevice =
wl_data_device_manager_get_data_device(_glfw.wl.dataDeviceManager, wl_data_device_manager_get_data_device(_glfw.wl.dataDeviceManager,
_glfw.wl.seat); _glfw.wl.seat);
wl_data_device_add_listener(_glfw.wl.dataDevice, &dataDeviceListener, NULL); _glfwAddDataDeviceListenerWayland(_glfw.wl.dataDevice);
_glfw.wl.clipboardSize = 4096;
_glfw.wl.clipboardString = calloc(_glfw.wl.clipboardSize, 1);
if (!_glfw.wl.clipboardString)
{
_glfwInputError(GLFW_OUT_OF_MEMORY,
"Wayland: Unable to allocate clipboard memory");
return GLFW_FALSE;
}
} }
return GLFW_TRUE; return GLFW_TRUE;
@@ -1215,6 +490,8 @@ void _glfwPlatformTerminate(void)
_glfwTerminateJoysticksLinux(); _glfwTerminateJoysticksLinux();
#endif #endif
_glfwTerminateEGL(); _glfwTerminateEGL();
_glfwTerminateOSMesa();
if (_glfw.wl.egl.handle) if (_glfw.wl.egl.handle)
{ {
_glfw_dlclose(_glfw.wl.egl.handle); _glfw_dlclose(_glfw.wl.egl.handle);
@@ -1245,6 +522,11 @@ void _glfwPlatformTerminate(void)
_glfw.wl.cursor.handle = NULL; _glfw.wl.cursor.handle = NULL;
} }
for (unsigned int i = 0; i < _glfw.wl.offerCount; i++)
wl_data_offer_destroy(_glfw.wl.offers[i].offer);
free(_glfw.wl.offers);
if (_glfw.wl.cursorSurface) if (_glfw.wl.cursorSurface)
wl_surface_destroy(_glfw.wl.cursorSurface); wl_surface_destroy(_glfw.wl.cursorSurface);
if (_glfw.wl.subcompositor) if (_glfw.wl.subcompositor)
@@ -1253,20 +535,20 @@ void _glfwPlatformTerminate(void)
wl_compositor_destroy(_glfw.wl.compositor); wl_compositor_destroy(_glfw.wl.compositor);
if (_glfw.wl.shm) if (_glfw.wl.shm)
wl_shm_destroy(_glfw.wl.shm); wl_shm_destroy(_glfw.wl.shm);
if (_glfw.wl.shell)
wl_shell_destroy(_glfw.wl.shell);
if (_glfw.wl.viewporter) if (_glfw.wl.viewporter)
wp_viewporter_destroy(_glfw.wl.viewporter); wp_viewporter_destroy(_glfw.wl.viewporter);
if (_glfw.wl.decorationManager) if (_glfw.wl.decorationManager)
zxdg_decoration_manager_v1_destroy(_glfw.wl.decorationManager); zxdg_decoration_manager_v1_destroy(_glfw.wl.decorationManager);
if (_glfw.wl.wmBase) if (_glfw.wl.wmBase)
xdg_wm_base_destroy(_glfw.wl.wmBase); xdg_wm_base_destroy(_glfw.wl.wmBase);
if (_glfw.wl.dataSource) if (_glfw.wl.selectionOffer)
wl_data_source_destroy(_glfw.wl.dataSource); wl_data_offer_destroy(_glfw.wl.selectionOffer);
if (_glfw.wl.dragOffer)
wl_data_offer_destroy(_glfw.wl.dragOffer);
if (_glfw.wl.selectionSource)
wl_data_source_destroy(_glfw.wl.selectionSource);
if (_glfw.wl.dataDevice) if (_glfw.wl.dataDevice)
wl_data_device_destroy(_glfw.wl.dataDevice); wl_data_device_destroy(_glfw.wl.dataDevice);
if (_glfw.wl.dataOffer)
wl_data_offer_destroy(_glfw.wl.dataOffer);
if (_glfw.wl.dataDeviceManager) if (_glfw.wl.dataDeviceManager)
wl_data_device_manager_destroy(_glfw.wl.dataDeviceManager); wl_data_device_manager_destroy(_glfw.wl.dataDeviceManager);
if (_glfw.wl.pointer) if (_glfw.wl.pointer)
@@ -1295,7 +577,6 @@ void _glfwPlatformTerminate(void)
close(_glfw.wl.cursorTimerfd); close(_glfw.wl.cursorTimerfd);
free(_glfw.wl.clipboardString); free(_glfw.wl.clipboardString);
free(_glfw.wl.clipboardSendString);
} }
const char* _glfwPlatformGetVersionString(void) const char* _glfwPlatformGetVersionString(void)
+62 -22
View File
@@ -35,7 +35,7 @@
#include <math.h> #include <math.h>
static void outputHandleGeometry(void* data, static void outputHandleGeometry(void* userData,
struct wl_output* output, struct wl_output* output,
int32_t x, int32_t x,
int32_t y, int32_t y,
@@ -46,24 +46,25 @@ static void outputHandleGeometry(void* data,
const char* model, const char* model,
int32_t transform) int32_t transform)
{ {
struct _GLFWmonitor *monitor = data; struct _GLFWmonitor* monitor = userData;
monitor->wl.x = x; monitor->wl.x = x;
monitor->wl.y = y; monitor->wl.y = y;
monitor->widthMM = physicalWidth; monitor->widthMM = physicalWidth;
monitor->heightMM = physicalHeight; 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* data, static void outputHandleMode(void* userData,
struct wl_output* output, struct wl_output* output,
uint32_t flags, uint32_t flags,
int32_t width, int32_t width,
int32_t height, int32_t height,
int32_t refresh) int32_t refresh)
{ {
struct _GLFWmonitor *monitor = data; struct _GLFWmonitor* monitor = userData;
GLFWvidmode mode; GLFWvidmode mode;
mode.width = width; mode.width = width;
@@ -82,9 +83,9 @@ static void outputHandleMode(void* data,
monitor->wl.currentMode = monitor->modeCount - 1; monitor->wl.currentMode = monitor->modeCount - 1;
} }
static void outputHandleDone(void* data, struct wl_output* output) static void outputHandleDone(void* userData, struct wl_output* output)
{ {
struct _GLFWmonitor *monitor = data; struct _GLFWmonitor* monitor = userData;
if (monitor->widthMM <= 0 || monitor->heightMM <= 0) if (monitor->widthMM <= 0 || monitor->heightMM <= 0)
{ {
@@ -94,23 +95,63 @@ static void outputHandleDone(void* data, struct wl_output* output)
monitor->heightMM = (int) (mode->height * 25.4f / 96.f); 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); _glfwInputMonitor(monitor, GLFW_CONNECTED, _GLFW_INSERT_LAST);
} }
static void outputHandleScale(void* data, static void outputHandleScale(void* userData,
struct wl_output* output, struct wl_output* output,
int32_t factor) int32_t factor)
{ {
struct _GLFWmonitor *monitor = data; struct _GLFWmonitor* monitor = userData;
monitor->wl.scale = factor; 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;
}
}
}
} }
static const struct wl_output_listener outputListener = { #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, outputHandleGeometry,
outputHandleMode, outputHandleMode,
outputHandleDone, outputHandleDone,
outputHandleScale, outputHandleScale,
#ifdef WL_OUTPUT_NAME_SINCE_VERSION
outputHandleName,
outputHandleDescription,
#endif
}; };
@@ -120,9 +161,6 @@ static const struct wl_output_listener outputListener = {
void _glfwAddOutputWayland(uint32_t name, uint32_t version) void _glfwAddOutputWayland(uint32_t name, uint32_t version)
{ {
_GLFWmonitor *monitor;
struct wl_output *output;
if (version < 2) if (version < 2)
{ {
_glfwInputError(GLFW_PLATFORM_ERROR, _glfwInputError(GLFW_PLATFORM_ERROR,
@@ -130,19 +168,21 @@ void _glfwAddOutputWayland(uint32_t name, uint32_t version)
return; return;
} }
// The actual name of this output will be set in the geometry handler. #ifdef WL_OUTPUT_NAME_SINCE_VERSION
monitor = _glfwAllocMonitor("", 0, 0); version = _glfw_min(version, WL_OUTPUT_NAME_SINCE_VERSION);
#else
version = 2;
#endif
output = wl_registry_bind(_glfw.wl.registry, struct wl_output* output = wl_registry_bind(_glfw.wl.registry,
name, name,
&wl_output_interface, &wl_output_interface,
2); version);
if (!output) if (!output)
{
_glfwFreeMonitor(monitor);
return; 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.scale = 1;
monitor->wl.output = output; monitor->wl.output = output;
monitor->wl.name = name; monitor->wl.name = name;
+47 -28
View File
@@ -65,7 +65,7 @@ typedef VkBool32 (APIENTRY *PFN_vkGetPhysicalDeviceWaylandPresentationSupportKHR
#define _glfw_dlclose(handle) dlclose(handle) #define _glfw_dlclose(handle) dlclose(handle)
#define _glfw_dlsym(handle, name) dlsym(handle, name) #define _glfw_dlsym(handle, name) dlsym(handle, name)
#define _GLFW_EGL_NATIVE_WINDOW ((EGLNativeWindowType) window->wl.native) #define _GLFW_EGL_NATIVE_WINDOW ((EGLNativeWindowType) window->wl.egl.window)
#define _GLFW_EGL_NATIVE_DISPLAY ((EGLNativeDisplayType) _glfw.wl.display) #define _GLFW_EGL_NATIVE_DISPLAY ((EGLNativeDisplayType) _glfw.wl.display)
#define _GLFW_PLATFORM_WINDOW_STATE _GLFWwindowWayland wl #define _GLFW_PLATFORM_WINDOW_STATE _GLFWwindowWayland wl
@@ -115,8 +115,8 @@ typedef struct xkb_state* (* PFN_xkb_state_new)(struct xkb_keymap*);
typedef void (* PFN_xkb_state_unref)(struct xkb_state*); 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 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 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 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_new _glfw.wl.xkb.context_new
#define xkb_context_unref _glfw.wl.xkb.context_unref #define xkb_context_unref _glfw.wl.xkb.context_unref
#define xkb_keymap_new_from_string _glfw.wl.xkb.keymap_new_from_string #define xkb_keymap_new_from_string _glfw.wl.xkb.keymap_new_from_string
@@ -128,8 +128,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_unref _glfw.wl.xkb.state_unref
#define xkb_state_key_get_syms _glfw.wl.xkb.state_key_get_syms #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_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_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 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*); typedef void (* PFN_xkb_compose_table_unref)(struct xkb_compose_table*);
@@ -146,11 +146,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_status _glfw.wl.xkb.compose_state_get_status
#define xkb_compose_state_get_one_sym _glfw.wl.xkb.compose_state_get_one_sym #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 typedef enum _GLFWdecorationSideWayland
{ {
mainWindow, mainWindow,
@@ -167,6 +162,13 @@ typedef struct _GLFWdecorationWayland
struct wp_viewport* viewport; struct wp_viewport* viewport;
} _GLFWdecorationWayland; } _GLFWdecorationWayland;
typedef struct _GLFWofferWayland
{
struct wl_data_offer* offer;
GLFWbool text_plain_utf8;
GLFWbool text_uri_list;
} _GLFWofferWayland;
// Wayland-specific per-window data // Wayland-specific per-window data
// //
typedef struct _GLFWwindowWayland typedef struct _GLFWwindowWayland
@@ -174,17 +176,30 @@ typedef struct _GLFWwindowWayland
int width, height; int width, height;
GLFWbool visible; GLFWbool visible;
GLFWbool maximized; GLFWbool maximized;
GLFWbool activated;
GLFWbool fullscreen;
GLFWbool hovered; GLFWbool hovered;
GLFWbool transparent; GLFWbool transparent;
struct wl_surface* surface; struct wl_surface* surface;
struct wl_egl_window* native;
struct wl_shell_surface* shellSurface;
struct wl_callback* callback; struct wl_callback* callback;
struct {
struct wl_egl_window* window;
} egl;
struct {
int width, height;
GLFWbool maximized;
GLFWbool iconified;
GLFWbool activated;
GLFWbool fullscreen;
} pending;
struct { struct {
struct xdg_surface* surface; struct xdg_surface* surface;
struct xdg_toplevel* toplevel; struct xdg_toplevel* toplevel;
struct zxdg_toplevel_decoration_v1* decoration; struct zxdg_toplevel_decoration_v1* decoration;
uint32_t decorationMode;
} xdg; } xdg;
_GLFWcursor* currentCursor; _GLFWcursor* currentCursor;
@@ -206,13 +221,10 @@ typedef struct _GLFWwindowWayland
struct zwp_idle_inhibitor_v1* idleInhibitor; struct zwp_idle_inhibitor_v1* idleInhibitor;
GLFWbool wasFullscreen;
struct { struct {
GLFWbool serverSide;
struct wl_buffer* buffer; struct wl_buffer* buffer;
_GLFWdecorationWayland top, left, right, bottom; _GLFWdecorationWayland top, left, right, bottom;
int focus; _GLFWdecorationSideWayland focus;
} decorations; } decorations;
} _GLFWwindowWayland; } _GLFWwindowWayland;
@@ -224,15 +236,12 @@ typedef struct _GLFWlibraryWayland
struct wl_registry* registry; struct wl_registry* registry;
struct wl_compositor* compositor; struct wl_compositor* compositor;
struct wl_subcompositor* subcompositor; struct wl_subcompositor* subcompositor;
struct wl_shell* shell;
struct wl_shm* shm; struct wl_shm* shm;
struct wl_seat* seat; struct wl_seat* seat;
struct wl_pointer* pointer; struct wl_pointer* pointer;
struct wl_keyboard* keyboard; struct wl_keyboard* keyboard;
struct wl_data_device_manager* dataDeviceManager; struct wl_data_device_manager* dataDeviceManager;
struct wl_data_device* dataDevice; struct wl_data_device* dataDevice;
struct wl_data_offer* dataOffer;
struct wl_data_source* dataSource;
struct xdg_wm_base* wmBase; struct xdg_wm_base* wmBase;
struct zxdg_decoration_manager_v1* decorationManager; struct zxdg_decoration_manager_v1* decorationManager;
struct wp_viewporter* viewporter; struct wp_viewporter* viewporter;
@@ -240,6 +249,16 @@ typedef struct _GLFWlibraryWayland
struct zwp_pointer_constraints_v1* pointerConstraints; struct zwp_pointer_constraints_v1* pointerConstraints;
struct zwp_idle_inhibit_manager_v1* idleInhibitManager; struct zwp_idle_inhibit_manager_v1* idleInhibitManager;
_GLFWofferWayland* offers;
unsigned int offerCount;
struct wl_data_offer* selectionOffer;
struct wl_data_source* selectionSource;
struct wl_data_offer* dragOffer;
_GLFWwindow* dragFocus;
uint32_t dragSerial;
int compositorVersion; int compositorVersion;
int seatVersion; int seatVersion;
@@ -256,9 +275,6 @@ typedef struct _GLFWlibraryWayland
int keyboardLastKey; int keyboardLastKey;
int keyboardLastScancode; int keyboardLastScancode;
char* clipboardString; char* clipboardString;
size_t clipboardSize;
char* clipboardSendString;
size_t clipboardSendSize;
int timerfd; int timerfd;
short int keycodes[256]; short int keycodes[256];
short int scancodes[GLFW_KEY_LAST + 1]; short int scancodes[GLFW_KEY_LAST + 1];
@@ -271,12 +287,12 @@ typedef struct _GLFWlibraryWayland
struct xkb_state* state; struct xkb_state* state;
struct xkb_compose_state* composeState; struct xkb_compose_state* composeState;
xkb_mod_mask_t controlMask; xkb_mod_index_t controlIndex;
xkb_mod_mask_t altMask; xkb_mod_index_t altIndex;
xkb_mod_mask_t shiftMask; xkb_mod_index_t shiftIndex;
xkb_mod_mask_t superMask; xkb_mod_index_t superIndex;
xkb_mod_mask_t capsLockMask; xkb_mod_index_t capsLockIndex;
xkb_mod_mask_t numLockMask; xkb_mod_index_t numLockIndex;
unsigned int modifiers; unsigned int modifiers;
PFN_xkb_context_new context_new; PFN_xkb_context_new context_new;
@@ -290,8 +306,8 @@ typedef struct _GLFWlibraryWayland
PFN_xkb_state_unref state_unref; PFN_xkb_state_unref state_unref;
PFN_xkb_state_key_get_syms state_key_get_syms; PFN_xkb_state_key_get_syms state_key_get_syms;
PFN_xkb_state_update_mask state_update_mask; 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_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_new_from_locale compose_table_new_from_locale;
PFN_xkb_compose_table_unref compose_table_unref; PFN_xkb_compose_table_unref compose_table_unref;
@@ -348,7 +364,10 @@ typedef struct _GLFWcursorWayland
int currentImage; int currentImage;
} _GLFWcursorWayland; } _GLFWcursorWayland;
void _glfwAddOutputWayland(uint32_t name, uint32_t version); void _glfwAddOutputWayland(uint32_t name, uint32_t version);
void _glfwUpdateContentScaleWayland(_GLFWwindow* window);
GLFWbool _glfwInputTextWayland(_GLFWwindow* window, uint32_t scancode); GLFWbool _glfwInputTextWayland(_GLFWwindow* window, uint32_t scancode);
void _glfwAddSeatListenerWayland(struct wl_seat* seat);
void _glfwAddDataDeviceListenerWayland(struct wl_data_device* device);
+1348 -554
View File
File diff suppressed because it is too large Load Diff
+6 -2
View File
@@ -39,6 +39,7 @@
#include <unistd.h> #include <unistd.h>
#include <fcntl.h> #include <fcntl.h>
#include <errno.h> #include <errno.h>
#include <assert.h>
// Translate the X11 KeySyms for a key to a GLFW key code // Translate the X11 KeySyms for a key to a GLFW key code
@@ -1022,8 +1023,9 @@ static int errorHandler(Display *display, XErrorEvent* event)
// //
void _glfwGrabErrorHandlerX11(void) void _glfwGrabErrorHandlerX11(void)
{ {
assert(_glfw.x11.errorHandler == NULL);
_glfw.x11.errorCode = Success; _glfw.x11.errorCode = Success;
XSetErrorHandler(errorHandler); _glfw.x11.errorHandler = XSetErrorHandler(errorHandler);
} }
// Clears the X error handler callback // Clears the X error handler callback
@@ -1032,7 +1034,8 @@ void _glfwReleaseErrorHandlerX11(void)
{ {
// Synchronize to make sure all commands are processed // Synchronize to make sure all commands are processed
XSync(_glfw.x11.display, False); 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 // Reports the specified error, appending information about the last X error
@@ -1235,6 +1238,7 @@ void _glfwPlatformTerminate(void)
_glfw.x11.xi.handle = NULL; _glfw.x11.xi.handle = NULL;
} }
_glfwTerminateOSMesa();
// NOTE: These need to be unloaded after XCloseDisplay, as they register // NOTE: These need to be unloaded after XCloseDisplay, as they register
// cleanup callbacks that get called by that function // cleanup callbacks that get called by that function
_glfwTerminateEGL(); _glfwTerminateEGL();
+2
View File
@@ -222,6 +222,8 @@ typedef struct _GLFWlibraryX11
XContext context; XContext context;
// XIM input method // XIM input method
XIM im; XIM im;
// The previous X error handler, to be restored later
XErrorHandler errorHandler;
// Most recent error code received by X error handler // Most recent error code received by X error handler
int errorCode; int errorCode;
// Primary selection string (while the primary selection is owned) // Primary selection string (while the primary selection is owned)
+27 -83
View File
@@ -164,7 +164,7 @@ static void writeEmptyEvent(void)
for (;;) for (;;)
{ {
const char byte = 0; const char byte = 0;
const int result = write(_glfw.x11.emptyEventPipe[1], &byte, 1); const ssize_t result = write(_glfw.x11.emptyEventPipe[1], &byte, 1);
if (result == 1 || (result == -1 && errno != EINTR)) if (result == 1 || (result == -1 && errno != EINTR))
break; break;
} }
@@ -177,7 +177,7 @@ static void drainEmptyEvents(void)
for (;;) for (;;)
{ {
char dummy[64]; char dummy[64];
const int result = read(_glfw.x11.emptyEventPipe[0], dummy, sizeof(dummy)); const ssize_t result = read(_glfw.x11.emptyEventPipe[0], dummy, sizeof(dummy));
if (result == -1 && errno != EINTR) if (result == -1 && errno != EINTR)
break; break;
} }
@@ -458,57 +458,6 @@ static void updateWindowMode(_GLFWwindow* window)
} }
} }
// Splits and translates a text/uri-list into separate file paths
// NOTE: This function destroys the provided string
//
static char** parseUriList(char* text, int* count)
{
const char* prefix = "file://";
char** paths = NULL;
char* line;
*count = 0;
while ((line = strtok(text, "\r\n")))
{
text = NULL;
if (line[0] == '#')
continue;
if (strncmp(line, prefix, strlen(prefix)) == 0)
{
line += strlen(prefix);
// TODO: Validate hostname
while (*line != '/')
line++;
}
(*count)++;
char* path = calloc(strlen(line) + 1, 1);
paths = realloc(paths, *count * sizeof(char*));
paths[*count - 1] = path;
while (*line)
{
if (line[0] == '%' && line[1] && line[2])
{
const char digits[3] = { line[1], line[2], '\0' };
*path = strtol(digits, NULL, 16);
line += 2;
}
else
*path = *line;
path++;
line++;
}
}
return paths;
}
// Decode a Unicode code point from a UTF-8 stream // Decode a Unicode code point from a UTF-8 stream
// Based on cutef8 by Jeff Bezanson (Public Domain) // Based on cutef8 by Jeff Bezanson (Public Domain)
// //
@@ -980,20 +929,6 @@ static Atom writeTargetToProperty(const XSelectionRequestEvent* request)
return None; return None;
} }
static void handleSelectionClear(XEvent* event)
{
if (event->xselectionclear.selection == _glfw.x11.PRIMARY)
{
free(_glfw.x11.primarySelectionString);
_glfw.x11.primarySelectionString = NULL;
}
else
{
free(_glfw.x11.clipboardString);
_glfw.x11.clipboardString = NULL;
}
}
static void handleSelectionRequest(XEvent* event) static void handleSelectionRequest(XEvent* event)
{ {
const XSelectionRequestEvent* request = &event->xselectionrequest; const XSelectionRequestEvent* request = &event->xselectionrequest;
@@ -1114,13 +1049,16 @@ static const char* getSelectionString(Atom selection)
if (!itemCount) if (!itemCount)
{ {
if (targets[i] == XA_STRING) if (string)
{ {
*selectionString = convertLatin1toUTF8(string); if (targets[i] == XA_STRING)
free(string); {
*selectionString = convertLatin1toUTF8(string);
free(string);
}
else
*selectionString = string;
} }
else
*selectionString = string;
break; break;
} }
@@ -1287,12 +1225,7 @@ static void processEvent(XEvent *event)
return; return;
} }
if (event->type == SelectionClear) if (event->type == SelectionRequest)
{
handleSelectionClear(event);
return;
}
else if (event->type == SelectionRequest)
{ {
handleSelectionRequest(event); handleSelectionRequest(event);
return; return;
@@ -1808,7 +1741,7 @@ static void processEvent(XEvent *event)
if (result) if (result)
{ {
int i, count; int i, count;
char** paths = parseUriList(data, &count); char** paths = _glfwParseUriList(data, &count);
_glfwInputDrop(window, count, (const char**) paths); _glfwInputDrop(window, count, (const char**) paths);
@@ -1997,10 +1930,6 @@ void _glfwPushSelectionToManagerX11(void)
handleSelectionRequest(&event); handleSelectionRequest(&event);
break; break;
case SelectionClear:
handleSelectionClear(&event);
break;
case SelectionNotify: case SelectionNotify:
{ {
if (event.xselection.target == _glfw.x11.SAVE_TARGETS) if (event.xselection.target == _glfw.x11.SAVE_TARGETS)
@@ -2084,6 +2013,9 @@ int _glfwPlatformCreateWindow(_GLFWwindow* window,
if (!_glfwCreateContextOSMesa(window, ctxconfig, fbconfig)) if (!_glfwCreateContextOSMesa(window, ctxconfig, fbconfig))
return GLFW_FALSE; return GLFW_FALSE;
} }
if (!_glfwRefreshContextAttribs(window, ctxconfig))
return GLFW_FALSE;
} }
if (window->monitor) if (window->monitor)
@@ -2091,6 +2023,18 @@ int _glfwPlatformCreateWindow(_GLFWwindow* window,
_glfwPlatformShowWindow(window); _glfwPlatformShowWindow(window);
updateWindowMode(window); updateWindowMode(window);
acquireMonitor(window); acquireMonitor(window);
if (wndconfig->centerCursor)
_glfwCenterCursorInContentArea(window);
}
else
{
if (wndconfig->visible)
{
_glfwPlatformShowWindow(window);
if (wndconfig->focused)
_glfwPlatformFocusWindow(window);
}
} }
XFlush(_glfw.x11.display); XFlush(_glfw.x11.display);
+101 -78
View File
@@ -210,30 +210,6 @@ static void list_context_extensions(int client, int major, int minor)
} }
} }
static void list_vulkan_instance_extensions(void)
{
uint32_t i, ep_count = 0;
VkExtensionProperties* ep;
printf("Vulkan instance extensions:\n");
if (vkEnumerateInstanceExtensionProperties(NULL, &ep_count, NULL) != VK_SUCCESS)
return;
ep = calloc(ep_count, sizeof(VkExtensionProperties));
if (vkEnumerateInstanceExtensionProperties(NULL, &ep_count, ep) != VK_SUCCESS)
{
free(ep);
return;
}
for (i = 0; i < ep_count; i++)
printf(" %s (v%u)\n", ep[i].extensionName, ep[i].specVersion);
free(ep);
}
static void list_vulkan_instance_layers(void) static void list_vulkan_instance_layers(void)
{ {
uint32_t i, lp_count = 0; uint32_t i, lp_count = 0;
@@ -263,30 +239,6 @@ static void list_vulkan_instance_layers(void)
free(lp); free(lp);
} }
static void list_vulkan_device_extensions(VkInstance instance, VkPhysicalDevice device)
{
uint32_t i, ep_count;
VkExtensionProperties* ep;
printf("Vulkan device extensions:\n");
if (vkEnumerateDeviceExtensionProperties(device, NULL, &ep_count, NULL) != VK_SUCCESS)
return;
ep = calloc(ep_count, sizeof(VkExtensionProperties));
if (vkEnumerateDeviceExtensionProperties(device, NULL, &ep_count, ep) != VK_SUCCESS)
{
free(ep);
return;
}
for (i = 0; i < ep_count; i++)
printf(" %s (v%u)\n", ep[i].extensionName, ep[i].specVersion);
free(ep);
}
static void list_vulkan_device_layers(VkInstance instance, VkPhysicalDevice device) static void list_vulkan_device_layers(VkInstance instance, VkPhysicalDevice device)
{ {
uint32_t i, lp_count; uint32_t i, lp_count;
@@ -346,11 +298,6 @@ static void print_version(void)
printf("GLFW library version string: \"%s\"\n", glfwGetVersionString()); printf("GLFW library version string: \"%s\"\n", glfwGetVersionString());
} }
static GLADapiproc glad_vulkan_callback(const char* name, void* user)
{
return glfwGetInstanceProcAddress((VkInstance) user, name);
}
int main(int argc, char** argv) int main(int argc, char** argv)
{ {
int ch, client, major, minor, revision, profile; int ch, client, major, minor, revision, profile;
@@ -812,14 +759,16 @@ int main(int argc, char** argv)
if (glfwVulkanSupported()) if (glfwVulkanSupported())
{ {
uint32_t loader_version = VK_API_VERSION_1_0; uint32_t loader_version = VK_API_VERSION_1_0;
uint32_t i, re_count, pd_count; int portability_enumeration = GLFW_FALSE;
uint32_t i, j, glfw_re_count, re_count, pd_count, ep_count;
const char** glfw_re;
const char** re; const char** re;
VkApplicationInfo ai = {0}; VkApplicationInfo ai = {0};
VkInstanceCreateInfo ici = {0}; VkInstanceCreateInfo ici = {0};
VkInstance instance; VkInstance instance;
VkPhysicalDevice* pd; VkPhysicalDevice* pd;
gladLoadVulkanUserPtr(NULL, glad_vulkan_callback, NULL); gladLoadVulkanUserPtr(NULL, (GLADuserptrloadfunc) glfwGetInstanceProcAddress, NULL);
if (vkEnumerateInstanceVersion) if (vkEnumerateInstanceVersion)
{ {
@@ -832,20 +781,47 @@ int main(int argc, char** argv)
VK_VERSION_MAJOR(loader_version), VK_VERSION_MAJOR(loader_version),
VK_VERSION_MINOR(loader_version)); VK_VERSION_MINOR(loader_version));
re = glfwGetRequiredInstanceExtensions(&re_count); glfw_re = glfwGetRequiredInstanceExtensions(&glfw_re_count);
printf("Vulkan required instance extensions:"); re_count = glfw_re_count;
if (re) re = calloc(glfw_re_count, sizeof(char*));
printf("Vulkan window surface required instance extensions:\n");
if (glfw_re)
{ {
for (i = 0; i < re_count; i++) for (i = 0; i < glfw_re_count; i++)
printf(" %s", re[i]); {
putchar('\n'); printf(" %s\n", glfw_re[i]);
re[i] = glfw_re[i];
}
} }
else else
printf(" missing\n"); printf(" missing\n");
vkEnumerateInstanceExtensionProperties(NULL, &ep_count, NULL);
VkExtensionProperties* ep = calloc(ep_count, sizeof(VkExtensionProperties));
vkEnumerateInstanceExtensionProperties(NULL, &ep_count, ep);
if (list_extensions) if (list_extensions)
list_vulkan_instance_extensions(); {
printf("Vulkan instance extensions:\n");
for (i = 0; i < ep_count; i++)
printf(" %s (spec version %u)\n", ep[i].extensionName, ep[i].specVersion);
}
for (i = 0; i < ep_count; i++)
{
if (strcmp(ep[i].extensionName, "VK_KHR_portability_enumeration") != 0)
continue;
re_count++;
re = realloc((void*) re, sizeof(char*) * re_count);
re[re_count - 1] = "VK_KHR_portability_enumeration";
portability_enumeration = GLFW_TRUE;
}
free(ep);
if (list_layers) if (list_layers)
list_vulkan_instance_layers(); list_vulkan_instance_layers();
@@ -866,34 +842,27 @@ int main(int argc, char** argv)
ici.enabledExtensionCount = re_count; ici.enabledExtensionCount = re_count;
ici.ppEnabledExtensionNames = re; ici.ppEnabledExtensionNames = re;
if (portability_enumeration)
ici.flags |= VK_INSTANCE_CREATE_ENUMERATE_PORTABILITY_BIT_KHR;
if (vkCreateInstance(&ici, NULL, &instance) != VK_SUCCESS) if (vkCreateInstance(&ici, NULL, &instance) != VK_SUCCESS)
{ {
glfwTerminate(); glfwTerminate();
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
gladLoadVulkanUserPtr(NULL, glad_vulkan_callback, instance); free((void*) re);
if (vkEnumeratePhysicalDevices(instance, &pd_count, NULL) != VK_SUCCESS) gladLoadVulkanUserPtr(NULL, (GLADuserptrloadfunc) glfwGetInstanceProcAddress, instance);
{
vkDestroyInstance(instance, NULL);
glfwTerminate();
exit(EXIT_FAILURE);
}
vkEnumeratePhysicalDevices(instance, &pd_count, NULL);
pd = calloc(pd_count, sizeof(VkPhysicalDevice)); pd = calloc(pd_count, sizeof(VkPhysicalDevice));
vkEnumeratePhysicalDevices(instance, &pd_count, pd);
if (vkEnumeratePhysicalDevices(instance, &pd_count, pd) != VK_SUCCESS)
{
free(pd);
vkDestroyInstance(instance, NULL);
glfwTerminate();
exit(EXIT_FAILURE);
}
for (i = 0; i < pd_count; i++) for (i = 0; i < pd_count; i++)
{ {
VkPhysicalDeviceProperties pdp; VkPhysicalDeviceProperties pdp;
uint32_t qfp_count, ep_count;
vkGetPhysicalDeviceProperties(pd[i], &pdp); vkGetPhysicalDeviceProperties(pd[i], &pdp);
@@ -903,8 +872,62 @@ int main(int argc, char** argv)
VK_VERSION_MAJOR(pdp.apiVersion), VK_VERSION_MAJOR(pdp.apiVersion),
VK_VERSION_MINOR(pdp.apiVersion)); VK_VERSION_MINOR(pdp.apiVersion));
vkGetPhysicalDeviceQueueFamilyProperties(pd[i], &qfp_count, NULL);
vkEnumerateDeviceExtensionProperties(pd[i], NULL, &ep_count, NULL);
VkExtensionProperties* ep = calloc(ep_count, sizeof(VkExtensionProperties));
vkEnumerateDeviceExtensionProperties(pd[i], NULL, &ep_count, ep);
if (portability_enumeration)
{
int conformant = GLFW_TRUE;
for (j = 0; j < ep_count; j++)
{
if (strcmp(ep[j].extensionName, "VK_KHR_portability_subset") == 0)
{
conformant = GLFW_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 (j = 0; j < qfp_count; j++)
{
printf(" %u: ", j);
if (glfwGetPhysicalDevicePresentationSupport(instance, pd[i], j))
printf("supported\n");
else
printf("no\n");
}
}
if (list_extensions) if (list_extensions)
list_vulkan_device_extensions(instance, pd[i]); {
printf("Vulkan device extensions:\n");
for (j = 0; j < ep_count; j++)
printf(" %s (spec version %u)\n", ep[j].extensionName, ep[j].specVersion);
}
free(ep);
if (list_layers) if (list_layers)
list_vulkan_device_layers(instance, pd[i]); list_vulkan_device_layers(instance, pd[i]);
+15 -9
View File
@@ -65,11 +65,6 @@
exit(1); \ exit(1); \
} while (0) } while (0)
static GLADapiproc glad_vulkan_callback(const char* name, void* user)
{
return glfwGetInstanceProcAddress((VkInstance) user, name);
}
static const uint32_t fragShaderCode[] = { static const uint32_t fragShaderCode[] = {
0x07230203,0x00010000,0x00080007,0x00000014,0x00000000,0x00020011,0x00000001,0x0006000b, 0x07230203,0x00010000,0x00080007,0x00000014,0x00000000,0x00020011,0x00000001,0x0006000b,
0x00000001,0x4c534c47,0x6474732e,0x3035342e,0x00000000,0x0003000e,0x00000000,0x00000001, 0x00000001,0x4c534c47,0x6474732e,0x3035342e,0x00000000,0x0003000e,0x00000000,0x00000001,
@@ -1251,7 +1246,7 @@ static void demo_prepare_pipeline(struct demo *demo) {
VkPipelineDepthStencilStateCreateInfo ds; VkPipelineDepthStencilStateCreateInfo ds;
VkPipelineViewportStateCreateInfo vp; VkPipelineViewportStateCreateInfo vp;
VkPipelineMultisampleStateCreateInfo ms; VkPipelineMultisampleStateCreateInfo ms;
VkDynamicState dynamicStateEnables[VK_DYNAMIC_STATE_RANGE_SIZE]; VkDynamicState dynamicStateEnables[2];
VkPipelineDynamicStateCreateInfo dynamicState; VkPipelineDynamicStateCreateInfo dynamicState;
VkResult U_ASSERT_ONLY err; VkResult U_ASSERT_ONLY err;
@@ -1565,6 +1560,7 @@ static VkBool32 demo_check_layers(uint32_t check_count, const char **check_names
static void demo_init_vk(struct demo *demo) { static void demo_init_vk(struct demo *demo) {
VkResult err; VkResult err;
VkBool32 portability_enumeration = VK_FALSE;
uint32_t i = 0; uint32_t i = 0;
uint32_t required_extension_count = 0; uint32_t required_extension_count = 0;
uint32_t instance_extension_count = 0; uint32_t instance_extension_count = 0;
@@ -1672,6 +1668,13 @@ static void demo_init_vk(struct demo *demo) {
} }
} }
assert(demo->enabled_extension_count < 64); 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); free(instance_extensions);
@@ -1696,6 +1699,9 @@ static void demo_init_vk(struct demo *demo) {
.ppEnabledExtensionNames = (const char *const *)demo->extension_names, .ppEnabledExtensionNames = (const char *const *)demo->extension_names,
}; };
if (portability_enumeration)
inst_info.flags |= VK_INSTANCE_CREATE_ENUMERATE_PORTABILITY_BIT_KHR;
uint32_t gpu_count; uint32_t gpu_count;
err = vkCreateInstance(&inst_info, NULL, &demo->inst); err = vkCreateInstance(&inst_info, NULL, &demo->inst);
@@ -1715,7 +1721,7 @@ static void demo_init_vk(struct demo *demo) {
"vkCreateInstance Failure"); "vkCreateInstance Failure");
} }
gladLoadVulkanUserPtr(NULL, glad_vulkan_callback, demo->inst); gladLoadVulkanUserPtr(NULL, (GLADuserptrloadfunc) glfwGetInstanceProcAddress, demo->inst);
/* Make initial call to query gpu_count, then second call for gpu info*/ /* Make initial call to query gpu_count, then second call for gpu info*/
err = vkEnumeratePhysicalDevices(demo->inst, &gpu_count, NULL); err = vkEnumeratePhysicalDevices(demo->inst, &gpu_count, NULL);
@@ -1738,7 +1744,7 @@ static void demo_init_vk(struct demo *demo) {
"vkEnumeratePhysicalDevices Failure"); "vkEnumeratePhysicalDevices Failure");
} }
gladLoadVulkanUserPtr(demo->gpu, glad_vulkan_callback, demo->inst); gladLoadVulkanUserPtr(demo->gpu, (GLADuserptrloadfunc) glfwGetInstanceProcAddress, demo->inst);
/* Look for device extensions */ /* Look for device extensions */
uint32_t device_extension_count = 0; uint32_t device_extension_count = 0;
@@ -1966,7 +1972,7 @@ static void demo_init_connection(struct demo *demo) {
exit(1); exit(1);
} }
gladLoadVulkanUserPtr(NULL, glad_vulkan_callback, NULL); gladLoadVulkanUserPtr(NULL, (GLADuserptrloadfunc) glfwGetInstanceProcAddress, NULL);
} }
static void demo_init(struct demo *demo, const int argc, const char *argv[]) static void demo_init(struct demo *demo, const int argc, const char *argv[])