Prof-Butts / xwa_ddraw_d3d11

Direct3D 11 implementation of DDraw.dll for XWA with VR support and New Shaders
MIT License
6 stars 4 forks source link

Implement OpenXR support #24

Open morallo opened 4 years ago

morallo commented 4 years ago

Because why not? 😄

https://www.khronos.org/openxr/

It's phasing out OpenVR as the official API for SteamVR. Also, it would allow to support Oculus and WMR runtimes directly without needing SteamVR.

morallo commented 3 years ago

Hey @Prof-Butts I am giving this a try, and I could use some hints.

First problem: to initialize the XrInstance, I need a pointer to the D3DDevice, which is a member of DeviceResources. But the deviceResources instance is only created when the app calls DirectDrawCreate(), and not available at the time dllmain is executed, where other initialization routines are run (for example SteamVR).

Should we implement the initialization of VR resources in DeviceResources::Initialize() instead of dllmain?

Prof-Butts commented 3 years ago

Yeah, I think that's the right call. Just protect the initialization with some global variable (like g_bUseOpenXR) and maybe try creating a new branch because I've got the feeling several things might break while we work on this.

morallo commented 3 years ago

Yep, already created it :-) This is more an experiment than anything, for now. I will let you know if I manage to make it work.

Prof-Butts commented 3 years ago

I'm confident you'll make it work. So, it's a matter of "when", not "if" ;)

I'm also curious about one thing: do we still have to deal with something similar to WaitGetPoses() and the associated penalty in performance?

On Mon, Feb 8, 2021 at 12:31 PM Marcos Orallo notifications@github.com wrote:

Yep, already created it :-) This is more an experiment than anything, for now. I will let you know if I manage to make it work.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Prof-Butts/xwa_ddraw_d3d11/issues/24#issuecomment-775432658, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAK2FAIIXLO5RGJSXLT6OO3S6BCYNANCNFSM4OU5DPAA .

morallo commented 3 years ago

Yes, all VR runtimes have the same concept, to minimize latency. In OpenXR there is xrWaitFrame and xrBeginFrame. I hope that the implementation is more flexible and consistent than in openvr. Oculus SteamVR support was really weird for this.