Reputation: 319
I'm trying to create a VR application using Vulkan and OVR.
Here are the main steps:
ovrInitParams initParams = { ovrInit_RequestVersion | ovrInit_FocusAware, OVR_MINOR_VERSION, NULL, 0, 0 };
ovrResult result = ovr_Initialize(&initParams);
if (!OVR_SUCCESS(result))
{
Debug::sendError("Failed to initialize OVR");
return;
}
result = ovr_Create(&m_session, &m_luid);
if (!OVR_SUCCESS(result))
{
Debug::sendError("Failed to create OVR");
return;
}
ovr_GetSessionPhysicalDeviceVk(m_session, m_luid, m_instance, &m_physicalDevice);
ovrTextureSwapChainDesc colorDesc = {};
colorDesc.Type = ovrTexture_2D;
colorDesc.ArraySize = 1;
colorDesc.Format = OVR_FORMAT_B8G8R8A8_UNORM_SRGB;
colorDesc.Width = 1280;
colorDesc.Height = 720;
colorDesc.MipLevels = 1;
colorDesc.SampleCount = 1;
colorDesc.MiscFlags = ovrTextureMisc_DX_Typeless;
colorDesc.BindFlags = ovrTextureBind_DX_RenderTarget;
colorDesc.StaticImage = ovrFalse;
ovrResult result = ovr_CreateTextureSwapChainVk(m_session, device, &colorDesc, &m_textureChain);
if (!OVR_SUCCESS(result))
{
ovrErrorInfo errorInfo;
ovr_GetLastErrorInfo(&errorInfo);
Debug::sendError("Failed to create swapchain OVR");
return;
}
The problem is that the program crashes when calling ovr_CreateTextureSwapChainVk
.
Upvotes: 1
Views: 112
Reputation: 319
The problem was due to device extensions. Here are the correct extensions to use OVR :
{ VK_KHR_SWAPCHAIN_EXTENSION_NAME, VK_KHR_EXTERNAL_MEMORY_EXTENSION_NAME, "VK_KHR_external_memory_win32", VK_KHR_EXTERNAL_SEMAPHORE_EXTENSION_NAME, "VK_KHR_external_semaphore_win32", VK_KHR_GET_MEMORY_REQUIREMENTS_2_EXTENSION_NAME };
Upvotes: 1