org.lwjgl.vulkan.KHRExternalFenceFd 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 java.nio.*;
import org.lwjgl.system.*;
import static org.lwjgl.system.Checks.*;
import static org.lwjgl.system.JNI.*;
import static org.lwjgl.system.MemoryUtil.*;
/**
* An application using external memory may wish to synchronize access to that memory using fences. This extension enables an application to export fence payload to and import fence payload from POSIX file descriptors.
*
*
* - Name String
* - {@code VK_KHR_external_fence_fd}
* - Extension Type
* - Device extension
* - Registered Extension Number
* - 116
* - Revision
* - 1
* - Extension and Version Dependencies
*
* - Requires Vulkan 1.0
* - Requires {@code VK_KHR_external_fence}
*
* - Contact
*
* - Jesse Hall @jessehall
*
* - Last Modified Date
* - 2017-05-08
* - IP Status
* - No known IP claims.
* - Contributors
*
* - Jesse Hall, Google
* - James Jones, NVIDIA
* - Jeff Juliano, NVIDIA
* - Cass Everitt, Oculus
* - Contributors to VK_KHR_external_semaphore_fd
*
*
*/
public class KHRExternalFenceFd {
/** The extension specification version. */
public static final int VK_KHR_EXTERNAL_FENCE_FD_SPEC_VERSION = 1;
/** The extension name. */
public static final String VK_KHR_EXTERNAL_FENCE_FD_EXTENSION_NAME = "VK_KHR_external_fence_fd";
/**
* Extends {@code VkStructureType}.
*
* Enum values:
*
*
* - {@link #VK_STRUCTURE_TYPE_IMPORT_FENCE_FD_INFO_KHR STRUCTURE_TYPE_IMPORT_FENCE_FD_INFO_KHR}
* - {@link #VK_STRUCTURE_TYPE_FENCE_GET_FD_INFO_KHR STRUCTURE_TYPE_FENCE_GET_FD_INFO_KHR}
*
*/
public static final int
VK_STRUCTURE_TYPE_IMPORT_FENCE_FD_INFO_KHR = 1000115000,
VK_STRUCTURE_TYPE_FENCE_GET_FD_INFO_KHR = 1000115001;
protected KHRExternalFenceFd() {
throw new UnsupportedOperationException();
}
static boolean isAvailable(VKCapabilitiesDevice caps) {
return checkFunctions(
caps.vkImportFenceFdKHR, caps.vkGetFenceFdKHR
);
}
// --- [ vkImportFenceFdKHR ] ---
/** Unsafe version of: {@link #vkImportFenceFdKHR ImportFenceFdKHR} */
public static int nvkImportFenceFdKHR(VkDevice device, long pImportFenceFdInfo) {
long __functionAddress = device.getCapabilities().vkImportFenceFdKHR;
if (CHECKS) {
check(__functionAddress);
}
return callPPI(__functionAddress, device.address(), pImportFenceFdInfo);
}
/**
* Import a fence from a POSIX file descriptor.
*
* C Specification
*
* To import a fence payload from a POSIX file descriptor, call:
*
*
* VkResult vkImportFenceFdKHR(
* VkDevice device,
* const VkImportFenceFdInfoKHR* pImportFenceFdInfo);
*
* Description
*
* Importing a fence payload from a file descriptor transfers ownership of the file descriptor from the application to the Vulkan implementation. The application must not perform any operations on the file descriptor after a successful import.
*
* Applications can import the same fence payload into multiple instances of Vulkan, into the same instance from which it was exported, and multiple times into a given Vulkan instance.
*
* Valid Usage
*
*
* - {@code fence} must not be associated with any queue command that has not yet completed execution on that queue
*
*
* Valid Usage (Implicit)
*
*
* - {@code device} must be a valid {@code VkDevice} handle
* - {@code pImportFenceFdInfo} must be a pointer to a valid {@link VkImportFenceFdInfoKHR} structure
*
*
* 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 KHRExternalMemory#VK_ERROR_INVALID_EXTERNAL_HANDLE_KHR ERROR_INVALID_EXTERNAL_HANDLE_KHR}
*
*
*
* See Also
*
* {@link VkImportFenceFdInfoKHR}
*
* @param device the logical device that created the fence.
* @param pImportFenceFdInfo points to a {@link VkImportFenceFdInfoKHR} structure specifying the fence and import parameters.
*/
@NativeType("VkResult")
public static int vkImportFenceFdKHR(VkDevice device, @NativeType("const VkImportFenceFdInfoKHR *") VkImportFenceFdInfoKHR pImportFenceFdInfo) {
return nvkImportFenceFdKHR(device, pImportFenceFdInfo.address());
}
// --- [ vkGetFenceFdKHR ] ---
/** Unsafe version of: {@link #vkGetFenceFdKHR GetFenceFdKHR} */
public static int nvkGetFenceFdKHR(VkDevice device, long pGetFdInfo, long pFd) {
long __functionAddress = device.getCapabilities().vkGetFenceFdKHR;
if (CHECKS) {
check(__functionAddress);
}
return callPPPI(__functionAddress, device.address(), pGetFdInfo, pFd);
}
/**
* Get a POSIX file descriptor handle for a fence.
*
* C Specification
*
* To export a POSIX file descriptor representing the payload of a fence, call:
*
*
* VkResult vkGetFenceFdKHR(
* VkDevice device,
* const VkFenceGetFdInfoKHR* pGetFdInfo,
* int* pFd);
*
* Description
*
* Each call to {@link #vkGetFenceFdKHR GetFenceFdKHR} must create a new file descriptor and transfer ownership of it to the application. To avoid leaking resources, the application must release ownership of the file descriptor when it is no longer needed.
*
* Note
*
* Ownership can be released in many ways. For example, the application can call fname:close() on the file descriptor, or transfer ownership back to Vulkan by using the file descriptor to import a fence payload.
*
*
* If {@code pGetFdInfo}{@code ::handleType} is {@link KHRExternalFenceCapabilities#VK_EXTERNAL_FENCE_HANDLE_TYPE_SYNC_FD_BIT_KHR EXTERNAL_FENCE_HANDLE_TYPE_SYNC_FD_BIT_KHR} and the fence is signaled at the time {@code vkGetFenceFdKHR} is called, {@code pFd} may return the value {@code -1} instead of a valid file descriptor.
*
* Where supported by the operating system, the implementation must set the file descriptor to be closed automatically when an fname:execve system call is made.
*
* Exporting a file descriptor from a fence may have side effects depending on the transference of the specified handle type, as described in Importing Fence State.
*
* Valid Usage (Implicit)
*
*
* - {@code device} must be a valid {@code VkDevice} handle
* - {@code pGetFdInfo} must be a pointer to a valid {@link VkFenceGetFdInfoKHR} structure
* - {@code pFd} must be a pointer to a {@code int} value
*
*
* Return Codes
*
*
* - On success, this command returns
*
* - {@link VK10#VK_SUCCESS SUCCESS}
*
* - On failure, this command returns
*
* - {@link VK10#VK_ERROR_TOO_MANY_OBJECTS ERROR_TOO_MANY_OBJECTS}
* - {@link VK10#VK_ERROR_OUT_OF_HOST_MEMORY ERROR_OUT_OF_HOST_MEMORY}
*
*
*
* See Also
*
* {@link VkFenceGetFdInfoKHR}
*
* @param device the logical device that created the fence being exported.
* @param pGetFdInfo a pointer to an instance of the {@link VkFenceGetFdInfoKHR} structure containing parameters of the export operation.
* @param pFd will return the file descriptor representing the fence payload.
*/
@NativeType("VkResult")
public static int vkGetFenceFdKHR(VkDevice device, @NativeType("const VkFenceGetFdInfoKHR *") VkFenceGetFdInfoKHR pGetFdInfo, @NativeType("int *") IntBuffer pFd) {
if (CHECKS) {
check(pFd, 1);
}
return nvkGetFenceFdKHR(device, pGetFdInfo.address(), memAddress(pFd));
}
/** Array version of: {@link #vkGetFenceFdKHR GetFenceFdKHR} */
@NativeType("VkResult")
public static int vkGetFenceFdKHR(VkDevice device, @NativeType("const VkFenceGetFdInfoKHR *") VkFenceGetFdInfoKHR pGetFdInfo, @NativeType("int *") int[] pFd) {
long __functionAddress = device.getCapabilities().vkGetFenceFdKHR;
if (CHECKS) {
check(__functionAddress);
check(pFd, 1);
}
return callPPPI(__functionAddress, device.address(), pGetFdInfo.address(), pFd);
}
}