harmony 鸿蒙Vulkan

  • 2023-10-30
  • 浏览 (874)

Vulkan

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

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

Structs

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.

Macros

Name Description
VK_OHOS_surface 1 Surface extension macro definition of OpenHarmony.
VK_OHOS_SURFACE_SPEC_VERSION 1 Surface extension version of OpenHarmony.
VK_OHOS_SURFACE_EXTENSION_NAME “VK_OHOS_surface” Surface extension name of OpenHarmony.
VK_OHOS_external_memory 1 External memory extension macro definition of OpenHarmony.
VK_OHOS_EXTERNAL_MEMORY_SPEC_VERSION 1 External memory extension version of OpenHarmony.
VK_OHOS_EXTERNAL_MEMORY_EXTENSION_NAME “VK_OHOS_external_memory” External memory extension name of OpenHarmony.

Types

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.

Functions

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.

Variables

Name Description
VkSurfaceCreateInfoOHOS::sType Struct type.
VkSurfaceCreateInfoOHOS::pNext Pointer to the next-level struct.
VkSurfaceCreateInfoOHOS::flags Reserved flag type.
VkSurfaceCreateInfoOHOS::window Pointer to an OHNativeWindow instance.
VkNativeBufferUsageOHOS::sType Struct type.
VkNativeBufferUsageOHOS::pNext Pointer to the next-level struct.
VkNativeBufferUsageOHOS::OHOSNativeBufferUsage Usage of a NativeBuffer.
VkNativeBufferPropertiesOHOS::sType Struct type.
VkNativeBufferPropertiesOHOS::pNext Pointer to the next-level struct.
VkNativeBufferPropertiesOHOS::allocationSize Size of the occupied memory.
VkNativeBufferPropertiesOHOS::memoryTypeBits Memory type.
VkNativeBufferFormatPropertiesOHOS::sType Struct type.
VkNativeBufferFormatPropertiesOHOS::pNext Pointer to the next-level struct.
VkNativeBufferFormatPropertiesOHOS::format Format properties.
VkNativeBufferFormatPropertiesOHOS::externalFormat Externally defined format.
VkNativeBufferFormatPropertiesOHOS::formatFeatures Features of the externally defined format.
VkNativeBufferFormatPropertiesOHOS::samplerYcbcrConversionComponents A group of VkComponentSwizzles.
VkNativeBufferFormatPropertiesOHOS::suggestedYcbcrModel Color model.
VkNativeBufferFormatPropertiesOHOS::suggestedYcbcrRange Color value range.
VkNativeBufferFormatPropertiesOHOS::suggestedXChromaOffset X chrominance offset.
VkNativeBufferFormatPropertiesOHOS::suggestedYChromaOffset Y chrominance offset.
VkImportNativeBufferInfoOHOS::sType Struct type.
VkImportNativeBufferInfoOHOS::pNext Pointer to the next-level struct.
VkImportNativeBufferInfoOHOS::buffer Pointer to an OH_NativeBuffer struct.
VkMemoryGetNativeBufferInfoOHOS::sType Struct type.
VkMemoryGetNativeBufferInfoOHOS::pNext Pointer to the next-level struct.
VkMemoryGetNativeBufferInfoOHOS::memory VkDeviceMemory instance.
VkExternalFormatOHOS::sType Struct type.
VkExternalFormatOHOS::pNext Pointer to the next-level struct.
VkExternalFormatOHOS::externalFormat Externally 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

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.

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

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.

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

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.

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

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.

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

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.

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

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.

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 [12]

uint64_t VkNativeBufferFormatPropertiesOHOS::externalFormat

Description

Externally defined format.

externalFormat [22]

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 [17]

const void* VkSurfaceCreateInfoOHOS::pNext

Description

Pointer to the next-level struct.

pNext [27]

void* VkNativeBufferUsageOHOS::pNext

Description

Pointer to the next-level struct.

pNext [37]

void* VkNativeBufferPropertiesOHOS::pNext

Description

Pointer to the next-level struct.

pNext [47]

void* VkNativeBufferFormatPropertiesOHOS::pNext

Description

Pointer to the next-level struct.

pNext [57]

const void* VkImportNativeBufferInfoOHOS::pNext

Description

Pointer to the next-level struct.

pNext [67]

const void* VkMemoryGetNativeBufferInfoOHOS::pNext

Description

Pointer to the next-level struct.

pNext [77]

void* VkExternalFormatOHOS::pNext

Description

Pointer to the next-level struct.

samplerYcbcrConversionComponents

VkComponentMapping VkNativeBufferFormatPropertiesOHOS::samplerYcbcrConversionComponents

Description

A group of VkComponentSwizzles.

sType [17]

VkStructureType VkSurfaceCreateInfoOHOS::sType

Description

Struct type.

sType [27]

VkStructureType VkNativeBufferUsageOHOS::sType

Description

Struct type.

sType [37]

VkStructureType VkNativeBufferPropertiesOHOS::sType

Description

Struct type.

sType [47]

VkStructureType VkNativeBufferFormatPropertiesOHOS::sType

Description

Struct type.

sType [57]

VkStructureType VkImportNativeBufferInfoOHOS::sType

Description

Struct type.

sType [67]

VkStructureType VkMemoryGetNativeBufferInfoOHOS::sType

Description

Struct type.

sType [77]

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 APIs

harmony 鸿蒙AVCapability

harmony 鸿蒙AVDemuxer

harmony 鸿蒙AVMuxer

harmony 鸿蒙AVScreenCapture

harmony 鸿蒙AVSource

harmony 鸿蒙AudioDecoder

harmony 鸿蒙AudioEncoder

harmony 鸿蒙CodecBase

harmony 鸿蒙Core

0  赞