• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //
2 // Copyright 2019 The ANGLE Project Authors. All rights reserved.
3 // Use of this source code is governed by a BSD-style license that can be
4 // found in the LICENSE file.
5 //
6 // vulkan_fuchsia_ext:
7 //    Defines Fuchsia-specific Vulkan extensions that haven't been
8 //    upstreamed to the official Vulkan headers.
9 //
10 
11 #ifndef COMMON_VULKAN_FUCHSIA_EXT_H_
12 #define COMMON_VULKAN_FUCHSIA_EXT_H_
13 
14 #if !defined(VK_NO_PROTOTYPES)
15 #    define VK_NO_PROTOTYPES
16 #endif
17 
18 #include <vulkan/vulkan.h>
19 
20 #if defined(ANGLE_PLATFORM_FUCHSIA)
21 #    include <zircon/types.h>
22 #else
23 typedef uint32_t zx_handle_t;
24 #    define ZX_HANDLE_INVALID ((zx_handle_t)0)
25 #endif
26 
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
30 
31 const VkStructureType VK_STRUCTURE_TYPE_TEMP_IMPORT_MEMORY_ZIRCON_HANDLE_INFO_FUCHSIA =
32     static_cast<VkStructureType>(1001005000);
33 const VkStructureType VK_STRUCTURE_TYPE_TEMP_MEMORY_ZIRCON_HANDLE_PROPERTIES_FUCHSIA =
34     static_cast<VkStructureType>(1001005001);
35 const VkStructureType VK_STRUCTURE_TYPE_TEMP_MEMORY_GET_ZIRCON_HANDLE_INFO_FUCHSIA =
36     static_cast<VkStructureType>(1001005002);
37 const VkStructureType VK_STRUCTURE_TYPE_TEMP_IMPORT_SEMAPHORE_ZIRCON_HANDLE_INFO_FUCHSIA =
38     static_cast<VkStructureType>(1001006000);
39 const VkStructureType VK_STRUCTURE_TYPE_TEMP_SEMAPHORE_GET_ZIRCON_HANDLE_INFO_FUCHSIA =
40     static_cast<VkStructureType>(1001006001);
41 
42 const VkExternalMemoryHandleTypeFlagBits
43     VK_EXTERNAL_MEMORY_HANDLE_TYPE_TEMP_ZIRCON_VMO_BIT_FUCHSIA =
44         static_cast<VkExternalMemoryHandleTypeFlagBits>(0x00100000);
45 
46 const VkExternalSemaphoreHandleTypeFlagBits
47     VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_TEMP_ZIRCON_EVENT_BIT_FUCHSIA =
48         static_cast<VkExternalSemaphoreHandleTypeFlagBits>(0x00100000);
49 
50 #define VK_FUCHSIA_external_memory 1
51 #define VK_FUCHSIA_EXTERNAL_MEMORY_SPEC_VERSION 1
52 #define VK_FUCHSIA_EXTERNAL_MEMORY_EXTENSION_NAME "VK_FUCHSIA_external_memory"
53 
54 typedef struct VkImportMemoryZirconHandleInfoFUCHSIA
55 {
56     VkStructureType sType;
57     const void *pNext;
58     VkExternalMemoryHandleTypeFlagBits handleType;
59     zx_handle_t handle;
60 } VkImportMemoryZirconHandleInfoFUCHSIA;
61 
62 typedef struct VkMemoryZirconHandlePropertiesFUCHSIA
63 {
64     VkStructureType sType;
65     void *pNext;
66     zx_handle_t memoryTypeBits;
67 } VkMemoryZirconHandlePropertiesFUCHSIA;
68 
69 typedef struct VkMemoryGetZirconHandleInfoFUCHSIA
70 {
71     VkStructureType sType;
72     const void *pNext;
73     VkDeviceMemory memory;
74     VkExternalMemoryHandleTypeFlagBits handleType;
75 } VkMemoryGetZirconHandleInfoFUCHSIA;
76 
77 typedef VkResult(VKAPI_PTR *PFN_vkGetMemoryZirconHandleFUCHSIA)(
78     VkDevice device,
79     const VkMemoryGetZirconHandleInfoFUCHSIA *pGetZirconHandleInfo,
80     zx_handle_t *pZirconHandle);
81 typedef VkResult(VKAPI_PTR *PFN_vkGetMemoryZirconHandlePropertiesFUCHSIA)(
82     VkDevice device,
83     VkExternalMemoryHandleTypeFlagBits handleType,
84     zx_handle_t ZirconHandle,
85     VkMemoryZirconHandlePropertiesFUCHSIA *pMemoryZirconHandleProperties);
86 
87 #ifndef VK_NO_PROTOTYPES
88 VKAPI_ATTR VkResult VKAPI_CALL
89 vkGetMemoryZirconHandleFUCHSIA(VkDevice device,
90                                const VkMemoryGetZirconHandleInfoFUCHSIA *pGetZirconHandleInfo,
91                                zx_handle_t *pZirconHandle);
92 
93 VKAPI_ATTR VkResult VKAPI_CALL vkGetMemoryZirconHandlePropertiesFUCHSIA(
94     VkDevice device,
95     VkExternalMemoryHandleTypeFlagBits handleType,
96     zx_handle_t ZirconHandle,
97     VkMemoryZirconHandlePropertiesFUCHSIA *pMemoryZirconHandleProperties);
98 #endif
99 
100 #define VK_FUCHSIA_external_semaphore 1
101 #define VK_FUCHSIA_EXTERNAL_SEMAPHORE_SPEC_VERSION 1
102 #define VK_FUCHSIA_EXTERNAL_SEMAPHORE_EXTENSION_NAME "VK_FUCHSIA_external_semaphore"
103 
104 typedef struct VkImportSemaphoreZirconHandleInfoFUCHSIA
105 {
106     VkStructureType sType;
107     const void *pNext;
108     VkSemaphore semaphore;
109     VkSemaphoreImportFlags flags;
110     VkExternalSemaphoreHandleTypeFlagBits handleType;
111     zx_handle_t handle;
112 } VkImportSemaphoreZirconHandleInfoFUCHSIA;
113 
114 typedef struct VkSemaphoreGetZirconHandleInfoFUCHSIA
115 {
116     VkStructureType sType;
117     const void *pNext;
118     VkSemaphore semaphore;
119     VkExternalSemaphoreHandleTypeFlagBits handleType;
120 } VkSemaphoreGetZirconHandleInfoFUCHSIA;
121 
122 typedef VkResult(VKAPI_PTR *PFN_vkImportSemaphoreZirconHandleFUCHSIA)(
123     VkDevice device,
124     const VkImportSemaphoreZirconHandleInfoFUCHSIA *pImportSemaphoreZirconHandleInfo);
125 typedef VkResult(VKAPI_PTR *PFN_vkGetSemaphoreZirconHandleFUCHSIA)(
126     VkDevice device,
127     const VkSemaphoreGetZirconHandleInfoFUCHSIA *pGetZirconHandleInfo,
128     zx_handle_t *pZirconHandle);
129 
130 #ifndef VK_NO_PROTOTYPES
131 VKAPI_ATTR VkResult VKAPI_CALL vkImportSemaphoreZirconHandleFUCHSIA(
132     VkDevice device,
133     const VkImportSemaphoreZirconHandleInfoFUCHSIA *pImportSemaphoreZirconHandleInfo);
134 
135 VKAPI_ATTR VkResult VKAPI_CALL
136 vkGetSemaphoreZirconHandleFUCHSIA(VkDevice device,
137                                   const VkSemaphoreGetZirconHandleInfoFUCHSIA *pGetZirconHandleInfo,
138                                   zx_handle_t *pZirconHandle);
139 #endif
140 
141 #ifdef __cplusplus
142 }
143 #endif
144 
145 #endif  // COMMON_VULKAN_FUCHSIA_EXT_H_
146