org.lwjgl.vulkan.KHRExternalSemaphoreWin32 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.*;
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 Windows handles.
*
*
* - Name String
* - {@code VK_KHR_external_semaphore_win32}
* - Extension Type
* - Device extension
* - Registered Extension Number
* - 79
* - 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
*
* - James Jones, NVIDIA
* - Jeff Juliano, NVIDIA
* - Carsten Rohde, NVIDIA
*
*
*/
public class KHRExternalSemaphoreWin32 {
/** The extension specification version. */
public static final int VK_KHR_EXTERNAL_SEMAPHORE_WIN32_SPEC_VERSION = 1;
/** The extension name. */
public static final String VK_KHR_EXTERNAL_SEMAPHORE_WIN32_EXTENSION_NAME = "VK_KHR_external_semaphore_win32";
/**
* Extends {@code VkStructureType}.
*
* Enum values:
*
*
* - {@link #VK_STRUCTURE_TYPE_IMPORT_SEMAPHORE_WIN32_HANDLE_INFO_KHR STRUCTURE_TYPE_IMPORT_SEMAPHORE_WIN32_HANDLE_INFO_KHR}
* - {@link #VK_STRUCTURE_TYPE_EXPORT_SEMAPHORE_WIN32_HANDLE_INFO_KHR STRUCTURE_TYPE_EXPORT_SEMAPHORE_WIN32_HANDLE_INFO_KHR}
* - {@link #VK_STRUCTURE_TYPE_D3D12_FENCE_SUBMIT_INFO_KHR STRUCTURE_TYPE_D3D12_FENCE_SUBMIT_INFO_KHR}
* - {@link #VK_STRUCTURE_TYPE_SEMAPHORE_GET_WIN32_HANDLE_INFO_KHR STRUCTURE_TYPE_SEMAPHORE_GET_WIN32_HANDLE_INFO_KHR}
*
*/
public static final int
VK_STRUCTURE_TYPE_IMPORT_SEMAPHORE_WIN32_HANDLE_INFO_KHR = 1000078000,
VK_STRUCTURE_TYPE_EXPORT_SEMAPHORE_WIN32_HANDLE_INFO_KHR = 1000078001,
VK_STRUCTURE_TYPE_D3D12_FENCE_SUBMIT_INFO_KHR = 1000078002,
VK_STRUCTURE_TYPE_SEMAPHORE_GET_WIN32_HANDLE_INFO_KHR = 1000078003;
protected KHRExternalSemaphoreWin32() {
throw new UnsupportedOperationException();
}
static boolean isAvailable(VKCapabilitiesDevice caps) {
return checkFunctions(
caps.vkImportSemaphoreWin32HandleKHR, caps.vkGetSemaphoreWin32HandleKHR
);
}
// --- [ vkImportSemaphoreWin32HandleKHR ] ---
/** Unsafe version of: {@link #vkImportSemaphoreWin32HandleKHR ImportSemaphoreWin32HandleKHR} */
public static int nvkImportSemaphoreWin32HandleKHR(VkDevice device, long pImportSemaphoreWin32HandleInfo) {
long __functionAddress = device.getCapabilities().vkImportSemaphoreWin32HandleKHR;
if (CHECKS) {
check(__functionAddress);
VkImportSemaphoreWin32HandleInfoKHR.validate(pImportSemaphoreWin32HandleInfo);
}
return callPPI(__functionAddress, device.address(), pImportSemaphoreWin32HandleInfo);
}
/**
* Import a semaphore from a Windows HANDLE.
*
* C Specification
*
* To import a semaphore payload from a Windows handle, call:
*
*
* VkResult vkImportSemaphoreWin32HandleKHR(
* VkDevice device,
* const VkImportSemaphoreWin32HandleInfoKHR* pImportSemaphoreWin32HandleInfo);
*
* Description
*
* Importing a semaphore payload from Windows handles does not transfer ownership of the handle to the Vulkan implementation. For handle types defined as NT handles, the application must release ownership using the fname:CloseHandle system call when the handle is no longer needed.
*
* 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 (Implicit)
*
*
* - {@code device} must be a valid {@code VkDevice} handle
* - {@code pImportSemaphoreWin32HandleInfo} must be a pointer to a valid {@link VkImportSemaphoreWin32HandleInfoKHR} 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 VkImportSemaphoreWin32HandleInfoKHR}
*
* @param device the logical device that created the semaphore.
* @param pImportSemaphoreWin32HandleInfo points to a {@link VkImportSemaphoreWin32HandleInfoKHR} structure specifying the semaphore and import parameters.
*/
@NativeType("VkResult")
public static int vkImportSemaphoreWin32HandleKHR(VkDevice device, @NativeType("const VkImportSemaphoreWin32HandleInfoKHR *") VkImportSemaphoreWin32HandleInfoKHR pImportSemaphoreWin32HandleInfo) {
return nvkImportSemaphoreWin32HandleKHR(device, pImportSemaphoreWin32HandleInfo.address());
}
// --- [ vkGetSemaphoreWin32HandleKHR ] ---
/** Unsafe version of: {@link #vkGetSemaphoreWin32HandleKHR GetSemaphoreWin32HandleKHR} */
public static int nvkGetSemaphoreWin32HandleKHR(VkDevice device, long pGetWin32HandleInfo, long pHandle) {
long __functionAddress = device.getCapabilities().vkGetSemaphoreWin32HandleKHR;
if (CHECKS) {
check(__functionAddress);
}
return callPPPI(__functionAddress, device.address(), pGetWin32HandleInfo, pHandle);
}
/**
* Get a Windows HANDLE for a semaphore.
*
* C Specification
*
* To export a Windows handle representing the payload of a semaphore, call:
*
*
* VkResult vkGetSemaphoreWin32HandleKHR(
* VkDevice device,
* const VkSemaphoreGetWin32HandleInfoKHR* pGetWin32HandleInfo,
* HANDLE* pHandle);
*
* Description
*
* For handle types defined as NT handles, the handles returned by {@link #vkGetSemaphoreWin32HandleKHR GetSemaphoreWin32HandleKHR} are owned by the application. To avoid leaking resources, the application must release ownership of them using the fname:CloseHandle system call when they are no longer needed.
*
* Exporting a Windows handle from a semaphore may have side effects depending on the transference of the specified handle type, as described in Importing Semaphore Payloads.
*
* Valid Usage (Implicit)
*
*
* - {@code device} must be a valid {@code VkDevice} handle
* - {@code pGetWin32HandleInfo} must be a pointer to a valid {@link VkSemaphoreGetWin32HandleInfoKHR} structure
* - {@code pHandle} must be a pointer to a {@code HANDLE} 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 VkSemaphoreGetWin32HandleInfoKHR}
*
* @param device the logical device that created the semaphore being exported.
* @param pGetWin32HandleInfo a pointer to an instance of the {@link VkSemaphoreGetWin32HandleInfoKHR} structure containing parameters of the export operation.
* @param pHandle will return the Windows handle representing the semaphore state.
*/
@NativeType("VkResult")
public static int vkGetSemaphoreWin32HandleKHR(VkDevice device, @NativeType("const VkSemaphoreGetWin32HandleInfoKHR *") VkSemaphoreGetWin32HandleInfoKHR pGetWin32HandleInfo, @NativeType("HANDLE *") PointerBuffer pHandle) {
if (CHECKS) {
check(pHandle, 1);
}
return nvkGetSemaphoreWin32HandleKHR(device, pGetWin32HandleInfo.address(), memAddress(pHandle));
}
}