
org.lwjgl.openxr.KHRConvertTimespecTime Maven / Gradle / Ivy
Show all versions of lwjgl-openxr Show documentation
/*
* Copyright LWJGL. All rights reserved.
* License terms: https://www.lwjgl.org/license
* MACHINE GENERATED FILE, DO NOT EDIT
*/
package org.lwjgl.openxr;
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.*;
/**
* The XR_KHR_convert_timespec_time extension.
*
* This extension provides two functions for converting between timespec monotonic time and {@code XrTime}. The {@link #xrConvertTimespecTimeToTimeKHR ConvertTimespecTimeToTimeKHR} function converts from timespec time to {@code XrTime}, while the {@link #xrConvertTimeToTimespecTimeKHR ConvertTimeToTimespecTimeKHR} function converts {@code XrTime} to timespec monotonic time. The primary use case for this functionality is to be able to synchronize events between the local system and the OpenXR system.
*/
public class KHRConvertTimespecTime {
/** The extension specification version. */
public static final int XR_KHR_convert_timespec_time_SPEC_VERSION = 1;
/** The extension name. */
public static final String XR_KHR_CONVERT_TIMESPEC_TIME_EXTENSION_NAME = "XR_KHR_convert_timespec_time";
protected KHRConvertTimespecTime() {
throw new UnsupportedOperationException();
}
// --- [ xrConvertTimespecTimeToTimeKHR ] ---
/** Unsafe version of: {@link #xrConvertTimespecTimeToTimeKHR ConvertTimespecTimeToTimeKHR} */
public static int nxrConvertTimespecTimeToTimeKHR(XrInstance instance, long timespecTime, long time) {
long __functionAddress = instance.getCapabilities().xrConvertTimespecTimeToTimeKHR;
if (CHECKS) {
check(__functionAddress);
check(timespecTime);
}
return callPPPI(instance.address(), timespecTime, time, __functionAddress);
}
/**
* Convert timespec monotonic time to XrTime.
*
* C Specification
*
* To convert from timespec monotonic time to {@code XrTime}, call:
*
*
* XrResult xrConvertTimespecTimeToTimeKHR(
* XrInstance instance,
* const struct timespec* timespecTime,
* XrTime* time);
*
* Description
*
* The {@link #xrConvertTimespecTimeToTimeKHR ConvertTimespecTimeToTimeKHR} function converts a time obtained by the {@code clock_gettime} function to the equivalent {@code XrTime}.
*
* If the output {@code time} cannot represent the input {@code timespecTime}, the runtime must return {@link XR10#XR_ERROR_TIME_INVALID ERROR_TIME_INVALID}.
*
* Valid Usage (Implicit)
*
*
* - The {@link KHRConvertTimespecTime XR_KHR_convert_timespec_time} extension must be enabled prior to calling {@link #xrConvertTimespecTimeToTimeKHR ConvertTimespecTimeToTimeKHR}
* - {@code instance} must be a valid {@code XrInstance} handle
* - {@code timespecTime} must be a pointer to a valid {@code timespec} value
* - {@code time} must be a pointer to an {@code XrTime} value
*
*
* Return Codes
*
*
* - On success, this command returns
*
* - {@link XR10#XR_SUCCESS SUCCESS}
*
* - On failure, this command returns
*
* - {@link XR10#XR_ERROR_FUNCTION_UNSUPPORTED ERROR_FUNCTION_UNSUPPORTED}
* - {@link XR10#XR_ERROR_VALIDATION_FAILURE ERROR_VALIDATION_FAILURE}
* - {@link XR10#XR_ERROR_RUNTIME_FAILURE ERROR_RUNTIME_FAILURE}
* - {@link XR10#XR_ERROR_HANDLE_INVALID ERROR_HANDLE_INVALID}
* - {@link XR10#XR_ERROR_INSTANCE_LOST ERROR_INSTANCE_LOST}
* - {@link XR10#XR_ERROR_TIME_INVALID ERROR_TIME_INVALID}
*
*
*
* @param instance an {@code XrInstance} handle previously created with {@link XR10#xrCreateInstance CreateInstance}.
* @param timespecTime a {@code timespec} obtained from {@code clock_gettime} with {@code CLOCK_MONOTONIC}.
* @param time the resulting {@code XrTime} that is equivalent to the {@code timespecTime}.
*/
@NativeType("XrResult")
public static int xrConvertTimespecTimeToTimeKHR(XrInstance instance, @NativeType("struct timespec const *") long timespecTime, @NativeType("XrTime *") LongBuffer time) {
if (CHECKS) {
check(time, 1);
}
return nxrConvertTimespecTimeToTimeKHR(instance, timespecTime, memAddress(time));
}
// --- [ xrConvertTimeToTimespecTimeKHR ] ---
/**
* Convert XrTime to timespec monotonic time.
*
* C Specification
*
* To convert from {@code XrTime} to timespec monotonic time, call:
*
*
* XrResult xrConvertTimeToTimespecTimeKHR(
* XrInstance instance,
* XrTime time,
* struct timespec* timespecTime);
*
* Description
*
* The {@link #xrConvertTimeToTimespecTimeKHR ConvertTimeToTimespecTimeKHR} function converts an {@code XrTime} to time as if generated by {@code clock_gettime}.
*
* If the output {@code timespecTime} cannot represent the input {@code time}, the runtime must return {@link XR10#XR_ERROR_TIME_INVALID ERROR_TIME_INVALID}.
*
* Valid Usage (Implicit)
*
*
* - The {@link KHRConvertTimespecTime XR_KHR_convert_timespec_time} extension must be enabled prior to calling {@link #xrConvertTimeToTimespecTimeKHR ConvertTimeToTimespecTimeKHR}
* - {@code instance} must be a valid {@code XrInstance} handle
* - {@code timespecTime} must be a pointer to a {@code timespec} value
*
*
* Return Codes
*
*
* - On success, this command returns
*
* - {@link XR10#XR_SUCCESS SUCCESS}
*
* - On failure, this command returns
*
* - {@link XR10#XR_ERROR_FUNCTION_UNSUPPORTED ERROR_FUNCTION_UNSUPPORTED}
* - {@link XR10#XR_ERROR_VALIDATION_FAILURE ERROR_VALIDATION_FAILURE}
* - {@link XR10#XR_ERROR_RUNTIME_FAILURE ERROR_RUNTIME_FAILURE}
* - {@link XR10#XR_ERROR_HANDLE_INVALID ERROR_HANDLE_INVALID}
* - {@link XR10#XR_ERROR_INSTANCE_LOST ERROR_INSTANCE_LOST}
* - {@link XR10#XR_ERROR_TIME_INVALID ERROR_TIME_INVALID}
*
*
*
* @param instance an {@code XrInstance} handle previously created with {@link XR10#xrCreateInstance CreateInstance}.
* @param time an {@code XrTime}.
* @param timespecTime the resulting timespec time that is equivalent to a {@code timespec} obtained from {@code clock_gettime} with {@code CLOCK_MONOTONIC}.
*/
@NativeType("XrResult")
public static int xrConvertTimeToTimespecTimeKHR(XrInstance instance, @NativeType("XrTime") long time, @NativeType("struct timespec *") long timespecTime) {
long __functionAddress = instance.getCapabilities().xrConvertTimeToTimespecTimeKHR;
if (CHECKS) {
check(__functionAddress);
check(timespecTime);
}
return callPJPI(instance.address(), time, timespecTime, __functionAddress);
}
}