|
| 1 | +/* |
| 2 | + * Copyright (c) 2023 Huawei Device Co., Ltd. |
| 3 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | + * you may not use this file except in compliance with the License. |
| 5 | + * You may obtain a copy of the License at |
| 6 | + * |
| 7 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | + * |
| 9 | + * Unless required by applicable law or agreed to in writing, software |
| 10 | + * distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | + * See the License for the specific language governing permissions and |
| 13 | + * limitations under the License. |
| 14 | + */ |
| 15 | + |
| 16 | +#ifndef VULKAN_OHOS_H |
| 17 | +#define VULKAN_OHOS_H 1 |
| 18 | + |
| 19 | +#include <vulkan/vulkan_core.h> |
| 20 | + |
| 21 | +#ifdef __cplusplus |
| 22 | +extern "C" { |
| 23 | +#endif |
| 24 | + |
| 25 | +#define VK_KHR_OHOS_XCOMPONENT 1 |
| 26 | +struct ONativeWindow; |
| 27 | + |
| 28 | +#define VK_KHR_OHOS_XCOMPONENT_SPEC_VERSION 6 |
| 29 | +#define VK_KHR_OHOS_XCOMPONENT_EXTENSION_NAME "VK_OHOS_surface" |
| 30 | + |
| 31 | +typedef VkFlags VkOHOSXComponentCreateFlagsKHR; |
| 32 | + |
| 33 | +typedef struct VkOHOSXComponentCreateInfoKHR { |
| 34 | + VkStructureType sType; |
| 35 | + const void* pNext; |
| 36 | + VkOHOSXComponentCreateFlagsKHR flags; |
| 37 | + struct OHNativeWindow* window; |
| 38 | +} VkOHOSXComponentCreateInfoKHR; |
| 39 | + |
| 40 | +typedef VkResult (VKAPI_PTR *PFN_vkCreateOHOSXComponentKHR)(VkInstance instance, |
| 41 | + const VkOHOSXComponentCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, |
| 42 | + VkSurfaceKHR* pXComponent); |
| 43 | + |
| 44 | +#ifndef VK_NO_PROTOTYPES |
| 45 | +VKAPI_ATTR VkResult VKAPI_CALL vkCreateOHOSXComponentKHR( |
| 46 | + VkInstance instance, |
| 47 | + const VkOHOSXComponentCreateInfoKHR* pCreateInfo, |
| 48 | + const VkAllocationCallbacks* pAllocator, |
| 49 | + VkSurfaceKHR* pSurface); |
| 50 | +#endif |
| 51 | + |
| 52 | +#define VK_OHOS_EXTERNAL_MEMORY_OHOS_HARDWARE_BUFFER 1 |
| 53 | +struct OHardwareBuffer; |
| 54 | + |
| 55 | +#define VK_OHOS_EXTERNAL_MEMORY_OHOS_HARDWARE_BUFFER_SPEC_VERSION 3 |
| 56 | +#define VK_OHOS_EXTERNAL_MEMORY_OHOS_HARDWARE_BUFFER_EXTENSION_NAME "VK_OHOS_EXTERNAL_MEMORY_OHOS_HARDWARE_BUFFER" |
| 57 | + |
| 58 | +typedef struct VkOHOSHardwareBufferUsageOHOS { |
| 59 | + VkStructureType sType; |
| 60 | + void* pNext; |
| 61 | + uint64_t ohosHardwareBufferUsage; |
| 62 | +} VkOHOSHardwareBufferUsageOHOS; |
| 63 | + |
| 64 | +typedef struct VkOHOSHardwareBufferPropertiesOHOS { |
| 65 | + VkStructureType sType; |
| 66 | + void* pNext; |
| 67 | + VkDeviceSize allocationSize; |
| 68 | + uint32_t memoryTypeBits; |
| 69 | +} VkOHOSHardwareBufferPropertiesOHOS; |
| 70 | + |
| 71 | +typedef struct VkOHOSHardwareBufferFormatPropertiesOHOS { |
| 72 | + VkStructureType sType; |
| 73 | + void* pNext; |
| 74 | + VkFormat format; |
| 75 | + uint64_t externalFormat; |
| 76 | + VkFormatFeatureFlags formatFeatures; |
| 77 | + VkComponentMapping samplerYcbcrConversionComponents; |
| 78 | + VkSamplerYcbcrModelConversion suggestedYcbcrModel; |
| 79 | + VkSamplerYcbcrRange suggestedYcbcrRange; |
| 80 | + VkChromaLocation suggestedXChromaOffset; |
| 81 | + VkChromaLocation suggestedYChromaOffset; |
| 82 | +} VkOHOSHardwareBufferFormatPropertiesOHOS; |
| 83 | + |
| 84 | +typedef struct VkImportOHOSHardwareBufferInfoOHOS { |
| 85 | + VkStructureType sType; |
| 86 | + const void* pNext; |
| 87 | + struct OHardwareBuffer* buffer; |
| 88 | +} VkImportOHOSHardwareBufferInfoOHOS; |
| 89 | + |
| 90 | +typedef struct VkMemoryGetOHOSHardwareBufferInfoOHOS { |
| 91 | + VkStructureType sType; |
| 92 | + const void* pNext; |
| 93 | + VkDeviceMemory memory; |
| 94 | +} VkMemoryGetOHOSHardwareBufferInfoOHOS; |
| 95 | + |
| 96 | +typedef struct VkExternalFormatOHOS { |
| 97 | + VkStructureType sType; |
| 98 | + void* pNext; |
| 99 | + uint64_t externalFormat; |
| 100 | +} VkExternalFormatOHOS; |
| 101 | + |
| 102 | + |
| 103 | +typedef VkResult (VKAPI_PTR *PFN_vkGetOHOSHardwareBufferPropertiesOHOS)(VkDevice device, |
| 104 | + const struct OHardwareBuffer* buffer, VkOHOSHardwareBufferPropertiesOHOS* pProperties); |
| 105 | +typedef VkResult (VKAPI_PTR *PFN_vkGetMemoryOHOSHardwareBufferOHOS)(VkDevice device, |
| 106 | + const VkMemoryGetOHOSHardwareBufferInfoOHOS* pInfo, struct OHardwareBuffer** pBuffer); |
| 107 | + |
| 108 | +#ifndef VK_NO_PROTOTYPES |
| 109 | +VKAPI_ATTR VkResult VKAPI_CALL vkGetOHOSHardwareBufferPropertiesOHOS( |
| 110 | + VkDevice device, |
| 111 | + const struct OHardwareBuffer* buffer, |
| 112 | + VkOHOSHardwareBufferPropertiesOHOS* pProperties); |
| 113 | + |
| 114 | +VKAPI_ATTR VkResult VKAPI_CALL vkGetMemoryOHOSHardwareBufferOHOS( |
| 115 | + VkDevice device, |
| 116 | + const VkMemoryGetOHOSHardwareBufferInfoOHOS* pInfo, |
| 117 | + struct OHardwareBuffer** pBuffer); |
| 118 | +#endif |
| 119 | + |
| 120 | +#ifdef __cplusplus |
| 121 | +} |
| 122 | +#endif |
| 123 | + |
| 124 | +#endif |
0 commit comments