Class VK
macOS: Vulkan on macOS is emulated over the Metal API using the MoltenVK library.
The lwjgl-vulkan-natives-macos*
artifact includes a MoltenVK build and LWJGL will try to load it first, if available. Using MoltenVK directly is
simple and efficient, but circumvents the Vulkan SDK and the validation layers it provides. During development, it is often very useful to make use of these
validation layers, to verify correct API usage and avoid common pitfalls. In order to do that on macOS, LWJGL must be forced to load the Vulkan Loader
library (libvulkan.1.dylib
) instead of MoltenVK. There are two options:
-
Set
Configuration.VULKAN_LIBRARY_NAME
tolibvulkan.1.dylib
. Depending on the Vulkan SDK installation, this file may not be in the library path and an absolute path must be used instead. -
Remove the
lwjgl-vulkan-natives
artifact from the class/module-path. LWJGL will fall back to loadinglibvulkan.1.dylib
(if it is in the library path).
Note that when using the Vulkan Loader the Vulkan implementation will be provided by the MoltenVK build shipped with the Vulkan SDK. That build may be different from the one bundled with LWJGL.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
create()
Loads the Vulkan shared library, using the default library name.static void
Loads the Vulkan shared library, using the specified library name.static void
create
(FunctionProvider functionProvider) Initializes Vulkan with the specifiedFunctionProvider
.static void
destroy()
Unloads the Vulkan shared library.static FunctionProvider
Returns theFunctionProvider
for the Vulkan shared library.static int
Returns auint32_t
, which is the version of Vulkan supported by instance-level functionality, encoded as described in the Version Numbers section.
-
Method Details
-
create
public static void create()Loads the Vulkan shared library, using the default library name.- See Also:
-
create
Loads the Vulkan shared library, using the specified library name.The
FunctionProvider
instance created by this method can only be used to retrieve global commands and commands exposed statically by the Vulkan shared library.- Parameters:
libName
- the shared library name- See Also:
-
create
Initializes Vulkan with the specifiedFunctionProvider
. This method can be used to implement custom Vulkan library loading.- Parameters:
functionProvider
- the provider of Vulkan function addresses
-
destroy
public static void destroy()Unloads the Vulkan shared library. -
getFunctionProvider
Returns theFunctionProvider
for the Vulkan shared library. -
getInstanceVersionSupported
public static int getInstanceVersionSupported()Returns auint32_t
, which is the version of Vulkan supported by instance-level functionality, encoded as described in the Version Numbers section.This method can be called before creating a Vulkan instance. The returned value can be used to set the
VkApplicationInfo
::apiVersion
member.
-