ovr_CreateTextureSwapChainVk 崩溃
ovr_CreateTextureSwapChainVk crashes
我正在尝试使用 Vulkan 和 OVR 创建 VR 应用程序。
主要步骤如下:
- 初始化 OVR
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;
}
- 选择 vkPhysicalDevice
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;
}
问题是程序在调用ovr_CreateTextureSwapChainVk
时崩溃了。
问题是由于设备扩展。以下是使用 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 };
我正在尝试使用 Vulkan 和 OVR 创建 VR 应用程序。
主要步骤如下:
- 初始化 OVR
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;
}
- 选择 vkPhysicalDevice
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;
}
问题是程序在调用ovr_CreateTextureSwapChainVk
时崩溃了。
问题是由于设备扩展。以下是使用 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 };