openvr icon indicating copy to clipboard operation
openvr copied to clipboard

DXVK: problems submitting Vulkan images

Open TheIronWolfModding opened this issue 4 years ago • 1 comments

I am enhacing old DX9 game to support OpenVR and I got it to work in VR in DX11 mode. Someone however, brought DXVK to my attention, and to my big surprise using DXVK in DX9->Vulkan mode adds ~7%-20% FPS and most importantly, reduces RAM use in some cases. Now, I am trying to move away from my DX11 VR to DXVK by submitting Vulkam images to OpenVR. Note: this is on Win10, not Wine.

Game works with no issues in 2D DXVK mode, so my issue is purely OpenVR. I can see submitted images in VR view, but I hit some kind of race:

  • Sometimes, Submit fails with this:

Sun Nov 21 2021 19:31:30.124 - vkAllocateMemory failed with result -2 Sun Nov 21 2021 19:31:30.124 - Failed to create sync texture. Ensure application was built using DXGI 1.1 or later (i.e. Call CreateDXGIFactory1).

  • Most often, it succeeds but eventually DXVK hangs waiting on Vulkan command sets queues to drain (if I understand correclty). I do flush/sync before Submit, so I don't know why I hit those races still (game is single threaded).

As soon as I comment out OpenVR Submit or SetOverlayTexture all problems are gone, it's like something happens in those 2 APIs and I need to call something after calling them to synchronize. Any ideas? Thanks in advance.

TheIronWolfModding avatar Nov 22 '21 23:11 TheIronWolfModding

I got to a point where my code runs fine in VR via DXVK. The only problem is it runs 1 out of 20 times I start the process. Most of the time I get:

vkAllocateMemory failed with result -2

Coming from SetOverlayTexture or Submit. That one time it starts correctly, however everything runs nicely, so it is some sort of race at OVR initialization time, any ideas how to fix this?

TheIronWolfModding avatar Nov 25 '21 21:11 TheIronWolfModding