If you're curious or don't know, there's an example of OpenGL+OpenXR here (https://github.com/ReliaSolve/OpenXR-OpenGL-Example/blob/main/main.cpp) that I was just looking at it. From what I know so far OpenXR begins with
XrSessionCreateInfo that is a structure tailored to the underlying graphics API and for Direct3D it looks like it takes a device pointer. In this OpenGL case it looks like it takes arguments for creating its own context, bypassing WGL/EGL, etc. to my surprise. (In that case ANGLE would have to piggyback onto its context.) Direct3D seems simpler in this regard. Then the second step I know of is
. This pulls back native buffers that OpenXR creates by itself. In that case ANGLE would unlikely know about these handles and would have to patch them into its internal representation. It's possible it could function ignorant of this (I'm speculating) but the next step is per frame XrSwapchainImageAcquireInfo is used to get a swap chain index into those, but the index is really used to get an XrSwapchainImageOpenGLKHR or
. These have handles that may be identical to
(I don't know) that the apps draw themselves into.
In the OpenGL example this handle is passed to
and a depth buffer is allocated by the app independently and it to uses
. In the Direct3D case the interface pointer is passed to CreateRenderTargetView.
[Personally I'm a little skeptical of OpenXr but this could be premature on my part, being inexperienced with it. I feel strong-armed into using it. I just have a feeling its specification is too controlling and too expensive (compromising) on performance (I worry some screen effects won't work and vendors may feel they're in position to dictate screen effects to artistic apps) and that I will at some point find myself trying to use its "headless" extension (headless is kind of misnomer for head sets) to bypass its rendering interface. But that won't be possible unless enough information is available for a given device to draw it correctly, assuming the picture can be sent to the device like a regular display, and hoping that with the headless mode "reprojection" doesn't cut out. IOW I have to program an OpenXR path to start working with high end sets. There's an open source Monado project for Linux that might have to figure this out too. But I think apart from rendering OpenXR will be fine.]