目录

abr_base.h

Overview

Declares ABR APIs used for different graphics APIs.

File to include: <graphics_game_sdk/abr_base.h>

Library: libabr.so

System capability: SystemCapability.GraphicsGame.RenderAccelerate

Since: 5.0.0(12)

Related module: GraphicsAccelerate

Summary

[h2]Structs

Name Description
struct ABR_Vector3 Describes an ABR 3D vector.
struct ABR_CameraData Describes the camera motion data of a game app's each frame. The ABR capability adaptively adjusts the buffer resolution factor according to the camera motion data.

[h2]Type Definitions

Name Description
typedef struct ABR_Context ABR_Context Describes the ABR context.
typedef enum ABR_RenderAPI_Type ABR_RenderAPI_Type Describes the graphics API types supported by the ABR capability.
typedef struct ABR_Vector3 ABR_Vector3 Describes an ABR 3D vector.
typedef struct ABR_CameraData ABR_CameraData Describes the camera motion data of a game app's each frame. The ABR capability adaptively adjusts the buffer resolution factor according to the camera motion data.
typedef enum ABR_ErrorCode ABR_ErrorCode Describes the error codes of ABR API calls.

[h2]Enums

Name Description

ABR_RenderAPI_Type {

RENDER_API_GLES = 0

}

Describes the graphics API types supported by the ABR capability. RENDER_API_GLES indicates the OpenGL ES API.

ABR_ErrorCode {

ABR_SUCCESS = 0,

ABR_INVALID_PARAMETER = 401,

ABR_CONTEXT_CONFIG_AFTER_ACTIVE = 1009501001,

ABR_CONTEXT_NOT_CONFIG = 1009501002,

ABR_CONTEXT_NOT_ACTIVE = 1009501003,

ABR_METADATA_INVALID = 1009501004,

ABR_FRAMEBUFFER_INVALID = 1009501005

}

Describes the error codes of ABR API calls.

[h2]Functions

Name Description
ABR_Context* HMS_ABR_CreateContext(ABR_RenderAPI_Type type) Creates an ABR context instance. Each time this API is successfully called, an ABR_Context object is created and a pointer to the ABR_Context object is returned. Currently, only the RENDER_API_GLES type is supported. If other types are used, the context fails to be created.
ABR_ErrorCode HMS_ABR_SetTargetFps(ABR_Context* context, const uint32_t targetFps) Sets the target frame rate of an ABR context instance.
ABR_ErrorCode HMS_ABR_SetScaleRange(ABR_Context* context, const float minValue, const float maxValue) Sets the buffer resolution factor range of an ABR context instance. The value range of minValue and maxValue is [0.5, 1.0]. minValue must be less than or equal to maxValue. If the constraints are not met, the error code ABR_INVALID_PARAMETER is returned.
ABR_ErrorCode HMS_ABR_Activate(ABR_Context* context) Activates an ABR context instance. Before activating an ABR context instance, you need to call HMS_ABR_SetTargetFps and HMS_ABR_SetScaleRange to configure the instance properties. If the target frame rate or resolution range is not correctly configured, the error code ABR_CONTEXT_NOT_CONFIG is returned when HMS_ABR_Activate is called.
ABR_ErrorCode HMS_ABR_IsActive(ABR_Context* context, bool* isActive) Checks whether an ABR context instance is activated.
ABR_ErrorCode HMS_ABR_Deactivate(ABR_Context* context) Deactivates an ABR context instance. To activate the instance again, call the HMS_ABR_Activate API.
ABR_ErrorCode HMS_ABR_UpdateCameraData(ABR_Context* context, ABR_CameraData* data) Updates the camera motion data of each frame. Before the update, the HMS_ABR_Activate API must be called to activate the ABR context instance. If this API is called when the context instance is not activated, the error code ABR_CONTEXT_NOT_ACTIVE is returned.
ABR_ErrorCode HMS_ABR_GetScale(ABR_Context* context, float* scale) Obtains the ABR buffer resolution factor.
ABR_ErrorCode HMS_ABR_GetNextScale(ABR_Context* context, float* scale) Obtains the ABR buffer resolution factor of the next frame.
ABR_ErrorCode HMS_ABR_DestroyContext(ABR_Context** context) Destroys an ABR context instance and releases memory resources.