public class GLFWVulkan
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static class |
GLFWVulkan.Functions
Contains the function pointers loaded from
GLFW.getLibrary(). |
| Modifier and Type | Method and Description |
|---|---|
static int |
glfwCreateWindowSurface(org.lwjgl.vulkan.VkInstance instance,
long window,
org.lwjgl.vulkan.VkAllocationCallbacks allocator,
long[] surface)
Array version of:
CreateWindowSurface |
static int |
glfwCreateWindowSurface(org.lwjgl.vulkan.VkInstance instance,
long window,
org.lwjgl.vulkan.VkAllocationCallbacks allocator,
java.nio.LongBuffer surface)
Creates a Vulkan surface for the specified window.
|
static long |
glfwGetInstanceProcAddress(org.lwjgl.vulkan.VkInstance instance,
java.nio.ByteBuffer procname)
Returns the address of the specified Vulkan core or extension function for the specified instance.
|
static long |
glfwGetInstanceProcAddress(org.lwjgl.vulkan.VkInstance instance,
java.lang.CharSequence procname)
Returns the address of the specified Vulkan core or extension function for the specified instance.
|
static boolean |
glfwGetPhysicalDevicePresentationSupport(org.lwjgl.vulkan.VkInstance instance,
org.lwjgl.vulkan.VkPhysicalDevice device,
int queuefamily)
Returns whether the specified queue family of the specified physical device supports presentation to the platform GLFW was built for.
|
static org.lwjgl.PointerBuffer |
glfwGetRequiredInstanceExtensions()
Returns an array of names of Vulkan instance extensions required by GLFW for creating Vulkan surfaces for GLFW windows.
|
static boolean |
glfwVulkanSupported()
Returns whether the Vulkan loader has been found.
|
static int |
nglfwCreateWindowSurface(long instance,
long window,
long allocator,
long surface)
Unsafe version of:
CreateWindowSurface |
static long |
nglfwGetInstanceProcAddress(long instance,
long procname)
Unsafe version of:
GetInstanceProcAddress |
static long |
nglfwGetRequiredInstanceExtensions(long count)
Unsafe version of:
GetRequiredInstanceExtensions |
static void |
setPath(java.lang.String path)
Overrides the Vulkan shared library that GLFW loads internally.
|
static void |
setPathLWJGL()
Calls
setPath(String) with the path of the Vulkan shared library loaded by LWJGL. |
public static boolean glfwVulkanSupported()
Init.
The availability of a Vulkan loader does not by itself guarantee that window surface creation or even device creation is possible. Call
GetRequiredInstanceExtensions to check whether the extensions necessary for Vulkan surface creation are available and
GetPhysicalDevicePresentationSupport to check whether a queue family of a physical device supports image presentation.
Possible errors include NOT_INITIALIZED.
This function may be called from any thread.
public static long nglfwGetRequiredInstanceExtensions(long count)
GetRequiredInstanceExtensionscount - where to store the number of extensions in the returned array. This is set to zero if an error occurred.@Nullable public static org.lwjgl.PointerBuffer glfwGetRequiredInstanceExtensions()
VK_KHR_surface, so if you don't require any additional extensions you can pass this list directly to the VkInstanceCreateInfo
struct.
If Vulkan is not available on the machine, this function returns NULL and generates a API_UNAVAILABLE error. Call VulkanSupported to check whether
Vulkan is available.
If Vulkan is available but no set of extensions allowing window surface creation was found, this function returns NULL. You may still use Vulkan for
off-screen rendering and compute work.
Additional extensions may be required by future versions of GLFW. You should check if any extensions you wish to enable are already in the returned
array, as it is an error to specify an extension more than once in the VkInstanceCreateInfo struct.
The returned array is allocated and freed by GLFW. You should not free it yourself. It is guaranteed to be valid only until the library is terminated.
This function may be called from any thread.
Possible errors include NOT_INITIALIZED and API_UNAVAILABLE.
NULL if an error occurredpublic static long nglfwGetInstanceProcAddress(long instance,
long procname)
GetInstanceProcAddresspublic static long glfwGetInstanceProcAddress(@Nullable
org.lwjgl.vulkan.VkInstance instance,
java.nio.ByteBuffer procname)
NULL it can return any
function exported from the Vulkan loader, including at least the following functions:
VK10.vkEnumerateInstanceExtensionProperties(java.nio.ByteBuffer, java.nio.IntBuffer, org.lwjgl.vulkan.VkExtensionProperties.Buffer)VK10.vkEnumerateInstanceLayerProperties(java.nio.IntBuffer, org.lwjgl.vulkan.VkLayerProperties.Buffer)VK10.vkCreateInstance(org.lwjgl.vulkan.VkInstanceCreateInfo, org.lwjgl.vulkan.VkAllocationCallbacks, org.lwjgl.PointerBuffer)VK10.vkGetInstanceProcAddr(org.lwjgl.vulkan.VkInstance, java.nio.ByteBuffer)If Vulkan is not available on the machine, this function returns NULL and generates a API_UNAVAILABLE error. Call VulkanSupported to check whether
Vulkan is available.
This function is equivalent to calling VK10.vkGetInstanceProcAddr(org.lwjgl.vulkan.VkInstance, java.nio.ByteBuffer) with a platform-specific query of the Vulkan loader as a fallback.
Possible errors include NOT_INITIALIZED and API_UNAVAILABLE.
The returned function pointer is valid until the library is terminated.
This function may be called from any thread.
instance - the Vulkan instance to query, or NULL to retrieve functions related to instance creationprocname - the ASCII encoded name of the functionNULL if an error occurredpublic static long glfwGetInstanceProcAddress(@Nullable
org.lwjgl.vulkan.VkInstance instance,
java.lang.CharSequence procname)
NULL it can return any
function exported from the Vulkan loader, including at least the following functions:
VK10.vkEnumerateInstanceExtensionProperties(java.nio.ByteBuffer, java.nio.IntBuffer, org.lwjgl.vulkan.VkExtensionProperties.Buffer)VK10.vkEnumerateInstanceLayerProperties(java.nio.IntBuffer, org.lwjgl.vulkan.VkLayerProperties.Buffer)VK10.vkCreateInstance(org.lwjgl.vulkan.VkInstanceCreateInfo, org.lwjgl.vulkan.VkAllocationCallbacks, org.lwjgl.PointerBuffer)VK10.vkGetInstanceProcAddr(org.lwjgl.vulkan.VkInstance, java.nio.ByteBuffer)If Vulkan is not available on the machine, this function returns NULL and generates a API_UNAVAILABLE error. Call VulkanSupported to check whether
Vulkan is available.
This function is equivalent to calling VK10.vkGetInstanceProcAddr(org.lwjgl.vulkan.VkInstance, java.nio.ByteBuffer) with a platform-specific query of the Vulkan loader as a fallback.
Possible errors include NOT_INITIALIZED and API_UNAVAILABLE.
The returned function pointer is valid until the library is terminated.
This function may be called from any thread.
instance - the Vulkan instance to query, or NULL to retrieve functions related to instance creationprocname - the ASCII encoded name of the functionNULL if an error occurredpublic static boolean glfwGetPhysicalDevicePresentationSupport(org.lwjgl.vulkan.VkInstance instance,
org.lwjgl.vulkan.VkPhysicalDevice device,
int queuefamily)
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
available and GetRequiredInstanceExtensions to check what instance extensions are required.
Possible errors include NOT_INITIALIZED, API_UNAVAILABLE and PLATFORM_ERROR.
This function may be called from any thread. For synchronization details of Vulkan objects, see the Vulkan specification.
public static int nglfwCreateWindowSurface(long instance,
long window,
long allocator,
long surface)
CreateWindowSurfacepublic static int glfwCreateWindowSurface(org.lwjgl.vulkan.VkInstance instance,
long window,
@Nullable
org.lwjgl.vulkan.VkAllocationCallbacks allocator,
java.nio.LongBuffer surface)
If the Vulkan loader was not found at initialization, this function returns VK10.VK_ERROR_INITIALIZATION_FAILED and generates a API_UNAVAILABLE error.
Call VulkanSupported to check whether the Vulkan loader was found.
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 VK10.VK_ERROR_EXTENSION_NOT_PRESENT and generates a API_UNAVAILABLE error. Call GetRequiredInstanceExtensions 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 KHRSurface.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 KHRSurface.vkDestroySurfaceKHR(org.lwjgl.vulkan.VkInstance, long, org.lwjgl.vulkan.VkAllocationCallbacks) to destroy the surface.
Possible errors include NOT_INITIALIZED, API_UNAVAILABLE, PLATFORM_ERROR and INVALID_VALUE.
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 GetRequiredInstanceExtensions should eliminate almost all occurrences of these errors.
This function may be called from any thread. For synchronization details of Vulkan objects, see the Vulkan specification.
instance - the Vulkan instance to create the surface inwindow - the window to create the surface forallocator - the allocator to use, or NULL to use the default allocator.surface - where to store the handle of the surface. This is set to VK10.VK_NULL_HANDLE if an error occurred.VK10.VK_SUCCESS if successful, or a Vulkan error code if an error occurredpublic static int glfwCreateWindowSurface(org.lwjgl.vulkan.VkInstance instance,
long window,
@Nullable
org.lwjgl.vulkan.VkAllocationCallbacks allocator,
long[] surface)
CreateWindowSurfacepublic static void setPathLWJGL()
setPath(String) with the path of the Vulkan shared library loaded by LWJGL.public static void setPath(@Nullable
java.lang.String path)
This is useful when there's a mismatch between the shared libraries loaded by LWJGL and GLFW.
This method must be called before GLFW initializes Vulkan. The override is available only in the default GLFW build bundled with LWJGL. Using the
override with a custom GLFW build will produce a warning in DEBUG mode (but not an error).
path - the Vulkan shared library path, or null to remove the override.Copyright LWJGL. All Rights Reserved. License terms.