harmony 鸿蒙Vulkan Module

2025-06-12 浏览 (1)

Vulkan Module

Overview

The Vulkan module provides Vulkan capabilities extended by OpenHarmony. 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

Summary

Files

NameDescription
vulkan_ohos.hDeclares the Vulkan interfaces extended by OpenHarmony.
File to include: <vulkan/vulkan.h>
Library: libvulkan.so

Structs

NameDescription
VkSurfaceCreateInfoOHOSDefines the parameters required for creating a Vulkan surface.
VkNativeBufferUsageOHOSDefines the usage of a NativeBuffer.
VkNativeBufferPropertiesOHOSDefines the properties of a NativeBuffer.
VkNativeBufferFormatPropertiesOHOSDefines the format properties of a NativeBuffer.
VkImportNativeBufferInfoOHOSDefines the pointer to an OH_NativeBuffer struct.
VkMemoryGetNativeBufferInfoOHOSDefines a struct used to obtain an OH_NativeBuffer from the Vulkan memory.
VkExternalFormatOHOSDefines an externally defined format.

Macros

NameDescription
VK_OHOS_surface 1Surface extension macro definition of OpenHarmony.
VK_OHOS_SURFACE_SPEC_VERSION 1Surface extension version of OpenHarmony.
VK_OHOS_SURFACE_EXTENSION_NAME "VK_OHOS_surface"Surface extension name of OpenHarmony.
VK_OHOS_external_memory 1External memory extension macro definition of OpenHarmony.
VK_OHOS_EXTERNAL_MEMORY_SPEC_VERSION 1External memory extension version of OpenHarmony.
VK_OHOS_EXTERNAL_MEMORY_EXTENSION_NAME "VK_OHOS_external_memory"External memory extension name of OpenHarmony.

Types

NameDescription
OHNativeWindowDefines an OHNativeWindow.
VkSurfaceCreateFlagsOHOSDefines the bit mask of the VkFlags type used for the creation of a Vulkan surface. It is a reserved flag type.
VkSurfaceCreateInfoOHOSDefines 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.
VkNativeBufferUsageOHOSDefines the usage of a NativeBuffer.
VkNativeBufferPropertiesOHOSDefines the properties of a NativeBuffer.
VkNativeBufferFormatPropertiesOHOSDefines the format properties of a NativeBuffer.
VkImportNativeBufferInfoOHOSDefines the pointer to an OH_NativeBuffer struct.
VkMemoryGetNativeBufferInfoOHOSDefines a struct used to obtain an OH_NativeBuffer from the Vulkan memory.
VkExternalFormatOHOSDefines 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.

Functions

NameDescription
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.

Variables

NameDescription
VkSurfaceCreateInfoOHOS::sTypeStruct type.
VkSurfaceCreateInfoOHOS::pNextPointer to the next-level struct.
VkSurfaceCreateInfoOHOS::flagsReserved flag type.
VkSurfaceCreateInfoOHOS::windowPointer to an OHNativeWindow instance.
VkNativeBufferUsageOHOS::sTypeStruct type.
VkNativeBufferUsageOHOS::pNextPointer to the next-level struct.
VkNativeBufferUsageOHOS::OHOSNativeBufferUsageUsage of a NativeBuffer.
VkNativeBufferPropertiesOHOS::sTypeStruct type.
VkNativeBufferPropertiesOHOS::pNextPointer to the next-level struct.
VkNativeBufferPropertiesOHOS::allocationSizeSize of the occupied memory.
VkNativeBufferPropertiesOHOS::memoryTypeBitsMemory type.
VkNativeBufferFormatPropertiesOHOS::sTypeStruct type.
VkNativeBufferFormatPropertiesOHOS::pNextPointer to the next-level struct.
VkNativeBufferFormatPropertiesOHOS::formatFormat properties.
VkNativeBufferFormatPropertiesOHOS::externalFormatExternally defined format.
VkNativeBufferFormatPropertiesOHOS::formatFeaturesFeatures of the externally defined format.
VkNativeBufferFormatPropertiesOHOS::samplerYcbcrConversionComponentsA group of VkComponentSwizzles.
VkNativeBufferFormatPropertiesOHOS::suggestedYcbcrModelColor model.
VkNativeBufferFormatPropertiesOHOS::suggestedYcbcrRangeColor value range.
VkNativeBufferFormatPropertiesOHOS::suggestedXChromaOffsetX chrominance offset.
VkNativeBufferFormatPropertiesOHOS::suggestedYChromaOffsetY chrominance offset.
VkImportNativeBufferInfoOHOS::sTypeStruct type.
VkImportNativeBufferInfoOHOS::pNextPointer to the next-level struct.
VkImportNativeBufferInfoOHOS::bufferPointer to an OH_NativeBuffer struct.
VkMemoryGetNativeBufferInfoOHOS::sTypeStruct type.
VkMemoryGetNativeBufferInfoOHOS::pNextPointer to the next-level struct.
VkMemoryGetNativeBufferInfoOHOS::memoryVkDeviceMemory instance.
VkExternalFormatOHOS::sTypeStruct type.
VkExternalFormatOHOS::pNextPointer to the next-level struct.
VkExternalFormatOHOS::externalFormatExternally defined format.

Macro Description

VK_OHOS_external_memory

#define VK_OHOS_external_memory   1

Description

External memory extension macro definition of OpenHarmony.

VK_OHOS_EXTERNAL_MEMORY_EXTENSION_NAME

#define VK_OHOS_EXTERNAL_MEMORY_EXTENSION_NAME   "VK_OHOS_external_memory"

Description

External memory extension name of OpenHarmony.

VK_OHOS_EXTERNAL_MEMORY_SPEC_VERSION

#define VK_OHOS_EXTERNAL_MEMORY_SPEC_VERSION   1

Description

External memory extension version of OpenHarmony.

VK_OHOS_surface

#define VK_OHOS_surface   1

Description

Surface extension macro definition of OpenHarmony.

VK_OHOS_SURFACE_EXTENSION_NAME

#define VK_OHOS_SURFACE_EXTENSION_NAME   "VK_OHOS_surface"

Description

Surface extension name of OpenHarmony.

VK_OHOS_SURFACE_SPEC_VERSION

#define VK_OHOS_SURFACE_SPEC_VERSION   1

Description

Surface extension version of OpenHarmony.

Type Description

OHNativeWindow

typedef struct NativeWindow OHNativeWindow

Description

Defines an OHNativeWindow.

PFN_vkCreateSurfaceOHOS

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

NameDescription
instanceVulkan instance.
pCreateInfoPointer to the VkSurfaceCreateInfoOHOS struct, including the parameters required for creating a Vulkan surface.
pAllocatorPointer 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.
pSurfacePointer 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.

PFN_vkGetMemoryNativeBufferOHOS

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

NameDescription
deviceVkDevice instance.
pInfoPointer to a VkMemoryGetNativeBufferInfoOHOS struct.
pBufferPointer to the OH_NativeBuffer obtained.

Returns

Returns VK_SUCCESS if the execution is successful; returns an error code of the VkResult type otherwise.

PFN_vkGetNativeBufferPropertiesOHOS

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

NameDescription
deviceVkDevice instance.
bufferPointer to an OH_NativeBuffer struct.
pPropertiesPointer 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.

VkExternalFormatOHOS

typedef struct VkExternalFormatOHOS VkExternalFormatOHOS

Description

Defines an externally defined format.

VkImportNativeBufferInfoOHOS

typedef struct VkImportNativeBufferInfoOHOS VkImportNativeBufferInfoOHOS

Description

Defines the pointer to an OH_NativeBuffer struct.

VkMemoryGetNativeBufferInfoOHOS

typedef struct VkMemoryGetNativeBufferInfoOHOS VkMemoryGetNativeBufferInfoOHOS

Description

Defines a struct used to obtain an OH_NativeBuffer from the Vulkan memory.

VkNativeBufferFormatPropertiesOHOS

typedef struct VkNativeBufferFormatPropertiesOHOS VkNativeBufferFormatPropertiesOHOS

Description

Defines the format properties of a NativeBuffer.

VkNativeBufferPropertiesOHOS

typedef struct VkNativeBufferPropertiesOHOS VkNativeBufferPropertiesOHOS

Description

Defines the properties of a NativeBuffer.

VkNativeBufferUsageOHOS

typedef struct VkNativeBufferUsageOHOS VkNativeBufferUsageOHOS

Description

Defines the usage of a NativeBuffer.

VkSurfaceCreateFlagsOHOS

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.

VkSurfaceCreateInfoOHOS

typedef struct VkSurfaceCreateInfoOHOS VkSurfaceCreateInfoOHOS

Description

Defines the parameters required for creating a Vulkan surface.

Function Description

vkCreateSurfaceOHOS()

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

NameDescription
instanceVulkan instance.
pCreateInfoPointer to the VkSurfaceCreateInfoOHOS struct, including the parameters required for creating a Vulkan surface.
pAllocatorPointer 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.
pSurfacePointer 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.

vkGetMemoryNativeBufferOHOS()

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

NameDescription
deviceVkDevice instance.
pInfoPointer to a VkMemoryGetNativeBufferInfoOHOS struct.
pBufferPointer to the OH_NativeBuffer obtained.

Returns

Returns VK_SUCCESS if the execution is successful; returns an error code of the VkResult type otherwise.

vkGetNativeBufferPropertiesOHOS()

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

NameDescription
deviceVkDevice instance.
bufferPointer to an OH_NativeBuffer struct.
pPropertiesPointer 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.

Variable Description

allocationSize

VkDeviceSize VkNativeBufferPropertiesOHOS::allocationSize

Description

Size of the occupied memory.

buffer

struct OH_NativeBuffer* VkImportNativeBufferInfoOHOS::buffer

Description

Pointer to an OH_NativeBuffer struct.

externalFormat [1/2]

uint64_t VkNativeBufferFormatPropertiesOHOS::externalFormat

Description

Externally defined format.

externalFormat [2/2]

uint64_t VkExternalFormatOHOS::externalFormat

Description

Externally defined format.

flags

VkSurfaceCreateFlagsOHOS VkSurfaceCreateInfoOHOS::flags

Description

Reserved flag type.

format

VkFormat VkNativeBufferFormatPropertiesOHOS::format

Description

Format properties.

formatFeatures

VkFormatFeatureFlags VkNativeBufferFormatPropertiesOHOS::formatFeatures

Description

Features of the externally defined format.

memory

VkDeviceMemory VkMemoryGetNativeBufferInfoOHOS::memory

Description

VkDeviceMemory instance.

memoryTypeBits

uint32_t VkNativeBufferPropertiesOHOS::memoryTypeBits

Description

Memory type.

OHOSNativeBufferUsage

uint64_t VkNativeBufferUsageOHOS::OHOSNativeBufferUsage

Description

Usage of a NativeBuffer.

pNext [1/7]

const void* VkSurfaceCreateInfoOHOS::pNext

Description

Pointer to the next-level struct.

pNext [2/7]

void* VkNativeBufferUsageOHOS::pNext

Description

Pointer to the next-level struct.

pNext [3/7]

void* VkNativeBufferPropertiesOHOS::pNext

Description

Pointer to the next-level struct.

pNext [4/7]

void* VkNativeBufferFormatPropertiesOHOS::pNext

Description

Pointer to the next-level struct.

pNext [5/7]

const void* VkImportNativeBufferInfoOHOS::pNext

Description

Pointer to the next-level struct.

pNext [6/7]

const void* VkMemoryGetNativeBufferInfoOHOS::pNext

Description

Pointer to the next-level struct.

pNext [7/7]

void* VkExternalFormatOHOS::pNext

Description

Pointer to the next-level struct.

samplerYcbcrConversionComponents

VkComponentMapping VkNativeBufferFormatPropertiesOHOS::samplerYcbcrConversionComponents

Description

A group of VkComponentSwizzles.

sType [1/7]

VkStructureType VkSurfaceCreateInfoOHOS::sType

Description

Struct type.

sType [2/7]

VkStructureType VkNativeBufferUsageOHOS::sType

Description

Struct type.

sType [3/7]

VkStructureType VkNativeBufferPropertiesOHOS::sType

Description

Struct type.

sType [4/7]

VkStructureType VkNativeBufferFormatPropertiesOHOS::sType

Description

Struct type.

sType [5/7]

VkStructureType VkImportNativeBufferInfoOHOS::sType

Description

Struct type.

sType [6/7]

VkStructureType VkMemoryGetNativeBufferInfoOHOS::sType

Description

Struct type.

sType [7/7]

VkStructureType VkExternalFormatOHOS::sType

Description

Struct type.

suggestedXChromaOffset

VkChromaLocation VkNativeBufferFormatPropertiesOHOS::suggestedXChromaOffset

Description

X chrominance offset.

suggestedYcbcrModel

VkSamplerYcbcrModelConversion VkNativeBufferFormatPropertiesOHOS::suggestedYcbcrModel

Description

Color model.

suggestedYcbcrRange

VkSamplerYcbcrRange VkNativeBufferFormatPropertiesOHOS::suggestedYcbcrRange

Description

Color value range.

suggestedYChromaOffset

VkChromaLocation VkNativeBufferFormatPropertiesOHOS::suggestedYChromaOffset

Description

Y chrominance offset.

window

OHNativeWindow* VkSurfaceCreateInfoOHOS::window

Description

Pointer to an OHNativeWindow instance.

你可能感兴趣的鸿蒙文章

harmony 鸿蒙Native API Standard Libraries

harmony 鸿蒙VkExternalFormatOHOS

harmony 鸿蒙VkImportNativeBufferInfoOHOS

harmony 鸿蒙VkMemoryGetNativeBufferInfoOHOS

harmony 鸿蒙VkNativeBufferFormatPropertiesOHOS

harmony 鸿蒙VkNativeBufferPropertiesOHOS

harmony 鸿蒙VkNativeBufferUsageOHOS

harmony 鸿蒙VkSurfaceCreateInfoOHOS

harmony 鸿蒙libc++

harmony 鸿蒙EGL Symbols Exported from Native APIs

  • 所属分类: 后端技术
  • 本文标签: 软件 鸿蒙
  • 版权声明: 本文链接 https://seaxiang.com/blog/uhAqcn