目录

GraphicsAccelerate

Overview

The module provides APIs related to the graphics rendering acceleration capabilities of Graphics Accelerate Kit.

System capability: SystemCapability.GraphicsGame.RenderAccelerate

Since: 5.0.0(12)

Summary

[h2]Files

Name Description
abr_base.h Declares ABR APIs used for different graphics APIs.
abr_gles.h Declares ABR APIs used for the OpenGL ES graphics API.
frame_generation_base.h Declares frame generation APIs used for different graphics APIs.
frame_generation_gles.h Declares frame generation APIs used for the OpenGL ES graphics API.
frame_generation_vk.h Declares frame generation APIs used for the Vulkan graphics API.
opengtx_base.h Declares OpenGTX APIs used for both the OpenGL ES and Vulkan graphics APIs.

[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.
struct FG_Mat4x4 Describes a 4x4 matrix in column-major order. In column-major order, matrix elements are traversed by column first in consecutive linear memory addresses.
struct FG_AlgorithmModeInfo Describes the frame generation algorithm mode information.
struct FG_Dimension2D Describes the 2D image resolution, in pixels.
struct FG_ResolutionInfo Describes the resolutions of input and output images for frame generation.
struct FG_Vec3D Describes a frame generation 3D vector.
struct FG_PerFrameExtendedCameraInfo Describes extended camera information. When the translation component of the view projection matrix is very large (> 100,000), more detailed camera information can be provided for more accurate frame prediction.
struct FG_IntegrationInfo Describes the integration information about frame generation, including the display mode, whether to separately buffer depth and color textures, and whether to flip the color texture. It takes effect only when FG_PredictionMode is set to FG_PREDICTION_MODE_INTERPOLATION.
struct FG_DispatchDescription_GLES Describes the parameter information required by HMS_FG_Dispatch_GLES. The parameter information needs to be updated for each frame. This API applies only to the OpenGL ES graphics API.
struct FG_ContextDescription_VK Describes the property information required for creating a frame generation context instance FG_Context_VK. This API applies only to the Vulkan graphics API.
struct FG_ImageFormat_VK Describes the input and output image format information for frame generation. This API applies only to the Vulkan graphics API.
struct FG_ImageSync_VK Describes the synchronization status information about the input and output images for frame generation. It is used to create a memory barrier for the images. This API applies only to the Vulkan graphics API.
struct FG_ImageInfo_VK Describes the input and output image information for frame generation. This API applies only to the Vulkan graphics API.
struct FG_DispatchDescription_VK Describes the parameter information required by HMS_FG_Dispatch_VK. The parameter information needs to be updated for each frame. This API applies only to the Vulkan graphics API.
struct OpenGTX_ConfigDescription Describes the OpenGTX property settings.
struct OpenGTX_GameSceneInfo Describes the game scene information. This struct is passed by a game app after obtaining the scene information.
struct OpenGTX_FrameRenderInfo Describes the frame rendering information. This struct is passed by a game app after obtaining the frame properties. The camera matrix in this parameter is typically used to optimize the image quality effect for render layer load-reduction schemes.
struct OpenGTX_NetworkInfo Describes the current device network information. This struct is passed by a game app after obtaining the network information.
struct OpenGTX_ResolutionValue Describes the resolution of a game app.
struct OpenGTX_Vector3 Describes an OpenGTX 3D vector.
struct OpenGTX_NetworkLatency Describes the current device network latency information. This struct is passed by a game app after obtaining the network latency information. This parameter is typically used to optimize the network latency.

[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.
typedef struct FG_Mat4x4 FG_Mat4x4 Describes a 4x4 matrix in column-major order. In column-major order, matrix elements are traversed by column first in consecutive linear memory addresses.
typedef enum FG_PredictionMode FG_PredictionMode Describes the frame prediction algorithm modes for frame generation.
typedef enum FG_MeMode FG_MeMode Describes the motion estimation algorithm modes. The basic mode and enhanced mode are supported.
typedef enum FG_PresentMode FG_PresentMode Defines the predicted frame display modes, including the game display mode (the game sends predicted frames for display) and system display mode (the system sends predicted frames for display).
typedef struct FG_AlgorithmModeInfo FG_AlgorithmModeInfo Describes the frame generation algorithm mode information.
typedef struct FG_Vec3D FG_Vec3D Describes a frame generation 3D vector.
typedef struct FG_PerFrameExtendedCameraInfo FG_PerFrameExtendedCameraInfo Describes extended camera information. When the translation component of the view projection matrix is very large (> 100,000), more detailed camera information can be provided for more accurate frame prediction.
typedef struct FG_IntegrationInfo Describes the integration information about frame generation, including the display mode, whether to separately buffer depth and color textures, and whether to flip the color texture. It takes effect only when FG_PredictionMode is set to FG_PREDICTION_MODE_INTERPOLATION.
typedef enum FG_ErrorCode FG_ErrorCode Describes the error codes of frame generation API calls.
typedef enum FG_CvvZSemantic FG_CvvZSemantic Describes the homogeneous clip space Z/W ranges and depth functions after camera projection transformation.
typedef struct FG_Dimension2D FG_Dimension2D Describes the 2D image resolution, in pixels.
typedef struct FG_ResolutionInfo FG_ResolutionInfo Describes the resolutions of input and output images for frame generation.
typedef struct FG_Context_GLES FG_Context_GLES Describes the frame generation context. This API applies only to the OpenGL ES graphics API.
typedef struct FG_DispatchDescription_GLES FG_DispatchDescription_GLES Describes the parameter information required by HMS_FG_Dispatch_GLES. The parameter information needs to be updated for each frame. This API applies only to the OpenGL ES graphics API.
typedef enum FG_ImageFormat_GLES FG_ImageFormat_GLES Describes the image formats of the real frame color buffer and the predicted frame buffer. This API applies only to the OpenGL ES graphics API.
typedef struct FG_Context_VK FG_Context_VK Describes the frame generation context. This API applies only to the Vulkan graphics API.
typedef struct FG_Image_VK FG_Image_VK Describes the input and output images for frame generation. This API applies only to the Vulkan graphics API.
typedef struct FG_ContextDescription_VK FG_ContextDescription_VK Describes the property information required for creating a frame generation context instance FG_Context_VK. This API applies only to the Vulkan graphics API.
typedef struct FG_ImageFormat_VK FG_ImageFormat_VK Describes the input and output image format information for frame generation. This API applies only to the Vulkan graphics API.
typedef struct FG_ImageSync_VK FG_ImageSync_VK Describes the synchronization status information about the input and output images for frame generation. It is used to create a memory barrier for the images. This API applies only to the Vulkan graphics API.
typedef struct FG_ImageInfo_VK FG_ImageInfo_VK Describes the input and output image information for frame generation. This API applies only to the Vulkan graphics API.
typedef struct FG_DispatchDescription_VK FG_DispatchDescription_VK Describes the parameter information required by HMS_FG_Dispatch_VK. The parameter information needs to be updated for each frame. This API applies only to the Vulkan graphics API.
typedef enum FG_FeatureType FG_FeatureType Defines the feature types of frame generation, categorized by platform (OpenGL ES, Vulkan), generation mode (interpolation, extrapolation), and algorithm.
typedef enum OpenGTX_ErrorCode OpenGTX_ErrorCode Describes the error codes of OpenGTX API calls.
typedef enum OpenGTX_LTPO_Mode OpenGTX_LTPO_Mode Describes the OpenGTX_LTPO modes for controlling the game frame rate.
typedef enum OpenGTX_EngineType OpenGTX_EngineType Describes the underlying game engine types used by game apps.
typedef enum OpenGTX_GameType OpenGTX_GameType Describes the game types.
typedef enum OpenGTX_SceneID OpenGTX_SceneID Describes the OpenGTX game scene types.
typedef enum OpenGTX_PictureQualityMaxLevel OpenGTX_PictureQualityMaxLevel Describes the game app image quality levels.
typedef enum OpenGTX_TempLevel OpenGTX_TempLevel Describes the device temperature levels.
typedef struct OpenGTX_Context OpenGTX_Context Describes the OpenGTX context.
typedef struct OpenGTX_ConfigDescription OpenGTX_ConfigDescription Describes the OpenGTX property settings.
typedef struct OpenGTX_GameSceneInfo OpenGTX_GameSceneInfo Describes the game scene information. This struct is passed by a game app after obtaining the scene information.
typedef struct OpenGTX_FrameRenderInfo OpenGTX_FrameRenderInfo Describes the frame rendering information. This struct is passed by a game app after obtaining the frame properties. The camera matrix in this parameter is typically used to optimize the image quality effect for render layer load-reduction schemes.
typedef struct OpenGTX_NetworkInfo OpenGTX_NetworkInfo Describes the current device network information. This struct is passed by a game app after obtaining the network information.
typedef struct OpenGTX_ResolutionValue OpenGTX_ResolutionValue Describes the resolution of a game app.
typedef struct OpenGTX_Vector3 OpenGTX_Vector3 Describes an OpenGTX 3D vector.
typedef struct OpenGTX_NetworkLatency OpenGTX_NetworkLatency Describes the current device network latency information. This struct is passed by a game app after obtaining the network latency information. This parameter is typically used to optimize the network latency.
typedef void(* OpenGTX_DeviceInfoCallback) (OpenGTX_TempLevel) Callback for device temperature information.

[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.

FG_PredictionMode {

FG_PREDICTION_MODE_INTERPOLATION = 0,

FG_PREDICTION_MODE_EXTRAPOLATION = 1

}

Describes the frame prediction algorithm modes for frame generation.

FG_MeMode {

FG_ME_MODE_BASIC = 0,

FG_ME_MODE_ENHANCED = 1

}

Describes the motion estimation algorithm modes. The basic mode and enhanced mode are supported.

FG_ErrorCode {

FG_SUCCESS = 0,

FG_INVALID_PARAMETER = 401,

FG_CONTEXT_NOT_CONFIG = 1009500001,

FG_CONTEXT_NOT_ACTIVE = 1009500002,

FG_COLLECTING_PREVIOUS_FRAMES = 1009500003

}

Describes the error codes of frame generation API calls.

FG_CvvZSemantic {

FG_CVV_Z_SEMANTIC_MINUS_ONE_TO_ONE_FORWARD_Z = 0,

FG_CVV_Z_SEMANTIC_ZERO_TO_ONE_REVERSE_Z = 1,

FG_CVV_Z_SEMANTIC_MINUS_ONE_TO_ONE_REVERSE_Z = 2,

FG_CVV_Z_SEMANTIC_ZERO_TO_ONE_FORWARD_Z = 3

}

Describes the homogeneous clip space Z/W ranges and depth functions after camera projection transformation.

FG_ImageFormat_GLES {

FG_FORMAT_R8G8B8A8_UNORM = 0,

FG_FORMAT_R11G11B10_SFLOAT = 1,

FG_FORMAT_R16G16B16A16_SFLOAT = 2

}

Describes the image formats of the real frame color buffer and the predicted frame buffer. This API applies only to the OpenGL ES graphics API.

FG_PresentMode {

FG_PRESENT_BY_GAME = 0,

FG_PRESENT_BY_SYSTEM = 1

}

Defines the predicted frame display modes. There are two modes: game display mode (the game sends predicted frames for display) and system display mode (the system sends predicted frames for display).

FG_FeatureType {

INTERPOLATION_GPU_GLES = 0,

INTERPOLATION_GPU_VULKAN = 1,

EXTRAPOLATION_GPU_GLES = 2,

EXTRAPOLATION_GPU_VULKAN = 3,

INTERPOLATION_AI_VULKAN = 4

}

Defines the feature types of frame generation, categorized by platform (OpenGL ES, Vulkan), generation mode (interpolation, extrapolation), and algorithm.

OpenGTX_ErrorCode {

OPENGTX_SUCCESS = 0,

OPENGTX_INVALID_PARAMETER = 401,

OPENGTX_CONTEXT_NOT_CONFIG = 1009502001,

OPENGTX_CONTEXT_NOT_ACTIVE = 1009502002

}

Describes the error codes of OpenGTX API calls.

OpenGTX_LTPO_Mode {

SCENE_MODE = 0x0001,

TOUCH_MODE = 0x0010,

ADAPTIVE_MODE = 0x0100

}

Describes the OpenGTX_LTPO modes for controlling the game frame rate.

OpenGTX_EngineType {

UNITY = 1,

UNREAL = 2,

MESSIAH = 3,

COCOS = 4,

OTHERS_ENGINE = 100

}

Describes the underlying game engine types used by game apps.

OpenGTX_GameType {

MOBA = 1,

RPG = 2,

FPS = 3,

RAC = 4,

OTHERS_TYPE = 100

}

Describes the game types.

OpenGTX_SceneID {

LOGIN = 1,

GAME_INTERFACE = 2,

LOADING = 3,

PLAYING = 4,

SPECTATOR = 5,

DEATH = 6,

HEAVY_LOAD = 7,

OTHERS_SCENE = 100

}

Describes the OpenGTX game scene types.

OpenGTX_PictureQualityMaxLevel {

SD = 1,

HD = 2,

FHD = 3,

QHD = 4,

UHD = 5

}

Describes the game app image quality levels.

OpenGTX_TempLevel {

TEMP_LEVEL1 = 1,

TEMP_LEVEL2 = 2,

TEMP_LEVEL3 = 3,

TEMP_LEVEL4 = 4,

TEMP_LEVEL5 = 5,

TEMP_LEVEL6 = 6

}

Describes the device temperature levels.

[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.
ABR_ErrorCode HMS_ABR_MarkFrameBuffer_GLES(ABR_Context* context) Marks a GLES buffer for adaptive rendering. This API must be called before the rendering is started.
ABR_ErrorCode HMS_ABR_GetScaledTexture_GLES(ABR_Context* context, uint32_t originTexture, uint32_t* scaledTexture) Obtains the GLES texture index after adaptive buffer resolution adjustment based on the GLES texture index corresponding to the original resolution. Before calling this API, ensure that the original texture and rendering context are valid. originTexture indicates the ID of the original texture and cannot be 0. Otherwise, scaledTexture cannot be correctly obtained, and the API function becomes invalid. scaledTexture cannot be a null pointer. Otherwise, the error code ABR_INVALID_PARAMETER is returned.
bool HMS_FG_IsFrameGenerationSupported(FG_FeatureType featureType) Indicates whether the current device supports this specific frame generation feature, which depends on device capabilities. For example, when checking the AI frame generation feature, this API determines whether the current device model has an NPU and whether the NPU's computing power meets the feature requirements. If the requirements are not met, the API returns false.
FG_Context_GLES* HMS_FG_CreateContext_GLES(void) Creates a frame generation context instance. If the call is successful, a pointer to the FG_Context_GLES object is returned. If the call fails, nullptr is returned. This API applies only to the OpenGL ES graphics API.
FG_ErrorCode HMS_FG_SetAlgorithmMode_GLES(FG_Context_GLES* context, const FG_AlgorithmModeInfo* predictionModeInfo) Sets the frame prediction algorithm mode and motion estimation mode for frame generation (mandatory). This API applies only to the OpenGL ES graphics API.
FG_ErrorCode HMS_FG_SetResolution_GLES(FG_Context_GLES* context, const FG_ResolutionInfo* resolutionInfo) Sets the resolutions of input and output images for frame generation (mandatory). This API applies only to the OpenGL ES graphics API.
FG_ErrorCode HMS_FG_SetCvvZSemantic_GLES(FG_Context_GLES* context, FG_CvvZSemantic semantic) Sets the homogeneous clip space Z/W range and depth function. This API is optional. If it is not called, the default value FG_CVV_Z_SEMANTIC_MINUS_ONE_TO_ONE_FORWARD_Z will be used. This API applies only to the OpenGL ES graphics API.
FG_ErrorCode HMS_FG_SetImageFormat_GLES(FG_Context_GLES* context, FG_ImageFormat_GLES format) Sets the image format of the real frame color buffer and the predicted frame buffer. This API is optional. If it is not called, the default value FG_FORMAT_R8G8B8A8_UNORM will be used. This API applies only to the OpenGL ES graphics API.
FG_ErrorCode HMS_FG_SetDepthStencilYDirectionInverted_GLES(FG_Context_GLES* context, bool inverted) Sets the flag bit for flipping the color buffer around the Y axis relative to the depth stencil buffer. This API is optional. If it is not called, no flipping is performed by default. If the color buffer is flipped 180 degrees around the Y axis relative to the depth stencil buffer in the rendering pipeline, set this parameter to true. If the drawing direction of the color buffer is the same as that of the depth stencil buffer, set this parameter to false. This API applies only to the OpenGL ES graphics API.
FG_ErrorCode HMS_FG_Activate_GLES(FG_Context_GLES* context) Activates a frame generation context instance. Before the activation, the HMS_FG_SetAlgorithmMode_GLES and HMS_FG_SetResolution_GLES APIs must be called to complete the configuration. For an activated frame generation context instance, the HMS_FG_Dispatch_GLES API can be called to generate a predicted frame. This API applies only to the OpenGL ES graphics API.
FG_ErrorCode HMS_FG_Deactivate_GLES(FG_Context_GLES* context) Deactivates a frame generation context instance. To activate the instance again, call the HMS_FG_Activate_GLES API. This API applies only to the OpenGL ES graphics API.
FG_ErrorCode HMS_FG_IsActive_GLES(FG_Context_GLES* context, bool* isActive) Checks whether a frame generation context instance is activated. This API applies only to the OpenGL ES graphics API.
FG_ErrorCode HMS_FG_Dispatch_GLES(FG_Context_GLES* context, const FG_DispatchDescription_GLES* desc) Sets the parameter information required for frame prediction to generate a predicted frame. This API is valid only when the context instance is activated, and applies only to the OpenGL ES graphics API.
FG_ErrorCode HMS_FG_SetExtendedCameraInfo_GLES(FG_Context_GLES* context, const FG_PerFrameExtendedCameraInfo* info) Sets the extended camera property information. When the translation component of the view projection matrix is very large, this information is provided for more accurate frame generation. This API is optional. This API applies only to the OpenGL ES graphics API.
FG_ErrorCode HMS_FG_DestroyContext_GLES(FG_Context_GLES** context) Destroys a frame generation context instance and releases memory resources. This API applies only to the OpenGL ES graphics API.
FG_ErrorCode HMS_FG_SetIntegrationMode_GLES(FG_Context_GLES* context, const FG_IntegrationInfo* integrationInfo) Sets the frame prediction integration information. The presentMode, textureCachedByGame, needFlipInputColor, and needFlipOutputColor members in FG_IntegrationInfo take effect only when FG_PredictionMode is set to FG_PREDICTION_MODE_INTERPOLATION. In other cases, these parameters should be ignored or set to their default values. This API applies only to the OpenGL ES graphics API.
FG_ErrorCode HMS_FG_SetUiPredictionEnabled_GLES(FG_Context_GLES* context, bool isEnabled) Sets whether to enable the UI prediction function. This function can be enabled only in system display mode. It is invalid in game display mode. This API applies only to the OpenGL ES graphics API.
FG_ErrorCode HMS_FG_SetTargetFps_GLES(FG_Context_GLES* context, int targetFps) Sets the target frame rate for frame generation. The setting takes effect only for the system display mode and is invalid for the game display mode. The value range of targetFps is [30, 144] to ensure performance stability and user experience consistency across different platforms. You should select a proper frame rate based on the actual service scenario. This API takes effect after the game is released for the first time and applies only to the OpenGL ES graphics API.
FG_Context_VK* HMS_FG_CreateContext_VK(const FG_ContextDescription_VK* contextDescription) Creates a frame generation context instance. If the call is successful, a pointer to the FG_Context_VK object is returned. If the call fails, nullptr is returned. This API applies only to the Vulkan graphics API.
FG_ErrorCode HMS_FG_SetAlgorithmMode_VK(FG_Context_VK* context, const FG_AlgorithmModeInfo* predictionModeInfo) Sets the frame generation algorithm mode, including the prediction algorithm mode and motion estimation mode (mandatory). This API applies only to the Vulkan graphics API.
FG_ErrorCode HMS_FG_SetResolution_VK(FG_Context_VK* context, const FG_ResolutionInfo* resolutionInfo) Sets the resolutions of input and output images for frame generation (mandatory). This API applies only to the Vulkan graphics API.
FG_ErrorCode HMS_FG_SetCvvZSemantic_VK(FG_Context_VK* context, FG_CvvZSemantic semantic) Sets the homogeneous clip space Z/W range and depth function. This API is optional. If it is not called, the default value FG_CVV_Z_SEMANTIC_ZERO_TO_ONE_FORWARD_Z will be used. This API applies only to the Vulkan graphics API.
FG_ErrorCode HMS_FG_SetImageFormat_VK(FG_Context_VK* context, const FG_ImageFormat_VK* format) Sets the input and output image formats for frame generation. This API is optional. If it is not called, the default value VK_FORMAT_R8G8B8A8_UNORM will be used for the real frame color buffer and predicted frame buffer, and VK_FORMAT_D24_UNORM_S8_UINT will be used for the depth stencil buffer. This API applies only to the Vulkan graphics API.
FG_ErrorCode HMS_FG_SetDepthStencilYDirectionInverted_VK(FG_Context_VK* context, bool inverted) Sets the flag bit for flipping the color buffer around the Y axis relative to the depth stencil buffer. This API is optional. If it is not called, no flipping is performed by default. If the color buffer is flipped 180 degrees around the Y axis relative to the depth stencil buffer in the rendering pipeline, set this parameter to true. If the drawing direction of the color buffer is the same as that of the depth stencil buffer, set this parameter to false. This API applies only to the Vulkan graphics API.
FG_Image_VK* HMS_FG_CreateImage_VK(FG_Context_VK* context, VkImage image, VkImageView view) Creates input and output image instances for frame generation. An image instance must be created through this API for the real frame color buffer, depth stencil buffer, and predicted frame buffer. Then, the created image instances are passed to the HMS_FG_Dispatch_VK API to generate a predicted frame. This API associates the image resources provided by a user with the frame generation algorithm implementation and applies only to the Vulkan graphics API.
FG_ErrorCode HMS_FG_DestroyImage_VK(FG_Context_VK* context, FG_Image_VK* image) Destroys input and output image instances for frame generation and cancels the corresponding association. This API applies only to the Vulkan graphics API.
FG_ErrorCode HMS_FG_Activate_VK(FG_Context_VK* context) Activates a frame generation context instance. Before the activation, the HMS_FG_SetAlgorithmMode_VK and HMS_FG_SetResolution_VK APIs must be called to complete the configuration. For an activated frame generation context instance, the HMS_FG_Dispatch_VK API can be called to generate a predicted frame. This API applies only to the Vulkan graphics API.
FG_ErrorCode HMS_FG_Deactivate_VK(FG_Context_VK* context) Deactivates a frame generation context instance. To activate the instance again, call the HMS_FG_Activate_VK API. This API applies only to the Vulkan graphics API.
FG_ErrorCode HMS_FG_IsActive_VK(FG_Context_VK* context, bool* isActive) Checks whether a frame generation context instance is activated. This API applies only to the Vulkan graphics API.
FG_ErrorCode HMS_FG_Dispatch_VK(FG_Context_VK* context, const FG_DispatchDescription_VK* desc) Sets the parameter information required for frame prediction to generate a predicted frame. This API is valid only when the context instance is activated, and applies only to the Vulkan graphics API.
FG_ErrorCode HMS_FG_DestroyContext_VK(FG_Context_VK** context) Destroys a frame generation context instance and releases memory resources. This API applies only to the Vulkan graphics API.
FG_ErrorCode HMS_FG_SetIntegrationMode_VK(FG_Context_VK* context, const FG_IntegrationInfo* integrationInfo) Sets the frame prediction integration information. The presentMode, textureCachedByGame, needFlipInputColor, and needFlipOutputColor members in FG_IntegrationInfo take effect only when FG_PredictionMode is set to FG_PREDICTION_MODE_INTERPOLATION. In other cases, these parameters should be ignored or set to their default values. This API applies only to the Vulkan graphics API.
FG_ErrorCode HMS_FG_SetUiPredictionEnabled_VK(FG_Context_VK* context, bool isEnabled) Sets whether to enable the UI prediction function. This function can be enabled only in system display mode. It is invalid in game display mode. This API applies only to the Vulkan graphics API.
FG_ErrorCode HMS_FG_SetTargetFps_VK(FG_Context_VK* context, int targetFps) Sets the target frame rate for frame generation. The setting takes effect only for the system display mode and is invalid for the game display mode. The value range of targetFps is [30, 144] to ensure performance stability and user experience consistency across different platforms. You should select a proper frame rate based on the actual service scenario. This API takes effect after the game is released for the first time and applies only to the Vulkan graphics API.
OpenGTX_Context* HMS_OpenGTX_CreateContext(OpenGTX_DeviceInfoCallback deviceInfoCallback) Creates an OpenGTX context instance. Each time this API is successfully called, an OpenGTX_Context object is created and a pointer to the OpenGTX_Context object is returned.
OpenGTX_ErrorCode HMS_OpenGTX_Activate(OpenGTX_Context* context) Activates an OpenGTX context instance. Before using an OpenGTX context instance, you need to activate it.
OpenGTX_ErrorCode HMS_OpenGTX_Deactivate(OpenGTX_Context* context) Deactivates an OpenGTX context instance. To activate the instance again, call the HMS_OpenGTX_Activate API.
OpenGTX_ErrorCode HMS_OpenGTX_SetConfiguration(OpenGTX_Context* context, const OpenGTX_ConfigDescription* config) Initializes an OpenGTX context instance and sets the OpenGTX context instance properties.
OpenGTX_ErrorCode HMS_OpenGTX_DispatchFrameRenderInfo(OpenGTX_Context* context, const OpenGTX_FrameRenderInfo* frameRenderInfo) Sets the frame rendering information required for OpenGTX running. The information needs to be updated after each change to a frame.
OpenGTX_ErrorCode HMS_OpenGTX_DispatchGameSceneInfo(OpenGTX_Context* context, const OpenGTX_GameSceneInfo* gameSceneInfo) Sets the game scene information required for OpenGTX running.
OpenGTX_ErrorCode HMS_OpenGTX_DispatchNetworkInfo(OpenGTX_Context* context, const OpenGTX_NetworkInfo* networkInfo) Sets the network latency information required for OpenGTX running.
OpenGTX_ErrorCode HMS_OpenGTX_DestroyContext(OpenGTX_Context** context) Destroys an OpenGTX context instance and releases memory resources.

Type Definition Description

[h2]ABR_CameraData

typedef struct ABR_CameraData ABR_CameraData

Description

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.

Since: 5.0.0(12)

[h2]ABR_Context

typedef struct ABR_Context ABR_Context

Description

Describes the ABR context.

Since: 5.0.0(12)

[h2]ABR_ErrorCode

typedef enum ABR_ErrorCode ABR_ErrorCode

Description

Describes the error codes of ABR API calls.

Since: 5.0.0(12)

[h2]ABR_RenderAPI_Type

typedef enum ABR_RenderAPI_Type ABR_RenderAPI_Type

Description

Describes the graphics API types supported by the ABR capability.

Since: 5.0.0(12)

[h2]ABR_Vector3

typedef struct ABR_Vector3 ABR_Vector3

Description

Describes an ABR 3D vector.

Since: 5.0.0(12)

[h2]FG_AlgorithmModeInfo

typedef struct FG_AlgorithmModeInfo FG_AlgorithmModeInfo

Description

Describes the frame generation algorithm mode information.

Since: 5.0.0(12)

[h2]FG_Context_GLES

typedef struct FG_Context_GLES FG_Context_GLES

Description

Describes the frame generation context. This API applies only to the OpenGL ES graphics API.

Since: 5.0.0(12)

[h2]FG_Context_VK

typedef struct FG_Context_VK FG_Context_VK

Description

Describes the frame generation context. This API applies only to the Vulkan graphics API.

Since: 5.0.0(12)

[h2]FG_ContextDescription_VK

typedef struct FG_ContextDescription_VK FG_ContextDescription_VK

Description

Describes the property information required for creating a frame generation context instance FG_Context_VK. This API applies only to the Vulkan graphics API.

Since: 5.0.0(12)

[h2]FG_CvvZSemantic

typedef enum FG_CvvZSemantic FG_CvvZSemantic

Description

Describes the homogeneous clip space Z/W ranges and depth functions after camera projection transformation.

Since: 5.0.0(12)

[h2]FG_Dimension2D

typedef struct FG_Dimension2D FG_Dimension2D

Description

Describes the 2D image resolution, in pixels.

Since: 5.0.0(12)

[h2]FG_DispatchDescription_GLES

typedef struct FG_DispatchDescription_GLES FG_DispatchDescription_GLES

Description

Describes the parameter information required by HMS_FG_Dispatch_GLES. The parameter information needs to be updated for each frame. This API applies only to the OpenGL ES graphics API.

Since: 5.0.0(12)

[h2]FG_DispatchDescription_VK

typedef struct FG_DispatchDescription_VK FG_DispatchDescription_VK

Description

Describes the parameter information required by HMS_FG_Dispatch_VK. The parameter information needs to be updated for each frame. This API applies only to the Vulkan graphics API.

Since: 5.0.0(12)

[h2]FG_ErrorCode

typedef enum FG_ErrorCode FG_ErrorCode

Description

Describes the error codes of frame generation API calls.

Since: 5.0.0(12)

[h2]FG_Image_VK

typedef struct FG_Image_VK FG_Image_VK

Description

Describes the input and output images for frame generation. This API applies only to the Vulkan graphics API.

Since: 5.0.0(12)

[h2]FG_ImageFormat_GLES

typedef enum FG_ImageFormat_GLES FG_ImageFormat_GLES

Description

Describes the image formats of the real frame color buffer and the predicted frame buffer. This API applies only to the OpenGL ES graphics API.

Since: 5.0.0(12)

[h2]FG_ImageFormat_VK

typedef struct FG_ImageFormat_VK FG_ImageFormat_VK

Description

Describes the input and output image format information for frame generation. This API applies only to the Vulkan graphics API.

Since: 5.0.0(12)

[h2]FG_ImageInfo_VK

typedef struct FG_ImageInfo_VK FG_ImageInfo_VK

Description

Describes the input and output image information for frame generation. This API applies only to the Vulkan graphics API.

Since: 5.0.0(12)

[h2]FG_ImageSync_VK

typedef struct FG_ImageSync_VK FG_ImageSync_VK

Description

Describes the synchronization status information about the input and output images for frame generation. It is used to create a memory barrier for the images. This API applies only to the Vulkan graphics API.

Since: 5.0.0(12)

[h2]FG_Mat4x4

typedef struct FG_Mat4x4 FG_Mat4x4

Description

Describes a 4x4 matrix in column-major order. In column-major order, matrix elements are traversed by column first in consecutive linear memory addresses.

Since: 5.0.0(12)

[h2]FG_MeMode

typedef enum FG_MeMode FG_MeMode

Description

Describes the motion estimation algorithm modes. The basic mode and enhanced mode are supported.

Since: 5.0.0(12)

[h2]FG_PredictionMode

typedef enum FG_PredictionMode FG_PredictionMode

Description

Describes the frame prediction algorithm modes for frame generation.

Since: 5.0.0(12)

[h2]FG_PresentMode

typedef enum FG_PresentMode FG_PresentMode

Description

Defines the predicted frame display modes, including the game display mode (the game sends predicted frames for display) and system display mode (the system sends predicted frames for display).

Since: 5.1.0(18)

[h2]FG_FeatureType

typedef enum FG_FeatureType FG_FeatureType

Description

Defines the feature types of frame generation, categorized by platform (OpenGL ES, Vulkan), generation mode (interpolation, extrapolation), and algorithm.

Since: 26.0.0

[h2]FG_ResolutionInfo

typedef struct FG_ResolutionInfo FG_ResolutionInfo

Description

Describes the resolutions of input and output images for frame generation.

Since: 5.0.0(12)

[h2]FG_Vec3D

typedef struct FG_Vec3D FG_Vec3D

Description

Describes a frame generation 3D vector.

Since: 5.0.0(12)

[h2]FG_PerFrameExtendedCameraInfo

typedef struct FG_PerFrameExtendedCameraInfo FG_PerFrameExtendedCameraInfo

Description

Describes extended camera information. When the translation component of the view projection matrix is very large (> 100,000), more detailed camera information can be provided for more accurate frame prediction.

Since: 5.0.0(12)

[h2]FG_IntegrationInfo

typedef struct FG_IntegrationInfo

Description

Describes the integration information about frame generation, including the display mode, whether to separately buffer depth and color textures, and whether to flip the color texture. It takes effect only when FG_PredictionMode is set to FG_PREDICTION_MODE_INTERPOLATION.

Since: 5.1.0(18)

[h2]OpenGTX_ConfigDescription

typedef struct OpenGTX_ConfigDescription OpenGTX_ConfigDescription

Description

Describes the OpenGTX property settings.

Since: 5.0.0(12)

[h2]OpenGTX_Context

typedef struct OpenGTX_Context OpenGTX_Context

Description

Describes the OpenGTX context.

Since: 5.0.0(12)

[h2]OpenGTX_DeviceInfoCallback

typedef void(* OpenGTX_DeviceInfoCallback) (OpenGTX_TempLevel)

Description

Callback for device temperature information.

Since: 5.0.0(12)

Parameters

Name Description
OpenGTX_TempLevel Device temperature level OpenGTX_TempLevel.

[h2]OpenGTX_EngineType

typedef enum OpenGTX_EngineType OpenGTX_EngineType

Description

Describes the underlying game engine types used by game apps.

Since: 5.0.0(12)

[h2]OpenGTX_ErrorCode

typedef enum OpenGTX_ErrorCode OpenGTX_ErrorCode

Description

Describes the error codes of OpenGTX API calls.

Since: 5.0.0(12)

[h2]OpenGTX_FrameRenderInfo

typedef struct OpenGTX_FrameRenderInfo OpenGTX_FrameRenderInfo

Description

Describes the frame rendering information. This struct is passed by a game app after obtaining the frame properties. The camera matrix in this parameter is typically used to optimize the image quality effect for render layer load-reduction schemes.

Since: 5.0.0(12)

[h2]OpenGTX_GameSceneInfo

typedef struct OpenGTX_GameSceneInfo OpenGTX_GameSceneInfo

Description

Describes the game scene information. This struct is passed by a game app after obtaining the scene information.

Since: 5.0.0(12)

[h2]OpenGTX_GameType

typedef enum OpenGTX_GameType OpenGTX_GameType

Description

Describes the game types.

Since: 5.0.0(12)

[h2]OpenGTX_LTPO_Mode

typedef enum OpenGTX_LTPO_Mode OpenGTX_LTPO_Mode

Description

Describes the OpenGTX_LTPO modes for controlling the game frame rate.

Since: 5.0.0(12)

[h2]OpenGTX_NetworkInfo

typedef struct OpenGTX_NetworkInfo OpenGTX_NetworkInfo

Description

Describes the current device network information. This struct is passed by a game app after obtaining the network information.

Since: 5.0.0(12)

[h2]OpenGTX_NetworkLatency

typedef struct OpenGTX_NetworkLatency OpenGTX_NetworkLatency

Description

Describes the current device network latency information. This struct is passed by a game app after obtaining the network latency information. This parameter is typically used to optimize the network latency.

Since: 5.0.0(12)

[h2]OpenGTX_PictureQualityMaxLevel

typedef enum OpenGTX_PictureQualityMaxLevel OpenGTX_PictureQualityMaxLevel

Description

Describes the game app image quality levels.

Since: 5.0.0(12)

[h2]OpenGTX_ResolutionValue

typedef struct OpenGTX_ResolutionValue OpenGTX_ResolutionValue

Description

Describes the resolution of a game app.

Since: 5.0.0(12)

[h2]OpenGTX_SceneID

typedef enum OpenGTX_SceneID OpenGTX_SceneID

Description

Describes the OpenGTX game scene types.

Since: 5.0.0(12)

[h2]OpenGTX_TempLevel

typedef enum OpenGTX_TempLevel OpenGTX_TempLevel

Description

Describes the device temperature levels.

Since: 5.0.0(12)

[h2]OpenGTX_Vector3

typedef struct OpenGTX_Vector3 OpenGTX_Vector3

Description

Describes an OpenGTX 3D vector.

Since: 5.0.0(12)

Enum Description

[h2]ABR_ErrorCode

enum ABR_ErrorCode

Description

Describes the error codes of ABR API calls.

Since: 5.0.0(12)

Enumerated Value Description
ABR_SUCCESS The API execution is successful.
ABR_INVALID_PARAMETER Invalid parameters, including a missing mandatory parameter, an incorrect parameter type, and an invalid parameter value.
ABR_CONTEXT_CONFIG_AFTER_ACTIVE The properties of an ABR context instance are to be set after the instance is activated. This error code is returned if an ABR context instance has been activated before property setting.
ABR_CONTEXT_NOT_CONFIG The ABR context instance properties are not set. This error code is returned if the ABR context instance properties are not set or fail to be set when HMS_ABR_Activate is called.
ABR_CONTEXT_NOT_ACTIVE The ABR context instance is not activated. This error code is returned if the ABR context instance is not activated when HMS_ABR_MarkFrameBuffer_GLES or an ABR update-related function is called.
ABR_METADATA_INVALID Invalid ABR metadata. This error code is returned if invalid metadata is detected during ABR context instance property setting.
ABR_FRAMEBUFFER_INVALID Invalid buffer. This error code is returned if an invalid buffer is detected when HMS_ABR_MarkFrameBuffer_GLES is called.

[h2]ABR_RenderAPI_Type

enum ABR_RenderAPI_Type

Description

Describes the graphics API types supported by the ABR capability.

Since: 5.0.0(12)

Enumerated Value Description
RENDER_API_GLES OpenGL ES API

[h2]FG_CvvZSemantic

enum FG_CvvZSemantic

Description

Describes the homogeneous clip space Z/W ranges and depth functions after camera projection transformation.

Since: 5.0.0(12)

Enumerated Value Description
FG_CVV_Z_SEMANTIC_MINUS_ONE_TO_ONE_FORWARD_Z After projection transformation, the homogeneous clip space Z/W range is [–1, 1] and the depth function is less equal, which are usually used by the OpenGL ES graphics API.
FG_CVV_Z_SEMANTIC_ZERO_TO_ONE_REVERSE_Z After projection transformation, the homogeneous clip space Z/W range is [0, 1] and the depth function is greater equal, which are usually used by the DirectX or Vulkan graphics API.
FG_CVV_Z_SEMANTIC_MINUS_ONE_TO_ONE_REVERSE_Z After projection transformation, the homogeneous clip space Z/W range is [–1, 1] and the depth function is greater equal.
FG_CVV_Z_SEMANTIC_ZERO_TO_ONE_FORWARD_Z After projection transformation, the homogeneous clip space Z/W range is [0, 1] and the depth function is less equal.

[h2]FG_ErrorCode

enum FG_ErrorCode

Description

Describes the error codes of frame generation API calls.

Since: 5.0.0(12)

Enumerated Value Description
FG_SUCCESS The API execution is successful.
FG_INVALID_PARAMETER Invalid parameters, including a missing mandatory parameter, an incorrect parameter type, and an invalid parameter value.
FG_CONTEXT_NOT_CONFIG The frame generation context instance properties are not set. This error code is returned if the frame generation context instance properties are not set or fail to be set when HMS_FG_Activate_GLES is called.
FG_CONTEXT_NOT_ACTIVE The frame generation context instance is not activated. This error code is returned if the frame generation context instance is not activated when HMS_FG_Dispatch_GLES is called.
FG_COLLECTING_PREVIOUS_FRAMES Multiple historical frames need to be passed for motion estimation during frame generation. This error code is returned and no predicted frame will be generated if the number of passed frames is less than a fixed threshold when HMS_FG_Dispatch_GLES is called. The threshold value is 2 for the following modes: GLES basic interpolation mode, GLES enhanced interpolation mode, and GLES enhanced extrapolation mode. The threshold value is 3 for the following modes: GLES basic extrapolation mode, Vulkan basic interpolation mode, and Vulkan basic extrapolation mode. When the number of passed frames reaches the fixed threshold, the call will be successful and FG_SUCCESS is returned.

[h2]FG_ImageFormat_GLES

enum FG_ImageFormat_GLES

Description

Describes the image formats of the real frame color buffer and the predicted frame buffer. This API applies only to the OpenGL ES graphics API.

Since: 5.0.0(12)

Enumerated Value Description
FG_FORMAT_R8G8B8A8_UNORM GL_RGBA8.
FG_FORMAT_R11G11B10_SFLOAT GL_R11F_G11F_B10F.
FG_FORMAT_R16G16B16A16_SFLOAT GL_RGBA16F.

[h2]FG_MeMode

enum FG_MeMode

Description

Describes the motion estimation algorithm modes. The basic mode and enhanced mode are supported.

Since: 5.0.0(12)

Enumerated Value Description
FG_ME_MODE_BASIC Basic mode. Motion estimation is performed by using the color, depth, and camera matrix information about historical frames.
FG_ME_MODE_ENHANCED Enhanced mode. The geometric vertex information about historical frames is used for more accurate motion estimation to draw predicted frames with higher quality. In this mode, you need to mark the draw calls for drawing vertices. If depth information is not passed, you can switch to the AI-based frame generation mode.

[h2]FG_PredictionMode

enum FG_PredictionMode

Description

Describes the frame prediction algorithm modes for frame generation.

Since: 5.0.0(12)

Enumerated Value Description
FG_PREDICTION_MODE_INTERPOLATION Interpolation mode. A predicted frame (frame N-0.5) is generated between two adjacent real frames (frame N–1 and frame N). This mode applies to role-playing games, racing games, and other games that have high requirements on rendering quality and running smoothness.
FG_PREDICTION_MODE_EXTRAPOLATION Extrapolation mode. A future predicted frame (frame N+0.5) is generated based on two adjacent real frames (frame N–1 and frame N). This mode applies to action games, shooting games, and other games that have high requirements on response latency and operation sensitivity.

[h2]FG_PresentMode

enum FG_PresentMode

Description

Defines the predicted frame display modes, including the game display mode (the game sends predicted frames for display) and system display mode (the system sends predicted frames for display).

Since: 5.1.0(18)

Enumerated Value Description
FG_PRESENT_BY_GAME The game applies for and manages predicted frames, and sends the predicted frames for display.
FG_PRESENT_BY_SYSTEM The system applies for and manages predicted frames, and sends the predicted frames for display.

[h2]FG_FeatureType

enum FG_FeatureType

Description

Defines the feature types of frame generation, categorized by platform (OpenGL ES, Vulkan), generation mode (interpolation, extrapolation), and algorithm.

Since: 26.0.0

Enumerated Value Description
INTERPOLATION_GPU_GLES GPU interpolation in OpenGL ES.
INTERPOLATION_GPU_VULKAN GPU interpolation in Vulkan.
EXTRAPOLATION_GPU_GLES GPU extrapolation in OpenGL ES.
EXTRAPOLATION_GPU_VULKAN GPU extrapolation in Vulkan.
INTERPOLATION_AI_VULKAN AI interpolation in Vulkan.

[h2]OpenGTX_EngineType

enum OpenGTX_EngineType

Description

Describes the underlying game engine types used by game apps.

Since: 5.0.0(12)

Enumerated Value Description
UNITY Unity.
UNREAL Unreal.
MESSIAH Messiah.
COCOS Cocos.
OTHERS_ENGINE Other engines.

[h2]OpenGTX_ErrorCode

enum OpenGTX_ErrorCode

Description

Describes the error codes of OpenGTX API calls.

Since: 5.0.0(12)

Enumerated Value Description
OPENGTX_SUCCESS The API execution is successful.
OPENGTX_INVALID_PARAMETER Invalid parameters, including a missing mandatory parameter, an incorrect parameter type, and an invalid parameter value.
OPENGTX_CONTEXT_NOT_CONFIG The OpenGTX context instance properties are not set. This error code is returned if the OpenGTX context instance is not configured when functions such as HMS_OpenGTX_DispatchFrameRenderInfo are called.
OPENGTX_CONTEXT_NOT_ACTIVE The OpenGTX context instance is not activated. This error code is returned if the OpenGTX context instance is not activated when functions such as HMS_OpenGTX_DispatchFrameRenderInfo are called.

[h2]OpenGTX_GameType

enum OpenGTX_GameType

Description

Describes the game types.

Since: 5.0.0(12)

Enumerated Value Description
MOBA Multiplayer online battle arena (MOBA).
RPG Role-playing game (RPG).
FPS First-person shooter (FPS).
RAC Racing (RAC).
OTHERS_TYPE Other game types.

[h2]OpenGTX_LTPO_Mode

enum OpenGTX_LTPO_Mode

Description

Describes the OpenGTX_LTPO modes for controlling the game frame rate.

Since: 5.0.0(12)

Enumerated Value Description
SCENE_MODE Scene mode.
TOUCH_MODE Touch mode.
ADAPTIVE_MODE Adaptive mode.

[h2]OpenGTX_PictureQualityMaxLevel

enum OpenGTX_PictureQualityMaxLevel

Description

Describes the game app image quality levels.

Since: 5.0.0(12)

Enumerated Value Description
SD SD, for example, 480p.
HD HD, for example, 720p.
FHD FHD, for example, 1080p.
QHD QHD, for example, 2K.
UHD UHD, for example, 4K.

[h2]OpenGTX_SceneID

enum OpenGTX_SceneID

Description

Describes the OpenGTX game scene types.

Since: 5.0.0(12)

Enumerated Value Description
LOGIN Login.
GAME_INTERFACE Game hall.
LOADING Loading a game.
PLAYING Playing a game.
SPECTATOR Spectating a game.
DEATH Preparing for combat.
HEAVY_LOAD Heavy load.
OTHERS_SCENE Other scenes.

[h2]OpenGTX_TempLevel

enum OpenGTX_TempLevel

Description

Describes the device temperature levels.

Since: 5.0.0(12)

Enumerated Value Description
TEMP_LEVEL1 Temperature level 1. The game can retain the current settings.
TEMP_LEVEL2 Temperature level 2. The game should reduce unnecessary services, such as background updates.
TEMP_LEVEL3 Temperature level 3. The game should stop non-key services.
TEMP_LEVEL4 Temperature level 4. The game should lower its gaming effect.
TEMP_LEVEL5 Temperature level 5. The game should lower its scene settings, such as the frame resolution, frame rate, and image quality.
TEMP_LEVEL6 Temperature level 6. The game should maintain the minimum settings.

Function Description

[h2]HMS_ABR_Activate()

ABR_ErrorCode HMS_ABR_Activate(ABR_Context* context)

Description

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.

Since: 5.0.0(12)

Parameters

Name Description
context Created ABR context instance, that is, a pointer to the ABR_Context instance. The pointer cannot be null. Otherwise, an error code indicating failure is returned.

Return value

Execution result of the function. If the execution is successful, ABR_SUCCESS is returned. If the execution fails, an error code is returned. For details about the error codes, please refer to ABR_ErrorCode.

[h2]HMS_ABR_CreateContext()

ABR_Context* HMS_ABR_CreateContext(ABR_RenderAPI_Type type)

Description

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.

Since: 5.0.0(12)

Parameters

Name Description
type Graphics API type. The options are specified by ABR_RenderAPI_Type.

Return value

If the call is successful, a pointer to ABR_Context is returned. If the call fails, a null pointer is returned.

[h2]HMS_ABR_Deactivate()

ABR_ErrorCode HMS_ABR_Deactivate(ABR_Context* context)

Description

Deactivates an ABR context instance. To activate the instance again, call the HMS_ABR_Activate API.

Since: 5.0.0(12)

Parameters

Name Description
context Created ABR context instance, that is, a pointer to the ABR_Context instance. The pointer cannot be null. Otherwise, an error code indicating failure is returned.

Return value

Execution result of the function. If the execution is successful, ABR_SUCCESS is returned. If the execution fails, an error code is returned. For details about the error codes, please refer to ABR_ErrorCode.

[h2]HMS_ABR_DestroyContext()

ABR_ErrorCode HMS_ABR_DestroyContext(ABR_Context** context)

Description

Destroys an ABR context instance and releases memory resources.

Since: 5.0.0(12)

Parameters

Name Description
context Level-2 pointer to a created ABR_Context instance. The pointer cannot be null. Otherwise, an error code indicating failure is returned.

Return value

Execution result of the function. If the execution is successful, ABR_SUCCESS is returned. If the execution fails, an error code is returned. For details about the error codes, please refer to ABR_ErrorCode.

[h2]HMS_ABR_GetScale()

ABR_ErrorCode HMS_ABR_GetScale(ABR_Context* context, float* scale )

Description

Obtains the ABR buffer resolution factor.

Since: 5.0.0(12)

Parameters

Name Description
context Created ABR context instance, that is, a pointer to the ABR_Context instance. The pointer cannot be null. Otherwise, an error code indicating failure is returned.
scale Points to a variable used to specify the ABR resolution factor. The pointer cannot be null. Otherwise, an error code indicating failure is returned. The value range of scale is [0.5, 1.0].

Return value

Execution result of the function. If the execution is successful, ABR_SUCCESS is returned. If the execution fails, an error code is returned. For details about the error codes, please refer to ABR_ErrorCode.

[h2]HMS_ABR_GetNextScale()

ABR_ErrorCode HMS_ABR_GetNextScale(ABR_Context* context, float* scale)

Description

Obtains the ABR buffer resolution factor of the next frame.

Since: 5.0.0(12)

Parameters

Name Description
context Created ABR context instance, that is, a pointer to the ABR_Context instance. The pointer cannot be null. Otherwise, an error code indicating failure is returned.
scale Points to a variable used to specify the ABR resolution factor. The pointer cannot be null. Otherwise, an error code indicating failure is returned. The value range of scale is [0.5, 1.0].

Return value

Execution result of the function. If the execution is successful, ABR_SUCCESS is returned. If the execution fails, an error code is returned. For details about the error codes, please refer to ABR_ErrorCode.

[h2]HMS_ABR_IsActive()

ABR_ErrorCode HMS_ABR_IsActive(ABR_Context* context, bool* isActive )

Description

Checks whether an ABR context instance is activated.

Since: 5.0.0(12)

Parameters

Name Description
context Created ABR context instance, that is, a pointer to the ABR_Context instance. The pointer cannot be null. Otherwise, an error code indicating failure is returned.
isActive

Indicates whether an ABR context instance is activated.

- true: yes

- false: no

Return value

Execution result of the function. If the execution is successful, ABR_SUCCESS is returned. If the execution fails, an error code is returned. For details about the error codes, please refer to ABR_ErrorCode.

[h2]HMS_ABR_MarkFrameBuffer_GLES()

ABR_ErrorCode HMS_ABR_MarkFrameBuffer_GLES(ABR_Context* context)

Description

Marks a GLES buffer for adaptive rendering. This API must be called before the rendering is started.

Since: 5.0.0(12)

Parameters

Name Description
context Created ABR context instance, that is, a pointer to the ABR_Context instance. The pointer cannot be null. Otherwise, an error code indicating failure is returned.

Return value

Execution result of the function. If the execution is successful, ABR_SUCCESS is returned. If the execution fails, an error code is returned. For details about the error codes, please refer to ABR_ErrorCode.

[h2]HMS_ABR_GetScaledTexture_GLES()

ABR_ErrorCode HMS_ABR_GetScaledTexture_GLES(ABR_Context* context, uint32_t originTexture, uint32_t* scaledTexture)

Description

Obtains the GLES texture index after adaptive buffer resolution adjustment based on the GLES texture index corresponding to the original resolution. Before calling this API, ensure that the original texture and rendering context are valid. originTexture indicates the ID of the original texture and cannot be 0. Otherwise, scaledTexture cannot be correctly obtained, and the API function becomes invalid. scaledTexture cannot be a null pointer. Otherwise, the error code ABR_INVALID_PARAMETER is returned.

Since: 5.0.0(12)

Parameters

Name Description
context Created ABR context instance, that is, a pointer to the ABR_Context instance. The pointer cannot be null. Otherwise, an error code indicating failure is returned.
originTexture GLES texture index of the original resolution.
scaledTexture GLES texture index after adaptive buffer resolution adjustment.

Return value

Execution result of the function. If the execution is successful, ABR_SUCCESS is returned. If the execution fails, an error code is returned. For details about the error codes, please refer to ABR_ErrorCode.

[h2]HMS_ABR_SetScaleRange()

ABR_ErrorCode HMS_ABR_SetScaleRange(ABR_Context* context, const float minValue, const float maxValue )

Description

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.

Since: 5.0.0(12)

Parameters

Name Description
context Created ABR context instance, that is, a pointer to the ABR_Context instance. The pointer cannot be null. Otherwise, an error code indicating failure is returned.
minValue Minimum buffer resolution factor of an ABR context instance. The value range is [0.5, 1.0]. If the parameter value is out of the range, the error code ABR_INVALID_PARAMETER is returned.
maxValue Maximum buffer resolution factor of an ABR context instance. The value range is [0.5, 1.0]. If the parameter value is out of the range, the error code ABR_INVALID_PARAMETER is returned.

Return value

Execution result of the function. If the execution is successful, ABR_SUCCESS is returned. If the execution fails, an error code is returned. For details about the error codes, please refer to ABR_ErrorCode.

[h2]HMS_ABR_SetTargetFps()

ABR_ErrorCode HMS_ABR_SetTargetFps(ABR_Context* context, const uint32_t targetFps )

Description

Sets the target frame rate of an ABR context instance.

Since: 5.0.0(12)

Parameters

Name Description
context Created ABR context instance, that is, a pointer to the ABR_Context instance. The pointer cannot be null. Otherwise, an error code indicating failure is returned.
targetFps Target frame rate of an ABR context instance. The value range is [30, 120]. If the parameter value is out of the range, the error code ABR_INVALID_PARAMETER is returned.

Return value

Execution result of the function. If the execution is successful, ABR_SUCCESS is returned. If the execution fails, an error code is returned. For details about the error codes, please refer to ABR_ErrorCode.

[h2]HMS_ABR_UpdateCameraData()

ABR_ErrorCode HMS_ABR_UpdateCameraData(ABR_Context* context, ABR_CameraData* data )

Description

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.

Since: 5.0.0(12)

Parameters

Name Description
context Created ABR context instance, that is, a pointer to the ABR_Context instance. The pointer cannot be null. Otherwise, an error code indicating failure is returned.
data Camera motion data of a game app's each frame, that is, a pointer to ABR_CameraData. The pointer cannot be null. Otherwise, an error code indicating failure is returned.

Return value

Execution result of the function. If the execution is successful, ABR_SUCCESS is returned. If the execution fails, an error code is returned. For details about the error codes, please refer to ABR_ErrorCode.

[h2]HMS_FG_IsFrameGenerationSupported()

bool HMS_FG_IsFrameGenerationSupported(FG_FeatureType featureType)

Description

Indicates whether the current device supports this specific frame generation feature, which depends on device capabilities. For example, when checking the AI frame generation feature, this API determines whether the current device model has an NPU and whether the NPU's computing power meets the feature requirements. If the requirements are not met, the API returns false.

Since: 26.0.0

Parameters

Name Description
featureType Feature type of the frame generation. For details, see FG_FeatureType.

Return value

If the current device supports this function, true is returned. Otherwise, false is returned.

[h2]HMS_FG_Activate_GLES()

FG_ErrorCode HMS_FG_Activate_GLES(FG_Context_GLES* context)

Description

Activates a frame generation context instance. Before the activation, the HMS_FG_SetAlgorithmMode_GLES and HMS_FG_SetResolution_GLES APIs must be called to complete the configuration. For an activated frame generation context instance, the HMS_FG_Dispatch_GLES API can be called to generate a predicted frame. This API applies only to the OpenGL ES graphics API.

Since: 5.0.0(12)

Parameters

Name Description
context Created frame generation context instance, that is, a pointer to the FG_Context_GLES object. The pointer cannot be null.

Return value

Execution result of the function. If the execution is successful, FG_SUCCESS is returned. If the execution fails, an error code is returned. For details about the error codes, please refer to FG_ErrorCode.

[h2]HMS_FG_Activate_VK()

FG_ErrorCode HMS_FG_Activate_VK(FG_Context_VK* context)

Description

Activates a frame generation context instance. Before the activation, the HMS_FG_SetAlgorithmMode_VK and HMS_FG_SetResolution_VK APIs must be called to complete the configuration. For an activated frame generation context instance, the HMS_FG_Dispatch_VK API can be called to generate a predicted frame. This API applies only to the Vulkan graphics API.

Since: 5.0.0(12)

Parameters

Name Description
context Created frame generation context instance, that is, a pointer to the FG_Context_VK object. The pointer cannot be null.

Return value

Execution result of the function. If the execution is successful, FG_SUCCESS is returned. If the execution fails, an error code is returned. For details about the error codes, please refer to FG_ErrorCode.

[h2]HMS_FG_CreateContext_GLES()

FG_Context_GLES* HMS_FG_CreateContext_GLES(void )

Description

Creates a frame generation context instance. If the call is successful, a pointer to the FG_Context_GLES object is returned. If the call fails, nullptr is returned. This API applies only to the OpenGL ES graphics API.

Since: 5.0.0(12)

Return value

If the call is successful, a pointer to FG_Context_GLES is returned. If the call fails, a null pointer is returned.

[h2]HMS_FG_CreateContext_VK()

FG_Context_VK* HMS_FG_CreateContext_VK(const FG_ContextDescription_VK* contextDescription)

Description

Creates a frame generation context instance. If the call is successful, a pointer to the FG_Context_VK object is returned. If the call fails, nullptr is returned. This API applies only to the Vulkan graphics API.

Since: 5.0.0(12)

Parameters

Name Description
contextDescription Pointer to the property information struct FG_ContextDescription_VK required for creating a frame generation context instance. The pointer cannot be null.

Return value

If the call is successful, a pointer to FG_Context_VK is returned. If the call fails, a null pointer is returned.

[h2]HMS_FG_CreateImage_VK()

FG_Image_VK* HMS_FG_CreateImage_VK(FG_Context_VK* context, VkImage image, VkImageView view )

Description

Creates input and output image instances for frame generation. An image instance must be created through this API for the real frame color buffer, depth stencil buffer, and predicted frame buffer. Then, the created image instances are passed to the HMS_FG_Dispatch_VK API to generate a predicted frame. This API associates the image resources provided by a user with the frame generation algorithm implementation and applies only to the Vulkan graphics API.

Since: 5.0.0(12)

Parameters

Name Description
context Created frame generation context instance, that is, a pointer to the FG_Context_VK object. The pointer cannot be null.
image VkImage object.
view VkImageView object.

Return value

Input and output image instances for frame generation.

[h2]HMS_FG_Deactivate_GLES()

FG_ErrorCode HMS_FG_Deactivate_GLES(FG_Context_GLES* context)

Description

Deactivates a frame generation context instance. To activate the instance again, call the HMS_FG_Activate_GLES API. This API applies only to the OpenGL ES graphics API.

Since: 5.0.0(12)

Parameters

Name Description
context Created frame generation context instance, that is, a pointer to the FG_Context_GLES object. The pointer cannot be null.

Return value

Execution result of the function. If the execution is successful, FG_SUCCESS is returned. If the execution fails, an error code is returned. For details about the error codes, please refer to FG_ErrorCode.

[h2]HMS_FG_Deactivate_VK()

FG_ErrorCode HMS_FG_Deactivate_VK(FG_Context_VK* context)

Description

Deactivates a frame generation context instance. To activate the instance again, call the HMS_FG_Activate_VK API. This API applies only to the Vulkan graphics API.

Since: 5.0.0(12)

Parameters

Name Description
context Created frame generation context instance, that is, a pointer to the FG_Context_VK object. The pointer cannot be null.

Return value

Execution result of the function. If the execution is successful, FG_SUCCESS is returned. If the execution fails, an error code is returned. For details about the error codes, please refer to FG_ErrorCode.

[h2]HMS_FG_DestroyContext_GLES()

FG_ErrorCode HMS_FG_DestroyContext_GLES(FG_Context_GLES** context)

Description

Destroys a frame generation context instance and releases memory resources. This API applies only to the OpenGL ES graphics API.

Since: 5.0.0(12)

Parameters

Name Description
context Level-2 pointer to a created FG_Context_GLES object. The pointer cannot be null.

Return value

Execution result of the function. If the execution is successful, FG_SUCCESS is returned. If the execution fails, an error code is returned. For details about the error codes, please refer to FG_ErrorCode.

[h2]HMS_FG_DestroyContext_VK()

FG_ErrorCode HMS_FG_DestroyContext_VK(FG_Context_VK** context)

Description

Destroys a frame generation context instance and releases memory resources. This API applies only to the Vulkan graphics API.

Since: 5.0.0(12)

Parameters

Name Description
context Level-2 pointer to a created FG_Context_VK object. The pointer cannot be null.

Return value

Execution result of the function. If the execution is successful, FG_SUCCESS is returned. If the execution fails, an error code is returned. For details about the error codes, please refer to FG_ErrorCode.

[h2]HMS_FG_DestroyImage_VK()

FG_ErrorCode HMS_FG_DestroyImage_VK(FG_Context_VK* context, FG_Image_VK* image )

Description

Destroys input and output image instances for frame generation and cancels the corresponding association. This API applies only to the Vulkan graphics API.

Since: 5.0.0(12)

Parameters

Name Description
context Created frame generation context instance, that is, a pointer to the FG_Context_VK object. The pointer cannot be null.
image Pointer to an FG_Image_VK object.

Return value

Execution result of the function. If the execution is successful, FG_SUCCESS is returned. If the execution fails, an error code is returned. For details about the error codes, please refer to FG_ErrorCode.

[h2]HMS_FG_Dispatch_GLES()

FG_ErrorCode HMS_FG_Dispatch_GLES(FG_Context_GLES* context, const FG_DispatchDescription_GLES* desc )

Description

Sets the parameter information required for frame prediction to generate a predicted frame. This API is valid only when the context instance is activated, and applies only to the OpenGL ES graphics API.

Since: 5.0.0(12)

Parameters

Name Description
context Created frame generation context instance, that is, a pointer to the FG_Context_GLES object. The pointer cannot be null.
desc Pointer to FG_DispatchDescription_GLES. The pointer cannot be null. The parameter information needs to be updated for each frame.

Return value

Execution result of the function. If the execution is successful, FG_SUCCESS is returned. If the number of input historical frames does not reach the fixed threshold (which is 2 for the basic interpolation mode, enhanced interpolation mode, and enhanced extrapolation mode, and 3 for the basic extrapolation mode), FG_COLLECTING_PREVIOUS_FRAMES is returned. If the execution fails, an error code is returned. For details about the error codes, please refer to FG_ErrorCode.

[h2]HMS_FG_SetExtendedCameraInfo_GLES()

FG_ErrorCode HMS_FG_SetExtendedCameraInfo_GLES(FG_Context_GLES* context, const FG_PerFrameExtendedCameraInfo* info)

Description

Sets the extended camera property information. When the translation component of the view projection matrix is very large, this information is provided for more accurate frame generation. This API is optional. This API applies only to the OpenGL ES graphics API.

Since: 5.0.0(12)

Parameters

Name Description
context Created frame generation context instance, that is, a pointer to the FG_Context_GLES object. The pointer cannot be null.
info Pointer to an FG_PerFrameExtendedCameraInfo object. The pointer cannot be null.

Return value

Execution result of the function. If the execution is successful, FG_SUCCESS is returned. If the execution fails, an error code is returned. For details about the error codes, please refer to FG_ErrorCode.

[h2]HMS_FG_Dispatch_VK()

FG_ErrorCode HMS_FG_Dispatch_VK(FG_Context_VK* context, const FG_DispatchDescription_VK* desc )

Description

Sets the parameter information required for frame prediction to generate a predicted frame. This API is valid only when the context instance is activated, and applies only to the Vulkan graphics API.

Since: 5.0.0(12)

Parameters

Name Description
context Created frame generation context instance, that is, a pointer to the FG_Context_VK object. The pointer cannot be null.
desc Pointer to FG_DispatchDescription_VK. The pointer cannot be null. The parameter information needs to be updated for each frame.

Return value

Execution result of the function. If the execution is successful, FG_SUCCESS is returned. If the number of input historical frames does not reach the fixed threshold (which is 3 for both the interpolation and extrapolation modes), FG_COLLECTING_PREVIOUS_FRAMES is returned. If the execution fails, an error code is returned. For details about the error codes, please refer to FG_ErrorCode.

[h2]HMS_FG_IsActive_GLES()

FG_ErrorCode HMS_FG_IsActive_GLES(FG_Context_GLES* context, bool* isActive )

Description

Checks whether a frame generation context instance is activated. This API applies only to the OpenGL ES graphics API.

Since: 5.0.0(12)

Parameters

Name Description
context Created frame generation context instance, that is, a pointer to the FG_Context_GLES object. The pointer cannot be null.
isActive

Indicates whether a frame generation context instance is activated.

true: yes

false: no

Return value

Execution result of the function. If the execution is successful, FG_SUCCESS is returned. If the execution fails, an error code is returned. For details about the error codes, please refer to FG_ErrorCode.

[h2]HMS_FG_IsActive_VK()

FG_ErrorCode HMS_FG_IsActive_VK(FG_Context_VK* context, bool* isActive )

Description

Checks whether a frame generation context instance is activated. This API applies only to the Vulkan graphics API.

Since: 5.0.0(12)

Parameters

Name Description
context Created frame generation context instance, that is, a pointer to the FG_Context_VK object. The pointer cannot be null.
isActive

Indicates whether a frame generation context instance is activated.

true: yes

false: no

Return value

Execution result of the function. If the execution is successful, FG_SUCCESS is returned. If the execution fails, an error code is returned. For details about the error codes, please refer to FG_ErrorCode.

[h2]HMS_FG_SetAlgorithmMode_GLES()

FG_ErrorCode HMS_FG_SetAlgorithmMode_GLES(FG_Context_GLES* context, const FG_AlgorithmModeInfo* predictionModeInfo )

Description

Sets the frame prediction algorithm mode and motion estimation mode for frame generation (mandatory). This API applies only to the OpenGL ES graphics API.

Since: 5.0.0(12)

Parameters

Name Description
context Created frame generation context instance, that is, a pointer to the FG_Context_GLES object. The pointer cannot be null.
predictionModeInfo Pointer to an FG_AlgorithmModeInfo object. The pointer cannot be null.

Return value

Execution result of the function. If the execution is successful, FG_SUCCESS is returned. If the execution fails, an error code is returned. For details about the error codes, please refer to FG_ErrorCode.

[h2]HMS_FG_SetAlgorithmMode_VK()

FG_ErrorCode HMS_FG_SetAlgorithmMode_VK(FG_Context_VK* context, const FG_AlgorithmModeInfo* predictionModeInfo )

Description

Sets the frame generation algorithm mode, including the prediction algorithm mode and motion estimation mode (mandatory). This API applies only to the Vulkan graphics API.

Since: 5.0.0(12)

Parameters

Name Description
context Created frame generation context instance, that is, a pointer to the FG_Context_VK object. The pointer cannot be null.
predictionModeInfo Pointer to an FG_AlgorithmModeInfo object. The pointer cannot be null.

Return value

Execution result of the function. If the execution is successful, FG_SUCCESS is returned. If the execution fails, an error code is returned. For details about the error codes, please refer to FG_ErrorCode.

[h2]HMS_FG_SetCvvZSemantic_GLES()

FG_ErrorCode HMS_FG_SetCvvZSemantic_GLES(FG_Context_GLES* context, FG_CvvZSemantic semantic )

Description

Sets the homogeneous clip space Z/W range and depth function. This API is optional. If it is not called, the default value FG_CVV_Z_SEMANTIC_MINUS_ONE_TO_ONE_FORWARD_Z will be used. This API applies only to the OpenGL ES graphics API.

Since: 5.0.0(12)

Parameters

Name Description
context Created frame generation context instance, that is, a pointer to the FG_Context_GLES object. The pointer cannot be null.
semantic Enumerated values of the homogeneous clip space Z/W range and depth function.

Return value

Execution result of the function. If the execution is successful, FG_SUCCESS is returned. If the execution fails, an error code is returned. For details about the error codes, please refer to FG_ErrorCode.

[h2]HMS_FG_SetCvvZSemantic_VK()

FG_ErrorCode HMS_FG_SetCvvZSemantic_VK(FG_Context_VK* context, FG_CvvZSemantic semantic )

Description

Sets the homogeneous clip space Z/W range and depth function. This API is optional. If it is not called, the default value FG_CVV_Z_SEMANTIC_ZERO_TO_ONE_FORWARD_Z will be used. This API applies only to the Vulkan graphics API.

Since: 5.0.0(12)

Parameters

Name Description
context Created frame generation context instance, that is, a pointer to the FG_Context_VK object. The pointer cannot be null.
semantic Enumerated values of the homogeneous clip space Z/W range and depth function.

Return value

Execution result of the function. If the execution is successful, FG_SUCCESS is returned. If the execution fails, an error code is returned. For details about the error codes, please refer to FG_ErrorCode.

[h2]HMS_FG_SetDepthStencilYDirectionInverted_GLES()

FG_ErrorCode HMS_FG_SetDepthStencilYDirectionInverted_GLES(FG_Context_GLES* context, bool inverted )

Description

Sets the flag bit for flipping the color buffer around the Y axis relative to the depth stencil buffer. This API is optional. If it is not called, no flipping is performed by default. If the color buffer is flipped 180 degrees around the Y axis relative to the depth stencil buffer in the rendering pipeline, set this parameter to true. If the drawing direction of the color buffer is the same as that of the depth stencil buffer, set this parameter to false. This API applies only to the OpenGL ES graphics API.

Since: 5.0.0(12)

Parameters

Name Description
context Created frame generation context instance, that is, a pointer to the FG_Context_GLES object. The pointer cannot be null.
inverted

Flag bit indicating whether the color buffer is flipped around the Y axis relative to the depth stencil buffer.

true: The color buffer is flipped 180 degrees around the Y axis relative to the depth stencil buffer.

false: The color buffer is not flipped relative to the depth stencil buffer.

Return value

Execution result of the function. If the execution is successful, FG_SUCCESS is returned. If the execution fails, an error code is returned. For details about the error codes, please refer to FG_ErrorCode.

[h2]HMS_FG_SetDepthStencilYDirectionInverted_VK()

FG_ErrorCode HMS_FG_SetDepthStencilYDirectionInverted_VK(FG_Context_VK* context, bool inverted )

Description

Sets the flag bit for flipping the color buffer around the Y axis relative to the depth stencil buffer. This API is optional. If it is not called, no flipping is performed by default. If the color buffer is flipped 180 degrees around the Y axis relative to the depth stencil buffer in the rendering pipeline, set this parameter to true. If the drawing direction of the color buffer is the same as that of the depth stencil buffer, set this parameter to false. This API applies only to the Vulkan graphics API.

Since: 5.0.0(12)

Parameters

Name Description
context Created frame generation context instance, that is, a pointer to the FG_Context_VK object. The pointer cannot be null.
inverted

Flag bit indicating whether the color buffer is flipped around the Y axis relative to the depth stencil buffer.

true: The color buffer is flipped 180 degrees around the Y axis relative to the depth stencil buffer.

false: The color buffer is not flipped relative to the depth stencil buffer.

Return value

Execution result of the function. If the execution is successful, FG_SUCCESS is returned. If the execution fails, an error code is returned. For details about the error codes, please refer to FG_ErrorCode.

[h2]HMS_FG_SetImageFormat_GLES()

FG_ErrorCode HMS_FG_SetImageFormat_GLES(FG_Context_GLES* context, FG_ImageFormat_GLES format )

Description

Sets the image format of the real frame color buffer and the predicted frame buffer. This API is optional. If it is not called, the default value FG_FORMAT_R8G8B8A8_UNORM will be used. This API applies only to the OpenGL ES graphics API.

Since: 5.0.0(12)

Parameters

Name Description
context Created frame generation context instance, that is, a pointer to the FG_Context_GLES object. The pointer cannot be null.
format Enumerated values of the image formats of the real frame color buffer and the predicted frame buffer.

Return value

Execution result of the function. If the execution is successful, FG_SUCCESS is returned. If the execution fails, an error code is returned. For details about the error codes, please refer to FG_ErrorCode.

[h2]HMS_FG_SetImageFormat_VK()

FG_ErrorCode HMS_FG_SetImageFormat_VK(FG_Context_VK* context, const FG_ImageFormat_VK* format )

Description

Sets the input and output image formats for frame generation. This API is optional. If it is not called, the default value VK_FORMAT_R8G8B8A8_UNORM will be used for the real frame color buffer and predicted frame buffer, and VK_FORMAT_D24_UNORM_S8_UINT will be used for the depth stencil buffer. This API applies only to the Vulkan graphics API.

Since: 5.0.0(12)

Parameters

Name Description
context Created frame generation context instance, that is, a pointer to the FG_Context_VK object. The pointer cannot be null.
format Pointer to an FG_ImageFormat_VK object. The pointer cannot be null.

Return value

Execution result of the function. If the execution is successful, FG_SUCCESS is returned. If the execution fails, an error code is returned. For details about the error codes, please refer to FG_ErrorCode.

[h2]HMS_FG_SetResolution_GLES()

FG_ErrorCode HMS_FG_SetResolution_GLES(FG_Context_GLES* context, const FG_ResolutionInfo* resolutionInfo )

Description

Sets the resolutions of input and output images for frame generation (mandatory). This API applies only to the OpenGL ES graphics API.

Since: 5.0.0(12)

Parameters

Name Description
context Created frame generation context instance, that is, a pointer to the FG_Context_GLES object. The pointer cannot be null.
resolutionInfo Pointer to an FG_ResolutionInfo object. The pointer cannot be null.

Return value

Execution result of the function. If the execution is successful, FG_SUCCESS is returned. If the execution fails, an error code is returned. For details about the error codes, please refer to FG_ErrorCode.

[h2]HMS_FG_SetResolution_VK()

FG_ErrorCode HMS_FG_SetResolution_VK(FG_Context_VK* context, const FG_ResolutionInfo* resolutionInfo )

Description

Sets the resolutions of input and output images for frame generation (mandatory). This API applies only to the Vulkan graphics API.

Since: 5.0.0(12)

Parameters

Name Description
context Created frame generation context instance, that is, a pointer to the FG_Context_VK object. The pointer cannot be null.
resolutionInfo Pointer to an FG_ResolutionInfo object. The pointer cannot be null.

Return value

Execution result of the function. If the execution is successful, FG_SUCCESS is returned. If the execution fails, an error code is returned. For details about the error codes, please refer to FG_ErrorCode.

[h2]HMS_FG_SetIntegrationMode_GLES()

FG_ErrorCode HMS_FG_SetIntegrationMode_GLES(FG_Context_GLES* context, const FG_IntegrationInfo* integrationInfo)

Description

Sets the frame prediction integration information. The presentMode, textureCachedByGame, needFlipInputColor, and needFlipOutputColor members in FG_IntegrationInfo take effect only when FG_PredictionMode is set to FG_PREDICTION_MODE_INTERPOLATION. In other cases, these parameters should be ignored or set to their default values. This API applies only to the OpenGL ES graphics API.

Since: 5.1.0(18)

Parameters

Name Description
context Created frame generation context instance, that is, a pointer to the FG_Context_GLES object. The pointer cannot be null.
integrationInfo Pointer to an FG_IntegrationInfo object. The pointer cannot be null.

Return value

Execution result of the function. If the execution is successful, FG_SUCCESS is returned. If the execution fails, an error code is returned. For details about the error codes, please refer to FG_ErrorCode.

[h2]HMS_FG_SetIntegrationMode_VK()

FG_ErrorCode HMS_FG_SetIntegrationMode_VK(FG_Context_VK* context, const FG_IntegrationInfo* integrationInfo)

Description

Sets the frame prediction integration information. The presentMode, textureCachedByGame, needFlipInputColor, and needFlipOutputColor members in FG_IntegrationInfo take effect only when FG_PredictionMode is set to FG_PREDICTION_MODE_INTERPOLATION. In other cases, these parameters should be ignored or set to their default values. This API applies only to the Vulkan graphics API.

Since: 5.1.0(18)

Parameters

Name Description
context Created frame generation context instance, that is, a pointer to the FG_Context_VK object. The pointer cannot be null.
integrationInfo Pointer to an FG_IntegrationInfo object. The pointer cannot be null.

Return value

Execution result of the function. If the execution is successful, FG_SUCCESS is returned. If the execution fails, an error code is returned. For details about the error codes, please refer to FG_ErrorCode.

[h2]HMS_FG_SetUiPredictionEnabled_GLES()

FG_ErrorCode HMS_FG_SetUiPredictionEnabled_GLES(FG_Context_GLES* context, bool isEnabled)

Description

Sets whether to enable the UI prediction function. This function can be enabled only in system display mode. It is invalid in game display mode. This API applies only to the OpenGL ES graphics API.

Since: 5.1.0(18)

Parameters

Name Description
context Created frame generation context instance, that is, a pointer to the FG_Context_GLES object. The pointer cannot be null.
isEnabled

Indicates whether the UI prediction function is enabled.

true: yes

false: no

Return value

Execution result of the function. If the execution is successful, FG_SUCCESS is returned. If the execution fails, an error code is returned. For details about the error codes, please refer to FG_ErrorCode.

[h2]HMS_FG_SetUiPredictionEnabled_VK()

FG_ErrorCode HMS_FG_SetUiPredictionEnabled_VK(FG_Context_VK* context, bool isEnabled)

Description

Sets whether to enable the UI prediction function. This function can be enabled only in system display mode. It is invalid in game display mode. This API applies only to the Vulkan graphics API.

Since: 5.1.0(18)

Parameters

Name Description
context Created frame generation context instance, that is, a pointer to the FG_Context_VK object. The pointer cannot be null.
isEnabled

Indicates whether the UI prediction function is enabled.

true: yes

false: no

Return value

Execution result of the function. If the execution is successful, FG_SUCCESS is returned. If the execution fails, an error code is returned. For details about the error codes, please refer to FG_ErrorCode.

[h2]HMS_FG_SetTargetFps_GLES()

FG_ErrorCode HMS_FG_SetTargetFps_GLES(FG_Context_GLES* context, int targetFps)

Description

Sets the target frame rate for frame generation. The setting takes effect only for the system display mode and is invalid for the game display mode. The value range of targetFps is [30, 144] to ensure performance stability and user experience consistency across different platforms. You should select a proper frame rate based on the actual service scenario. This API takes effect after the game is released for the first time and applies only to the OpenGL ES graphics API.

Since: 5.1.0(18)

Parameters

Name Description
context Created frame generation context instance, that is, a pointer to the FG_Context_GLES object. The pointer cannot be null.
targetFps Target frame rate for frame generation. The minimum value is 30 and the maximum value is 144. If the value is out of the range, the error code FG_INVALID_PARAMETER is returned.

Return value

Execution result of the function. If the execution is successful, FG_SUCCESS is returned. If the execution fails, an error code is returned. For details about the error codes, please refer to FG_ErrorCode.

[h2]HMS_FG_SetTargetFps_VK()

FG_ErrorCode HMS_FG_SetTargetFps_VK(FG_Context_VK* context, int targetFps)

Description

Sets the target frame rate for frame generation. The setting takes effect only for the system display mode and is invalid for the game display mode. The value range of targetFps is [30, 144] to ensure performance stability and user experience consistency across different platforms. You should select a proper frame rate based on the actual service scenario. This API takes effect after the game is released for the first time and applies only to the Vulkan graphics API.

Since: 5.1.0(18)

Parameters

Name Description
context Created frame generation context instance, that is, a pointer to the FG_Context_VK object. The pointer cannot be null.
targetFps Target frame rate for frame generation. The minimum value is 30 and the maximum value is 144. If the value is out of the range, the error code FG_INVALID_PARAMETER is returned.

Return value

Execution result of the function. If the execution is successful, FG_SUCCESS is returned. If the execution fails, an error code is returned. For details about the error codes, please refer to FG_ErrorCode.

[h2]HMS_OpenGTX_Activate()

OpenGTX_ErrorCode HMS_OpenGTX_Activate(OpenGTX_Context* context)

Description

Activates an OpenGTX context instance. Before using an OpenGTX context instance, you need to activate it.

Since: 5.0.0(12)

Parameters

Name Description
context Created OpenGTX context instance, that is, a pointer to the OpenGTX_Context instance. The pointer cannot be null. Otherwise, an error code indicating failure is returned.

Return value

Execution result of the function. If the execution is successful, OPENGTX_SUCCESS is returned. If the execution fails, an error code is returned. For details about the error codes, please refer to OpenGTX_ErrorCode.

[h2]HMS_OpenGTX_CreateContext()

OpenGTX_Context* HMS_OpenGTX_CreateContext(OpenGTX_DeviceInfoCallback deviceInfoCallback)

Description

Creates an OpenGTX context instance. Each time this API is successfully called, an OpenGTX_Context object is created and a pointer to the OpenGTX_Context object is returned.

Since: 5.0.0(12)

Parameters

Name Description
deviceInfoCallback Callback for device temperature information, corresponding to OpenGTX_DeviceInfoCallback.

Return value

If the call is successful, a pointer to OpenGTX_Context is returned. If the call fails, a null pointer is returned.

[h2]HMS_OpenGTX_Deactivate()

OpenGTX_ErrorCode HMS_OpenGTX_Deactivate(OpenGTX_Context* context)

Description

Deactivates an OpenGTX context instance. To activate the instance again, call the HMS_OpenGTX_Activate API.

Since: 5.0.0(12)

Parameters

Name Description
context Created OpenGTX context instance, that is, a pointer to the OpenGTX_Context instance. The pointer cannot be null. Otherwise, an error code indicating failure is returned.

Return value

Execution result of the function. If the execution is successful, OPENGTX_SUCCESS is returned. If the execution fails, an error code is returned. For details about the error codes, please refer to OpenGTX_ErrorCode.

[h2]HMS_OpenGTX_DestroyContext()

OpenGTX_ErrorCode HMS_OpenGTX_DestroyContext(OpenGTX_Context** context)

Description

Destroys an OpenGTX context instance and releases memory resources.

Since: 5.0.0(12)

Parameters

Name Description
context Created OpenGTX context instance, that is, a pointer to the OpenGTX_Context instance. The pointer cannot be null. Otherwise, an error code indicating failure is returned.

Return value

Execution result of the function. If the execution is successful, OPENGTX_SUCCESS is returned. If the execution fails, an error code is returned. For details about the error codes, please refer to OpenGTX_ErrorCode.

[h2]HMS_OpenGTX_DispatchFrameRenderInfo()

OpenGTX_ErrorCode HMS_OpenGTX_DispatchFrameRenderInfo(OpenGTX_Context* context, const OpenGTX_FrameRenderInfo* frameRenderInfo )

Description

Sets the frame rendering information required for OpenGTX running. The information needs to be updated after each change to a frame.

Since: 5.0.0(12)

Parameters

Name Description
context Created OpenGTX context instance, that is, a pointer to the OpenGTX_Context instance. The pointer cannot be null. Otherwise, an error code indicating failure is returned.
frameRenderInfo Frame rendering information struct, that is, a pointer to OpenGTX_FrameRenderInfo. The pointer cannot be null. Otherwise, an error code indicating failure is returned.

Return value

Execution result of the function. If the execution is successful, OPENGTX_SUCCESS is returned. If the execution fails, an error code is returned. For details about the error codes, please refer to OpenGTX_ErrorCode.

[h2]HMS_OpenGTX_DispatchGameSceneInfo()

OpenGTX_ErrorCode HMS_OpenGTX_DispatchGameSceneInfo(OpenGTX_Context* context, const OpenGTX_GameSceneInfo* gameSceneInfo )

Description

Sets the game scene information required for OpenGTX running.

Since: 5.0.0(12)

Parameters

Name Description
context Created OpenGTX context instance, that is, a pointer to the OpenGTX_Context instance. The pointer cannot be null. Otherwise, an error code indicating failure is returned.
gameSceneInfo Game scene information, that is, a pointer to OpenGTX_GameSceneInfo. The pointer cannot be null. Otherwise, an error code indicating failure is returned.

Return value

Execution result of the function. If the execution is successful, OPENGTX_SUCCESS is returned. If the execution fails, an error code is returned. For details about the error codes, please refer to OpenGTX_ErrorCode.

[h2]HMS_OpenGTX_DispatchNetworkInfo()

OpenGTX_ErrorCode HMS_OpenGTX_DispatchNetworkInfo(OpenGTX_Context* context, const OpenGTX_NetworkInfo* networkInfo )

Description

Sets the network latency information required for OpenGTX running.

Since: 5.0.0(12)

Parameters

Name Description
context Created OpenGTX context instance, that is, a pointer to the OpenGTX_Context instance. The pointer cannot be null. Otherwise, an error code indicating failure is returned.
networkInfo Network information, that is, a pointer to OpenGTX_NetworkInfo. The pointer cannot be null. Otherwise, an error code indicating failure is returned.

Return value

Execution result of the function. If the execution is successful, OPENGTX_SUCCESS is returned. If the execution fails, an error code is returned. For details about the error codes, please refer to OpenGTX_ErrorCode.

[h2]HMS_OpenGTX_SetConfiguration()

OpenGTX_ErrorCode HMS_OpenGTX_SetConfiguration (OpenGTX_Context* context, const OpenGTX_ConfigDescription* config )

Description

Initializes an OpenGTX context instance and sets the OpenGTX context instance properties.

Since: 5.0.0(12)

Parameters

Name Description
context Created OpenGTX context instance, that is, a pointer to the OpenGTX_Context instance. The pointer cannot be null. Otherwise, an error code indicating failure is returned.
config Initialization parameters of an OpenGTX context instance, that is, a pointer to OpenGTX_ConfigDescription. The pointer cannot be null. Otherwise, an error code indicating failure is returned.

Return value

Execution result of the function. If the execution is successful, OPENGTX_SUCCESS is returned. If the execution fails, an error code is returned. For details about the error codes, please refer to OpenGTX_ErrorCode.