Vulkan Development Overview
Vulkan is a set of graphics APIs designed for 2D and 3D rendering. In OpenHarmony, two new extensions are introduced: VK_OHOS_surface and VK_OHOS_external_memory.
The VK_OHOS_surface extension enables the creation of a VkSurfaceKHR, which connects to the OHNativeWindow module to implement the rotation of OHNativeBuffers for display purposes.
The VK_OHOS_external_memory extension supports zero-copy memory sharing between the GPU Vulkan environment and OpenHarmony OHNativeBuffer. Typical scenarios are as follows:
-
Camera/Camera pipeline: OHNativeBuffers generated by the camera can be directly sampled in Vulkan or used as rendering targets.
-
Zero-copy video decoding and rendering: OHNativeBuffers output by decoders can be directly imported into Vulkan for post-processing or compositing.
-
Surface/OHNativeWindow interoperability: Importing the buffers of OHNativeWindow or Surface into Vulkan or exporting Vulkan rendering results as OHNativeBuffers for use by the system (such as RenderService) or other clients.
-
Multi-API interoperability: Share the same OHNativeBuffer across OpenGL/EGL and Vulkan for cross-API resource sharing (zero-copy).
For details about how to use Vulkan, visit the Vulkan official website.