Class VK

java.lang.Object
org.lwjgl.vulkan.VK

public final class VK extends Object
This class loads the Vulkan library into the JVM process.

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:

  1. Set Configuration.VULKAN_LIBRARY_NAME to libvulkan.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.
  2. Remove the lwjgl-vulkan-natives artifact from the class/module-path. LWJGL will fall back to loading libvulkan.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 Details

    • create

      public static void create()
      Loads the Vulkan shared library, using the default library name.
      See Also:
    • create

      public static void create(String libName)
      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

      public static void create(FunctionProvider functionProvider)
      Initializes Vulkan with the specified FunctionProvider. 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

      public static FunctionProvider getFunctionProvider()
      Returns the FunctionProvider for the Vulkan shared library.
    • getInstanceVersionSupported

      public static int getInstanceVersionSupported()
      Returns a uint32_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.