WVR_RenderInit

WVR_EXPORT WVR_RenderError WVR_RenderInit(const WVR_RenderInitParams_t * param)

Use this interface to initiate the render runtime.

Render runtime is in charge of pre-processing the rendered scene before updating to the display. To initiate render runtime, it is recommended to invoke this interface before the following interfaces in some platforms, such as WVR_RenderMask, WVR_SubmitFrame, WVR_ObtainTextureQueue, WVR_GetTextureQueueLength, WVR_GetAvailableTextureIndex, WVR_GetTexture, WVR_ReleaseTextureQueue, WVR_RequestScreenshot, WVR_StartRenderer, WVR_IsRendererRendering, and WVR_GetSyncPose.

Instead of the default configuration and selecting the OpenGL graphics API, Invoking WVR_RenderInit first can provide the customized initiating configuration and select the supported graphics library via the argument WVR_RenderInitParams_t. Based on the return type WVR_RenderError, the status of the render runtime initialization can be determined.

Return
WVR_RenderError, this return type enumerates all the possible error statuses for this interface.
Version
API Level 1
Parameters
  • param: Pointer of struct WVR_RenderInitParams_t to aggregate the necessary information to initialize the render runtime.

Struct and enumeration

The struct WVR_RenderInitParams is defined as:

struct WVR_RenderInitParams

Render initialization parameters.

Aggregate the necessary information to initialize the render runtime.

Public Members

WVR_GraphicsApiType graphicsApi

Select the supported graphics API library (currently only OpenGL is supportred.)

uint64_t renderConfig

The bit mask chooses the combination of the render initialization configuration. The corresponding enumeration is defined in WVR_RenderConfig

WVR_GraphicsParams_t graphicsParams

The rendering context from the native application is packed here WVR_GraphicsParams.

enum WVR_GraphicsApiType

Graphics API for render support.

Currently, only OpenGL texture type is supported. Other graphics APIs will be supported in future releases.

Values:

WVR_GraphicsApiType_OpenGL = 1

WVR_GraphicsApiType_OpenGL: Specify OpenGL as the graphics API during render runtime initialization.

enum WVR_RenderConfig

Render runtime initialization configuration.

Determine whether render runtime uses the additional method to improve the user experience after runtime initialization. The render configuration is a bit mask that is able to combine with these methods. This bit mask should be set to the member renderConfig of WVR_RenderInitParams_t. As a necessary part of the input parameter of the WVR_RenderInit interface, the render configurations are passed to the render runtime initialization stage.

Values:

WVR_RenderConfig_Default = 0

WVR_RenderConfig_Default: Runtime initialization reflects certain properties in the device service such as the single buffer mode and reprojection mechanism. The default settings are determined by the device service or runtime config file on a specific platform. The default color space is set as the linear domain.

WVR_RenderConfig_Disable_SingleBuffer = ( 1 << 0 )

WVR_RenderConfig_Disable_SingleBuffer: Disable the single buffer mode in runtime.

WVR_RenderConfig_Disable_Reprojection = ( 1 << 1 )

WVR_RenderConfig_Disable_Reprojection: Disable the reprojection mechanism in runtime.

WVR_RenderConfig_sRGB = ( 1 << 2 )

WVR_RenderConfig_sRGB: To do gamma correction for a linear space source.

WVR_RenderConfig_GL_No_Error = ( 1 << 3 )

WVR_RenderConfig_GL_No_Error: Apply GL_KHR_no_error extension to enable OpenGL no error mode.

WVR_RenderConfig_Initialize_FadeOut = ( 1 << 5 )

WVR_RenderConfig_Initialize_FadeOut: Initialize fade out feature, it will take gpu usage for polling state.

WVR_RenderConfig_Initialize_UMC = ( 1 << 6 )

WVR_RenderConfig_Initialize_UMC: Initialize UMC feature, it will take gpu usage for polling state.

WVR_RenderConfig_Initialize_PMC = ( 1 << 7 )

WVR_RenderConfig_Initialize_PMC: Initialize PMC feature, it will take gpu usage for polling state.

WVR_RenderConfig_Initialize_FrameSharpnessEnhancement = ( 1 << 8 )

WVR_RenderConfig_Initialize_FrameSharpnessEnhancement: Initialize frame sharpness enhancement, it will force enable 2-stage pipeline and take gpu usage for polling state.

Static shader feature

We can mute some render features related to ATW pipeline to save some GPU performance consumption due to stage polling. You have to initialize these feature with related flag.

struct WVR_GraphicsParams

The rendering context from the native application.

Maintain the rendering context from the native application via the render runtime initialization interface.

Public Members

void *renderContext

The rendering context from the native application is for binding the surface of the VR application.

enum WVR_RenderError

Error for render runtime initialization.

The return value for the initialization interface WVR_RenderInit.

Values:

WVR_RenderError_None = 0

WVR_RenderError_None: No error.

WVR_RenderError_RuntimeInitFailed = 410

WVR_RenderError_RuntimeInitFailed: The dependent component failed to block the render runtime initialization.

WVR_RenderError_ContextSetupFailed = 411

WVR_RenderError_ContextSetupFailed: The necessary context to set up runtime failed.

WVR_RenderError_DisplaySetupFailed = 412

WVR_RenderError_DisplaySetupFailed: The display configuration for the display was not set up.

WVR_RenderError_LibNotSupported = 413

WVR_RenderError_LibNotSupported: The provided graphics API type is not supported by runtime.

WVR_RenderError_NullPtr = 414

WVR_RenderError_NullPtr: Did not pass Null check.

WVR_RenderError_Max = 65535

WVR_RenderError_Max: Maximum error code reserve. The actual value may change depending on the compiler word length.

How to use

Here is an example for the function:

#include <wvr/wvr_render.h>

void initRuntime() {
    // Load the WVR Runtime before invoking WVR_RenderInit
    WVR_InitError eError = WVR_InitError_None;
    eError = WVR_Init(WVR_AppType_VRContent);
    if (eError != WVR_InitError_None) {
        LOGE("Unable to init VR runtime: %s", WVR_GetInitErrorString(eError));
        return false;
    }

    // Must initialize render runtime before calling all rendering-related API.
    WVR_RenderInitParams_t param = {WVR_GraphicsApiType_OpenGL, WVR_RenderConfig_Default};
    WVR_RenderError pError = WVR_RenderInit(&param);
    if (pError != WVR_RenderError_None) {
        LOGE("Render init failed - Error[%d]", pError);
    }
}