org.lwjgl.vulkan.KHRPresentWait Maven / Gradle / Ivy
Show all versions of lwjgl-vulkan Show documentation
/*
* Copyright LWJGL. All rights reserved.
* License terms: https://www.lwjgl.org/license
* MACHINE GENERATED FILE, DO NOT EDIT
*/
package org.lwjgl.vulkan;
import org.lwjgl.system.*;
import static org.lwjgl.system.Checks.*;
import static org.lwjgl.system.JNI.*;
/**
* This device extension allows an application that uses the {@link KHRSwapchain VK_KHR_swapchain} extension to wait for present operations to complete. An application can use this to monitor and control the pacing of the application by managing the number of outstanding images yet to be presented.
*
* VK_KHR_present_wait
*
*
* - Name String
* - {@code VK_KHR_present_wait}
* - Extension Type
* - Device extension
* - Registered Extension Number
* - 249
* - Revision
* - 1
* - Extension and Version Dependencies
*
* - Requires Vulkan 1.0
* - Requires {@link KHRSwapchain VK_KHR_swapchain}
* - Requires {@link KHRPresentId VK_KHR_present_id}
*
* - Contact
*
* - Keith Packard keithp
*
*
*
* Other Extension Metadata
*
*
* - Last Modified Date
* - 2019-05-15
* - IP Status
* - No known IP claims.
* - Contributors
*
* - Keith Packard, Valve
* - Ian Elliott, Google
* - Tobias Hector, AMD
* - Daniel Stone, Collabora
*
*
*/
public class KHRPresentWait {
/** The extension specification version. */
public static final int VK_KHR_PRESENT_WAIT_SPEC_VERSION = 1;
/** The extension name. */
public static final String VK_KHR_PRESENT_WAIT_EXTENSION_NAME = "VK_KHR_present_wait";
/** Extends {@code VkStructureType}. */
public static final int VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PRESENT_WAIT_FEATURES_KHR = 1000248000;
protected KHRPresentWait() {
throw new UnsupportedOperationException();
}
// --- [ vkWaitForPresentKHR ] ---
/**
* Wait for presentation.
*
* C Specification
*
* When the {@code presentWait} feature is enabled, an application can wait for an image to be presented to the user by first specifying a presentId for the target presentation by adding a {@link VkPresentIdKHR} structure to the {@code pNext} chain of the {@link VkPresentInfoKHR} structure and then waiting for that presentation to complete by calling:
*
*
* VkResult vkWaitForPresentKHR(
* VkDevice device,
* VkSwapchainKHR swapchain,
* uint64_t presentId,
* uint64_t timeout);
*
* Description
*
* {@code vkWaitForPresentKHR} waits for the presentId associated with {@code swapchain} to be increased in value so that it is at least equal to {@code presentId}.
*
* For {@link KHRSurface#VK_PRESENT_MODE_MAILBOX_KHR PRESENT_MODE_MAILBOX_KHR} (or other present mode where images may be replaced in the presentation queue) any wait of this type associated with such an image must be signaled no later than a wait associated with the replacing image would be signaled.
*
* When the presentation has completed, the presentId associated with the related {@code pSwapchains} entry will be increased in value so that it is at least equal to the value provided in the {@link VkPresentIdKHR} structure.
*
* There is no requirement for any precise timing relationship between the presentation of the image to the user and the update of the presentId value, but implementations should make this as close as possible to the presentation of the first pixel in the new image to the user.
*
* The call to {@code vkWaitForPresentKHR} will block until either the presentId associated with {@code swapchain} is greater than or equal to {@code presentId}, or {@code timeout} nanoseconds passes. When the swapchain becomes OUT_OF_DATE, the call will either return {@link VK10#VK_SUCCESS SUCCESS} (if the image was delivered to the presentation engine and may have been presented to the user) or will return early with status {@link KHRSwapchain#VK_ERROR_OUT_OF_DATE_KHR ERROR_OUT_OF_DATE_KHR} (if the image was not presented to the user).
*
* As an exception to the normal rules for objects which are externally synchronized, the {@code swapchain} passed to {@code vkWaitForPresentKHR} may be simultaneously used by other threads in calls to functions other than {@link KHRSwapchain#vkDestroySwapchainKHR DestroySwapchainKHR}. Access to the swapchain data associated with this extension must be atomic within the implementation.
*
* Valid Usage
*
*
* - {@code swapchain} must not be in the retired state
* - The {@code presentWait} feature must be enabled
*
*
* Valid Usage (Implicit)
*
*
* - {@code device} must be a valid {@code VkDevice} handle
* - {@code swapchain} must be a valid {@code VkSwapchainKHR} handle
* - Both of {@code device}, and {@code swapchain} must have been created, allocated, or retrieved from the same {@code VkInstance}
*
*
* Host Synchronization
*
*
* - Host access to {@code swapchain} must be externally synchronized
*
*
* Return Codes
*
*
* - On success, this command returns
*
* - {@link VK10#VK_SUCCESS SUCCESS}
* - {@link VK10#VK_TIMEOUT TIMEOUT}
*
* - On failure, this command returns
*
* - {@link VK10#VK_ERROR_OUT_OF_HOST_MEMORY ERROR_OUT_OF_HOST_MEMORY}
* - {@link VK10#VK_ERROR_OUT_OF_DEVICE_MEMORY ERROR_OUT_OF_DEVICE_MEMORY}
* - {@link VK10#VK_ERROR_DEVICE_LOST ERROR_DEVICE_LOST}
*
*
*
* @param device the device associated with {@code swapchain}.
* @param swapchain the non-retired swapchain on which an image was queued for presentation.
* @param presentId the presentation presentId to wait for.
* @param timeout the timeout period in units of nanoseconds. {@code timeout} is adjusted to the closest value allowed by the implementation-dependent timeout accuracy, which may be substantially longer than one nanosecond, and may be longer than the requested period.
*/
@NativeType("VkResult")
public static int vkWaitForPresentKHR(VkDevice device, @NativeType("VkSwapchainKHR") long swapchain, @NativeType("uint64_t") long presentId, @NativeType("uint64_t") long timeout) {
long __functionAddress = device.getCapabilities().vkWaitForPresentKHR;
if (CHECKS) {
check(__functionAddress);
}
return callPJJJI(device.address(), swapchain, presentId, timeout, __functionAddress);
}
}