// Copyright (c) 2018-2020 NVIDIA Corporation
//
// SPDX-License-Identifier: CC-BY-4.0

[open,refpage='VkImportMemoryWin32HandleInfoNV',desc='import Win32 memory created on the same physical device',type='structs']
--
To import memory created on the same physical device but outside of the
current Vulkan instance, add a slink:VkImportMemoryWin32HandleInfoNV
structure to the pname:pNext chain of the slink:VkMemoryAllocateInfo
structure, specifying a handle to and the type of the memory.

The sname:VkImportMemoryWin32HandleInfoNV structure is defined as:

include::{generated}/api/structs/VkImportMemoryWin32HandleInfoNV.txt[]

  * pname:sType is the type of this structure.
  * pname:pNext is `NULL` or a pointer to a structure extending this
    structure.
  * pname:handleType is `0` or a elink:VkExternalMemoryHandleTypeFlagBitsNV
    value specifying the type of memory handle in pname:handle.
  * pname:handle is a Windows code:HANDLE referring to the memory.

If pname:handleType is `0`, this structure is ignored by consumers of the
slink:VkMemoryAllocateInfo structure it is chained from.

.Valid Usage
****
  * [[VUID-VkImportMemoryWin32HandleInfoNV-handleType-01327]]
    pname:handleType must: not have more than one bit set
  * [[VUID-VkImportMemoryWin32HandleInfoNV-handle-01328]]
    pname:handle must: be a valid handle to memory, obtained as specified by
    pname:handleType
****

include::{generated}/validity/structs/VkImportMemoryWin32HandleInfoNV.txt[]
--
Bits which can: be set in pname:handleType are:

[open,refpage='VkExternalMemoryHandleTypeFlagBitsNV',desc='Bitmask specifying external memory handle types',type='enums']
--
Possible values of slink:VkImportMemoryWin32HandleInfoNV::pname:handleType,
specifying the type of an external memory handle, are:

include::{generated}/api/enums/VkExternalMemoryHandleTypeFlagBitsNV.txt[]

  * ename:VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_KMT_BIT_NV specifies a
    handle to memory returned by flink:vkGetMemoryWin32HandleNV.
  * ename:VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_BIT_NV specifies a
    handle to memory returned by flink:vkGetMemoryWin32HandleNV, or one
    duplicated from such a handle using `DuplicateHandle()`.
  * ename:VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_IMAGE_BIT_NV specifies a
    valid NT handle to memory returned by
    `IDXGIResource1::CreateSharedHandle`, or a handle duplicated from such a
    handle using `DuplicateHandle()`.
  * ename:VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_IMAGE_KMT_BIT_NV specifies a
    handle to memory returned by `IDXGIResource::GetSharedHandle()`.

ifdef::editing-notes[]
[NOTE]
.editing-note
====
(Jon) If additional (non-Win32) bits are added to the possible memory types,
this type should move to the `<<VK_NV_external_memory_capabilities>>`
section, and each bit would then be protected by ifdefs for the extension it
is defined by.
====
endif::editing-notes[]
--

[open,refpage='VkExternalMemoryHandleTypeFlagsNV',desc='Bitmask of VkExternalMemoryHandleTypeFlagBitsNV',type='flags']
--
include::{generated}/api/flags/VkExternalMemoryHandleTypeFlagsNV.txt[]

tname:VkExternalMemoryHandleTypeFlagsNV is a bitmask type for setting a mask
of zero or more elink:VkExternalMemoryHandleTypeFlagBitsNV.
--

