public class KHRSwapchain
extends java.lang.Object
VK_KHR_swapchain extension is the device-level companion to the VK_KHR_surface extension. It introduces VkSwapchainKHR objects, which provide the ability to present rendering results to a surface.
The example code for the VK_KHR_surface and VK_KHR_swapchain extensions was removed from the appendix after revision 1.0.29. This WSI example code was ported to the cube demo that is shipped with the official Khronos SDK, and is being kept up-to-date in that location (see: https://github.com/KhronosGroup/Vulkan-Tools/blob/master/cube/cube.c).
VK_KHR_swapchainVK_KHR_surface| Modifier and Type | Field and Description |
|---|---|
static int |
VK_DEVICE_GROUP_PRESENT_MODE_LOCAL_BIT_KHR
VkDeviceGroupPresentModeFlagBitsKHR - Bitmask specifying supported device group present modes
|
static int |
VK_DEVICE_GROUP_PRESENT_MODE_LOCAL_MULTI_DEVICE_BIT_KHR
VkDeviceGroupPresentModeFlagBitsKHR - Bitmask specifying supported device group present modes
|
static int |
VK_DEVICE_GROUP_PRESENT_MODE_REMOTE_BIT_KHR
VkDeviceGroupPresentModeFlagBitsKHR - Bitmask specifying supported device group present modes
|
static int |
VK_DEVICE_GROUP_PRESENT_MODE_SUM_BIT_KHR
VkDeviceGroupPresentModeFlagBitsKHR - Bitmask specifying supported device group present modes
|
static int |
VK_ERROR_OUT_OF_DATE_KHR
Extends
VkResult. |
static int |
VK_IMAGE_LAYOUT_PRESENT_SRC_KHR
Extends
VkImageLayout. |
static java.lang.String |
VK_KHR_SWAPCHAIN_EXTENSION_NAME
The extension name.
|
static int |
VK_KHR_SWAPCHAIN_SPEC_VERSION
The extension specification version.
|
static int |
VK_OBJECT_TYPE_SWAPCHAIN_KHR
Extends
VkObjectType. |
static int |
VK_STRUCTURE_TYPE_ACQUIRE_NEXT_IMAGE_INFO_KHR
Extends
VkStructureType. |
static int |
VK_STRUCTURE_TYPE_BIND_IMAGE_MEMORY_SWAPCHAIN_INFO_KHR
Extends
VkStructureType. |
static int |
VK_STRUCTURE_TYPE_DEVICE_GROUP_PRESENT_CAPABILITIES_KHR
Extends
VkStructureType. |
static int |
VK_STRUCTURE_TYPE_DEVICE_GROUP_PRESENT_INFO_KHR
Extends
VkStructureType. |
static int |
VK_STRUCTURE_TYPE_DEVICE_GROUP_SWAPCHAIN_CREATE_INFO_KHR
Extends
VkStructureType. |
static int |
VK_STRUCTURE_TYPE_IMAGE_SWAPCHAIN_CREATE_INFO_KHR
Extends
VkStructureType. |
static int |
VK_STRUCTURE_TYPE_PRESENT_INFO_KHR
Extends
VkStructureType. |
static int |
VK_STRUCTURE_TYPE_SWAPCHAIN_CREATE_INFO_KHR
Extends
VkStructureType. |
static int |
VK_SUBOPTIMAL_KHR
Extends
VkResult. |
static int |
VK_SWAPCHAIN_CREATE_PROTECTED_BIT_KHR
Extends
VkSwapchainCreateFlagBitsKHR. |
static int |
VK_SWAPCHAIN_CREATE_SPLIT_INSTANCE_BIND_REGIONS_BIT_KHR
Extends
VkSwapchainCreateFlagBitsKHR. |
| Modifier and Type | Method and Description |
|---|---|
static int |
nvkAcquireNextImage2KHR(org.lwjgl.vulkan.VkDevice device,
long pAcquireInfo,
long pImageIndex)
Unsafe version of:
AcquireNextImage2KHR |
static int |
nvkAcquireNextImageKHR(org.lwjgl.vulkan.VkDevice device,
long swapchain,
long timeout,
long semaphore,
long fence,
long pImageIndex)
Unsafe version of:
AcquireNextImageKHR |
static int |
nvkCreateSwapchainKHR(org.lwjgl.vulkan.VkDevice device,
long pCreateInfo,
long pAllocator,
long pSwapchain)
Unsafe version of:
CreateSwapchainKHR |
static void |
nvkDestroySwapchainKHR(org.lwjgl.vulkan.VkDevice device,
long swapchain,
long pAllocator)
Unsafe version of:
DestroySwapchainKHR |
static int |
nvkGetDeviceGroupPresentCapabilitiesKHR(org.lwjgl.vulkan.VkDevice device,
long pDeviceGroupPresentCapabilities)
Unsafe version of:
GetDeviceGroupPresentCapabilitiesKHR |
static int |
nvkGetDeviceGroupSurfacePresentModesKHR(org.lwjgl.vulkan.VkDevice device,
long surface,
long pModes)
Unsafe version of:
GetDeviceGroupSurfacePresentModesKHR |
static int |
nvkGetPhysicalDevicePresentRectanglesKHR(org.lwjgl.vulkan.VkPhysicalDevice physicalDevice,
long surface,
long pRectCount,
long pRects)
Unsafe version of:
GetPhysicalDevicePresentRectanglesKHR |
static int |
nvkGetSwapchainImagesKHR(org.lwjgl.vulkan.VkDevice device,
long swapchain,
long pSwapchainImageCount,
long pSwapchainImages)
Unsafe version of:
GetSwapchainImagesKHR |
static int |
nvkQueuePresentKHR(org.lwjgl.vulkan.VkQueue queue,
long pPresentInfo)
Unsafe version of:
QueuePresentKHR |
static int |
vkAcquireNextImage2KHR(org.lwjgl.vulkan.VkDevice device,
VkAcquireNextImageInfoKHR pAcquireInfo,
int[] pImageIndex)
Array version of:
AcquireNextImage2KHR |
static int |
vkAcquireNextImage2KHR(org.lwjgl.vulkan.VkDevice device,
VkAcquireNextImageInfoKHR pAcquireInfo,
java.nio.IntBuffer pImageIndex)
Retrieve the index of the next available presentable image.
|
static int |
vkAcquireNextImageKHR(org.lwjgl.vulkan.VkDevice device,
long swapchain,
long timeout,
long semaphore,
long fence,
int[] pImageIndex)
Array version of:
AcquireNextImageKHR |
static int |
vkAcquireNextImageKHR(org.lwjgl.vulkan.VkDevice device,
long swapchain,
long timeout,
long semaphore,
long fence,
java.nio.IntBuffer pImageIndex)
Retrieve the index of the next available presentable image.
|
static int |
vkCreateSwapchainKHR(org.lwjgl.vulkan.VkDevice device,
VkSwapchainCreateInfoKHR pCreateInfo,
VkAllocationCallbacks pAllocator,
long[] pSwapchain)
Array version of:
CreateSwapchainKHR |
static int |
vkCreateSwapchainKHR(org.lwjgl.vulkan.VkDevice device,
VkSwapchainCreateInfoKHR pCreateInfo,
VkAllocationCallbacks pAllocator,
java.nio.LongBuffer pSwapchain)
Create a swapchain.
|
static void |
vkDestroySwapchainKHR(org.lwjgl.vulkan.VkDevice device,
long swapchain,
VkAllocationCallbacks pAllocator)
Destroy a swapchain object.
|
static int |
vkGetDeviceGroupPresentCapabilitiesKHR(org.lwjgl.vulkan.VkDevice device,
VkDeviceGroupPresentCapabilitiesKHR pDeviceGroupPresentCapabilities)
Query present capabilities from other physical devices.
|
static int |
vkGetDeviceGroupSurfacePresentModesKHR(org.lwjgl.vulkan.VkDevice device,
long surface,
int[] pModes)
Array version of:
GetDeviceGroupSurfacePresentModesKHR |
static int |
vkGetDeviceGroupSurfacePresentModesKHR(org.lwjgl.vulkan.VkDevice device,
long surface,
java.nio.IntBuffer pModes)
Query present capabilities for a surface.
|
static int |
vkGetPhysicalDevicePresentRectanglesKHR(org.lwjgl.vulkan.VkPhysicalDevice physicalDevice,
long surface,
int[] pRectCount,
VkRect2D.Buffer pRects)
Array version of:
GetPhysicalDevicePresentRectanglesKHR |
static int |
vkGetPhysicalDevicePresentRectanglesKHR(org.lwjgl.vulkan.VkPhysicalDevice physicalDevice,
long surface,
java.nio.IntBuffer pRectCount,
VkRect2D.Buffer pRects)
Query present rectangles for a surface on a physical device.
|
static int |
vkGetSwapchainImagesKHR(org.lwjgl.vulkan.VkDevice device,
long swapchain,
int[] pSwapchainImageCount,
long[] pSwapchainImages)
Array version of:
GetSwapchainImagesKHR |
static int |
vkGetSwapchainImagesKHR(org.lwjgl.vulkan.VkDevice device,
long swapchain,
java.nio.IntBuffer pSwapchainImageCount,
java.nio.LongBuffer pSwapchainImages)
Obtain the array of presentable images associated with a swapchain.
|
static int |
vkQueuePresentKHR(org.lwjgl.vulkan.VkQueue queue,
VkPresentInfoKHR pPresentInfo)
Queue an image for presentation.
|
public static final int VK_KHR_SWAPCHAIN_SPEC_VERSION
public static final java.lang.String VK_KHR_SWAPCHAIN_EXTENSION_NAME
public static final int VK_STRUCTURE_TYPE_SWAPCHAIN_CREATE_INFO_KHR
VkStructureType.
public static final int VK_STRUCTURE_TYPE_PRESENT_INFO_KHR
VkStructureType.
public static final int VK_IMAGE_LAYOUT_PRESENT_SRC_KHR
VkImageLayout.public static final int VK_SUBOPTIMAL_KHR
public static final int VK_ERROR_OUT_OF_DATE_KHR
public static final int VK_OBJECT_TYPE_SWAPCHAIN_KHR
VkObjectType.public static final int VK_STRUCTURE_TYPE_DEVICE_GROUP_PRESENT_CAPABILITIES_KHR
VkStructureType.
public static final int VK_STRUCTURE_TYPE_IMAGE_SWAPCHAIN_CREATE_INFO_KHR
VkStructureType.
public static final int VK_STRUCTURE_TYPE_BIND_IMAGE_MEMORY_SWAPCHAIN_INFO_KHR
VkStructureType.
public static final int VK_STRUCTURE_TYPE_ACQUIRE_NEXT_IMAGE_INFO_KHR
VkStructureType.
public static final int VK_STRUCTURE_TYPE_DEVICE_GROUP_PRESENT_INFO_KHR
VkStructureType.
public static final int VK_STRUCTURE_TYPE_DEVICE_GROUP_SWAPCHAIN_CREATE_INFO_KHR
VkStructureType.
public static final int VK_SWAPCHAIN_CREATE_SPLIT_INSTANCE_BIND_REGIONS_BIT_KHR
VkSwapchainCreateFlagBitsKHR.
public static final int VK_SWAPCHAIN_CREATE_PROTECTED_BIT_KHR
VkSwapchainCreateFlagBitsKHR.
public static final int VK_DEVICE_GROUP_PRESENT_MODE_LOCAL_BIT_KHR
DEVICE_GROUP_PRESENT_MODE_LOCAL_BIT_KHR specifies that any physical device with a presentation engine can present its own swapchain images.DEVICE_GROUP_PRESENT_MODE_REMOTE_BIT_KHR specifies that any physical device with a presentation engine can present swapchain images from any physical device in its presentMask.DEVICE_GROUP_PRESENT_MODE_SUM_BIT_KHR specifies that any physical device with a presentation engine can present the sum of swapchain images from any physical devices in its presentMask.DEVICE_GROUP_PRESENT_MODE_LOCAL_MULTI_DEVICE_BIT_KHR specifies that multiple physical devices with a presentation engine can each present their own swapchain images.VkDeviceGroupPresentInfoKHR, VkDeviceGroupPresentModeFlagsKHR
public static final int VK_DEVICE_GROUP_PRESENT_MODE_REMOTE_BIT_KHR
DEVICE_GROUP_PRESENT_MODE_LOCAL_BIT_KHR specifies that any physical device with a presentation engine can present its own swapchain images.DEVICE_GROUP_PRESENT_MODE_REMOTE_BIT_KHR specifies that any physical device with a presentation engine can present swapchain images from any physical device in its presentMask.DEVICE_GROUP_PRESENT_MODE_SUM_BIT_KHR specifies that any physical device with a presentation engine can present the sum of swapchain images from any physical devices in its presentMask.DEVICE_GROUP_PRESENT_MODE_LOCAL_MULTI_DEVICE_BIT_KHR specifies that multiple physical devices with a presentation engine can each present their own swapchain images.VkDeviceGroupPresentInfoKHR, VkDeviceGroupPresentModeFlagsKHR
public static final int VK_DEVICE_GROUP_PRESENT_MODE_SUM_BIT_KHR
DEVICE_GROUP_PRESENT_MODE_LOCAL_BIT_KHR specifies that any physical device with a presentation engine can present its own swapchain images.DEVICE_GROUP_PRESENT_MODE_REMOTE_BIT_KHR specifies that any physical device with a presentation engine can present swapchain images from any physical device in its presentMask.DEVICE_GROUP_PRESENT_MODE_SUM_BIT_KHR specifies that any physical device with a presentation engine can present the sum of swapchain images from any physical devices in its presentMask.DEVICE_GROUP_PRESENT_MODE_LOCAL_MULTI_DEVICE_BIT_KHR specifies that multiple physical devices with a presentation engine can each present their own swapchain images.VkDeviceGroupPresentInfoKHR, VkDeviceGroupPresentModeFlagsKHR
public static final int VK_DEVICE_GROUP_PRESENT_MODE_LOCAL_MULTI_DEVICE_BIT_KHR
DEVICE_GROUP_PRESENT_MODE_LOCAL_BIT_KHR specifies that any physical device with a presentation engine can present its own swapchain images.DEVICE_GROUP_PRESENT_MODE_REMOTE_BIT_KHR specifies that any physical device with a presentation engine can present swapchain images from any physical device in its presentMask.DEVICE_GROUP_PRESENT_MODE_SUM_BIT_KHR specifies that any physical device with a presentation engine can present the sum of swapchain images from any physical devices in its presentMask.DEVICE_GROUP_PRESENT_MODE_LOCAL_MULTI_DEVICE_BIT_KHR specifies that multiple physical devices with a presentation engine can each present their own swapchain images.VkDeviceGroupPresentInfoKHR, VkDeviceGroupPresentModeFlagsKHR
public static int nvkCreateSwapchainKHR(org.lwjgl.vulkan.VkDevice device,
long pCreateInfo,
long pAllocator,
long pSwapchain)
CreateSwapchainKHRpublic static int vkCreateSwapchainKHR(org.lwjgl.vulkan.VkDevice device,
VkSwapchainCreateInfoKHR pCreateInfo,
@Nullable
VkAllocationCallbacks pAllocator,
java.nio.LongBuffer pSwapchain)
To create a swapchain, call:
VkResult vkCreateSwapchainKHR(
VkDevice device,
const VkSwapchainCreateInfoKHR* pCreateInfo,
const VkAllocationCallbacks* pAllocator,
VkSwapchainKHR* pSwapchain);
If the oldSwapchain parameter of pCreateInfo is a valid swapchain, which has exclusive full-screen access, that access is released from oldSwapchain. If the command succeeds in this case, the newly created swapchain will automatically acquire exclusive full-screen access from oldSwapchain.
This implicit transfer is intended to avoid exiting and entering full-screen exclusive mode, which may otherwise cause unwanted visual updates to the display.
In some cases, swapchain creation may fail if exclusive full-screen mode is requested for application control, but for some implementation-specific reason exclusive full-screen access is unavailable for the particular combination of parameters provided. If this occurs, ERROR_INITIALIZATION_FAILED will be returned.
In particular, it will fail if the imageExtent member of pCreateInfo does not match the extents of the monitor. Other reasons for failure may include the app not being set as high-dpi aware, or if the physical device and monitor are not compatible in this mode.
device must be a valid VkDevice handlepCreateInfo must be a valid pointer to a valid VkSwapchainCreateInfoKHR structurepAllocator is not NULL, pAllocator must be a valid pointer to a valid VkAllocationCallbacks structurepSwapchain must be a valid pointer to a VkSwapchainKHR handlepCreateInfo.surface must be externally synchronizedpCreateInfo.oldSwapchain must be externally synchronizeddevice - the device to create the swapchain for.pCreateInfo - a pointer to a VkSwapchainCreateInfoKHR structure specifying the parameters of the created swapchain.pAllocator - the allocator used for host memory allocated for the swapchain object when there is no more specific allocator available (see Memory Allocation).pSwapchain - a pointer to a VkSwapchainKHR handle in which the created swapchain object will be returned.public static void nvkDestroySwapchainKHR(org.lwjgl.vulkan.VkDevice device,
long swapchain,
long pAllocator)
DestroySwapchainKHRpublic static void vkDestroySwapchainKHR(org.lwjgl.vulkan.VkDevice device,
long swapchain,
@Nullable
VkAllocationCallbacks pAllocator)
To destroy a swapchain object call:
void vkDestroySwapchainKHR(
VkDevice device,
VkSwapchainKHR swapchain,
const VkAllocationCallbacks* pAllocator);
The application must not destroy a swapchain until after completion of all outstanding operations on images that were acquired from the swapchain. swapchain and all associated VkImage handles are destroyed, and must not be acquired or used any more by the application. The memory of each VkImage will only be freed after that image is no longer used by the presentation engine. For example, if one image of the swapchain is being displayed in a window, the memory for that image may not be freed until the window is destroyed, or another swapchain is created for the window. Destroying the swapchain does not invalidate the parent VkSurfaceKHR, and a new swapchain can be created with it.
When a swapchain associated with a display surface is destroyed, if the image most recently presented to the display surface is from the swapchain being destroyed, then either any display resources modified by presenting images from any swapchain associated with the display surface must be reverted by the implementation to their state prior to the first present performed on one of these swapchains, or such resources must be left in their current state.
If swapchain has exclusive full-screen access, it is released before the swapchain is destroyed.
swapchain must have completed executionVkAllocationCallbacks were provided when swapchain was created, a compatible set of callbacks must be provided hereVkAllocationCallbacks were provided when swapchain was created, pAllocator must be NULLdevice must be a valid VkDevice handleswapchain is not NULL_HANDLE, swapchain must be a valid VkSwapchainKHR handlepAllocator is not NULL, pAllocator must be a valid pointer to a valid VkAllocationCallbacks structuredevice, and swapchain that are valid handles of non-ignored parameters must have been created, allocated, or retrieved from the same VkInstanceswapchain must be externally synchronizeddevice - the VkDevice associated with swapchain.swapchain - the swapchain to destroy.pAllocator - the allocator used for host memory allocated for the swapchain object when there is no more specific allocator available (see Memory Allocation).public static int nvkGetSwapchainImagesKHR(org.lwjgl.vulkan.VkDevice device,
long swapchain,
long pSwapchainImageCount,
long pSwapchainImages)
GetSwapchainImagesKHRpSwapchainImageCount - a pointer to an integer related to the number of presentable images available or queried, as described below.public static int vkGetSwapchainImagesKHR(org.lwjgl.vulkan.VkDevice device,
long swapchain,
java.nio.IntBuffer pSwapchainImageCount,
@Nullable
java.nio.LongBuffer pSwapchainImages)
To obtain the array of presentable images associated with a swapchain, call:
VkResult vkGetSwapchainImagesKHR(
VkDevice device,
VkSwapchainKHR swapchain,
uint32_t* pSwapchainImageCount,
VkImage* pSwapchainImages);
If pSwapchainImages is NULL, then the number of presentable images for swapchain is returned in pSwapchainImageCount. Otherwise, pSwapchainImageCount must point to a variable set by the user to the number of elements in the pSwapchainImages array, and on return the variable is overwritten with the number of structures actually written to pSwapchainImages. If the value of pSwapchainImageCount is less than the number of presentable images for swapchain, at most pSwapchainImageCount structures will be written. If pSwapchainImageCount is smaller than the number of presentable images for swapchain, INCOMPLETE will be returned instead of SUCCESS to indicate that not all the available values were returned.
device must be a valid VkDevice handleswapchain must be a valid VkSwapchainKHR handlepSwapchainImageCount must be a valid pointer to a uint32_t valuepSwapchainImageCount is not 0, and pSwapchainImages is not NULL, pSwapchainImages must be a valid pointer to an array of pSwapchainImageCount VkImage handlesdevice, and swapchain must have been created, allocated, or retrieved from the same VkInstancedevice - the device associated with swapchain.swapchain - the swapchain to query.pSwapchainImageCount - a pointer to an integer related to the number of presentable images available or queried, as described below.pSwapchainImages - either NULL or a pointer to an array of VkImage handles.public static int nvkAcquireNextImageKHR(org.lwjgl.vulkan.VkDevice device,
long swapchain,
long timeout,
long semaphore,
long fence,
long pImageIndex)
AcquireNextImageKHRpublic static int vkAcquireNextImageKHR(org.lwjgl.vulkan.VkDevice device,
long swapchain,
long timeout,
long semaphore,
long fence,
java.nio.IntBuffer pImageIndex)
To acquire an available presentable image to use, and retrieve the index of that image, call:
VkResult vkAcquireNextImageKHR(
VkDevice device,
VkSwapchainKHR swapchain,
uint64_t timeout,
VkSemaphore semaphore,
VkFence fence,
uint32_t* pImageIndex);
swapchain must not be in the retired statesemaphore is not NULL_HANDLE it must be unsignaledsemaphore is not NULL_HANDLE it must not have any uncompleted signal or wait operations pendingfence is not NULL_HANDLE it must be unsignaled and must not be associated with any other queue command that has not yet completed execution on that queuesemaphore and fence must not both be equal to NULL_HANDLEswapchain and the value of VkSurfaceCapabilitiesKHR::minImageCount as returned by a call to GetPhysicalDeviceSurfaceCapabilities2KHR with the surface used to create swapchain, timeout must not be UINT64_MAXsemaphore must have a VkSemaphoreTypeKHR of SEMAPHORE_TYPE_BINARY_KHRdevice must be a valid VkDevice handleswapchain must be a valid VkSwapchainKHR handlesemaphore is not NULL_HANDLE, semaphore must be a valid VkSemaphore handlefence is not NULL_HANDLE, fence must be a valid VkFence handlepImageIndex must be a valid pointer to a uint32_t valuesemaphore is a valid handle, it must have been created, allocated, or retrieved from devicefence is a valid handle, it must have been created, allocated, or retrieved from devicedevice, and swapchain that are valid handles of non-ignored parameters must have been created, allocated, or retrieved from the same VkInstanceswapchain must be externally synchronizedsemaphore must be externally synchronizedfence must be externally synchronizeddevice - the device associated with swapchain.swapchain - the non-retired swapchain from which an image is being acquired.timeout - specifies how long the function waits, in nanoseconds, if no image is available.semaphore - NULL_HANDLE or a semaphore to signal.fence - NULL_HANDLE or a fence to signal.pImageIndex - a pointer to a uint32_t in which the index of the next image to use (i.e. an index into the array of images returned by vkGetSwapchainImagesKHR) is returned.public static int nvkQueuePresentKHR(org.lwjgl.vulkan.VkQueue queue,
long pPresentInfo)
QueuePresentKHRpublic static int vkQueuePresentKHR(org.lwjgl.vulkan.VkQueue queue,
VkPresentInfoKHR pPresentInfo)
After queueing all rendering commands and transitioning the image to the correct layout, to queue an image for presentation, call:
VkResult vkQueuePresentKHR(
VkQueue queue,
const VkPresentInfoKHR* pPresentInfo);
There is no requirement for an application to present images in the same order that they were acquired - applications can arbitrarily present any image that is currently acquired.
pSwapchains member of pPresentInfo must be a swapchain that is created for a surface for which presentation is supported from queue as determined using a call to vkGetPhysicalDeviceSurfaceSupportKHRpSwapchains was created from a display surface, all display surfaces referenced that refer to the same display must use the same display modepWaitSemaphores member of pPresentInfo executes on queue, there must be no other queues waiting on the same semaphore.pWaitSemaphores member of pPresentInfo must be semaphores that are signaled, or have semaphore signal operations previously submitted for execution.pWaitSemaphores member of pPresentInfo must be created with a VkSemaphoreTypeKHR of SEMAPHORE_TYPE_BINARY_KHR.pWaitSemaphores member of pPresentInfo must reference a semaphore signal operation that has been submitted for execution and any semaphore signal operations on which it depends (if any) must have also been submitted for execution.Any writes to memory backing the images referenced by the pImageIndices and pSwapchains members of pPresentInfo, that are available before QueuePresentKHR is executed, are automatically made visible to the read access performed by the presentation engine. This automatic visibility operation for an image happens-after the semaphore signal operation, and happens-before the presentation engine accesses the image.
Queueing an image for presentation defines a set of queue operations, including waiting on the semaphores and submitting a presentation request to the presentation engine. However, the scope of this set of queue operations does not include the actual processing of the image by the presentation engine.
If vkQueuePresentKHR fails to enqueue the corresponding set of queue operations, it may return ERROR_OUT_OF_HOST_MEMORY or ERROR_OUT_OF_DEVICE_MEMORY. If it does, the implementation must ensure that the state and contents of any resources or synchronization primitives referenced is unaffected by the call or its failure.
If vkQueuePresentKHR fails in such a way that the implementation is unable to make that guarantee, the implementation must return ERROR_DEVICE_LOST.
However, if the presentation request is rejected by the presentation engine with an error ERROR_OUT_OF_DATE_KHR or ERROR_SURFACE_LOST_KHR, the set of queue operations are still considered to be enqueued and thus any semaphore wait operation specified in VkPresentInfoKHR will execute when the corresponding queue operation is complete.
If any swapchain member of pPresentInfo was created with FULL_SCREEN_EXCLUSIVE_APPLICATION_CONTROLLED_EXT, ERROR_FULL_SCREEN_EXCLUSIVE_MODE_LOST_EXT will be returned if that swapchain does not have exclusive full-screen access, possibly for implementation-specific reasons outside of the application's control.
queue must be a valid VkQueue handlepPresentInfo must be a valid pointer to a valid VkPresentInfoKHR structurequeue must be externally synchronizedpPresentInfo.pWaitSemaphores[] must be externally synchronizedpPresentInfo.pSwapchains[] must be externally synchronized| Command Buffer Levels | Render Pass Scope | Supported Queue Types | Pipeline Type |
|---|---|---|---|
| - | - | Any | - |
queue - a queue that is capable of presentation to the target surface’s platform on the same device as the image’s swapchain.pPresentInfo - a pointer to a VkPresentInfoKHR structure specifying parameters of the presentation.public static int nvkGetDeviceGroupPresentCapabilitiesKHR(org.lwjgl.vulkan.VkDevice device,
long pDeviceGroupPresentCapabilities)
GetDeviceGroupPresentCapabilitiesKHRpublic static int vkGetDeviceGroupPresentCapabilitiesKHR(org.lwjgl.vulkan.VkDevice device,
VkDeviceGroupPresentCapabilitiesKHR pDeviceGroupPresentCapabilities)
A logical device that represents multiple physical devices may support presenting from images on more than one physical device, or combining images from multiple physical devices.
To query these capabilities, call:
VkResult vkGetDeviceGroupPresentCapabilitiesKHR(
VkDevice device,
VkDeviceGroupPresentCapabilitiesKHR* pDeviceGroupPresentCapabilities);
device must be a valid VkDevice handlepDeviceGroupPresentCapabilities must be a valid pointer to a VkDeviceGroupPresentCapabilitiesKHR structuredevice - the logical device.pDeviceGroupPresentCapabilities - a pointer to a VkDeviceGroupPresentCapabilitiesKHR structure in which the device’s capabilities are returned.public static int nvkGetDeviceGroupSurfacePresentModesKHR(org.lwjgl.vulkan.VkDevice device,
long surface,
long pModes)
GetDeviceGroupSurfacePresentModesKHRpublic static int vkGetDeviceGroupSurfacePresentModesKHR(org.lwjgl.vulkan.VkDevice device,
long surface,
java.nio.IntBuffer pModes)
Some surfaces may not be capable of using all the device group present modes.
To query the supported device group present modes for a particular surface, call:
VkResult vkGetDeviceGroupSurfacePresentModesKHR(
VkDevice device,
VkSurfaceKHR surface,
VkDeviceGroupPresentModeFlagsKHR* pModes);
The modes returned by this command are not invariant, and may change in response to the surface being moved, resized, or occluded. These modes must be a subset of the modes returned by GetDeviceGroupPresentCapabilitiesKHR.
device must be a valid VkDevice handlesurface must be a valid VkSurfaceKHR handlepModes must be a valid pointer to a VkDeviceGroupPresentModeFlagsKHR valuedevice, and surface must have been created, allocated, or retrieved from the same VkInstancesurface must be externally synchronizeddevice - the logical device.surface - the surface.pModes - a pointer to a VkDeviceGroupPresentModeFlagsKHR in which the supported device group present modes for the surface are returned.public static int nvkGetPhysicalDevicePresentRectanglesKHR(org.lwjgl.vulkan.VkPhysicalDevice physicalDevice,
long surface,
long pRectCount,
long pRects)
GetPhysicalDevicePresentRectanglesKHRpRectCount - a pointer to an integer related to the number of rectangles available or queried, as described below.public static int vkGetPhysicalDevicePresentRectanglesKHR(org.lwjgl.vulkan.VkPhysicalDevice physicalDevice,
long surface,
java.nio.IntBuffer pRectCount,
@Nullable
VkRect2D.Buffer pRects)
When using DEVICE_GROUP_PRESENT_MODE_LOCAL_MULTI_DEVICE_BIT_KHR, the application may need to know which regions of the surface are used when presenting locally on each physical device. Presentation of swapchain images to this surface need only have valid contents in the regions returned by this command.
To query a set of rectangles used in presentation on the physical device, call:
VkResult vkGetPhysicalDevicePresentRectanglesKHR(
VkPhysicalDevice physicalDevice,
VkSurfaceKHR surface,
uint32_t* pRectCount,
VkRect2D* pRects);
If pRects is NULL, then the number of rectangles used when presenting the given surface is returned in pRectCount. Otherwise, pRectCount must point to a variable set by the user to the number of elements in the pRects array, and on return the variable is overwritten with the number of structures actually written to pRects. If the value of pRectCount is less than the number of rectangles, at most pRectCount structures will be written. If pRectCount is smaller than the number of rectangles used for the given surface, INCOMPLETE will be returned instead of SUCCESS to indicate that not all the available values were returned.
The values returned by this command are not invariant, and may change in response to the surface being moved, resized, or occluded.
The rectangles returned by this command must not overlap.
physicalDevice must be a valid VkPhysicalDevice handlesurface must be a valid VkSurfaceKHR handlepRectCount must be a valid pointer to a uint32_t valuepRectCount is not 0, and pRects is not NULL, pRects must be a valid pointer to an array of pRectCount VkRect2D structuresphysicalDevice, and surface must have been created, allocated, or retrieved from the same VkInstancesurface must be externally synchronizedphysicalDevice - the physical device.surface - the surface.pRectCount - a pointer to an integer related to the number of rectangles available or queried, as described below.pRects - either NULL or a pointer to an array of VkRect2D structures.public static int nvkAcquireNextImage2KHR(org.lwjgl.vulkan.VkDevice device,
long pAcquireInfo,
long pImageIndex)
AcquireNextImage2KHRpublic static int vkAcquireNextImage2KHR(org.lwjgl.vulkan.VkDevice device,
VkAcquireNextImageInfoKHR pAcquireInfo,
java.nio.IntBuffer pImageIndex)
To acquire an available presentable image to use, and retrieve the index of that image, call:
VkResult vkAcquireNextImage2KHR(
VkDevice device,
const VkAcquireNextImageInfoKHR* pAcquireInfo,
uint32_t* pImageIndex);
swapchain member of pAcquireInfo and the value of VkSurfaceCapabilitiesKHR::minImageCount as returned by a call to GetPhysicalDeviceSurfaceCapabilities2KHR with the surface used to create swapchain, the timeout member of pAcquireInfo must not be UINT64_MAXdevice must be a valid VkDevice handlepAcquireInfo must be a valid pointer to a valid VkAcquireNextImageInfoKHR structurepImageIndex must be a valid pointer to a uint32_t valuedevice - the device associated with swapchain.pAcquireInfo - a pointer to a VkAcquireNextImageInfoKHR structure containing parameters of the acquire.pImageIndex - a pointer to a uint32_t that is set to the index of the next image to use.public static int vkCreateSwapchainKHR(org.lwjgl.vulkan.VkDevice device,
VkSwapchainCreateInfoKHR pCreateInfo,
@Nullable
VkAllocationCallbacks pAllocator,
long[] pSwapchain)
CreateSwapchainKHRpublic static int vkGetSwapchainImagesKHR(org.lwjgl.vulkan.VkDevice device,
long swapchain,
int[] pSwapchainImageCount,
@Nullable
long[] pSwapchainImages)
GetSwapchainImagesKHRpublic static int vkAcquireNextImageKHR(org.lwjgl.vulkan.VkDevice device,
long swapchain,
long timeout,
long semaphore,
long fence,
int[] pImageIndex)
AcquireNextImageKHRpublic static int vkGetDeviceGroupSurfacePresentModesKHR(org.lwjgl.vulkan.VkDevice device,
long surface,
int[] pModes)
GetDeviceGroupSurfacePresentModesKHRpublic static int vkGetPhysicalDevicePresentRectanglesKHR(org.lwjgl.vulkan.VkPhysicalDevice physicalDevice,
long surface,
int[] pRectCount,
@Nullable
VkRect2D.Buffer pRects)
GetPhysicalDevicePresentRectanglesKHRpublic static int vkAcquireNextImage2KHR(org.lwjgl.vulkan.VkDevice device,
VkAcquireNextImageInfoKHR pAcquireInfo,
int[] pImageIndex)
AcquireNextImage2KHRCopyright LWJGL. All Rights Reserved. License terms.