harmony 鸿蒙Vulkan
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
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 [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.
你可能感兴趣的鸿蒙文章
- 所属分类: 后端技术
- 本文标签:
热门推荐
-
2、 - 优质文章
-
3、 gate.io
-
8、 golang
-
9、 openharmony
-
10、 Vue中input框自动聚焦