提交 d5732b67 编写于 作者: G Gloria

Update docs against 20666+20313+20666+20156+20975+20538+20725+20962+20601

Signed-off-by: wusongqing<wusongqing@huawei.com>
上级 88fa9035
# Native APIs
- [Using Native APIs in Application Projects](napi-guidelines.md)
- [Drawing Development](drawing-guidelines.md)
- [Raw File Development](rawfile-guidelines.md)
- [Native Window Development](native-window-guidelines.md)
- [Using MindSpore Lite for Model Inference](mindspore-lite-guidelines.md)
- [Using MindSpore Lite for Offline Model Conversion and Inference](mindspore-lite-offline-model-guidelines.md)
- [Connecting the Neural Network Runtime to an AI Inference Framework](neural-network-runtime-guidelines.md)
- Graphics
- [Drawing Development](drawing-guidelines.md)
- [NativeBuffer Development](native-buffer-guidelines.md)
- [NativeImage Development](native-image-guidelines.md)
- [NativeVsync Development](native-vsync-guidelines.md)
- [Native Window Development](native-window-guidelines.md)
- Resource Management
- [Raw File Development](rawfile-guidelines.md)
- AI
- [Using MindSpore Lite for Model Inference](mindspore-lite-guidelines.md)
- [Using MindSpore Lite for Offline Model Conversion and Inference](mindspore-lite-offline-model-guidelines.md)
- [Connecting the Neural Network Runtime to an AI Inference Framework](neural-network-runtime-guidelines.md)
- Memory Development
- [Purgeable Memory Development](purgeable-memory-guidelines.md)
......@@ -2,13 +2,13 @@
## When to Use
The Native Drawing module provides APIs for drawing 2D graphics and text. The following scenarios are common for drawing development:
The **NativeDrawing** module provides APIs for drawing 2D graphics and text. The following scenarios are common for drawing development:
* Drawing 2D graphics
* Drawing text drawing
## Available APIs
| API| Description|
| API| Description|
| -------- | -------- |
| OH_Drawing_BitmapCreate (void) | Creates a bitmap object.|
| OH_Drawing_BitmapBuild (OH_Drawing_Bitmap *, const uint32_t width, const uint32_t height, const OH_Drawing_BitmapFormat *) | Initializes the width and height of a bitmap object and sets the pixel format for the bitmap.|
......@@ -31,7 +31,7 @@ The Native Drawing module provides APIs for drawing 2D graphics and text. The fo
| OH_Drawing_TypographyHandlerAddText (OH_Drawing_TypographyCreate *, const char *) | Sets the text content.|
| OH_Drawing_TypographyPaint (OH_Drawing_Typography *, OH_Drawing_Canvas *, double, double) | Paints text on the canvas.|
For details about the APIs, see [Drawing](../reference/native-apis/_drawing.md).
## Development Procedure for 2D Graphics Drawing
......
# NativeBuffer Development
## When to Use
The **NativeBuffer** module provides APIs for you to apply for, use, and release the shared memory, and query memory properties.
The following scenario is common for **NativeBuffer** development:
Use the native APIs provided by **NativeBuffer** to create an **OH_NativeBuffer** instance, obtain memory properties, and map the corresponding ION memory to the process address space.
## Available APIs
| API| Description|
| -------- | -------- |
| OH_NativeBuffer_Alloc (const OH_NativeBuffer_Config \*config) | Creates an **OH_NativeBuffer** instance based on an **OH_NativeBuffer_Config** struct. A new **OH_NativeBuffer** instance is created each time this function is called.|
| OH_NativeBuffer_Reference (OH_NativeBuffer \*buffer) | Increases the reference count of an **OH_NativeBuffer** instance by 1.|
| OH_NativeBuffer_Unreference (OH_NativeBuffer \*buffer) | Decreases the reference count of an **OH_NativeBuffer** instance by 1 and, when the reference count reaches 0, destroys the instance.|
| OH_NativeBuffer_GetConfig (OH_NativeBuffer \*buffer, OH_NativeBuffer_Config \*config) | Obtains the properties of an **OH_NativeBuffer** instance.|
| OH_NativeBuffer_Map (OH_NativeBuffer \*buffer, void \*\*virAddr) | Maps the ION memory corresponding to an **OH_NativeBuffer** instance to the process address space.|
| OH_NativeBuffer_Unmap (OH_NativeBuffer \*buffer) | Unmaps the ION memory corresponding to an **OH_NativeBuffer** instance from the process address space.|
| OH_NativeBuffer_GetSeqNum (OH_NativeBuffer \*buffer) | Obtains the sequence number of an **OH_NativeBuffer** instance.|
For details about the APIs, see [native_buffer](../reference/native-apis/_o_h___native_buffer.md).
## How to Develop
The following describes how to use the native APIs provided by **NativeBuffer** to create an **OH_NativeBuffer** instance, obtain memory properties, and map the corresponding ION memory to the process address space.
**Header File**
```c++
#include <native_buffer/native_buffer.h>
```
1. Create an **OH_NativeBuffer** instance.
```c++
OH_NativeBuffer_Config config {
.width = 0x100,
.height = 0x100,
};
OH_NativeBuffer* buffer = OH_NativeBuffer_Alloc(&config);
if (buffer == nullptr) {
std::cout << "OH_NativeBuffer_Alloc Failed" << std::endl;
}
```
2. Map the ION memory corresponding to the **OH_NativeBuffer** instance to the process address space by calling **OH_NativeBuffer_Map**, if the application needs to access the memory space of the buffer.
```c++
// Map the ION memory to the process address space.
void* virAddr = nullptr;
int32_t ret = OH_NativeBuffer_Map(buffer, &virAddr); // After mapping, the start address of the memory is returned through the parameter virAddr.
if (ret != 0) {
std::cout << "OH_NativeBuffer_Map Failed" << std::endl;
}
// Unmap the ION memory from the process address space when it is no longer needed.
ret = OH_NativeBuffer_Unmap(buffer);
if (ret != 0) {
std::cout << "OH_NativeBuffer_Unmap Failed" << std::endl;
}
```
3. Obtain the memory properties.
```c++
// Obtain the properties of the OH_NativeBuffer instance.
OH_NativeBuffer_Config config = {};
OH_NativeBuffer_GetConfig(buffer, &config);
// Obtain the sequence number of the OH_NativeBuffer instance.
uint32_t hwBufferID = OH_NativeBuffer_GetSeqNum(buffer);
```
4. Destroy the **OH_NativeBuffer** instance.
```c++
// Call OH_NativeBuffer_Unreference to decrease the reference count by 1. When the reference count reaches 0, the instance is destroyed.
ret = OH_NativeBuffer_Unreference(buffer);
if (ret != 0) {
std::cout << "OH_NativeBuffer_Unreference Failed" << std::endl;
}
```
# NativeImage Development
## When to Use
**NativeImage** is a module provided by OpenHarmony for associating a surface with a OpenGL external texture. It functions as the consumer of a graphics queue. It provides APIs for you to obtain and use a buffer, and output the buffer content to a OpenGL external texture.
The following scenario is common for **NativeImage** development:
Use the native APIs provided by **NativeImage** to create a **NativeImage** instance as the consumer and obtain the corresponding **NativeWindow** instance (functioning as the producer). Use the APIs provided by **NativeWindow** to fill in and flush the buffer, and then use the APIs provided by **NativeImage** to update the buffer content to a OpenGL ES texture. The **NativeImage** module must be used together with the **NativeWindow**, **NativeBuffer**, **EGL**, and **GLES3** modules.
## Available APIs
| API| Description|
| -------- | -------- |
| OH_NativeImage_Create (uint32_t textureId, uint32_t textureTarget) | Creates an **OH_NativeImage** instance to be associated with the OpenGL ES texture ID and target.|
| OH_NativeImage_AcquireNativeWindow (OH_NativeImage \*image) | Obtains a **NativeWindow** instance associated with an **OH_NativeImage** instance. You need to call **OH_NativeWindow_DestroyNativeWindow** to release the **NativeWindow** instance when it is no longer needed.|
| OH_NativeImage_AttachContext (OH_NativeImage \*image, uint32_t textureId) | Attaches an **OH_NativeImage** instance to the current OpenGL ES context. The OpenGL ES texture will be bound to an **GL_TEXTURE_EXTERNAL_OES** instance and updated through the **OH_NativeImage** instance.|
| OH_NativeImage_DetachContext (OH_NativeImage \*image) | Detaches an **OH_NativeImage** instance from the current OpenGL ES context.|
| OH_NativeImage_UpdateSurfaceImage (OH_NativeImage \*image) | Updates the OpenGL ES texture associated with the latest frame through an **OH_NativeImage** instance.|
| OH_NativeImage_GetTimestamp (OH_NativeImage \*image) | Obtains the timestamp of the texture image that recently called the **OH_NativeImage_UpdateSurfaceImage** function.|
| OH_NativeImage_GetTransformMatrix (OH_NativeImage \*image, float matrix[16]) | Obtains the transform matrix of the texture image that recently called the **OH_NativeImage_UpdateSurfaceImage** function.|
| OH_NativeImage_Destroy (OH_NativeImage \*\*image) | Destroys an **OH_NativeImage** instance created by calling **OH_NativeImage_Create**. After the instance is destroyed, the pointer to the **OH_NativeImage** instance is assigned **NULL**.|
For details about the APIs, see [native_image](../reference/native-apis/_o_h___native_image.md).
## How to Develop
The following steps describe how to use the native APIs provided by **NativeImage** to create an **OH_NativeImage** instance as the consumer and update the data to a OpenGL external texture.
**Header File**
```c++
#include <EGL/egl.h>
#include <EGL/eglext.h>
#include <GLES3/gl3.h>
#include <native_image/native_image.h>
#include <native_window/external_window.h>
#include <native_buffer/native_buffer.h>
```
1. Initialize the EGL environment.
Refer to the code snippet below.
```c++
#include <EGL/egl.h>
#include <EGL/eglext.h>
using GetPlatformDisplayExt = PFNEGLGETPLATFORMDISPLAYEXTPROC;
constexpr const char* EGL_EXT_PLATFORM_WAYLAND = "EGL_EXT_platform_wayland";
constexpr const char* EGL_KHR_PLATFORM_WAYLAND = "EGL_KHR_platform_wayland";
constexpr int32_t EGL_CONTEXT_CLIENT_VERSION_NUM = 2;
constexpr char CHARACTER_WHITESPACE = ' ';
constexpr const char* CHARACTER_STRING_WHITESPACE = " ";
constexpr const char* EGL_GET_PLATFORM_DISPLAY_EXT = "eglGetPlatformDisplayEXT";
EGLContext eglContext_ = EGL_NO_CONTEXT;
EGLDisplay eglDisplay_ = EGL_NO_DISPLAY;
static inline EGLConfig config_;
// Check the EGL extension.
static bool CheckEglExtension(const char* extensions, const char* extension)
{
size_t extlen = strlen(extension);
const char* end = extensions + strlen(extensions);
while (extensions < end) {
size_t n = 0;
if (*extensions == CHARACTER_WHITESPACE) {
extensions++;
continue;
}
n = strcspn(extensions, CHARACTER_STRING_WHITESPACE);
if (n == extlen && strncmp(extension, extensions, n) == 0) {
return true;
}
extensions += n;
}
return false;
}
// Obtain the display.
static EGLDisplay GetPlatformEglDisplay(EGLenum platform, void* native_display, const EGLint* attrib_list)
{
static GetPlatformDisplayExt eglGetPlatformDisplayExt = NULL;
if (!eglGetPlatformDisplayExt) {
const char* extensions = eglQueryString(EGL_NO_DISPLAY, EGL_EXTENSIONS);
if (extensions &&
(CheckEglExtension(extensions, EGL_EXT_PLATFORM_WAYLAND) ||
CheckEglExtension(extensions, EGL_KHR_PLATFORM_WAYLAND))) {
eglGetPlatformDisplayExt = (GetPlatformDisplayExt)eglGetProcAddress(EGL_GET_PLATFORM_DISPLAY_EXT);
}
}
if (eglGetPlatformDisplayExt) {
return eglGetPlatformDisplayExt(platform, native_display, attrib_list);
}
return eglGetDisplay((EGLNativeDisplayType)native_display);
}
static void InitEGLEnv()
{
// Obtain the display.
eglDisplay_ = GetPlatformEglDisplay(EGL_PLATFORM_OHOS_KHR, EGL_DEFAULT_DISPLAY, NULL);
if (eglDisplay_ == EGL_NO_DISPLAY) {
std::cout << "Failed to create EGLDisplay gl errno : " << eglGetError() << std::endl;
}
EGLint major, minor;
// Initialize the EGL display.
if (eglInitialize(eglDisplay_, &major, &minor) == EGL_FALSE) {
std::cout << "Failed to initialize EGLDisplay" << std::endl;
}
// Bind the OpenGL ES API.
if (eglBindAPI(EGL_OPENGL_ES_API) == EGL_FALSE) {
std::cout << "Failed to bind OpenGL ES API" << std::endl;
}
unsigned int ret;
EGLint count;
EGLint config_attribs[] = { EGL_SURFACE_TYPE, EGL_WINDOW_BIT, EGL_RED_SIZE, 8, EGL_GREEN_SIZE, 8, EGL_BLUE_SIZE, 8,
EGL_ALPHA_SIZE, 8, EGL_RENDERABLE_TYPE, EGL_OPENGL_ES3_BIT, EGL_NONE };
// Obtain a valid system configuration.
ret = eglChooseConfig(eglDisplay_, config_attribs, &config_, 1, &count);
if (!(ret && static_cast<unsigned int>(count) >= 1)) {
std::cout << "Failed to eglChooseConfig" << std::endl;
}
static const EGLint context_attribs[] = { EGL_CONTEXT_CLIENT_VERSION, EGL_CONTEXT_CLIENT_VERSION_NUM, EGL_NONE };
// Create a context.
eglContext_ = eglCreateContext(eglDisplay_, config_, EGL_NO_CONTEXT, context_attribs);
if (eglContext_ == EGL_NO_CONTEXT) {
std::cout << "Failed to create egl context %{public}x, error:" << eglGetError() << std::endl;
}
// Associate the context.
eglMakeCurrent(eglDisplay_, EGL_NO_SURFACE, EGL_NO_SURFACE, eglContext_);
// The EGL environment initialization is complete.
std::cout << "Create EGL context successfully, version" << major << "." << minor << std::endl;
}
```
2. Create an **OH_NativeImage** instance.
```c++
// Create an OpenGL ES texture.
GLuint textureId;
glGenTextures(1, &textureId);
// Create an OH_NativeImage instance, which will be associated with an OpenGL ES texture.
OH_NativeImage* image = OH_NativeImage_Create(textureId, GL_TEXTURE_2D);
```
3. Obtain a **NativeWindow** instance that functions as the producer.
```c++
// Obtain a NativeWindow instance.
OHNativeWindow* nativeWindow = OH_NativeImage_AcquireNativeWindow(image);
```
4. Write the produced content to a **NativeWindowBuffer** instance.
1. Obtain a NativeWindowBuffer instance from the NativeWindow instance.
```c++
OHNativeWindowBuffer* buffer = nullptr;
int fenceFd;
// Obtain a NativeWindowBuffer instance by calling OH_NativeWindow_NativeWindowRequestBuffer.
OH_NativeWindow_NativeWindowRequestBuffer(nativeWindow, &buffer, &fenceFd);
BufferHandle *handle = OH_NativeWindow_GetBufferHandleFromNative(buffer);
int code = SET_BUFFER_GEOMETRY;
int32_t width = 0x100;
int32_t height = 0x100;
ret = OH_NativeWindow_NativeWindowHandleOpt(nativeWindow, code, width, height);
```
3. Write the produced content to the **NativeWindowBuffer** instance.
```c++
static uint32_t value = 0x00;
value++;
uint32_t *pixel = static_cast<uint32_t *>(handle->virAddr);
for (uint32_t x = 0; x < width; x++) {
for (uint32_t y = 0; y < height; y++) {
*pixel++ = value;
}
}
```
4. Flush the **NativeWindowBuffer** to the **NativeWindow**.
```c++
// Set the refresh region. If Rect in Region is a null pointer or rectNumber is 0, all contents in the NativeWindowBuffer are changed.
Region region{nullptr, 0};
// Flush the buffer to the consumer through OH_NativeWindow_NativeWindowFlushBuffer, for example, by displaying it on the screen.
OH_NativeWindow_NativeWindowFlushBuffer(nativeWindow, buffer, fenceFd, region);
```
5. Destroy the **NativeWindow** instance when it is no longer needed.
```c++
OH_NativeWindow_DestroyNativeWindow(nativeWindow);
```
5. Update the content to the OpenGL texture.
```c++
// Update the content to the OpenGL texture.
int32_t ret = OH_NativeImage_UpdateSurfaceImage(image);
if (ret != 0) {
std::cout << "OH_NativeImage_UpdateSurfaceImage failed" << std::endl;
}
// Obtain the timestamp and transform matrix of the texture image that recently called the **OH_NativeImage_UpdateSurfaceImage** function.
int64_t timeStamp = OH_NativeImage_GetTimestamp(image);
float matrix[16];
ret = OH_NativeImage_GetTransformMatrix(image, matrix);
if (ret != 0) {
std::cout << "OH_NativeImage_GetTransformMatrix failed" << std::endl;
}
```
6. Unbind the OpenGL texture and bind it to a new external texture.
```c++
// Detach an OH_NativeImage instance from the current OpenGL ES context.
ret = OH_NativeImage_DetachContext(image);
if (ret != 0) {
std::cout << "OH_NativeImage_DetachContext failed" << std::endl;
}
// Attach the OH_NativeImage instance to the current OpenGL ES context. The OpenGL ES texture will be bound to an GL_TEXTURE_EXTERNAL_OES instance and updated through the OH_NativeImage instance.
GLuint textureId2;
glGenTextures(1, &textureId2);
ret = OH_NativeImage_AttachContext(image, textureId2);
```
7. Destroy the **OH_NativeImage** instance when it is no longer needed.
```c++
// Destroy the OH_NativeImage instance.
OH_NativeImage_Destroy(&image);
```
# NativeVSync Development
## When to Use
The **NativeVSync** module is used to obtain virtual synchronization (VSync) signals from the system. It provides APIs for creating and destroying an **OH_NativeVSync** instance and setting the VSync callback function, which is triggered when a VSync signal arrives.
## Available APIs
| API| Description:|
| -------- | -------- |
| OH_NativeVSync_Create (const char \*name, unsigned int length) | Creates an **OH_NativeVSync** instance. A new **OH_NativeVSync** instance is created each time this function is called.|
| OH_NativeVSync_Destroy (OH_NativeVSync \*nativeVsync) | Destroys an **OH_NativeVSync** instance.|
| OH_NativeVSync_FrameCallback (long long timestamp, void \*data) | Sets a callback function. **timestamp** indicates the timestamp, and **data** indicates the input parameter of the callback function. |
| OH_NativeVSync_RequestFrame (OH_NativeVSync \*nativeVsync, OH_NativeVSync_FrameCallback callback, void \*data) | Requests the next VSync signal. When the signal arrives, a callback function is invoked.|
For details about the APIs, see [native_vsync](../reference/native-apis/_native_vsync.md).
## How to Develop
The following steps describe how to use the native APIs provided by **NativeVSync** to create and destroy an **OH_NativeVSync** instance and set the VSync callback function.
**Header File**
```c++
#include <native_vsync/native_vsync.h>
```
1. Prepare a VSync callback function.
```c++
static bool flag = false;
static void OnVSync(long long timestamp, void* data)
{
flag = true;
std::cout << "OnVSync: " << timestamp << std::endl;
}
OH_NativeVSync_FrameCallback callback = OnVSync; // The callback function must be of the OH_NativeVSync_FrameCallback type.
```
2. Create an **OH_NativeVSync** instance.
```c++
char name[] = "hello_vsync";
OH_NativeVSync* nativeVSync = OH_NativeVSync_Create(name, strlen(name));
```
3. Set the VSync callback function through the **OH_NativeVSync** instance.
```c++
OH_NativeVSync_RequestFrame(nativeVSync, callback, nullptr);
while (!flag) { // Check the flag value. The while loop exits only after the VSync callback function is executed, indicating that a VSync signal is received.
std::cout << "wait for vsync!\n";
sleep(1);
}
std::cout << "vsync come, end this thread\n";
```
4. Destroy the **OH_NativeVSync** instance.
```c++
OH_NativeVSync_Destroy(nativeVSync); // Destroy the OH_NativeVSync instance when the application does not need to receive VSync signals.
```
# Native Window Development
# NativeWindow Development
## When to Use
**NativeWindow** is a local platform-based window of OpenHarmony that represents the producer of a graphics queue. It provides APIs for you to create a native window from **Surface**, create a native window buffer from **SurfaceBuffer**, and request and flush a buffer.
The following scenarios are common for native window development:
**NativeWindow** is a local platform-based window of OpenHarmony that represents the producer of a graphics queue. It provides APIs for you to request and flush a buffer and configure buffer attributes.
* Request a graphics buffer by using the NAPI provided by **NativeWindow**, write the produced graphics content to the buffer, and flush the buffer to the graphics queue.
The following scenarios are common for NativeWindow development:
* Request a graphics buffer by using the native API provided by **NativeWindow**, write the produced graphics content to the buffer, and flush the buffer to the graphics queue.
* Request and flush a buffer when adapting to the **eglswapbuffer** interface at the EGL.
## Available APIs
| API| Description|
| -------- | -------- |
| OH_NativeWindow_CreateNativeWindowFromSurface (void \*pSurface) | Creates a **NativeWindow** instance. A new **NativeWindow** instance is created each time this function is called.|
| OH_NativeWindow_DestroyNativeWindow (OHNativeWindow \*window) | Decreases the reference count of a **NativeWindow** instance by 1 and, when the reference count reaches 0, destroys the instance.|
| OH_NativeWindow_CreateNativeWindowBufferFromSurfaceBuffer (void \*pSurfaceBuffer) | Creates a **NativeWindowBuffer** instance. A new **NativeWindowBuffer** instance is created each time this function is called.|
| OH_NativeWindow_DestroyNativeWindowBuffer (OHNativeWindowBuffer \*buffer) | Decreases the reference count of a **NativeWindowBuffer** instance by 1 and, when the reference count reaches 0, destroys the instance.|
| OH_NativeWindow_NativeWindowRequestBuffer (OHNativeWindow \*window, OHNativeWindowBuffer \*\*buffer, int \*fenceFd) | Requests a **NativeWindowBuffer** through a **NativeWindow** instance for content production.|
| OH_NativeWindow_NativeWindowFlushBuffer (OHNativeWindow \*window, OHNativeWindowBuffer \*buffer, int fenceFd, Region region) | Flushes the **NativeWindowBuffer** filled with the content to the buffer queue through a **NativeWindow** instance for content consumption.|
| OH_NativeWindow_NativeWindowAbortBuffer (OHNativeWindow \*window, OHNativeWindowBuffer \*buffer) | Returns the **NativeWindowBuffer** to the buffer queue through a **NativeWindow** instance, without filling in any content. The **NativeWindowBuffer** can be used for another request.|
| OH_NativeWindow_NativeWindowHandleOpt (OHNativeWindow \*window, int code,...) | Sets or obtains the attributes of a native window, including the width, height, and content format.|
| OH_NativeWindow_GetBufferHandleFromNative (OHNativeWindowBuffer \*buffer) | Obtains the pointer to a **BufferHandle** of a **NativeWindowBuffer** instance.|
| OH_NativeWindow_NativeObjectReference (void \*obj) | Adds the reference count of a native object.|
| OH_NativeWindow_NativeObjectUnreference (void \*obj) | Decreases the reference count of a native object and, when the reference count reaches 0, destroys this object.|
| OH_NativeWindow_GetNativeObjectMagic (void \*obj) | Obtains the magic ID of a native object.|
| OH_NativeWindow_NativeWindowSetScalingMode (OHNativeWindow \*window, uint32_t sequence, OHScalingMode scalingMode) | Sets the scaling mode of the native window.|
| OH_NativeWindow_NativeWindowSetMetaData(OHNativeWindow \*window, uint32_t sequence, int32_t size, const OHHDRMetaData \*metaData) | Sets the HDR static metadata of the native window.|
| OH_NativeWindow_NativeWindowSetMetaDataSet(OHNativeWindow \*window, uint32_t sequence, OHHDRMetadataKey key, int32_t size, const uint8_t \*metaData) | Sets the HDR static metadata set of the native window.|
| OH_NativeWindow_NativeWindowSetTunnelHandle(OHNativeWindow \*window, const OHExtDataHandle \*handle) | Sets the tunnel handle to the native window.|
| OH_NativeWindow_NativeWindowRequestBuffer (OHNativeWindow \*window, OHNativeWindowBuffer \*\*buffer, int \*fenceFd) | Requests an **OHNativeWindowBuffer** through an **OHNativeWindow** instance for content production.|
| OH_NativeWindow_NativeWindowFlushBuffer (OHNativeWindow \*window, OHNativeWindowBuffer \*buffer, int fenceFd, Region region) | Flushes the **OHNativeWindowBuffer** filled with the content to the buffer queue through an **OHNativeWindow** instance for content consumption.|
| OH_NativeWindow_NativeWindowHandleOpt (OHNativeWindow \*window, int code,...) | Sets or obtains the attributes of an **OHNativeWindow**, including the width, height, and content format.|
For details about the APIs, see [native_window](../reference/native-apis/_native_window.md).
## How to Develop
The following describes how to use the NAPI provided by **NativeWindow** to request a graphics buffer, write the produced graphics content to the buffer, and flush the buffer to the graphics queue.
The following describes how to use the native APIs provided by **NativeWindow** to request a graphics buffer, write the produced graphics content to the buffer, and flush the buffer to the graphics queue.
**Header File**
```c++
#include <native_window/external_window.h>
```
1. Obtain a **NativeWindow** instance, which can be obtained by running the APIs provided by **OH_NativeXComponent_Callback**.
1. Obtain an **OHNativeWindow** instance, which can be obtained by running the APIs provided by [OH_NativeXComponent_Callback](../reference/native-apis/_o_h___native_x_component___callback.md).
1. Define **XComponent** in an .ets file.
```ts
XComponent({ id: 'xcomponentId', type: 'surface', libraryname: 'nativerender'})
......@@ -60,25 +55,25 @@ The following describes how to use the NAPI provided by **NativeWindow** to requ
// Define the callback.
void OnSurfaceCreatedCB(OH_NativeXComponent* component, void* window)
{
// Obtain a NativeWindow instance.
// Obtain an OHNativeWindow instance.
OHNativeWindow* nativeWindow = window;
// ...
}
void OnSurfaceChangedCB(OH_NativeXComponent* component, void* window)
{
// Obtain a NativeWindow instance.
// Obtain an OHNativeWindow instance.
OHNativeWindow* nativeWindow = window;
// ...
}
void OnSurfaceDestroyedCB(OH_NativeXComponent* component, void* window)
{
// Obtain a NativeWindow instance.
// Obtain an OHNativeWindow instance.
OHNativeWindow* nativeWindow = window;
// ...
}
void DispatchTouchEventCB(OH_NativeXComponent* component, void* window)
{
// Obtain a NativeWindow instance.
// Obtain an OHNativeWindow instance.
OHNativeWindow* nativeWindow = window;
// ...
}
......@@ -96,38 +91,30 @@ The following describes how to use the NAPI provided by **NativeWindow** to requ
OH_NativeXComponent_RegisterCallback(nativeXComponent, &callback_);
```
2. Set the attributes of a native window buffer by using **OH_NativeWindow_NativeWindowHandleOpt**.
2. Set the attributes of an **OHNativeWindowBuffer** by using **OH_NativeWindow_NativeWindowHandleOpt**.
```c++
// Set the read and write scenarios of the native window buffer.
int code = SET_USAGE;
int32_t usage = BUFFER_USAGE_CPU_READ | BUFFER_USAGE_CPU_WRITE | BUFFER_USAGE_MEM_DMA;
int32_t ret = OH_NativeWindow_NativeWindowHandleOpt(nativeWindow, code, usage);
// Set the width and height of the native window buffer.
// Set the width and height of the OHNativeWindowBuffer.
code = SET_BUFFER_GEOMETRY;
int32_t width = 0x100;
int32_t height = 0x100;
ret = OH_NativeWindow_NativeWindowHandleOpt(nativeWindow, code, width, height);
// Set the step of the native window buffer.
// Set the step of the OHNativeWindowBuffer.
code = SET_STRIDE;
int32_t stride = 0x8;
ret = OH_NativeWindow_NativeWindowHandleOpt(nativeWindow, code, stride);
// Set the format of the native window buffer.
code = SET_FORMAT;
int32_t format = PIXEL_FMT_RGBA_8888;
ret = OH_NativeWindow_NativeWindowHandleOpt(nativeWindow, code, format);
```
3. Request a native window buffer from the graphics queue.
3. Request an **OHNativeWindowBuffer** from the graphics queue.
```c++
struct NativeWindowBuffer* buffer = nullptr;
OHNativeWindowBuffer* buffer = nullptr;
int fenceFd;
// Obtain the NativeWindowBuffer instance by calling OH_NativeWindow_NativeWindowRequestBuffer.
// Obtain the OHNativeWindowBuffer instance by calling OH_NativeWindow_NativeWindowRequestBuffer.
OH_NativeWindow_NativeWindowRequestBuffer(nativeWindow_, &buffer, &fenceFd);
// Obtain the buffer handle by calling OH_NativeWindow_GetNativeBufferHandleFromNative.
BufferHandle* bufferHandle = OH_NativeWindow_GetNativeBufferHandleFromNative(buffer);
```
4. Write the produced content to the native window buffer.
4. Write the produced content to the **OHNativeWindowBuffer**.
```c++
auto image = static_cast<uint8_t *>(buffer->sfbuffer->GetVirAddr());
static uint32_t value = 0x00;
......@@ -141,9 +128,9 @@ The following describes how to use the NAPI provided by **NativeWindow** to requ
}
```
5. Flush the native window buffer to the graphics queue.
5. Flush the **OHNativeWindowBuffer** to the graphics queue.
```c++
// Set the refresh region. If Rect in Region is a null pointer or rectNumber is 0, all contents in the native window buffer are changed.
// Set the refresh region. If Rect in Region is a null pointer or rectNumber is 0, all contents in the OHNativeWindowBuffer are changed.
Region region{nullptr, 0};
// Flush the buffer to the consumer through OH_NativeWindow_NativeWindowFlushBuffer, for example, by displaying it on the screen.
OH_NativeWindow_NativeWindowFlushBuffer(nativeWindow_, buffer, fenceFd, region);
......
# Vulkan Development
## When to Use
Vulkan is a set of graphics APIs for 2D and 3D rendering. Creating a **VkSurfaceKHR** instance is a key step, since **VkSurfaceKHR** work with the **OHNativeWindow** module to implement buffer recycling.
A **VkSurfaceKHR** instance is obtained through an **OHNativeWindow**, which is obtained from the **\<XComponent>**. Therefore, the **OHNativeWindow** module must be used together with the **XComponent** and **NativeWindow** modules.
## Available APIs
| API| Description|
| -------- | -------- |
| vkCreateSurfaceOHOS (VkInstance instance, const VkSurfaceCreateInfoOHOS\* pCreateInfo, const VkAllocationCallbacks\* pAllocator, VkSurfaceKHR\* pSurface) | Creates a **VkSurfaceKHR** instance.|
For details about the APIs, see [Vulkan](../reference/native-lib/third_party_vulkan/vulkan-symbol.md).
## How to Develop
The following steps illustrate how to create a **VkSurfaceKHR** instance.
**Header File**
```c++
#include <ace/xcomponent/native_interface_xcomponent.h>
#include <native_window/external_window.h>
#include <vulkan/vulkan.h>
```
1. Create a Vulkan instance.
```c++
VkInstance instance = VK_NULL_HANDLE;
VkApplicationInfo appInfo = {};
appInfo.sType = VK_STRUCTURE_TYPE_APPLICATION_INFO;
appInfo.pApplicationName = "vulkanExample";
appInfo.pEngineName = "vulkanExample";
appInfo.apiVersion = VK_API_VERSION_1_3;
VkInstanceCreateInfo instanceCreateInfo = {};
instanceCreateInfo.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO;
instanceCreateInfo.pNext = NULL;
instanceCreateInfo.pApplicationInfo = &appInfo;
std::vector<const char*> instanceExtensions = {
VK_KHR_SURFACE_EXTENSION_NAME,
VK_OHOS_SURFACE_EXTENSION_NAME // Surface extension.
};
instanceCreateInfo.enabledExtensionCount = static_cast<uint32_t>(instanceExtensions.size());
instanceCreateInfo.ppEnabledExtensionNames = instanceExtensions.data();
vkCreateInstance(&instanceCreateInfo, nullptr, &instance);
```
2. Obtain an **OHNativeWindow** instance.
The **OHNativeWindow** instance is obtained from the **\<XComponent>**. For details about how to use the **\<XComponent>**, see [XComponent](../ui/arkts-common-components-xcomponent.md) and [XComponent Development](xcomponent-guidelines.md).
1. Add an **\<XComponent>** to **ets/pages/Index.ets**.
```ts
XComponent({
id: 'xcomponentId',
type: 'surface',
libraryname: 'entry'
})
.margin({ bottom: 20 })
.width(360)
.height(360)
```
2. Obtain an **OHNativeWindow** instance from the **\<XComponent>**.
```c++
// Callback function of the \<XComponent> triggered when a surface is created.
void OnSurfaceCreatedCB(OH_NativeXComponent *component, void *window) {
// You can obtain an OHNativeWindow instance from the callback function.
OHNativeWindow* nativeWindow = static_cast<OHNativeWindow*>(window);
}
EXTERN_C_START
static napi_value Init(napi_env env, napi_value exports)
{
napi_property_descriptor desc[] = {
{ "add", nullptr, Add, nullptr, nullptr, nullptr, napi_default, nullptr }
};
napi_define_properties(env, exports, sizeof(desc) / sizeof(desc[0]), desc);
// Declare an XComponent callback.
OH_NativeXComponent_Callback callback;
// Register the OnSurfaceCreated callback function.
callback.OnSurfaceCreated = OnSurfaceCreatedCB;
char idStr[OH_XCOMPONENT_ID_LEN_MAX + 1] = {};
uint64_t idSize = OH_XCOMPONENT_ID_LEN_MAX + 1;
napi_value exportInstance = nullptr;
OH_NativeXComponent *nativeXComponent = nullptr;
// Obtain a native XComponent.
napi_get_named_property(env, exports, OH_NATIVE_XCOMPONENT_OBJ, &exportInstance);
napi_unwrap(env, exportInstance, reinterpret_cast<void **>(&nativeXComponent));
// Register the callback function for the native XComponent.
OH_NativeXComponent_RegisterCallback(nativeXComponent, &callback);
return exports;
}
```
3. Create a **VkSurfaceKHR** instance.
```c++
VkSurfaceKHR surface = VK_NULL_HANDLE;
VkSurfaceCreateInfoOHOS surfaceCreateInfo = {};
surfaceCreateInfo.sType = VK_STRUCTURE_TYPE_SURFACE_CREATE_INFO_OHOS;
surfaceCreateInfo.window = nativeWindow; // nativeWindow is obtained from the OnSurfaceCreatedCB callback function in the previous step.
int err = vkCreateSurfaceOHOS(instance, &surfaceCreateInfo, NULL, &surface);
if (err != VK_SUCCESS) {
std::cout << "Could not create surface!" << std::endl;
}
```
For details about how to use Vulkan, visit the [Vulkan official website](https://www.vulkan.org/).
......@@ -4,6 +4,16 @@
- [Common Events of the Bundle Management Subsystem](commonEvent-bundleManager.md)
- [Common Events of the Notification Service](commonEvent-ans.md)
- [Common Events of the Resource Scheduler Subsystem](commonEvent-resourceschedule.md)
- [Common Events of the Window Management Subsystem](commonEvent-window.md)
- [Common Events of the Network Management Subsystem](commonEvent-netmanager.md)
- [Common Events of the SMS Application](commonEvent-mms.md)
- [Common Events of the Telephony Subsystem](commonEvent-telephony.md)
- [Common Events of the Power Management Subsystem](commonEvent-powermgr.md)
- [Common Events of the NFC Subsystem](commonEvent-nfc.md)
- [Common Events of the Wi-Fi Subsystem](commonEvent-wifi.md)
- [Common Events of the USB Subsystem](commonEvent-usb.md)
- [Common Events of the File Management Subsystem](commonEvent-filemanagement.md)
- [Common Events of the Theme Framework - Lock Screen](commonEvent-screenlock.md)
- [Common Events of the Time and Time Zone Subsystem](commonEvent-time.md)
- [Common Events of the Account Subsystem](commonEvent-account.md)
# Enterprise Device Management Overview (Available Only for System Applications)
# Enterprise Device Management Overview (for System Applications Only)
## Overview
OpenHarmony provides Enterprise Device Management APIs to support enterprise APIs. You can use the APIs to implement system-level management and configuration of employee devices. For example, the IT personnel need to install enterprise applications, set security policies, set enterprise email addresses, access enterprise networks, and remotely restore factory settings (to clear lost or stolen device data).
......
......@@ -29,8 +29,8 @@
- [HuksTypeApi](_huks_type_api.md)
- [Init](init.md)
- [Memory](memory.md)
- [UsbDdk](_usb_ddk.md)
- [Hitrace](_hitrace.md)
- [Vulkan](_vulkan.md)
- Header Files
- [drawing_bitmap.h](drawing__bitmap_8h.md)
- [drawing_brush.h](drawing__brush_8h.md)
......@@ -89,9 +89,8 @@
- [relational_store.h](relational__store_8h.md)
- [syscap_ndk.h](syscap__ndk_8h.md)
- [purgeable_memory.h](purgeable__memory_8h.md)
- [usb_ddk_api.h](usb__ddk__api_8h.md)
- [usb_ddk_types.h](usb__ddk__types_8h.md)
- [trace.h](trace_8h.md)
- [vulkan_ohos.h](vulkan__ohos_8h.md)
- Structs
- [OH_Drawing_BitmapFormat](_o_h___drawing___bitmap_format.md)
- [OH_NativeBuffer_Config](_o_h___native_buffer___config.md)
......@@ -137,14 +136,10 @@
- [OH_Rdb_Store](_o_h___rdb___store.md)
- [OH_VBucket](_o_h___v_bucket.md)
- [OH_VObject](_o_h___v_object.md)
- [UsbConfigDescriptor](_usb_config_descriptor.md)
- [UsbControlRequestSetup](_usb_control_request_setup.md)
- [UsbDdkConfigDescriptor](_usb_ddk_config_descriptor.md)
- [UsbDdkEndpointDescriptor](_usb_ddk_endpoint_descriptor.md)
- [UsbDdkInterface](_usb_ddk_interface.md)
- [UsbDdkInterfaceDescriptor](_usb_ddk_interface_descriptor.md)
- [UsbDeviceDescriptor](_usb_device_descriptor.md)
- [UsbDeviceMemMap](_usb_device_mem_map.md)
- [UsbEndpointDescriptor](_usb_endpoint_descriptor.md)
- [UsbInterfaceDescriptor](_usb_interface_descriptor.md)
- [UsbRequestPipe](_usb_request_pipe.md)
- [VkExternalFormatOHOS](_vk_external_format_o_h_o_s.md)
- [VkImportNativeBufferInfoOHOS](_vk_import_native_buffer_info_o_h_o_s.md)
- [VkMemoryGetNativeBufferInfoOHOS](_vk_memory_get_native_buffer_info_o_h_o_s.md)
- [VkNativeBufferFormatPropertiesOHOS](_vk_native_buffer_format_properties_o_h_o_s.md)
- [VkNativeBufferPropertiesOHOS](_vk_native_buffer_properties_o_h_o_s.md)
- [VkNativeBufferUsageOHOS](_vk_native_buffer_usage_o_h_o_s.md)
- [VkSurfaceCreateInfoOHOS](_vk_surface_create_info_o_h_o_s.md)
# VkExternalFormatOHOS
## Overview
**VkExternalFormatOHOS** defines an externally defined format.
**Since**
10
**Related Modules**
[Vulkan](_vulkan.md)
## Summary
### Member Variables
| Name| Description|
| -------- | -------- |
| [sType](_vulkan.md#stype-77) | Struct type.|
| [pNext](_vulkan.md#pnext-77) | Pointer to the next-level struct.|
| [externalFormat](_vulkan.md#externalformat-22) | Externally defined format.|
# VkImportNativeBufferInfoOHOS
## Overview
**VkImportNativeBufferInfoOHOS** defines the pointer to an **OH_NativeBuffer** struct.
**Since**
10
**Related Modules**
[Vulkan](_vulkan.md)
## Summary
### Member Variables
| Name| Description|
| -------- | -------- |
| [sType](_vulkan.md#stype-57) | Struct type.|
| [pNext](_vulkan.md#pnext-57) | Pointer to the next-level struct.|
| [buffer](_vulkan.md#buffer) | Pointer to an **OH_NativeBuffer** struct.|
# VkMemoryGetNativeBufferInfoOHOS
## Overview
**VkMemoryGetNativeBufferInfoOHOS** defines a struct used to obtain an **OH_NativeBuffer** from the Vulkan memory.
**Since**
10
**Related Modules**
[Vulkan](_vulkan.md)
## Summary
### Member Variables
| Name| Description|
| -------- | -------- |
| [sType](_vulkan.md#stype-67) | Struct type.|
| [pNext](_vulkan.md#pnext-67) | Pointer to the next-level struct.|
| [memory](_vulkan.md#memory) | **VkDeviceMemory** instance.|
# VkNativeBufferFormatPropertiesOHOS
## Overview
**VkNativeBufferFormatPropertiesOHOS** defines the format properties of a **NaitveBuffer**.
**Since**
10
**Related Modules**
[Vulkan](_vulkan.md)
## Summary
### Member Variables
| Name| Description|
| -------- | -------- |
| [sType](_vulkan.md#stype-47) | Struct type.|
| [pNext](_vulkan.md#pnext-47) | Pointer to the next-level struct.|
| [format](_vulkan.md#format) | Format properties.|
| [externalFormat](_vulkan.md#externalformat-12) | Externally defined format.|
| [formatFeatures](_vulkan.md#formatfeatures) | Features of the externally defined format.|
| [samplerYcbcrConversionComponents](_vulkan.md#samplerycbcrconversioncomponents) | A group of VkComponentSwizzles.|
| [suggestedYcbcrModel](_vulkan.md#suggestedycbcrmodel) | Color model.|
| [suggestedYcbcrRange](_vulkan.md#suggestedycbcrrange) | Color value range.|
| [suggestedXChromaOffset](_vulkan.md#suggestedxchromaoffset) | X chrominance offset.|
| [suggestedYChromaOffset](_vulkan.md#suggestedychromaoffset) | Y chrominance offset.|
# VkNativeBufferPropertiesOHOS
## Overview
VkNativeBufferPropertiesOHOS defines the properties of a **NaitveBuffer**.
**Since**
10
**Related Modules**
[Vulkan](_vulkan.md)
## Summary
### Member Variables
| Name| Description|
| -------- | -------- |
| [sType](_vulkan.md#stype-37) | Struct type.|
| [pNext](_vulkan.md#pnext-37) | Pointer to the next-level struct.|
| [allocationSize](_vulkan.md#allocationsize) | Size of the occupied memory.|
| [memoryTypeBits](_vulkan.md#memorytypebits) | Memory type.|
# VkNativeBufferUsageOHOS
## Overview
**VkNativeBufferUsageOHOS** defines the usage of a **NativeBuffer**.
**Since**
10
**Related Modules**
[Vulkan](_vulkan.md)
## Summary
### Member Variables
| Name| Description|
| -------- | -------- |
| [sType](_vulkan.md#stype-27) | Struct type.|
| [pNext](_vulkan.md#pnext-27) | Pointer to the next-level struct.|
| [OHOSNativeBufferUsage](_vulkan.md#ohosnativebufferusage) | Usage of a **NativeBuffer**.|
# VkSurfaceCreateInfoOHOS
## Overview
**VkSurfaceCreateInfoOHOS** defines the parameters required for creating a Vulkan surface.
**Since**
10
**Related Modules**
[Vulkan](_vulkan.md)
## Summary
### Member Variables
| Name| Description|
| -------- | -------- |
| [sType](_vulkan.md#stype-17) | Struct type.|
| [pNext](_vulkan.md#pnext-17) | Pointer to the next-level struct.|
| [flags](_vulkan.md#flags) | Reserved flag type.|
| [window](_vulkan.md#window) | Pointer to an **OHNativeWindow** instance.|
# 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](vulkan__ohos_8h.md) | Declares the Vulkan interfaces extended by OpenHarmony.<br>File to include: &lt;vulkan/vulkan.h&gt;|
### Structs
| Name| Description|
| -------- | -------- |
| [VkSurfaceCreateInfoOHOS](_vk_surface_create_info_o_h_o_s.md) | Defines the parameters required for creating a Vulkan surface.|
| [VkNativeBufferUsageOHOS](_vk_native_buffer_usage_o_h_o_s.md) | Defines the usage of a **NativeBuffer**.|
| [VkNativeBufferPropertiesOHOS](_vk_native_buffer_properties_o_h_o_s.md) | Defines the properties of a **NativeBuffer**.|
| [VkNativeBufferFormatPropertiesOHOS](_vk_native_buffer_format_properties_o_h_o_s.md) | Defines the format properties of a **NativeBuffer**.|
| [VkImportNativeBufferInfoOHOS](_vk_import_native_buffer_info_o_h_o_s.md) | Defines the pointer to an **OH_NativeBuffer** struct.|
| [VkMemoryGetNativeBufferInfoOHOS](_vk_memory_get_native_buffer_info_o_h_o_s.md) | Defines a struct used to obtain an **OH_NativeBuffer** from the Vulkan memory.|
| [VkExternalFormatOHOS](_vk_external_format_o_h_o_s.md) | Defines an externally defined format.|
### Macros
| Name| Description|
| -------- | -------- |
| [VK_OHOS_surface](#vk_ohos_surface) 1 | Surface extension macro definition of OpenHarmony.|
| [VK_OHOS_SURFACE_SPEC_VERSION](#vk_ohos_surface_spec_version) 1 | Surface extension version of OpenHarmony.|
| [VK_OHOS_SURFACE_EXTENSION_NAME](#vk_ohos_surface_extension_name) "VK_OHOS_surface" | Surface extension name of OpenHarmony.|
| [VK_OHOS_external_memory](#vk_ohos_external_memory) 1 | External memory extension macro definition of OpenHarmony.|
| [VK_OHOS_EXTERNAL_MEMORY_SPEC_VERSION](#vk_ohos_external_memory_spec_version) 1 | External memory extension version of OpenHarmony.|
| [VK_OHOS_EXTERNAL_MEMORY_EXTENSION_NAME](#vk_ohos_external_memory_extension_name) "VK_OHOS_external_memory" | External memory extension name of OpenHarmony.|
### Types
| Name| Description|
| -------- | -------- |
| [OHNativeWindow](#ohnativewindow) | Defines an **OHNativeWindow**.|
| [VkSurfaceCreateFlagsOHOS](#vksurfacecreateflagsohos) | Defines the bit mask of the VkFlags type used for the creation of a Vulkan surface. It is a reserved flag type.|
| [VkSurfaceCreateInfoOHOS](#vksurfacecreateinfoohos) | Defines the parameters required for creating a Vulkan surface.|
| VkResult ([VKAPI_PTR *PFN_vkCreateSurfaceOHOS](#pfn_vkcreatesurfaceohos)) (VkInstance instance, const [VkSurfaceCreateInfoOHOS](_vk_surface_create_info_o_h_o_s.md) \*pCreateInfo, const VkAllocationCallbacks \*pAllocator, VkSurfaceKHR \*pSurface) | Defines the function pointer for creating a Vulkan surface.|
| [VkNativeBufferUsageOHOS](#vknativebufferusageohos) | Defines the usage of a **NativeBuffer**.|
| [VkNativeBufferPropertiesOHOS](#vknativebufferpropertiesohos) | Defines the properties of a **NativeBuffer**.|
| [VkNativeBufferFormatPropertiesOHOS](#vknativebufferformatpropertiesohos) | Defines the format properties of a **NativeBuffer**.|
| [VkImportNativeBufferInfoOHOS](#vkimportnativebufferinfoohos) | Defines the pointer to an **OH_NativeBuffer** struct.|
| [VkMemoryGetNativeBufferInfoOHOS](#vkmemorygetnativebufferinfoohos) | Defines a struct used to obtain an **OH_NativeBuffer** from the Vulkan memory.|
| [VkExternalFormatOHOS](#vkexternalformatohos) | Defines an externally defined format.|
| VkResult ([VKAPI_PTR *PFN_vkGetNativeBufferPropertiesOHOS](#pfn_vkgetnativebufferpropertiesohos)) (VkDevice device, const struct OH_NativeBuffer \*buffer, [VkNativeBufferPropertiesOHOS](_vk_native_buffer_properties_o_h_o_s.md) \*pProperties) | Defines a function pointer used to obtain **OH_NativeBuffer** properties.|
| VkResult ([VKAPI_PTR *PFN_vkGetMemoryNativeBufferOHOS](#pfn_vkgetmemorynativebufferohos)) (VkDevice device, const [VkMemoryGetNativeBufferInfoOHOS](_vk_memory_get_native_buffer_info_o_h_o_s.md) \*pInfo, struct OH_NativeBuffer \*\*pBuffer) | Defines a function pointer used to obtain an **OH_NativeBuffer** instance.|
### Functions
| Name| Description|
| -------- | -------- |
| [vkCreateSurfaceOHOS](#vkcreatesurfaceohos) (VkInstance instance, const VkSurfaceCreateInfoOHOS \*pCreateInfo, const VkAllocationCallbacks \*pAllocator, VkSurfaceKHR \*pSurface) | Creates a Vulkan surface.|
| [vkGetNativeBufferPropertiesOHOS](#vkgetnativebufferpropertiesohos) (VkDevice device, const struct OH_NativeBuffer \*buffer, VkNativeBufferPropertiesOHOS \*pProperties) | Obtains the properties of an **OH_NativeBuffer** instance.|
| [vkGetMemoryNativeBufferOHOS](#vkgetmemorynativebufferohos) (VkDevice device, const VkMemoryGetNativeBufferInfoOHOS \*pInfo, struct OH_NativeBuffer \*\*pBuffer) | Obtains an **OH_NativeBuffer** instance.|
### Variables
| Name| Description|
| -------- | -------- |
| [VkSurfaceCreateInfoOHOS::sType](#stype-17) | Struct type.|
| [VkSurfaceCreateInfoOHOS::pNext](#pnext-17) | Pointer to the next-level struct.|
| [VkSurfaceCreateInfoOHOS::flags](#flags) | Reserved flag type.|
| [VkSurfaceCreateInfoOHOS::window](#window) | Pointer to an **OHNativeWindow** instance.|
| [VkNativeBufferUsageOHOS::sType](#stype-27) | Struct type.|
| [VkNativeBufferUsageOHOS::pNext](#pnext-27) | Pointer to the next-level struct.|
| [VkNativeBufferUsageOHOS::OHOSNativeBufferUsage](#ohosnativebufferusage) | Usage of a **NativeBuffer**.|
| [VkNativeBufferPropertiesOHOS::sType](#stype-37) | Struct type.|
| [VkNativeBufferPropertiesOHOS::pNext](#pnext-37) | Pointer to the next-level struct.|
| [VkNativeBufferPropertiesOHOS::allocationSize](#allocationsize) | Size of the occupied memory.|
| [VkNativeBufferPropertiesOHOS::memoryTypeBits](#memorytypebits) | Memory type.|
| [VkNativeBufferFormatPropertiesOHOS::sType](#stype-47) | Struct type.|
| [VkNativeBufferFormatPropertiesOHOS::pNext](#pnext-47) | Pointer to the next-level struct.|
| [VkNativeBufferFormatPropertiesOHOS::format](#format) | Format properties.|
| [VkNativeBufferFormatPropertiesOHOS::externalFormat](#externalformat-12) | Externally defined format.|
| [VkNativeBufferFormatPropertiesOHOS::formatFeatures](#formatfeatures) | Features of the externally defined format.|
| [VkNativeBufferFormatPropertiesOHOS::samplerYcbcrConversionComponents](#samplerycbcrconversioncomponents) | A group of VkComponentSwizzles.|
| [VkNativeBufferFormatPropertiesOHOS::suggestedYcbcrModel](#suggestedycbcrmodel) | Color model.|
| [VkNativeBufferFormatPropertiesOHOS::suggestedYcbcrRange](#suggestedycbcrrange) | Color value range.|
| [VkNativeBufferFormatPropertiesOHOS::suggestedXChromaOffset](#suggestedxchromaoffset) | X chrominance offset.|
| [VkNativeBufferFormatPropertiesOHOS::suggestedYChromaOffset](#suggestedychromaoffset) | Y chrominance offset.|
| [VkImportNativeBufferInfoOHOS::sType](#stype-57) | Struct type.|
| [VkImportNativeBufferInfoOHOS::pNext](#pnext-57) | Pointer to the next-level struct.|
| [VkImportNativeBufferInfoOHOS::buffer](#buffer) | Pointer to an **OH_NativeBuffer** struct.|
| [VkMemoryGetNativeBufferInfoOHOS::sType](#stype-67) | Struct type.|
| [VkMemoryGetNativeBufferInfoOHOS::pNext](#pnext-67) | Pointer to the next-level struct.|
| [VkMemoryGetNativeBufferInfoOHOS::memory](#memory) | **VkDeviceMemory** instance.|
| [VkExternalFormatOHOS::sType](#stype-77) | Struct type.|
| [VkExternalFormatOHOS::pNext](#pnext-77) | Pointer to the next-level struct.|
| [VkExternalFormatOHOS::externalFormat](#externalformat-22) | 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 [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.
# vulkan_ohos.h
## Overview
The **vulkan_ohos.h** file declares the Vulkan interfaces extended by OpenHarmony. File to include: &lt;vulkan/vulkan.h&gt;
**Since**
10
**Related Modules**
[Vulkan](_vulkan.md)
## Summary
### Structs
| Name| Description|
| -------- | -------- |
| [VkSurfaceCreateInfoOHOS](_vk_surface_create_info_o_h_o_s.md) | Defines the parameters required for creating a Vulkan surface.|
| [VkNativeBufferUsageOHOS](_vk_native_buffer_usage_o_h_o_s.md) | Defines the usage of a **NativeBuffer**.|
| [VkNativeBufferPropertiesOHOS](_vk_native_buffer_properties_o_h_o_s.md) | Defines the properties of a **NativeBuffer**.|
| [VkNativeBufferFormatPropertiesOHOS](_vk_native_buffer_format_properties_o_h_o_s.md) | Defines the format properties of a **NativeBuffer**.|
| [VkImportNativeBufferInfoOHOS](_vk_import_native_buffer_info_o_h_o_s.md) | Defines the pointer to an **OH_NativeBuffer** struct.|
| [VkMemoryGetNativeBufferInfoOHOS](_vk_memory_get_native_buffer_info_o_h_o_s.md) | Defines a struct used to obtain an **OH_NativeBuffer** from the Vulkan memory.|
| [VkExternalFormatOHOS](_vk_external_format_o_h_o_s.md) | Defines an externally defined format.|
### Macros
| Name| Description|
| -------- | -------- |
| [VK_OHOS_surface](_vulkan.md#vk_ohos_surface) 1 | Surface extension macro definition of OpenHarmony.|
| [VK_OHOS_SURFACE_SPEC_VERSION](_vulkan.md#vk_ohos_surface_spec_version) 1 | Surface extension version of OpenHarmony.|
| [VK_OHOS_SURFACE_EXTENSION_NAME](_vulkan.md#vk_ohos_surface_extension_name) "VK_OHOS_surface" | Surface extension name of OpenHarmony.|
| [VK_OHOS_external_memory](_vulkan.md#vk_ohos_external_memory) 1 | External memory extension macro definition of OpenHarmony.|
| [VK_OHOS_EXTERNAL_MEMORY_SPEC_VERSION](_vulkan.md#vk_ohos_external_memory_spec_version) 1 | External memory extension version of OpenHarmony.|
| [VK_OHOS_EXTERNAL_MEMORY_EXTENSION_NAME](_vulkan.md#vk_ohos_external_memory_extension_name) "VK_OHOS_external_memory" | External memory extension name of OpenHarmony.|
### Types
| Name| Description|
| -------- | -------- |
| [OHNativeWindow](_vulkan.md#ohnativewindow) | Defines an **OHNativeWindow**.|
| [VkSurfaceCreateFlagsOHOS](_vulkan.md#vksurfacecreateflagsohos) | Defines the bit mask of the VkFlags type used for the creation of a Vulkan surface. It is a reserved flag type.|
| [VkSurfaceCreateInfoOHOS](_vulkan.md#vksurfacecreateinfoohos) | Defines the parameters required for creating a Vulkan surface.|
| VkResult ([VKAPI_PTR *PFN_vkCreateSurfaceOHOS](_vulkan.md#pfn_vkcreatesurfaceohos)) (VkInstance instance, const [VkSurfaceCreateInfoOHOS](_vk_surface_create_info_o_h_o_s.md) \*pCreateInfo, const VkAllocationCallbacks \*pAllocator, VkSurfaceKHR \*pSurface) | Defines the function pointer for creating a Vulkan surface.|
| [VkNativeBufferUsageOHOS](_vulkan.md#vknativebufferusageohos) | Defines the usage of a **NativeBuffer**.|
| [VkNativeBufferPropertiesOHOS](_vulkan.md#vknativebufferpropertiesohos) | Defines the properties of a **NativeBuffer**.|
| [VkNativeBufferFormatPropertiesOHOS](_vulkan.md#vknativebufferformatpropertiesohos) | Defines the format properties of a **NativeBuffer**.|
| [VkImportNativeBufferInfoOHOS](_vulkan.md#vkimportnativebufferinfoohos) | Defines the pointer to an **OH_NativeBuffer** struct.|
| [VkMemoryGetNativeBufferInfoOHOS](_vulkan.md#vkmemorygetnativebufferinfoohos) | Defines a struct used to obtain an **OH_NativeBuffer** from the Vulkan memory.|
| [VkExternalFormatOHOS](_vulkan.md#vkexternalformatohos) | Defines an externally defined format.|
| VkResult ([VKAPI_PTR *PFN_vkGetNativeBufferPropertiesOHOS](_vulkan.md#pfn_vkgetnativebufferpropertiesohos)) (VkDevice device, const struct OH_NativeBuffer \*buffer, [VkNativeBufferPropertiesOHOS](_vk_native_buffer_properties_o_h_o_s.md) \*pProperties) | Defines a function pointer used to obtain **OH_NativeBuffer** properties.|
| VkResult ([VKAPI_PTR *PFN_vkGetMemoryNativeBufferOHOS](_vulkan.md#pfn_vkgetmemorynativebufferohos)) (VkDevice device, const [VkMemoryGetNativeBufferInfoOHOS](_vk_memory_get_native_buffer_info_o_h_o_s.md) \*pInfo, struct OH_NativeBuffer \*\*pBuffer) | Defines a function pointer used to obtain an **OH_NativeBuffer** instance.|
### Functions
| Name| Description|
| -------- | -------- |
| [vkCreateSurfaceOHOS](_vulkan.md#vkcreatesurfaceohos) (VkInstance instance, const [VkSurfaceCreateInfoOHOS](_vk_surface_create_info_o_h_o_s.md) \*pCreateInfo, const VkAllocationCallbacks \*pAllocator, VkSurfaceKHR \*pSurface) | Creates a Vulkan surface.|
| [vkGetNativeBufferPropertiesOHOS](_vulkan.md#vkgetnativebufferpropertiesohos) (VkDevice device, const struct OH_NativeBuffer \*buffer, [VkNativeBufferPropertiesOHOS](_vk_native_buffer_properties_o_h_o_s.md) \*pProperties) | Obtains the properties of an **OH_NativeBuffer** instance.|
| [vkGetMemoryNativeBufferOHOS](_vulkan.md#vkgetmemorynativebufferohos) (VkDevice device, const [VkMemoryGetNativeBufferInfoOHOS](_vk_memory_get_native_buffer_info_o_h_o_s.md) \*pInfo, struct OH_NativeBuffer \*\*pBuffer) | Obtains an **OH_NativeBuffer** instance.|
# Native API Standard Libraries
- [libc](third_party_libc/musl.md)
- [libc++](third_party_libc/cpp.md)
- [c++](third_party_libc/cpp.md)
- [Node-API](third_party_napi/napi.md)
- [libuv](third_party_libuv/libuv.md)
- [OpenSL ES](third_party_opensles/opensles.md)
- [OpenGL ES](third_party_opengl/opengles.md)
- [EGL](third_party_opengl/egl.md)
- [zlib](third_party_zlib/zlib.md)
- [Vulkan](third_party_vulkan/vulkan.md)
- Appendix
- [Native API Symbols Not Exported](third_party_libc/musl-peculiar-symbol.md)
- [Native API Symbols That May Fail to Be Invoked Due to Permission Control](third_party_libc/musl-permission-control-symbol.md)
- [EGL Symbols Exported from Native APIs](third_party_opengl/egl-symbol.md)
- [OpenGL ES 3.0 Symbols Exported from Native APIs](third_party_opengl/openglesv3-symbol.md)
- [OpenSL ES Interfaces Supported by Native APIs](third_party_opensles/opensles.md)
\ No newline at end of file
- [libc Symbols Not Exported](third_party_libc/musl-peculiar-symbol.md)
- [libc Symbols That May Fail to Call Due to Permission Control](third_party_libc/musl-permission-control-symbol.md)
- [EGL Symbols Exported](third_party_opengl/egl-symbol.md)
- [OpenGL ES 3.0 Symbols Exported](third_party_opengl/openglesv3-symbol.md)
- [Vulkan Symbols Exported](third_party_vulkan/vulkan-symbol.md)
# Native API Symbols Not Exported
# libc Symbols Not Exported
|Type|Symbol|Remarks|
| --- | --- | --- |
......
# Native API Symbols That May Fail to Be Invoked Due to Permission Control
# libc Symbols That May Fail to Call Due to Permission Control
Before using the following interfaces, ensure that the application entity has the corresponding permission.
......
......@@ -61,6 +61,6 @@ param set musl.log.ld.app.{app_name} false
```
## Interfaces Not Supported by musl
[Native API Symbols Not Exported](musl-peculiar-symbol.md)
[Native API Symbols That May Fail to Be Invoked Due to Permission Control](musl-permission-control-symbol.md)
[libc Symbols Not Exported](musl-peculiar-symbol.md)
[libc Symbols That May Fail to Call Due to Permission Control](musl-permission-control-symbol.md)
# EGL Symbols Exported from Native APIs
# EGL Symbols Exported
|Type|Symbol|Remarks|
| --- | --- | --- |
......
......@@ -5,5 +5,5 @@ EGL is an interface between Khronos rendering APIs (such as OpenGL ES and OpenVG
## **Symbols Exported from the NAPI Library**
[EGL Symbols Exported fom Native APIs](egl-symbol.md)
[EGL Symbols Exported](egl-symbol.md)
......@@ -8,5 +8,5 @@ OpenGL ES 3.0
## **Symbols Exported from the NAPI Library**
[OpenGL ES 3.0 Symbols Exported from Native APIs](openglesv3-symbol.md)
[OpenGL ES 3.0 Symbols Exported](openglesv3-symbol.md)
# OpenGL ES 3.0 Symbols Exported from Native APIs
# OpenGL ES 3.0 Symbols Exported
|Type|Symbol|Remarks|
| --- | --- | --- |
......
# Vulkan Symbols Exported
## Standard Library Interfaces
|Type|Symbol|Remarks|
| --- | --- | --- |
|FUNC|vkAcquireNextImage2KHR|
|FUNC|vkAcquireNextImageKHR|
|FUNC|vkAllocateCommandBuffers|
|FUNC|vkAllocateDescriptorSets|
|FUNC|vkAllocateMemory|
|FUNC|vkBeginCommandBuffer|
|FUNC|vkBindBufferMemory|
|FUNC|vkBindBufferMemory2|
|FUNC|vkBindImageMemory|
|FUNC|vkBindImageMemory2|
|FUNC|vkCmdBeginQuery|
|FUNC|vkCmdBeginRendering|
|FUNC|vkCmdBeginRenderPass|
|FUNC|vkCmdBeginRenderPass2|
|FUNC|vkCmdBindDescriptorSets|
|FUNC|vkCmdBindIndexBuffer|
|FUNC|vkCmdBindPipeline|
|FUNC|vkCmdBindVertexBuffers|
|FUNC|vkCmdBindVertexBuffers2|
|FUNC|vkCmdBlitImage|
|FUNC|vkCmdBlitImage2|
|FUNC|vkCmdClearAttachments|
|FUNC|vkCmdClearColorImage|
|FUNC|vkCmdClearDepthStencilImage|
|FUNC|vkCmdCopyBuffer|
|FUNC|vkCmdCopyBuffer2|
|FUNC|vkCmdCopyBufferToImage|
|FUNC|vkCmdCopyBufferToImage2|
|FUNC|vkCmdCopyImage|
|FUNC|vkCmdCopyImage2|
|FUNC|vkCmdCopyImageToBuffer|
|FUNC|vkCmdCopyImageToBuffer2|
|FUNC|vkCmdCopyQueryPoolResults|
|FUNC|vkCmdDispatch|
|FUNC|vkCmdDispatchBase|
|FUNC|vkCmdDispatchIndirect|
|FUNC|vkCmdDraw|
|FUNC|vkCmdDrawIndexed|
|FUNC|vkCmdDrawIndexedIndirect|
|FUNC|vkCmdDrawIndexedIndirectCount|
|FUNC|vkCmdDrawIndirect|
|FUNC|vkCmdDrawIndirectCount|
|FUNC|vkCmdEndQuery|
|FUNC|vkCmdEndRendering|
|FUNC|vkCmdEndRenderPass|
|FUNC|vkCmdEndRenderPass2|
|FUNC|vkCmdExecuteCommands|
|FUNC|vkCmdFillBuffer|
|FUNC|vkCmdNextSubpass|
|FUNC|vkCmdNextSubpass2|
|FUNC|vkCmdPipelineBarrier|
|FUNC|vkCmdPipelineBarrier2|
|FUNC|vkCmdPushConstants|
|FUNC|vkCmdResetEvent|
|FUNC|vkCmdResetEvent2|
|FUNC|vkCmdResetQueryPool|
|FUNC|vkCmdResolveImage|
|FUNC|vkCmdResolveImage2|
|FUNC|vkCmdSetBlendConstants|
|FUNC|vkCmdSetCullMode|
|FUNC|vkCmdSetDepthBias|
|FUNC|vkCmdSetDepthBiasEnable|
|FUNC|vkCmdSetDepthBounds|
|FUNC|vkCmdSetDepthBoundsTestEnable|
|FUNC|vkCmdSetDepthCompareOp|
|FUNC|vkCmdSetDepthTestEnable|
|FUNC|vkCmdSetDepthWriteEnable|
|FUNC|vkCmdSetDeviceMask|
|FUNC|vkCmdSetEvent|
|FUNC|vkCmdSetEvent2|
|FUNC|vkCmdSetFrontFace|
|FUNC|vkCmdSetLineWidth|
|FUNC|vkCmdSetPrimitiveRestartEnable|
|FUNC|vkCmdSetPrimitiveTopology|
|FUNC|vkCmdSetRasterizerDiscardEnable|
|FUNC|vkCmdSetScissor|
|FUNC|vkCmdSetScissorWithCount|
|FUNC|vkCmdSetStencilCompareMask|
|FUNC|vkCmdSetStencilOp|
|FUNC|vkCmdSetStencilReference|
|FUNC|vkCmdSetStencilTestEnable|
|FUNC|vkCmdSetStencilWriteMask|
|FUNC|vkCmdSetViewport|
|FUNC|vkCmdSetViewportWithCount|
|FUNC|vkCmdUpdateBuffer|
|FUNC|vkCmdWaitEvents|
|FUNC|vkCmdWaitEvents2|
|FUNC|vkCmdWriteTimestamp|
|FUNC|vkCmdWriteTimestamp2|
|FUNC|vkCreateBuffer|
|FUNC|vkCreateBufferView|
|FUNC|vkCreateCommandPool|
|FUNC|vkCreateComputePipelines|
|FUNC|vkCreateDescriptorPool|
|FUNC|vkCreateDescriptorSetLayout|
|FUNC|vkCreateDescriptorUpdateTemplate|
|FUNC|vkCreateDevice|
|FUNC|vkCreateDisplayModeKHR|
|FUNC|vkCreateDisplayPlaneSurfaceKHR|
|FUNC|vkCreateEvent|
|FUNC|vkCreateFence|
|FUNC|vkCreateFramebuffer|
|FUNC|vkCreateGraphicsPipelines|
|FUNC|vkCreateImage|
|FUNC|vkCreateImageView|
|FUNC|vkCreateInstance|
|FUNC|vkCreatePipelineCache|
|FUNC|vkCreatePipelineLayout|
|FUNC|vkCreatePrivateDataSlot|
|FUNC|vkCreateQueryPool|
|FUNC|vkCreateRenderPass|
|FUNC|vkCreateRenderPass2|
|FUNC|vkCreateSampler|
|FUNC|vkCreateSamplerYcbcrConversion|
|FUNC|vkCreateSemaphore|
|FUNC|vkCreateShaderModule|
|FUNC|vkCreateSharedSwapchainsKHR|
|FUNC|vkCreateSwapchainKHR|
|FUNC|vkDestroyBuffer|
|FUNC|vkDestroyBufferView|
|FUNC|vkDestroyCommandPool|
|FUNC|vkDestroyDescriptorPool|
|FUNC|vkDestroyDescriptorSetLayout|
|FUNC|vkDestroyDescriptorUpdateTemplate|
|FUNC|vkDestroyDevice|
|FUNC|vkDestroyEvent|
|FUNC|vkDestroyFence|
|FUNC|vkDestroyFramebuffer|
|FUNC|vkDestroyImage|
|FUNC|vkDestroyImageView|
|FUNC|vkDestroyInstance|
|FUNC|vkDestroyPipeline|
|FUNC|vkDestroyPipelineCache|
|FUNC|vkDestroyPipelineLayout|
|FUNC|vkDestroyPrivateDataSlot|
|FUNC|vkDestroyQueryPool|
|FUNC|vkDestroyRenderPass|
|FUNC|vkDestroySampler|
|FUNC|vkDestroySamplerYcbcrConversion|
|FUNC|vkDestroySemaphore|
|FUNC|vkDestroyShaderModule|
|FUNC|vkDestroySurfaceKHR|
|FUNC|vkDestroySwapchainKHR|
|FUNC|vkDeviceWaitIdle|
|FUNC|vkEndCommandBuffer|
|FUNC|vkEnumerateDeviceExtensionProperties|
|FUNC|vkEnumerateDeviceLayerProperties|
|FUNC|vkEnumerateInstanceExtensionProperties|
|FUNC|vkEnumerateInstanceLayerProperties|
|FUNC|vkEnumerateInstanceVersion|
|FUNC|vkEnumeratePhysicalDeviceGroups|
|FUNC|vkEnumeratePhysicalDevices|
|FUNC|vkFlushMappedMemoryRanges|
|FUNC|vkFreeCommandBuffers|
|FUNC|vkFreeDescriptorSets|
|FUNC|vkFreeMemory|
|FUNC|vkGetBufferDeviceAddress|
|FUNC|vkGetBufferMemoryRequirements|
|FUNC|vkGetBufferMemoryRequirements2|
|FUNC|vkGetBufferOpaqueCaptureAddress|
|FUNC|vkGetDescriptorSetLayoutSupport|
|FUNC|vkGetDeviceBufferMemoryRequirements|
|FUNC|vkGetDeviceGroupPeerMemoryFeatures|
|FUNC|vkGetDeviceGroupPresentCapabilitiesKHR|
|FUNC|vkGetDeviceGroupSurfacePresentModesKHR|
|FUNC|vkGetDeviceImageMemoryRequirements|
|FUNC|vkGetDeviceImageSparseMemoryRequirements|
|FUNC|vkGetDeviceMemoryCommitment|
|FUNC|vkGetDeviceMemoryOpaqueCaptureAddress|
|FUNC|vkGetDeviceProcAddr|
|FUNC|vkGetDeviceQueue|
|FUNC|vkGetDeviceQueue2|
|FUNC|vkGetDisplayModeProperties2KHR|
|FUNC|vkGetDisplayModePropertiesKHR|
|FUNC|vkGetDisplayPlaneCapabilities2KHR|
|FUNC|vkGetDisplayPlaneCapabilitiesKHR|
|FUNC|vkGetDisplayPlaneSupportedDisplaysKHR|
|FUNC|vkGetEventStatus|
|FUNC|vkGetFenceStatus|
|FUNC|vkGetImageMemoryRequirements|
|FUNC|vkGetImageMemoryRequirements2|
|FUNC|vkGetImageSparseMemoryRequirements|
|FUNC|vkGetImageSparseMemoryRequirements2|
|FUNC|vkGetImageSubresourceLayout|
|FUNC|vkGetInstanceProcAddr|
|FUNC|vkGetPhysicalDeviceDisplayPlaneProperties2KHR|
|FUNC|vkGetPhysicalDeviceDisplayPlanePropertiesKHR|
|FUNC|vkGetPhysicalDeviceDisplayProperties2KHR|
|FUNC|vkGetPhysicalDeviceDisplayPropertiesKHR|
|FUNC|vkGetPhysicalDeviceExternalBufferProperties|
|FUNC|vkGetPhysicalDeviceExternalFenceProperties|
|FUNC|vkGetPhysicalDeviceExternalSemaphoreProperties|
|FUNC|vkGetPhysicalDeviceFeatures|
|FUNC|vkGetPhysicalDeviceFeatures2|
|FUNC|vkGetPhysicalDeviceFormatProperties|
|FUNC|vkGetPhysicalDeviceFormatProperties2|
|FUNC|vkGetPhysicalDeviceImageFormatProperties|
|FUNC|vkGetPhysicalDeviceImageFormatProperties2|
|FUNC|vkGetPhysicalDeviceMemoryProperties|
|FUNC|vkGetPhysicalDeviceMemoryProperties2|
|FUNC|vkGetPhysicalDevicePresentRectanglesKHR|
|FUNC|vkGetPhysicalDeviceProperties|
|FUNC|vkGetPhysicalDeviceProperties2|
|FUNC|vkGetPhysicalDeviceQueueFamilyProperties|
|FUNC|vkGetPhysicalDeviceQueueFamilyProperties2|
|FUNC|vkGetPhysicalDeviceSparseImageFormatProperties|
|FUNC|vkGetPhysicalDeviceSparseImageFormatProperties2|
|FUNC|vkGetPhysicalDeviceSurfaceCapabilities2KHR|
|FUNC|vkGetPhysicalDeviceSurfaceCapabilitiesKHR|
|FUNC|vkGetPhysicalDeviceSurfaceFormats2KHR|
|FUNC|vkGetPhysicalDeviceSurfaceFormatsKHR|
|FUNC|vkGetPhysicalDeviceSurfacePresentModesKHR|
|FUNC|vkGetPhysicalDeviceSurfaceSupportKHR|
|FUNC|vkGetPhysicalDeviceToolProperties|
|FUNC|vkGetPipelineCacheData|
|FUNC|vkGetPrivateData|
|FUNC|vkGetQueryPoolResults|
|FUNC|vkGetRenderAreaGranularity|
|FUNC|vkGetSemaphoreCounterValue|
|FUNC|vkGetSwapchainImagesKHR|
|FUNC|vkInvalidateMappedMemoryRanges|
|FUNC|vkMapMemory|
|FUNC|vkMergePipelineCaches|
|FUNC|vkQueueBindSparse|
|FUNC|vkQueuePresentKHR|
|FUNC|vkQueueSubmit|
|FUNC|vkQueueSubmit2|
|FUNC|vkQueueWaitIdle|
|FUNC|vkResetCommandBuffer|
|FUNC|vkResetCommandPool|
|FUNC|vkResetDescriptorPool|
|FUNC|vkResetEvent|
|FUNC|vkResetFences|
|FUNC|vkResetQueryPool|
|FUNC|vkSetEvent|
|FUNC|vkSetPrivateData|
|FUNC|vkSignalSemaphore|
|FUNC|vkTrimCommandPool|
|FUNC|vkUnmapMemory|
|FUNC|vkUpdateDescriptorSets|
|FUNC|vkUpdateDescriptorSetWithTemplate|
|FUNC|vkWaitForFences|
|FUNC|vkWaitSemaphores|
## New Interfaces in OpenHarmony
|Type|Symbol|Remarks|
| --- | --- | --- |
|FUNC|vkCreateSurfaceOHOS|
|FUNC|vkGetNativeBufferPropertiesOHOS|
|FUNC|vkGetMemoryNativeBufferOHOS|
For details about the new interfaces, see [Vulkan](../../native-apis/_vulkan.md).
# Vulkan
[Vulkan](https://www.vulkan.org/) is a set of 2D and 3D rendering APIs that feature cross-platform and high-performance. OpenHarmony now supports Vulkan v1.3.231.
## Supported Capabilities
Some interfaces of Vulkan v1.3.231 are supported. For details, see [Vulkan Symbols Exported](vulkan-symbol.md).
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册