The Vulkan module provides Vulkan capabilities extended by HarmonyOS. It provides extended APIs for creating a Vulkan surface using OHNativeWindow and obtaining **OH_NativeBuffer **and OH_NativeBuffer properties.
@syscap SystemCapability.Graphic.Vulkan
Since
10
| Name | Description |
|---|---|
| vulkan_ohos.h | Declares the Vulkan interfaces extended by HarmonyOS. File to include: <vulkan/vulkan.h> Library: libvulkan.so |
| Name | Description |
|---|---|
| VkSurfaceCreateInfoOHOS | Defines the parameters required for creating a Vulkan surface. |
| VkNativeBufferUsageOHOS | Defines the usage of a NativeBuffer. |
| VkNativeBufferPropertiesOHOS | Defines the properties of a NativeBuffer. |
| VkNativeBufferFormatPropertiesOHOS | Defines the format properties of a NativeBuffer. |
| VkImportNativeBufferInfoOHOS | Defines the pointer to an OH_NativeBuffer struct. |
| VkMemoryGetNativeBufferInfoOHOS | Defines a struct used to obtain an OH_NativeBuffer from the Vulkan memory. |
| VkExternalFormatOHOS | Defines an externally defined format. |
| Name | Description |
|---|---|
| VK_OHOS_surface 1 | Surface extension macro definition of HarmonyOS. |
| VK_OHOS_SURFACE_SPEC_VERSION 1 | Surface extension version of HarmonyOS. |
| VK_OHOS_SURFACE_EXTENSION_NAME "VK_OHOS_surface" | Surface extension name of HarmonyOS. |
| VK_OHOS_external_memory 1 | External memory extension macro definition of HarmonyOS. |
| VK_OHOS_EXTERNAL_MEMORY_SPEC_VERSION 1 | External memory extension version of HarmonyOS. |
| VK_OHOS_EXTERNAL_MEMORY_EXTENSION_NAME "VK_OHOS_external_memory" | External memory extension name of HarmonyOS. |
| Name | Description |
|---|---|
| OHNativeWindow | Defines an OHNativeWindow. |
| VkSurfaceCreateFlagsOHOS | Defines the bit mask of the VkFlags type used for the creation of a Vulkan surface. It is a reserved flag type. |
| VkSurfaceCreateInfoOHOS | Defines the parameters required for creating a Vulkan surface. |
| VkResult (VKAPI_PTR *PFN_vkCreateSurfaceOHOS) (VkInstance instance, const VkSurfaceCreateInfoOHOS *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface) | Defines the function pointer for creating a Vulkan surface. |
| VkNativeBufferUsageOHOS | Defines the usage of a NativeBuffer. |
| VkNativeBufferPropertiesOHOS | Defines the properties of a NativeBuffer. |
| VkNativeBufferFormatPropertiesOHOS | Defines the format properties of a NativeBuffer. |
| VkImportNativeBufferInfoOHOS | Defines the pointer to an OH_NativeBuffer struct. |
| VkMemoryGetNativeBufferInfoOHOS | Defines a struct used to obtain an OH_NativeBuffer from the Vulkan memory. |
| VkExternalFormatOHOS | Defines an externally defined format. |
| VkResult (VKAPI_PTR *PFN_vkGetNativeBufferPropertiesOHOS) (VkDevice device, const struct OH_NativeBuffer *buffer, VkNativeBufferPropertiesOHOS *pProperties) | Defines a function pointer used to obtain OH_NativeBuffer properties. |
| VkResult (VKAPI_PTR *PFN_vkGetMemoryNativeBufferOHOS) (VkDevice device, const VkMemoryGetNativeBufferInfoOHOS *pInfo, struct OH_NativeBuffer **pBuffer) | Defines a function pointer used to obtain an OH_NativeBuffer instance. |
| Name | Description |
|---|---|
| vkCreateSurfaceOHOS (VkInstance instance, const VkSurfaceCreateInfoOHOS *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface) | Creates a Vulkan surface. |
| vkGetNativeBufferPropertiesOHOS (VkDevice device, const struct OH_NativeBuffer *buffer, VkNativeBufferPropertiesOHOS *pProperties) | Obtains the properties of an OH_NativeBuffer instance. |
| vkGetMemoryNativeBufferOHOS (VkDevice device, const VkMemoryGetNativeBufferInfoOHOS *pInfo, struct OH_NativeBuffer **pBuffer) | Obtains an OH_NativeBuffer instance. |
#define VK_OHOS_external_memory 1
Description
External memory extension macro definition of HarmonyOS.
#define VK_OHOS_EXTERNAL_MEMORY_EXTENSION_NAME "VK_OHOS_external_memory"
Description
External memory extension name of HarmonyOS.
#define VK_OHOS_EXTERNAL_MEMORY_SPEC_VERSION 1
Description
External memory extension version of HarmonyOS.
#define VK_OHOS_surface 1
Description
Surface extension macro definition of HarmonyOS.
#define VK_OHOS_SURFACE_EXTENSION_NAME "VK_OHOS_surface"
Description
Surface extension name of HarmonyOS.
#define VK_OHOS_SURFACE_SPEC_VERSION 1
Description
Surface extension version of HarmonyOS.
typedef VkResult(VKAPI_PTR * PFN_vkCreateSurfaceOHOS) (VkInstance instance, const VkSurfaceCreateInfoOHOS *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface)
Description
Defines the function pointer for creating a Vulkan surface.
@syscap SystemCapability.Graphic.Vulkan
Parameters
| Name | Description |
|---|---|
| instance | Vulkan instance. |
| pCreateInfo | Pointer to the VkSurfaceCreateInfoOHOS struct, including the parameters required for creating a Vulkan surface. |
| pAllocator | Pointer to a callback function for custom memory allocation. If custom memory allocation is not required, pass in NULL, and the default memory allocation function is used. |
| pSurface | Pointer to the Vulkan surface created. The type is VkSurfaceKHR. |
Returns
Returns VK_SUCCESS if the execution is successful; returns an error code of the VkResult type otherwise.
typedef VkResult(VKAPI_PTR * PFN_vkGetMemoryNativeBufferOHOS) (VkDevice device, const VkMemoryGetNativeBufferInfoOHOS *pInfo, struct OH_NativeBuffer **pBuffer)
Description
Defines a function pointer used to obtain an OH_NativeBuffer instance.
@syscap SystemCapability.Graphic.Vulkan
Parameters
| Name | Description |
|---|---|
| device | VkDevice instance. |
| pInfo | Pointer to a VkMemoryGetNativeBufferInfoOHOS struct. |
| pBuffer | Pointer to the OH_NativeBuffer obtained. |
Returns
Returns VK_SUCCESS if the execution is successful; returns an error code of the VkResult type otherwise.
typedef VkResult(VKAPI_PTR * PFN_vkGetNativeBufferPropertiesOHOS) (VkDevice device, const struct OH_NativeBuffer *buffer, VkNativeBufferPropertiesOHOS *pProperties)
Description
Defines a function pointer used to obtain OH_NativeBuffer properties.
@syscap SystemCapability.Graphic.Vulkan
Parameters
| Name | Description |
|---|---|
| device | VkDevice instance. |
| buffer | Pointer to an OH_NativeBuffer struct. |
| pProperties | Pointer to the struct holding the properties of OH_NativeBuffer. |
Returns
Returns VK_SUCCESS if the execution is successful; returns an error code of the VkResult type otherwise.
typedef struct VkExternalFormatOHOS VkExternalFormatOHOS
Description
Defines an externally defined format.
typedef struct VkImportNativeBufferInfoOHOS VkImportNativeBufferInfoOHOS
Description
Defines the pointer to an OH_NativeBuffer struct.
typedef struct VkMemoryGetNativeBufferInfoOHOS VkMemoryGetNativeBufferInfoOHOS
Description
Defines a struct used to obtain an OH_NativeBuffer from the Vulkan memory.
typedef struct VkNativeBufferFormatPropertiesOHOS VkNativeBufferFormatPropertiesOHOS
Description
Defines the format properties of a NativeBuffer.
typedef struct VkNativeBufferPropertiesOHOS VkNativeBufferPropertiesOHOS
Description
Defines the properties of a NativeBuffer.
typedef struct VkNativeBufferUsageOHOS VkNativeBufferUsageOHOS
Description
Defines the usage of a NativeBuffer.
typedef VkFlags VkSurfaceCreateFlagsOHOS
Description
Defines the bit mask of the VkFlags type used for the creation of a Vulkan surface. It is a reserved flag type.
typedef struct VkSurfaceCreateInfoOHOS VkSurfaceCreateInfoOHOS
Description
Defines the parameters required for creating a Vulkan surface.
VKAPI_ATTR VkResult VKAPI_CALL vkCreateSurfaceOHOS (VkInstance instance, const VkSurfaceCreateInfoOHOS * pCreateInfo, const VkAllocationCallbacks * pAllocator, VkSurfaceKHR * pSurface )
Description
Creates a Vulkan surface.
@syscap SystemCapability.Graphic.Vulkan
Parameters
| Name | Description |
|---|---|
| instance | Vulkan instance. |
| pCreateInfo | Pointer to the VkSurfaceCreateInfoOHOS struct, including the parameters required for creating a Vulkan surface. |
| pAllocator | Pointer to a callback function for custom memory allocation. If custom memory allocation is not required, pass in NULL, and the default memory allocation function is used. |
| pSurface | Pointer to the Vulkan surface created. The type is VkSurfaceKHR. |
Returns
Returns VK_SUCCESS if the execution is successful; returns an error code of the VkResult type otherwise.
VKAPI_ATTR VkResult VKAPI_CALL vkGetMemoryNativeBufferOHOS (VkDevice device, const VkMemoryGetNativeBufferInfoOHOS * pInfo, struct OH_NativeBuffer ** pBuffer )
Description
Obtains an OH_NativeBuffer instance.
@syscap SystemCapability.Graphic.Vulkan
Parameters
| Name | Description |
|---|---|
| device | VkDevice instance. |
| pInfo | Pointer to a VkMemoryGetNativeBufferInfoOHOS struct. |
| pBuffer | Pointer to the OH_NativeBuffer obtained. |
Returns
Returns VK_SUCCESS if the execution is successful; returns an error code of the VkResult type otherwise.
VKAPI_ATTR VkResult VKAPI_CALL vkGetNativeBufferPropertiesOHOS (VkDevice device, const struct OH_NativeBuffer * buffer, VkNativeBufferPropertiesOHOS * pProperties )
Description
Obtains the properties of an OH_NativeBuffer instance.
@syscap SystemCapability.Graphic.Vulkan
Parameters
| Name | Description |
|---|---|
| device | VkDevice instance. |
| buffer | Pointer to an OH_NativeBuffer struct. |
| pProperties | Pointer to the struct holding the properties of OH_NativeBuffer. |
Returns
Returns VK_SUCCESS if the execution is successful; returns an error code of the VkResult type otherwise.
VkDeviceSize VkNativeBufferPropertiesOHOS::allocationSize
Description
Size of the occupied memory.
struct OH_NativeBuffer* VkImportNativeBufferInfoOHOS::buffer
Description
Pointer to an OH_NativeBuffer struct.
uint64_t VkNativeBufferFormatPropertiesOHOS::externalFormat
Description
Externally defined format.
uint64_t VkExternalFormatOHOS::externalFormat
Description
Externally defined format.
VkFormatFeatureFlags VkNativeBufferFormatPropertiesOHOS::formatFeatures
Description
Features of the externally defined format.
VkDeviceMemory VkMemoryGetNativeBufferInfoOHOS::memory
Description
VkDeviceMemory instance.
uint64_t VkNativeBufferUsageOHOS::OHOSNativeBufferUsage
Description
Usage of a NativeBuffer.
const void* VkSurfaceCreateInfoOHOS::pNext
Description
Pointer to the next-level struct.
void* VkNativeBufferPropertiesOHOS::pNext
Description
Pointer to the next-level struct.
void* VkNativeBufferFormatPropertiesOHOS::pNext
Description
Pointer to the next-level struct.
const void* VkImportNativeBufferInfoOHOS::pNext
Description
Pointer to the next-level struct.
const void* VkMemoryGetNativeBufferInfoOHOS::pNext
Description
Pointer to the next-level struct.
VkComponentMapping VkNativeBufferFormatPropertiesOHOS::samplerYcbcrConversionComponents
Description
A group of VkComponentSwizzles.
VkChromaLocation VkNativeBufferFormatPropertiesOHOS::suggestedXChromaOffset
Description
X chrominance offset.
VkSamplerYcbcrModelConversion VkNativeBufferFormatPropertiesOHOS::suggestedYcbcrModel
Description
Color model.
VkSamplerYcbcrRange VkNativeBufferFormatPropertiesOHOS::suggestedYcbcrRange
Description
Color value range.