vkGetFenceWin32HandleKHR(3)

# vkGetFenceWin32HandleKHR(3) Manual Page

## Name

vkGetFenceWin32HandleKHR - Get a Windows HANDLE for a fence

Loading… please wait.

## C Specification

To export a Windows handle representing the state of a fence, call:

    // Provided by VK_KHR_external_fence_win32
    VkResult vkGetFenceWin32HandleKHR(
        VkDevice                                    device,
        const VkFenceGetWin32HandleInfoKHR*         pGetWin32HandleInfo,
        HANDLE*                                     pHandle);

## Parameters

- `device` is the logical device that created the fence being exported.

- `pGetWin32HandleInfo` is a pointer to a VkFenceGetWin32HandleInfoKHR structure containing parameters of the export operation.

- `pHandle` will return the Windows handle representing the fence state.

## Description

For handle types defined as NT handles, the handles returned by `vkGetFenceWin32HandleKHR` are owned by the application. To avoid leaking resources, the application must release ownership of them using the `CloseHandle` system call when they are no longer needed.

Exporting a Windows handle from a fence may have side effects depending on the transference of the specified handle type, as described in Importing Fence Payloads.

Valid Usage (Implicit)

- VUID-vkGetFenceWin32HandleKHR-device-parameter
  `device` must be a valid VkDevice handle

- VUID-vkGetFenceWin32HandleKHR-pGetWin32HandleInfo-parameter
  `pGetWin32HandleInfo` must be a valid pointer to a valid VkFenceGetWin32HandleInfoKHR structure

- VUID-vkGetFenceWin32HandleKHR-pHandle-parameter
  `pHandle` must be a valid pointer to a `HANDLE` value

Return Codes

On success, this command returns

  - VK_SUCCESS

On failure, this command returns

  - VK_ERROR_OUT_OF_HOST_MEMORY

  - VK_ERROR_TOO_MANY_OBJECTS

  - VK_ERROR_UNKNOWN

  - VK_ERROR_VALIDATION_FAILED

## See Also

VK_KHR_external_fence_win32, VkDevice, VkFenceGetWin32HandleInfoKHR

## Document Notes

For more information, see the Vulkan Specification.

This page is extracted from the Vulkan Specification. Fixes and changes should be made to the Specification, not directly.

## Copyright

Copyright 2014-2026 The Khronos Group Inc.

SPDX-License-Identifier: CC-BY-4.0