org.lwjgl.vulkan.EXTCalibratedTimestamps 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 javax.annotation.*;
import java.nio.*;
import org.lwjgl.system.*;
import static org.lwjgl.system.Checks.*;
import static org.lwjgl.system.JNI.*;
import static org.lwjgl.system.MemoryUtil.*;
/**
* This extension provides an interface to query calibrated timestamps obtained quasi simultaneously from two time domains.
*
* VK_EXT_calibrated_timestamps
*
*
* - Name String
* - {@code VK_EXT_calibrated_timestamps}
* - Extension Type
* - Device extension
* - Registered Extension Number
* - 185
* - Revision
* - 2
* - Extension and Version Dependencies
*
* - Requires Vulkan 1.0
* - Requires {@link KHRGetPhysicalDeviceProperties2 VK_KHR_get_physical_device_properties2}
*
* - Contact
*
* - Daniel Rakos drakos-amd
*
*
*
* Other Extension Metadata
*
*
* - Last Modified Date
* - 2018-10-04
* - IP Status
* - No known IP claims.
* - Contributors
*
* - Matthaeus G. Chajdas, AMD
* - Alan Harrison, AMD
* - Derrick Owens, AMD
* - Daniel Rakos, AMD
* - Jason Ekstrand, Intel
* - Keith Packard, Valve
*
*
*/
public class EXTCalibratedTimestamps {
/** The extension specification version. */
public static final int VK_EXT_CALIBRATED_TIMESTAMPS_SPEC_VERSION = 2;
/** The extension name. */
public static final String VK_EXT_CALIBRATED_TIMESTAMPS_EXTENSION_NAME = "VK_EXT_calibrated_timestamps";
/** Extends {@code VkStructureType}. */
public static final int VK_STRUCTURE_TYPE_CALIBRATED_TIMESTAMP_INFO_EXT = 1000184000;
/**
* VkTimeDomainEXT - Supported time domains
*
* Description
*
*
* - {@link #VK_TIME_DOMAIN_DEVICE_EXT TIME_DOMAIN_DEVICE_EXT} specifies the device time domain. Timestamp values in this time domain use the same units and are comparable with device timestamp values captured using {@link VK10#vkCmdWriteTimestamp CmdWriteTimestamp} or {@link KHRSynchronization2#vkCmdWriteTimestamp2KHR CmdWriteTimestamp2KHR} and are defined to be incrementing according to the timestampPeriod of the device.
* - {@link #VK_TIME_DOMAIN_CLOCK_MONOTONIC_EXT TIME_DOMAIN_CLOCK_MONOTONIC_EXT} specifies the CLOCK_MONOTONIC time domain available on POSIX platforms. Timestamp values in this time domain are in units of nanoseconds and are comparable with platform timestamp values captured using the POSIX clock_gettime API as computed by this example:
*
*
* Note
*
* An implementation supporting {@link EXTCalibratedTimestamps VK_EXT_calibrated_timestamps} will use the same time domain for all its {@code VkQueue} so that timestamp values reported for {@link #VK_TIME_DOMAIN_DEVICE_EXT TIME_DOMAIN_DEVICE_EXT} can be matched to any timestamp captured through {@link VK10#vkCmdWriteTimestamp CmdWriteTimestamp} or {@link KHRSynchronization2#vkCmdWriteTimestamp2KHR CmdWriteTimestamp2KHR} .
*
*
*
* struct timespec tv;
* clock_gettime(CLOCK_MONOTONIC, &tv);
* return tv.tv_nsec + tv.tv_sec*1000000000ull;
*
*
* - {@link #VK_TIME_DOMAIN_CLOCK_MONOTONIC_RAW_EXT TIME_DOMAIN_CLOCK_MONOTONIC_RAW_EXT} specifies the CLOCK_MONOTONIC_RAW time domain available on POSIX platforms. Timestamp values in this time domain are in units of nanoseconds and are comparable with platform timestamp values captured using the POSIX clock_gettime API as computed by this example:
*
*
*
* struct timespec tv;
* clock_gettime(CLOCK_MONOTONIC_RAW, &tv);
* return tv.tv_nsec + tv.tv_sec*1000000000ull;
*
*
* - {@link #VK_TIME_DOMAIN_QUERY_PERFORMANCE_COUNTER_EXT TIME_DOMAIN_QUERY_PERFORMANCE_COUNTER_EXT} specifies the performance counter (QPC) time domain available on Windows. Timestamp values in this time domain are in the same units as those provided by the Windows QueryPerformanceCounter API and are comparable with platform timestamp values captured using that API as computed by this example:
*
*
*
* LARGE_INTEGER counter;
* QueryPerformanceCounter(&counter);
* return counter.QuadPart;
*
* See Also
*
* {@link VkCalibratedTimestampInfoEXT}, {@link #vkGetPhysicalDeviceCalibrateableTimeDomainsEXT GetPhysicalDeviceCalibrateableTimeDomainsEXT}
*/
public static final int
VK_TIME_DOMAIN_DEVICE_EXT = 0,
VK_TIME_DOMAIN_CLOCK_MONOTONIC_EXT = 1,
VK_TIME_DOMAIN_CLOCK_MONOTONIC_RAW_EXT = 2,
VK_TIME_DOMAIN_QUERY_PERFORMANCE_COUNTER_EXT = 3;
protected EXTCalibratedTimestamps() {
throw new UnsupportedOperationException();
}
// --- [ vkGetPhysicalDeviceCalibrateableTimeDomainsEXT ] ---
/**
* Unsafe version of: {@link #vkGetPhysicalDeviceCalibrateableTimeDomainsEXT GetPhysicalDeviceCalibrateableTimeDomainsEXT}
*
* @param pTimeDomainCount a pointer to an integer related to the number of calibrateable time domains available or queried, as described below.
*/
public static int nvkGetPhysicalDeviceCalibrateableTimeDomainsEXT(VkPhysicalDevice physicalDevice, long pTimeDomainCount, long pTimeDomains) {
long __functionAddress = physicalDevice.getCapabilities().vkGetPhysicalDeviceCalibrateableTimeDomainsEXT;
if (CHECKS) {
check(__functionAddress);
}
return callPPPI(physicalDevice.address(), pTimeDomainCount, pTimeDomains, __functionAddress);
}
/**
* Query calibrateable time domains.
*
* C Specification
*
* To query the set of time domains for which a physical device supports timestamp calibration, call:
*
*
* VkResult vkGetPhysicalDeviceCalibrateableTimeDomainsEXT(
* VkPhysicalDevice physicalDevice,
* uint32_t* pTimeDomainCount,
* VkTimeDomainEXT* pTimeDomains);
*
* Description
*
* If {@code pTimeDomains} is {@code NULL}, then the number of calibrateable time domains supported for the given {@code physicalDevice} is returned in {@code pTimeDomainCount}. Otherwise, {@code pTimeDomainCount} must point to a variable set by the user to the number of elements in the {@code pTimeDomains} array, and on return the variable is overwritten with the number of values actually written to {@code pTimeDomains}. If the value of {@code pTimeDomainCount} is less than the number of calibrateable time domains supported, at most {@code pTimeDomainCount} values will be written to {@code pTimeDomains}, and {@link VK10#VK_INCOMPLETE INCOMPLETE} will be returned instead of {@link VK10#VK_SUCCESS SUCCESS}, to indicate that not all the available time domains were returned.
*
* Valid Usage (Implicit)
*
*
* - {@code physicalDevice} must be a valid {@code VkPhysicalDevice} handle
* - {@code pTimeDomainCount} must be a valid pointer to a {@code uint32_t} value
* - If the value referenced by {@code pTimeDomainCount} is not 0, and {@code pTimeDomains} is not {@code NULL}, {@code pTimeDomains} must be a valid pointer to an array of {@code pTimeDomainCount} {@code VkTimeDomainEXT} values
*
*
* Return Codes
*
*
* - On success, this command returns
*
* - {@link VK10#VK_SUCCESS SUCCESS}
* - {@link VK10#VK_INCOMPLETE INCOMPLETE}
*
* - 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}
*
*
*
* @param physicalDevice the physical device from which to query the set of calibrateable time domains.
* @param pTimeDomainCount a pointer to an integer related to the number of calibrateable time domains available or queried, as described below.
* @param pTimeDomains either {@code NULL} or a pointer to an array of {@code VkTimeDomainEXT} values, indicating the supported calibrateable time domains.
*/
@NativeType("VkResult")
public static int vkGetPhysicalDeviceCalibrateableTimeDomainsEXT(VkPhysicalDevice physicalDevice, @NativeType("uint32_t *") IntBuffer pTimeDomainCount, @Nullable @NativeType("VkTimeDomainEXT *") IntBuffer pTimeDomains) {
if (CHECKS) {
check(pTimeDomainCount, 1);
checkSafe(pTimeDomains, pTimeDomainCount.get(pTimeDomainCount.position()));
}
return nvkGetPhysicalDeviceCalibrateableTimeDomainsEXT(physicalDevice, memAddress(pTimeDomainCount), memAddressSafe(pTimeDomains));
}
// --- [ vkGetCalibratedTimestampsEXT ] ---
/**
* Unsafe version of: {@link #vkGetCalibratedTimestampsEXT GetCalibratedTimestampsEXT}
*
* @param timestampCount the number of timestamps to query.
*/
public static int nvkGetCalibratedTimestampsEXT(VkDevice device, int timestampCount, long pTimestampInfos, long pTimestamps, long pMaxDeviation) {
long __functionAddress = device.getCapabilities().vkGetCalibratedTimestampsEXT;
if (CHECKS) {
check(__functionAddress);
}
return callPPPPI(device.address(), timestampCount, pTimestampInfos, pTimestamps, pMaxDeviation, __functionAddress);
}
/**
* Query calibrated timestamps.
*
* C Specification
*
* In order to be able to correlate the time a particular operation took place at on timelines of different time domains (e.g. a device operation vs a host operation), Vulkan allows querying calibrated timestamps from multiple time domains.
*
* To query calibrated timestamps from a set of time domains, call:
*
*
* VkResult vkGetCalibratedTimestampsEXT(
* VkDevice device,
* uint32_t timestampCount,
* const VkCalibratedTimestampInfoEXT* pTimestampInfos,
* uint64_t* pTimestamps,
* uint64_t* pMaxDeviation);
*
* Description
*
* Note
*
* The maximum deviation may vary between calls to {@code vkGetCalibratedTimestampsEXT} even for the same set of time domains due to implementation and platform specific reasons. It is the application’s responsibility to assess whether the returned maximum deviation makes the timestamp values suitable for any particular purpose and can choose to re-issue the timestamp calibration call pursuing a lower devation value.
*
*
* Calibrated timestamp values can be extrapolated to estimate future coinciding timestamp values, however, depending on the nature of the time domains and other properties of the platform extrapolating values over a sufficiently long period of time may no longer be accurate enough to fit any particular purpose, so applications are expected to re-calibrate the timestamps on a regular basis.
*
* Valid Usage (Implicit)
*
*
* - {@code device} must be a valid {@code VkDevice} handle
* - {@code pTimestampInfos} must be a valid pointer to an array of {@code timestampCount} valid {@link VkCalibratedTimestampInfoEXT} structures
* - {@code pTimestamps} must be a valid pointer to an array of {@code timestampCount} {@code uint64_t} values
* - {@code pMaxDeviation} must be a valid pointer to a {@code uint64_t} value
* - {@code timestampCount} must be greater than 0
*
*
* Return Codes
*
*
* - On success, this command returns
*
* - {@link VK10#VK_SUCCESS SUCCESS}
*
* - 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}
*
*
*
* See Also
*
* {@link VkCalibratedTimestampInfoEXT}
*
* @param device the logical device used to perform the query.
* @param pTimestampInfos a pointer to an array of {@code timestampCount} {@link VkCalibratedTimestampInfoEXT} structures, describing the time domains the calibrated timestamps should be captured from.
* @param pTimestamps a pointer to an array of {@code timestampCount} 64-bit unsigned integer values in which the requested calibrated timestamp values are returned.
* @param pMaxDeviation a pointer to a 64-bit unsigned integer value in which the strictly positive maximum deviation, in nanoseconds, of the calibrated timestamp values is returned.
*/
@NativeType("VkResult")
public static int vkGetCalibratedTimestampsEXT(VkDevice device, @NativeType("VkCalibratedTimestampInfoEXT const *") VkCalibratedTimestampInfoEXT.Buffer pTimestampInfos, @NativeType("uint64_t *") LongBuffer pTimestamps, @NativeType("uint64_t *") LongBuffer pMaxDeviation) {
if (CHECKS) {
check(pTimestamps, pTimestampInfos.remaining());
check(pMaxDeviation, 1);
}
return nvkGetCalibratedTimestampsEXT(device, pTimestampInfos.remaining(), pTimestampInfos.address(), memAddress(pTimestamps), memAddress(pMaxDeviation));
}
/** Array version of: {@link #vkGetPhysicalDeviceCalibrateableTimeDomainsEXT GetPhysicalDeviceCalibrateableTimeDomainsEXT} */
@NativeType("VkResult")
public static int vkGetPhysicalDeviceCalibrateableTimeDomainsEXT(VkPhysicalDevice physicalDevice, @NativeType("uint32_t *") int[] pTimeDomainCount, @Nullable @NativeType("VkTimeDomainEXT *") int[] pTimeDomains) {
long __functionAddress = physicalDevice.getCapabilities().vkGetPhysicalDeviceCalibrateableTimeDomainsEXT;
if (CHECKS) {
check(__functionAddress);
check(pTimeDomainCount, 1);
checkSafe(pTimeDomains, pTimeDomainCount[0]);
}
return callPPPI(physicalDevice.address(), pTimeDomainCount, pTimeDomains, __functionAddress);
}
/** Array version of: {@link #vkGetCalibratedTimestampsEXT GetCalibratedTimestampsEXT} */
@NativeType("VkResult")
public static int vkGetCalibratedTimestampsEXT(VkDevice device, @NativeType("VkCalibratedTimestampInfoEXT const *") VkCalibratedTimestampInfoEXT.Buffer pTimestampInfos, @NativeType("uint64_t *") long[] pTimestamps, @NativeType("uint64_t *") long[] pMaxDeviation) {
long __functionAddress = device.getCapabilities().vkGetCalibratedTimestampsEXT;
if (CHECKS) {
check(__functionAddress);
check(pTimestamps, pTimestampInfos.remaining());
check(pMaxDeviation, 1);
}
return callPPPPI(device.address(), pTimestampInfos.remaining(), pTimestampInfos.address(), pTimestamps, pMaxDeviation, __functionAddress);
}
}