1#ifndef VULKAN_OHOS_H_
2#define VULKAN_OHOS_H_ 1
3
4/*
5** Copyright 2015-2022 The Khronos Group Inc.
6**
7** SPDX-License-Identifier: Apache-2.0
8*/
9
10/*
11** This header is generated from the Khronos Vulkan XML API Registry.
12**
13*/
14
15
16#ifdef __cplusplus
17extern "C" {
18#endif
19
20
21
22#define VK_OHOS_surface 1
23typedef struct NativeWindow OHNativeWindow;
24#define VK_OHOS_SURFACE_SPEC_VERSION      1
25#define VK_OHOS_SURFACE_EXTENSION_NAME    "VK_OHOS_surface"
26typedef VkFlags VkSurfaceCreateFlagsOHOS;
27typedef struct VkSurfaceCreateInfoOHOS {
28    VkStructureType             sType;
29    const void*                 pNext;
30    VkSurfaceCreateFlagsOHOS    flags;
31    OHNativeWindow*             window;
32} VkSurfaceCreateInfoOHOS;
33
34typedef VkResult (VKAPI_PTR *PFN_vkCreateSurfaceOHOS)(VkInstance instance, const VkSurfaceCreateInfoOHOS* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface);
35
36#ifndef VK_NO_PROTOTYPES
37VKAPI_ATTR VkResult VKAPI_CALL vkCreateSurfaceOHOS(
38    VkInstance                                  instance,
39    const VkSurfaceCreateInfoOHOS*              pCreateInfo,
40    const VkAllocationCallbacks*                pAllocator,
41    VkSurfaceKHR*                               pSurface);
42#endif
43
44
45#define VK_OHOS_native_buffer 1
46struct OHBufferHandle;
47#define VK_OHOS_NATIVE_BUFFER_SPEC_VERSION 1
48#define VK_OHOS_NATIVE_BUFFER_EXTENSION_NAME "VK_OHOS_native_buffer"
49
50typedef enum VkSwapchainImageUsageFlagBitsOHOS {
51    VK_SWAPCHAIN_IMAGE_USAGE_SHARED_BIT_OHOS = 0x00000001,
52    VK_SWAPCHAIN_IMAGE_USAGE_FLAG_BITS_MAX_ENUM_OHOS = 0x7FFFFFFF
53} VkSwapchainImageUsageFlagBitsOHOS;
54typedef VkFlags VkSwapchainImageUsageFlagsOHOS;
55typedef struct VkNativeBufferOHOS {
56    VkStructureType    sType;
57    const void*        pNext;
58    struct OHBufferHandle*      handle;
59} VkNativeBufferOHOS;
60
61typedef struct VkSwapchainImageCreateInfoOHOS {
62    VkStructureType                   sType;
63    const void*                       pNext;
64    VkSwapchainImageUsageFlagsOHOS    usage;
65} VkSwapchainImageCreateInfoOHOS;
66
67typedef struct VkPhysicalDevicePresentationPropertiesOHOS {
68    VkStructureType    sType;
69    const void*        pNext;
70    VkBool32           sharedImage;
71} VkPhysicalDevicePresentationPropertiesOHOS;
72
73/**
74 * @brief this type is deprecated, please use PFN_vkAcquireImageOHOS instead
75 * @deprecated
76 */
77typedef VkResult (VKAPI_PTR *PFN_vkSetNativeFenceFdOpenHarmony)(VkDevice device, int32_t nativeFenceFd, VkSemaphore semaphore, VkFence fence);
78
79/**
80 * @brief this type is deprecated, please use PFN_vkQueueSignalReleaseImageOHOS instead
81 * @deprecated
82 */
83typedef VkResult (VKAPI_PTR *PFN_vkGetNativeFenceFdOpenHarmony)(VkQueue queue, uint32_t waitSemaphoreCount, const VkSemaphore* pWaitSemaphores, VkImage image, int32_t* pNativeFenceFd);
84typedef VkResult (VKAPI_PTR *PFN_vkGetSwapchainGrallocUsageOHOS)(VkDevice device, VkFormat format, VkImageUsageFlags imageUsage, uint64_t* grallocUsage);
85typedef VkResult (VKAPI_PTR *PFN_vkAcquireImageOHOS)(VkDevice device, VkImage image, int32_t nativeFenceFd, VkSemaphore semaphore, VkFence fence);
86typedef VkResult (VKAPI_PTR *PFN_vkQueueSignalReleaseImageOHOS)(VkQueue queue, uint32_t waitSemaphoreCount, const VkSemaphore* pWaitSemaphores, VkImage image, int32_t* pNativeFenceFd);
87
88#ifndef VK_NO_PROTOTYPES
89/**
90 * @brief this interface is deprecated, please use vkAcquireImageOHOS instead
91 * @deprecated
92 */
93VKAPI_ATTR VkResult VKAPI_CALL vkSetNativeFenceFdOpenHarmony(
94    VkDevice                                    device,
95    int32_t                                     nativeFenceFd,
96    VkSemaphore                                 semaphore,
97    VkFence                                     fence);
98
99/**
100 * @brief this interface is deprecated, please use vkQueueSignalReleaseImageOHOS instead
101 * @deprecated
102 */
103VKAPI_ATTR VkResult VKAPI_CALL vkGetNativeFenceFdOpenHarmony(
104    VkQueue                                     queue,
105    uint32_t                                    waitSemaphoreCount,
106    const VkSemaphore*                          pWaitSemaphores,
107    VkImage                                     image,
108    int32_t*                                    pNativeFenceFd);
109
110VKAPI_ATTR VkResult VKAPI_CALL vkGetSwapchainGrallocUsageOHOS(
111    VkDevice                                    device,
112    VkFormat                                    format,
113    VkImageUsageFlags                           imageUsage,
114    uint64_t*                                   grallocUsage);
115
116VKAPI_ATTR VkResult VKAPI_CALL vkAcquireImageOHOS(
117    VkDevice                                    device,
118    VkImage                                     image,
119    int32_t                                     nativeFenceFd,
120    VkSemaphore                                 semaphore,
121    VkFence                                     fence);
122
123VKAPI_ATTR VkResult VKAPI_CALL vkQueueSignalReleaseImageOHOS(
124    VkQueue                                     queue,
125    uint32_t                                    waitSemaphoreCount,
126    const VkSemaphore*                          pWaitSemaphores,
127    VkImage                                     image,
128    int32_t*                                    pNativeFenceFd);
129#endif
130
131
132#define VK_OHOS_external_memory 1
133struct OH_NativeBuffer;
134#define VK_OHOS_EXTERNAL_MEMORY_SPEC_VERSION 1
135#define VK_OHOS_EXTERNAL_MEMORY_EXTENSION_NAME "VK_OHOS_external_memory"
136typedef struct VkNativeBufferUsageOHOS {
137    VkStructureType    sType;
138    void*              pNext;
139    uint64_t           OHOSNativeBufferUsage;
140} VkNativeBufferUsageOHOS;
141
142typedef struct VkNativeBufferPropertiesOHOS {
143    VkStructureType    sType;
144    void*              pNext;
145    VkDeviceSize       allocationSize;
146    uint32_t           memoryTypeBits;
147} VkNativeBufferPropertiesOHOS;
148
149typedef struct VkNativeBufferFormatPropertiesOHOS {
150    VkStructureType                  sType;
151    void*                            pNext;
152    VkFormat                         format;
153    uint64_t                         externalFormat;
154    VkFormatFeatureFlags             formatFeatures;
155    VkComponentMapping               samplerYcbcrConversionComponents;
156    VkSamplerYcbcrModelConversion    suggestedYcbcrModel;
157    VkSamplerYcbcrRange              suggestedYcbcrRange;
158    VkChromaLocation                 suggestedXChromaOffset;
159    VkChromaLocation                 suggestedYChromaOffset;
160} VkNativeBufferFormatPropertiesOHOS;
161
162typedef struct VkImportNativeBufferInfoOHOS {
163    VkStructureType            sType;
164    const void*                pNext;
165    struct OH_NativeBuffer*    buffer;
166} VkImportNativeBufferInfoOHOS;
167
168typedef struct VkMemoryGetNativeBufferInfoOHOS {
169    VkStructureType    sType;
170    const void*        pNext;
171    VkDeviceMemory     memory;
172} VkMemoryGetNativeBufferInfoOHOS;
173
174typedef struct VkExternalFormatOHOS {
175    VkStructureType    sType;
176    void*              pNext;
177    uint64_t           externalFormat;
178} VkExternalFormatOHOS;
179
180typedef VkResult (VKAPI_PTR *PFN_vkGetNativeBufferPropertiesOHOS)(VkDevice device, const struct OH_NativeBuffer* buffer, VkNativeBufferPropertiesOHOS* pProperties);
181typedef VkResult (VKAPI_PTR *PFN_vkGetMemoryNativeBufferOHOS)(VkDevice device, const VkMemoryGetNativeBufferInfoOHOS* pInfo, struct OH_NativeBuffer** pBuffer);
182
183#ifndef VK_NO_PROTOTYPES
184VKAPI_ATTR VkResult VKAPI_CALL vkGetNativeBufferPropertiesOHOS(
185    VkDevice                                    device,
186    const struct OH_NativeBuffer*               buffer,
187    VkNativeBufferPropertiesOHOS*               pProperties);
188
189VKAPI_ATTR VkResult VKAPI_CALL vkGetMemoryNativeBufferOHOS(
190    VkDevice                                    device,
191    const VkMemoryGetNativeBufferInfoOHOS*      pInfo,
192    struct OH_NativeBuffer**                    pBuffer);
193#endif
194
195#ifdef __cplusplus
196}
197#endif
198
199#endif
200