org.lwjgl.vulkan.KHRExternalSemaphoreFd 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 semaphores. This extension enables an application to export semaphore payload to and import semaphore payload from POSIX file descriptors.
*
*
* - Name String
* - {@code VK_KHR_external_semaphore_fd}
* - Extension Type
* - Device extension
* - Registered Extension Number
* - 80
* - Revision
* - 1
* - Extension and Version Dependencies
*
* - Requires Vulkan 1.0
* - Requires {@code VK_KHR_external_semaphore}
*
* - Contact
*
* - James Jones @cubanismo
*
* - Last Modified Date
* - 2016-10-21
* - IP Status
* - No known IP claims.
* - Contributors
*
* - Jesse Hall, Google
* - James Jones, NVIDIA
* - Jeff Juliano, NVIDIA
* - Carsten Rohde, NVIDIA
*
*
*/
public class KHRExternalSemaphoreFd {
/** The extension specification version. */
public static final int VK_KHR_EXTERNAL_SEMAPHORE_FD_SPEC_VERSION = 1;
/** The extension name. */
public static final String VK_KHR_EXTERNAL_SEMAPHORE_FD_EXTENSION_NAME = "VK_KHR_external_semaphore_fd";
/**
* Extends {@code VkStructureType}.
*
* Enum values:
*
*
* - {@link #VK_STRUCTURE_TYPE_IMPORT_SEMAPHORE_FD_INFO_KHR STRUCTURE_TYPE_IMPORT_SEMAPHORE_FD_INFO_KHR}
* - {@link #VK_STRUCTURE_TYPE_SEMAPHORE_GET_FD_INFO_KHR STRUCTURE_TYPE_SEMAPHORE_GET_FD_INFO_KHR}
*
*/
public static final int
VK_STRUCTURE_TYPE_IMPORT_SEMAPHORE_FD_INFO_KHR = 1000079000,
VK_STRUCTURE_TYPE_SEMAPHORE_GET_FD_INFO_KHR = 1000079001;
protected KHRExternalSemaphoreFd() {
throw new UnsupportedOperationException();
}
static boolean isAvailable(VKCapabilitiesDevice caps) {
return checkFunctions(
caps.vkImportSemaphoreFdKHR, caps.vkGetSemaphoreFdKHR
);
}
// --- [ vkImportSemaphoreFdKHR ] ---
/** Unsafe version of: {@link #vkImportSemaphoreFdKHR ImportSemaphoreFdKHR} */
public static int nvkImportSemaphoreFdKHR(VkDevice device, long pImportSemaphoreFdInfo) {
long __functionAddress = device.getCapabilities().vkImportSemaphoreFdKHR;
if (CHECKS) {
check(__functionAddress);
}
return callPPI(__functionAddress, device.address(), pImportSemaphoreFdInfo);
}
/**
* Import a semaphore from a POSIX file descriptor.
*
* C Specification
*
* To import a semaphore payload from a POSIX file descriptor, call:
*
*
* VkResult vkImportSemaphoreFdKHR(
* VkDevice device,
* const VkImportSemaphoreFdInfoKHR* pImportSemaphoreFdInfo);
*
* Description
*
* Importing a semaphore 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 semaphore 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 semaphore} 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 pImportSemaphoreFdInfo} must be a pointer to a valid {@link VkImportSemaphoreFdInfoKHR} 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 VkImportSemaphoreFdInfoKHR}
*
* @param device the logical device that created the semaphore.
* @param pImportSemaphoreFdInfo points to a {@link VkImportSemaphoreFdInfoKHR} structure specifying the semaphore and import parameters.
*/
@NativeType("VkResult")
public static int vkImportSemaphoreFdKHR(VkDevice device, @NativeType("const VkImportSemaphoreFdInfoKHR *") VkImportSemaphoreFdInfoKHR pImportSemaphoreFdInfo) {
return nvkImportSemaphoreFdKHR(device, pImportSemaphoreFdInfo.address());
}
// --- [ vkGetSemaphoreFdKHR ] ---
/** Unsafe version of: {@link #vkGetSemaphoreFdKHR GetSemaphoreFdKHR} */
public static int nvkGetSemaphoreFdKHR(VkDevice device, long pGetFdInfo, long pFd) {
long __functionAddress = device.getCapabilities().vkGetSemaphoreFdKHR;
if (CHECKS) {
check(__functionAddress);
}
return callPPPI(__functionAddress, device.address(), pGetFdInfo, pFd);
}
/**
* Get a POSIX file descriptor handle for a semaphore.
*
* C Specification
*
* To export a POSIX file descriptor representing the payload of a semaphore, call:
*
*
* VkResult vkGetSemaphoreFdKHR(
* VkDevice device,
* const VkSemaphoreGetFdInfoKHR* pGetFdInfo,
* int* pFd);
*
* Description
*
* Each call to {@link #vkGetSemaphoreFdKHR GetSemaphoreFdKHR} 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 semaphore payload.
*
*
* 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 semaphore may have side effects depending on the transference of the specified handle type, as described in Importing Semaphore State.
*
* Valid Usage (Implicit)
*
*
* - {@code device} must be a valid {@code VkDevice} handle
* - {@code pGetFdInfo} must be a pointer to a valid {@link VkSemaphoreGetFdInfoKHR} 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 VkSemaphoreGetFdInfoKHR}
*
* @param device the logical device that created the semaphore being exported.
* @param pGetFdInfo a pointer to an instance of the {@link VkSemaphoreGetFdInfoKHR} structure containing parameters of the export operation.
* @param pFd will return the file descriptor representing the semaphore payload.
*/
@NativeType("VkResult")
public static int vkGetSemaphoreFdKHR(VkDevice device, @NativeType("const VkSemaphoreGetFdInfoKHR *") VkSemaphoreGetFdInfoKHR pGetFdInfo, @NativeType("int *") IntBuffer pFd) {
if (CHECKS) {
check(pFd, 1);
}
return nvkGetSemaphoreFdKHR(device, pGetFdInfo.address(), memAddress(pFd));
}
/** Array version of: {@link #vkGetSemaphoreFdKHR GetSemaphoreFdKHR} */
@NativeType("VkResult")
public static int vkGetSemaphoreFdKHR(VkDevice device, @NativeType("const VkSemaphoreGetFdInfoKHR *") VkSemaphoreGetFdInfoKHR pGetFdInfo, @NativeType("int *") int[] pFd) {
long __functionAddress = device.getCapabilities().vkGetSemaphoreFdKHR;
if (CHECKS) {
check(__functionAddress);
check(pFd, 1);
}
return callPPPI(__functionAddress, device.address(), pGetFdInfo.address(), pFd);
}
}