vks/
nv_external_memory_win32.rs

1// Copyright (c) 2017, Dennis Hamester <dennis.hamester@startmail.com>
2//
3// Permission to use, copy, modify, and/or distribute this software for any
4// purpose with or without fee is hereby granted, provided that the above
5// copyright notice and this permission notice appear in all copies.
6//
7// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
8// REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
9// FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
10// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
11// LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
12// OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
13// PERFORMANCE OF THIS SOFTWARE.
14
15//! [`VK_NV_external_memory_win32`](https://www.khronos.org/registry/vulkan/specs/1.0-extensions/html/vkspec.html#VK_NV_external_memory_win32)
16
17use core::ptr;
18use libc::c_void;
19use nv_external_memory_capabilities;
20use vk;
21use win32_types;
22
23pub const VK_NV_EXTERNAL_MEMORY_WIN32_SPEC_VERSION: u32 = 1;
24pub const VK_NV_EXTERNAL_MEMORY_WIN32_EXTENSION_NAME: &'static [u8; 28] = b"VK_NV_external_memory_win32\x00";
25pub const VK_NV_EXTERNAL_MEMORY_WIN32_EXTENSION_NAME_STR: &'static str = "VK_NV_external_memory_win32";
26
27/// See [`VkImportMemoryWin32HandleInfoNV`](https://www.khronos.org/registry/vulkan/specs/1.0-extensions/html/vkspec.html#VkImportMemoryWin32HandleInfoNV)
28#[repr(C)]
29#[derive(Debug, Copy, Clone)]
30pub struct VkImportMemoryWin32HandleInfoNV {
31    pub sType: vk::VkStructureType,
32    pub pNext: *const c_void,
33    pub handleType: nv_external_memory_capabilities::VkExternalMemoryHandleTypeFlagsNV,
34    pub handle: win32_types::HANDLE,
35}
36
37impl Default for VkImportMemoryWin32HandleInfoNV {
38    fn default() -> Self {
39        VkImportMemoryWin32HandleInfoNV {
40            sType: vk::VK_STRUCTURE_TYPE_IMPORT_MEMORY_WIN32_HANDLE_INFO_NV,
41            pNext: ptr::null(),
42            handleType: Default::default(),
43            handle: ptr::null_mut(),
44        }
45    }
46}
47
48/// See [`VkExportMemoryWin32HandleInfoNV`](https://www.khronos.org/registry/vulkan/specs/1.0-extensions/html/vkspec.html#VkExportMemoryWin32HandleInfoNV)
49#[repr(C)]
50#[derive(Debug, Copy, Clone)]
51pub struct VkExportMemoryWin32HandleInfoNV {
52    pub sType: vk::VkStructureType,
53    pub pNext: *const c_void,
54    pub pAttributes: *const win32_types::SECURITY_ATTRIBUTES,
55    pub dwAccess: win32_types::DWORD,
56}
57
58impl Default for VkExportMemoryWin32HandleInfoNV {
59    fn default() -> Self {
60        VkExportMemoryWin32HandleInfoNV {
61            sType: vk::VK_STRUCTURE_TYPE_EXPORT_MEMORY_WIN32_HANDLE_INFO_NV,
62            pNext: ptr::null(),
63            pAttributes: ptr::null(),
64            dwAccess: Default::default(),
65        }
66    }
67}
68
69/// See [`vkGetMemoryWin32HandleNV`](https://www.khronos.org/registry/vulkan/specs/1.0-extensions/html/vkspec.html#vkGetMemoryWin32HandleNV)
70pub type PFN_vkGetMemoryWin32HandleNV = Option<unsafe extern "system" fn(device: vk::VkDevice, memory: vk::VkDeviceMemory, handleType: nv_external_memory_capabilities::VkExternalMemoryHandleTypeFlagsNV, pHandle: *mut win32_types::HANDLE) -> vk::VkResult>;
71
72#[cfg(feature = "function_prototypes")]
73extern "system" {
74    /// See [`vkGetMemoryWin32HandleNV`](https://www.khronos.org/registry/vulkan/specs/1.0-extensions/html/vkspec.html#vkGetMemoryWin32HandleNV)
75    pub fn vkGetMemoryWin32HandleNV(device: vk::VkDevice, memory: vk::VkDeviceMemory, handleType: nv_external_memory_capabilities::VkExternalMemoryHandleTypeFlagsNV, pHandle: *mut win32_types::HANDLE) -> vk::VkResult;
76}