WVR_RenderInit¶
- WVR_EXPORT WVR_RenderError WVR_RenderInit(const WVR_RenderInitParams_t * param)
The interface to initiate the render runtime.
Render runtime is in charge of pre-processing the rendered scene before updating to display. To initiate render runtime, this interface is recommended to be invoked before the following interfaces in some platforms, such as WVR_RenderMask, WVR_SubmitFrame, WVR_ObtainTextureQueue, WVR_GetTextureQueueLength, WVR_GetAvailableTextureIndex, WVR_GetAvailableTextureIndex, WVR_GetAvailableTextureIndex, WVR_GetTexture, WVR_ReleaseTextureQueue, WVR_RequestScreenshot, WVR_StartRenderer, WVR_IsRendererRendering, and WVR_GetSyncPose.
Instead of default configuration and selecting OpenGL graphics API, the first shot of WVR_RenderInit invocation can provide the customized initiating configuration and selecting supported graphics library via the argument WVR_RenderInitParams_t. Based on the return type WVR_RenderError, the status of render runtime initialization can be determined.
- Return
- WVR_RenderError, this return type enumerates all the possible error status for this interface.
- Parameters
- param -
pointer of struct WVR_RenderInitParams_t, to aggregate necessary information to initialize the render runtime.
- param -
Struct and enumeration¶
The srtuct WVR_RenderInitParams is defined as below.
- struct WVR_RenderInitParams¶
Render initialization parameters.
Aggregate necessary information to initialize the render runtime.
Public Members
- WVR_GraphicsApiType graphicsApi¶
Select the supported graphics api library, currently, only support OpenGL.
- uint64_t renderConfig¶
4 bytes bit mask to choose combination of render initializing configuration. The corresponding enumeration is defined in WVR_RenderConfig
- enum WVR_GraphicsApiType¶
Graphics API for render support.
Texture type is only supported OpenGL currently. There will be other types of graphics API in future release.
Values:
- WVR_GraphicsApiType_OpenGL = 1¶
WVR_GraphicsApiType_OpenGL: Specify OpenGL as graphics API during render runtime initializing.
- enum WVR_RenderConfig¶
Render runtime initialization configuration.
Developer can determine whether render runtime use the additional method to improve the user experience after runtime initializing. The render configuration is a 4 bytes bit mask which 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 input parameter of interface WVR_RenderInit, the render configurations are passed to render runtime initializing stage.
Values:
- WVR_RenderConfig_Default = 0x0000¶
WVR_RenderConfig_Default: Set the render runtime without direct mode, MSAA, vertical sync, timewarp, and asynchronous time warp
- WVR_RenderConfig_Direct_Mode = 0x0001¶
WVR_RenderConfig_Direct_Mode: Runtime uses direct mode when this config is asserted. The direct mode determine whether runtime controls over frame queue based on specific timing of vertical retrace occurring on display. This method helps to reduce latency and improve the visual experience.
- WVR_RenderConfig_MSAA = 0x0002¶
WVR_RenderConfig_MSAA: Set config to enable MSAA effect to runtime.
- WVR_RenderConfig_Vertical_Sync = 0x0010¶
WVR_RenderConfig_Vertical_Sync: Determine the runtime front/back buffer behavior whether buffers swap upon vertical retrace occurring on display.
- WVR_RenderConfig_Timewarp = 0x0100¶
WVR_RenderConfig_Timewarp: The timewarp is also known as reprojection. This config determine that runtime choose to correct the rendered scene based on the head movement before updateing the result to display. This method help to reduce the judder.
- WVR_RenderConfig_Timewarp_Asynchronous = 0x0300¶
WVR_RenderConfig_Timewarp_Asynchronous: This config determine whether runtime uses the Asynchronous time warp method. Asynchrounous timewarp is held parallelly with scene rendering. Runtime determines to use the generated timewarped frame when the frame rate drops. This method helps to reduce latency.
- enum WVR_RenderError¶
Error for render runtime initialization.
The return value for the initializing interface WVR_RenderInit.
Values:
- WVR_RenderError_None = 0¶
WVR_RenderError_None: No error.
- WVR_RenderError_RuntimeInitFailed = 410¶
WVR_RenderError_RuntimeInitFailed: The dependent component is failed to block render runtime initializing go on.
- WVR_RenderError_ContextSetupFailed = 411¶
WVR_RenderError_ContextSetupFailed: The necessary context for runtime is failed to accomplish.
- WVR_RenderError_DisplaySetupFailed = 412¶
WVR_RenderError_DisplaySetupFailed: The display configuration for display is failed to 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: Not passing Null check.
- WVR_RenderError_Max = 65535¶
WVR_RenderError_Max: Maxium value to reserve bit word among compilers .
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_Timewarp_Asynchronous};
WVR_RenderError pError = WVR_RenderInit(¶m);
if (pError != WVR_RenderError_None) {
LOGE("Render init failed - Error[%d]", pError);
}
}