1#ifndef VULKAN_OHOS_H_
2#define VULKAN_OHOS_H_ 1
3
4/*
5** Copyright 2015-2023 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
73typedef VkResult (VKAPI_PTR *PFN_vkGetSwapchainGrallocUsageOHOS)(VkDevice device, VkFormat format, VkImageUsageFlags imageUsage, uint64_t* grallocUsage);
74typedef VkResult (VKAPI_PTR *PFN_vkAcquireImageOHOS)(VkDevice device, VkImage image, int32_t nativeFenceFd, VkSemaphore semaphore, VkFence fence);
75typedef VkResult (VKAPI_PTR *PFN_vkQueueSignalReleaseImageOHOS)(VkQueue queue, uint32_t waitSemaphoreCount, const VkSemaphore* pWaitSemaphores, VkImage image, int32_t* pNativeFenceFd);
76
77#ifndef VK_NO_PROTOTYPES
78VKAPI_ATTR VkResult VKAPI_CALL vkGetSwapchainGrallocUsageOHOS(
79    VkDevice                                    device,
80    VkFormat                                    format,
81    VkImageUsageFlags                           imageUsage,
82    uint64_t*                                   grallocUsage);
83
84VKAPI_ATTR VkResult VKAPI_CALL vkAcquireImageOHOS(
85    VkDevice                                    device,
86    VkImage                                     image,
87    int32_t                                     nativeFenceFd,
88    VkSemaphore                                 semaphore,
89    VkFence                                     fence);
90
91VKAPI_ATTR VkResult VKAPI_CALL vkQueueSignalReleaseImageOHOS(
92    VkQueue                                     queue,
93    uint32_t                                    waitSemaphoreCount,
94    const VkSemaphore*                          pWaitSemaphores,
95    VkImage                                     image,
96    int32_t*                                    pNativeFenceFd);
97#endif
98
99
100#define VK_OHOS_external_memory 1
101struct OH_NativeBuffer;
102#define VK_OHOS_EXTERNAL_MEMORY_SPEC_VERSION 1
103#define VK_OHOS_EXTERNAL_MEMORY_EXTENSION_NAME "VK_OHOS_external_memory"
104typedef struct VkNativeBufferUsageOHOS {
105    VkStructureType    sType;
106    void*              pNext;
107    uint64_t           OHOSNativeBufferUsage;
108} VkNativeBufferUsageOHOS;
109
110typedef struct VkNativeBufferPropertiesOHOS {
111    VkStructureType    sType;
112    void*              pNext;
113    VkDeviceSize       allocationSize;
114    uint32_t           memoryTypeBits;
115} VkNativeBufferPropertiesOHOS;
116
117typedef struct VkNativeBufferFormatPropertiesOHOS {
118    VkStructureType                  sType;
119    void*                            pNext;
120    VkFormat                         format;
121    uint64_t                         externalFormat;
122    VkFormatFeatureFlags             formatFeatures;
123    VkComponentMapping               samplerYcbcrConversionComponents;
124    VkSamplerYcbcrModelConversion    suggestedYcbcrModel;
125    VkSamplerYcbcrRange              suggestedYcbcrRange;
126    VkChromaLocation                 suggestedXChromaOffset;
127    VkChromaLocation                 suggestedYChromaOffset;
128} VkNativeBufferFormatPropertiesOHOS;
129
130typedef struct VkImportNativeBufferInfoOHOS {
131    VkStructureType            sType;
132    const void*                pNext;
133    struct OH_NativeBuffer*    buffer;
134} VkImportNativeBufferInfoOHOS;
135
136typedef struct VkMemoryGetNativeBufferInfoOHOS {
137    VkStructureType    sType;
138    const void*        pNext;
139    VkDeviceMemory     memory;
140} VkMemoryGetNativeBufferInfoOHOS;
141
142typedef struct VkExternalFormatOHOS {
143    VkStructureType    sType;
144    void*              pNext;
145    uint64_t           externalFormat;
146} VkExternalFormatOHOS;
147
148typedef VkResult (VKAPI_PTR *PFN_vkGetNativeBufferPropertiesOHOS)(VkDevice device, const struct OH_NativeBuffer* buffer, VkNativeBufferPropertiesOHOS* pProperties);
149typedef VkResult (VKAPI_PTR *PFN_vkGetMemoryNativeBufferOHOS)(VkDevice device, const VkMemoryGetNativeBufferInfoOHOS* pInfo, struct OH_NativeBuffer** pBuffer);
150
151#ifndef VK_NO_PROTOTYPES
152VKAPI_ATTR VkResult VKAPI_CALL vkGetNativeBufferPropertiesOHOS(
153    VkDevice                                    device,
154    const struct OH_NativeBuffer*               buffer,
155    VkNativeBufferPropertiesOHOS*               pProperties);
156
157VKAPI_ATTR VkResult VKAPI_CALL vkGetMemoryNativeBufferOHOS(
158    VkDevice                                    device,
159    const VkMemoryGetNativeBufferInfoOHOS*      pInfo,
160    struct OH_NativeBuffer**                    pBuffer);
161#endif
162
163#ifdef __cplusplus
164}
165#endif
166
167#endif
168