Skip to content

OpenXR support? #109

@gigadude

Description

@gigadude

I'd like to add OpenXR support, opening this issue to discuss the right way to do that.

My first pass at the needed API changes for minimalist XR support:

IEngineFactory:

  • CreateOpenXRFactory(OpenXRCreateInfo* info, IOpenXRContext** ctx), called before CreateDeviceAndContextsXx to initialize the OpenXR instance and return the interface. IOpenXRContext will provide interfaces to the session lifecycle stuff, input bindings, layers, spaces etc.

ISwapChain:

  • Uint32 GetViewCount() to turn the number of views for the device (typically 2 for right, left eyes). Non-OpenXR apps will return 1.
  • OpenXRViewDesc GetOpenOpenXRViewDesc(Uint32 ViewIndex) to return the view descriptor for a given view.
  • Uint32 SelectOpenXRView(Uint32 ViewIndex) to make one of the views "current", the rest of the swapchain functions will reference the resources for that view (e,g, GetDesc, GetCurrentBackBufferRTV etc. will return parameters for the selected view). Returns the previously current view.
  • WaitFrame(FrameInfo* frame) maps to xrWaitFrame, ignored by non-XR apps.
  • BeginFrame(FrameInfo* frame) maps to xrBeginFrame, ignored by non-XR apps.
  • EndFrame(FrameInfo* frame) maps to xrEndFrame, ignored by non-XR apps. Present() will be ignored by XR apps.

The intent is to allow the same code to work in both XR and 2D mode by simply choosing to call or not call CreateOpenXRFactory.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions