KhronosGroup / OpenXR-SDK-Source

Sources for OpenXR loader, basic API layers, and example code.
https://khronos.org/openxr
Apache License 2.0
680 stars 251 forks source link

Exception when running hello_xr in debug mode #218

Open gormlai opened 4 years ago

gormlai commented 4 years ago

I am getting an exception inside amdvlk64.dll when running hello_xr in debug mode. It looks like it could be related to enabled validation layers. The sample works as expected in release mode. This is the error I get in the output in debug mode:

[19:58:49.029][Error ] ERROR: (INSTANCE 0x1a69748ba60) [Validation] Validation Error: [ VUID-VkImageViewCreateInfo-image-parameter ] Object 0: handle = 0x1a69748ba60, type = VK_OBJECT_TYPE_INSTANCE; | MessageID = 0x12cba4ac | Invalid VkImage Object 0x1a6a0f28bf0.

I have attached a screenshot showing the callstack at the time of the exception.

Capture

rpavlik commented 4 years ago

Hmm, so that's a Vulkan validation error. I'll point some folks who might know at this report.

gormlai commented 4 years ago

Thanks, yes. Specifically it happens when it tries to create a VkImageView, of one of the images gotten with xrEnumerateSwapchainImages.

rpavlik commented 4 years ago

What runtime is this on?

gormlai commented 4 years ago

Oculus. Also, not sure if it matters, but the Vulkan SDK is 1.2.135.0

rpavlik commented 4 years ago

ah, my contact at Oculus desktop is out of the office right now. I've done some pinging anyway, hopefully I can get you some advice. Feels like either a runtime or gpu driver bug... you could try the forums/support for those things.

gormlai commented 4 years ago

I don't know if it matters, but besides getting this exception in hello_xr, I also get it in our own xr code which I ported from our oculus specific implementation. The oculus specific implementation does not raise any exception, and the validation layers seem to work as expected. Only the openxr implementation has this bug.

Paul-Hubert commented 4 years ago

I have the same bug, here is the smallest possible test case that presents it. In this case, the error happens during xrDestroySession, where it tries to destroy the same invalid VkImage. If you try to make a swapchain and get the images from it they will also be invalid, just like this issue. https://pastebin.com/kTR77VfH

Paul-Hubert commented 4 years ago

The only solution I could find is deactivating vulkan validation layers (works totally fine without) or switching to steamvr.

rpavlik commented 4 years ago

@Paul-Hubert are you also using Oculus runtime?

Paul-Hubert commented 4 years ago

@rpavlik yes

rpavlik-bot commented 4 years ago

An issue (number 1472) has been filed to correspond to this issue in the internal Khronos GitLab.

If you have a Khronos account, you can access that issue at KHR:openxr/openxr#1472.

johnkearney commented 2 years ago

This issue is specific to Oculus PC OpenXR Runtime when using an AMD GPU. For Vulkan support on AMD GPUs, Oculus PC uses LiquidVR's OpenSharedImage API. The Vulkan validation layers are not aware of this API, so when it comes time to use (or destroy) a VkImage the validation layers crash. We will change the behavior of Oculus PC in an upcoming release (v38) to use vkCreateImage, which should fix this problem.

It is also possible to force the v38 behavior with older releases by setting a regkey: HKEY_LOCAL_MACHINE\SOFTWARE\Oculus VR, LLC\Oculus\Config\KHRInteropEnabled to DWORD 1