OpenXR-SDK-Source icon indicating copy to clipboard operation
OpenXR-SDK-Source copied to clipboard

Exception when running hello_xr in debug mode

Open gormlai opened this issue 3 years ago • 12 comments

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

gormlai avatar Nov 03 '20 18:11 gormlai

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

rpavlik avatar Nov 16 '20 23:11 rpavlik

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

gormlai avatar Nov 17 '20 11:11 gormlai

What runtime is this on?

rpavlik avatar Nov 18 '20 19:11 rpavlik

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

gormlai avatar Nov 19 '20 10:11 gormlai

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.

rpavlik avatar Nov 19 '20 18:11 rpavlik

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.

gormlai avatar Nov 21 '20 12:11 gormlai

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 avatar Nov 23 '20 18:11 Paul-Hubert

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

Paul-Hubert avatar Nov 23 '20 18:11 Paul-Hubert

@Paul-Hubert are you also using Oculus runtime?

rpavlik avatar Nov 23 '20 23:11 rpavlik

@rpavlik yes

Paul-Hubert avatar Nov 23 '20 23:11 Paul-Hubert

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.

rpavlik-bot avatar Nov 25 '20 21:11 rpavlik-bot

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

johnkearney avatar Dec 20 '21 17:12 johnkearney