WVR_VulkanInit

WVR_EXPORT bool WVR_VulkanInit(const WVR_VulkanSystemInfo_t * vulkanInfo)

Initializes the API for Vulkan support.

This must be called after WVR_RenderInit and before WVR_ObtainTextureQueue.

vulkanInfo pointer of struct WVR_VulkanSystemInfo_t, to aggregate necessary information for Vulkan support.

Version
API Level 3
Return Value
  • true: Success to set the necessary information.
  • false: Fail to set the necessary information.

Struct and enumeration

struct WVR_VulkanSystemInfo

Vulkan initialization parameters.

Aggregate necessary information for Vulkan support.

How to use

Here is an example for the function:

#include <wvr/wvr.h>
#include <wvr/wvr_render.h>
#include <wvr/wvr_vulkan.h>

bool MainApplication::init() {
    // Loading the WVR Runtime
    WVR_InitError 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 all OpenGL code.
    WVR_RenderInitParams_t param;
    param = { WVR_GraphicsApiType_OpenGL, WVR_RenderConfig_Default };

    WVR_RenderError pError = WVR_RenderInit(&param);
    if (pError != WVR_RenderError_None) {
        LOGE("Present init failed - Error[%d]", pError);
        return false;
    }

    // Initialize Vulkan instance.
    initVK();

    // Must initialize Vulkan interface after render runtime be done.
    const WVR_VulkanSystemInfo_t vulkanInfo = { GetInstance(), GetPhysicalDevice(), GetDevice() };

    if (!WVR_VulkanInit(&vulkanInfo)) {
        LOGE("Fail to initialize Vulkan info!");
        return false;
    }

    return true;
}