Class GLFWVulkan

java.lang.Object
overrungl.glfw.GLFWVulkan

public final class GLFWVulkan extends Object
GLFWVulkan relies on preview features of the Java platform:
Programs can only use GLFWVulkan when preview features are enabled.
Preview features may be removed in a future release, or upgraded to permanent features of the Java platform.
The GLFW Vulkan binding.
Since:
0.1.0
Author:
squid233
  • Method Details

    • nglfwGetInstanceProcAddress

      public static MemorySegmentPREVIEW nglfwGetInstanceProcAddress(MemorySegmentPREVIEW instance, MemorySegmentPREVIEW procName)
      Returns the address of the specified Vulkan instance function.

      This function returns the address of the specified Vulkan core or extension function for the specified instance. If instance is set to NULLPREVIEW it can return any function exported from the Vulkan loader, including at least the following functions:

      • vkEnumerateInstanceExtensionProperties
      • vkEnumerateInstanceLayerProperties
      • vkCreateInstance
      • vkGetInstanceProcAddr

      If Vulkan is not available on the machine, this function returns NULLPREVIEW and generates a API_UNAVAILABLE error. Call vulkanSupported to check whether Vulkan is at least minimally available.

      This function is equivalent to calling vkGetInstanceProcAddr with a platform-specific query of the Vulkan loader as a fallback.

      Parameters:
      instance - The Vulkan instance to query, or NULLPREVIEW to retrieve functions related to instance creation.
      procName - The ASCII encoded name of the function.
      Returns:
      The address of the function, or NULLPREVIEW if an error occurred.
      Errors:
      Possible errors include NOT_INITIALIZED and API_UNAVAILABLE.
      Thread safety:
      This function may be called from any thread.
      Pointer lifetime:
      The returned function pointer is valid until the library is terminated.
    • glfwGetInstanceProcAddress

      public static MemorySegmentPREVIEW glfwGetInstanceProcAddress(MemorySegmentPREVIEW instance, String procName)
      Returns the address of the specified Vulkan instance function.
      Parameters:
      instance - The Vulkan instance to query, or NULLPREVIEW to retrieve functions related to instance creation.
      procName - The ASCII encoded name of the function.
      Returns:
      The address of the function, or NULLPREVIEW if an error occurred.
      See Also:
    • glfwGetPhysicalDevicePresentationSupport

      public static boolean glfwGetPhysicalDevicePresentationSupport(MemorySegmentPREVIEW instance, MemorySegmentPREVIEW device, int queueFamily)
      Returns whether the specified queue family can present images.

      This function returns whether the specified queue family of the specified physical device supports presentation to the platform GLFW was built for.

      If Vulkan or the required window surface creation instance extensions are not available on the machine, or if the specified instance was not created with the required extensions, this function returns false and generates a API_UNAVAILABLE error. Call vulkanSupported to check whether Vulkan is at least minimally available and getRequiredInstanceExtensionsPREVIEW to check what instance extensions are required.

      Parameters:
      instance - The instance that the physical device belongs to.
      device - The physical device that the queue family belongs to.
      queueFamily - The index of the queue family to query.
      Returns:
      true if the queue family supports presentation, or false otherwise.
      Errors:
      Possible errors include NOT_INITIALIZED, API_UNAVAILABLE and PLATFORM_ERROR.
      Remarks:
      macOS: This function currently always returns true, as the VK_MVK_macos_surface and VK_EXT_metal_surface extensions do not provide a vkGetPhysicalDevice*PresentationSupport type function.
      Thread safety:
      This function may be called from any thread. For synchronization details of Vulkan objects, see the Vulkan specification.
    • nglfwCreateWindowSurface

      public static int nglfwCreateWindowSurface(MemorySegmentPREVIEW instance, MemorySegmentPREVIEW window, MemorySegmentPREVIEW allocator, MemorySegmentPREVIEW surface)
      Creates a Vulkan surface for the specified window.

      This function creates a Vulkan surface for the specified window.

      If the Vulkan loader or at least one minimally functional ICD were not found, this function returns VK_ERROR_INITIALIZATION_FAILED and generates a API_UNAVAILABLE error. Call vulkanSupported to check whether Vulkan is at least minimally available.

      If the required window surface creation instance extensions are not available or if the specified instance was not created with these extensions enabled, this function returns VK_ERROR_EXTENSION_NOT_PRESENT and generates a API_UNAVAILABLE error. Call getRequiredInstanceExtensionsPREVIEW to check what instance extensions are required.

      The window surface cannot be shared with another API so the window must have been created with the client api hint set to NO_API otherwise it generates a INVALID_VALUE error and returns VK_ERROR_NATIVE_WINDOW_IN_USE_KHR.

      The window surface must be destroyed before the specified Vulkan instance. It is the responsibility of the caller to destroy the window surface. GLFW does not destroy it for you. Call vkDestroySurfaceKHR to destroy the surface.

      Parameters:
      instance - The Vulkan instance to create the surface in.
      window - The window to create the surface for.
      allocator - The allocator to use, or NULLPREVIEW to use the default allocator.
      surface - Where to store the handle of the surface. This is set to VK_NULL_HANDLE if an error occurred.
      Returns:
      VK_SUCCESS if successful, or a Vulkan error code if an error occurred.
      See Also:
      Errors:
      Possible errors include NOT_INITIALIZED, API_UNAVAILABLE, PLATFORM_ERROR and INVALID_VALUE.
      Remarks:
      If an error occurs before the creation call is made, GLFW returns the Vulkan error code most appropriate for the error. Appropriate use of vulkanSupported and getRequiredInstanceExtensionsPREVIEW should eliminate almost all occurrences of these errors.

      macOS: GLFW prefers the VK_EXT_metal_surface extension, with the VK_MVK_macos_surface extension as a fallback. The name of the selected extension, if any, is included in the array returned by getRequiredInstanceExtensionsPREVIEW.

      macOS: This function creates and sets a CAMetalLayer instance for the window content view, which is required for MoltenVK to function.

      Thread safety:
      This function may be called from any thread. For synchronization details of Vulkan objects, see the Vulkan specification.
    • glfwCreateWindowSurface

      public static int glfwCreateWindowSurface(MemorySegmentPREVIEW instance, MemorySegmentPREVIEW window, MemorySegmentPREVIEW allocator, long[] surface)
      Creates a Vulkan surface for the specified window.
      Parameters:
      instance - The Vulkan instance to create the surface in.
      window - The window to create the surface for.
      allocator - The allocator to use, or NULLPREVIEW to use the default allocator.
      surface - Where to store the handle of the surface. This is set to VK_NULL_HANDLE if an error occurred.
      Returns:
      VK_SUCCESS if successful, or a Vulkan error code if an error occurred.
      See Also: