LLGL 0.05 Beta
Loading...
Searching...
No Matches
LLGL::XRSystem Class Referenceabstract

XR system interface. More...

#include <XRSystem.h>

Inheritance diagram for LLGL::XRSystem:
LLGL::Interface LLGL::NonCopyable

Public Member Functions

 ~XRSystem ()
 Releases internal data.
virtual const char * GetRuntimeName () const =0
 Returns the runtime name reported by the active OpenXR runtime (e.g. "SteamVR" or "Monado").
virtual ArrayView< XRViewConfigurationView > GetViewConfigurations () const =0
 Returns the view configuration entries for the form factor selected at load time.
virtual const Report * GetReport () const =0
 Returns a pointer to the report or null if there is none.
virtual RenderSystemPtr CreateRenderSystem (const RenderSystemDescriptor &renderSystemDesc, Report *report=nullptr)=0
 Creates an LLGL::RenderSystem whose underlying graphics device satisfies the XR runtime's binding requirements.
virtual XRSession * CreateSession (const XRSessionDescriptor &sessionDesc, RenderSystem &renderSystem)=0
 Creates a new XR session bound to the given render system.
virtual void Release (XRSession &session)=0
 Releases the specified session. After this call, the session must no longer be used.
virtual bool PollEvents ()=0
 Polls the OpenXR runtime for events.
virtual bool GetNativeHandle (void *nativeHandle, std::size_t nativeHandleSize)=0
 Returns the native handle of this XR system.
Public Member Functions inherited from LLGL::Interface
virtual bool IsInstanceOf (int id) const
 Returns true if this object is an instance of the specified interface.
Public Member Functions inherited from LLGL::NonCopyable
 NonCopyable (const NonCopyable &)=delete
NonCopyable & operator= (const NonCopyable &)=delete
virtual ~NonCopyable ()=default

Static Public Member Functions

static XRSystemPtr Load (const XRSystemDescriptor &xrSystemDesc, Report *report=nullptr)
 Loads and brings up an XR runtime.
static void Unload (XRSystemPtr &&xrSystem)
 Unloads the specified XR system.

Protected Member Functions

 XRSystem ()
 Allocates the internal data.
Protected Member Functions inherited from LLGL::NonCopyable
 NonCopyable ()=default

Detailed Description

XR system interface.

Remarks
Top-level entry point for OpenXR support. An XRSystem brings up the XR runtime, queries the selected device's view configuration, and prepares an LLGL::RenderSystem whose underlying graphics device satisfies the runtime's binding requirements.

Typical usage:

// 1. Bring up XR runtime
xrDesc.applicationName = "MyApp";
// 2. Create an XR-compatible renderer
rDesc.rendererModule = "Vulkan";
LLGL::RenderSystemPtr renderer = xr->CreateRenderSystem(rDesc);
// 3. Create an XR session bound to that renderer, then per-view swap-chains
LLGL::XRSession* session = xr->CreateSession(LLGL::XRSessionDescriptor{}, *renderer);
const auto views = xr->GetViewConfigurations();
//...
XR session interface.
Definition XRSession.h:79
static XRSystemPtr Load(const XRSystemDescriptor &xrSystemDesc, Report *report=nullptr)
Loads and brings up an XR runtime.
std::unique_ptr< RenderSystem, RenderSystemDeleter > RenderSystemPtr
Unique pointer type for the RenderSystem interface with a custom deleter.
Definition RenderSystem.h:105
std::unique_ptr< XRSystem > XRSystemPtr
Unique pointer type for the XRSystem interface.
Definition XRSystem.h:35
Render system descriptor structure.
Definition RenderSystemFlags.h:333
XR session descriptor structure.
Definition XRSystemFlags.h:190
XR system descriptor structure.
Definition XRSystemFlags.h:109
See also
XRSession
XRSwapChain

Constructor & Destructor Documentation

◆ ~XRSystem()

LLGL::XRSystem::~XRSystem ( )

Releases internal data.

◆ XRSystem()

LLGL::XRSystem::XRSystem ( )
protected

Allocates the internal data.

Member Function Documentation

◆ CreateRenderSystem()

virtual RenderSystemPtr LLGL::XRSystem::CreateRenderSystem ( const RenderSystemDescriptor & renderSystemDesc,
Report * report = nullptr )
pure virtual

Creates an LLGL::RenderSystem whose underlying graphics device satisfies the XR runtime's binding requirements.

Parameters
[in]renderSystemDescSpecifies the render system descriptor.
[out]reportOptional pointer to a report on failure.
Returns
Unique pointer to a render system, or null on failure.
Remarks
Supported renderer modules are "Vulkan", "Direct3D11", and "Direct3D12". The returned render system must be used as the renderer parameter to CreateSession.
See also
RenderSystemDescriptor

◆ CreateSession()

virtual XRSession * LLGL::XRSystem::CreateSession ( const XRSessionDescriptor & sessionDesc,
RenderSystem & renderSystem )
pure virtual

Creates a new XR session bound to the given render system.

Parameters
[in]sessionDescSpecifies the XR session descriptor.
[in]renderSystemThe renderer to bind the session to. Must have been obtained from CreateRenderSystem on this same XRSystem instance.
Returns
Pointer to the new XRSession, or null on failure.
Remarks
Ownership of the session remains with the XRSystem; use Release to free it.

◆ GetNativeHandle()

virtual bool LLGL::XRSystem::GetNativeHandle ( void * nativeHandle,
std::size_t nativeHandleSize )
pure virtual

Returns the native handle of this XR system.

Parameters
[out]nativeHandlePointer to the backend-specific native handle structure. Obtain it from #include <LLGL/Backend/OpenXR/NativeHandle.h>.
[in]nativeHandleSizeSize (in bytes) of the native handle structure.
Returns
True if the native handle was successfully retrieved.
See also
OpenXR::SystemNativeHandle

◆ GetReport()

virtual const Report * LLGL::XRSystem::GetReport ( ) const
pure virtual

Returns a pointer to the report or null if there is none.

◆ GetRuntimeName()

virtual const char * LLGL::XRSystem::GetRuntimeName ( ) const
pure virtual

Returns the runtime name reported by the active OpenXR runtime (e.g. "SteamVR" or "Monado").

◆ GetViewConfigurations()

virtual ArrayView< XRViewConfigurationView > LLGL::XRSystem::GetViewConfigurations ( ) const
pure virtual

Returns the view configuration entries for the form factor selected at load time.

Remarks
The returned array's size is the number of views the application must render each frame (e.g. 2 for stereo). Each entry carries recommended and maximum image dimensions plus sample counts.

◆ Load()

XRSystemPtr LLGL::XRSystem::Load ( const XRSystemDescriptor & xrSystemDesc,
Report * report = nullptr )
static

Loads and brings up an XR runtime.

Parameters
[in]xrSystemDescSpecifies the XR system descriptor.
[out]reportOptional pointer to a report on failure of loading the XR runtime.
Returns
Unique pointer to the new XR system, or null on failure (in which case report is populated if provided).
Remarks
This function discovers the active OpenXR runtime via the OpenXR loader and queries the selected form factor. Returns null if no compatible runtime is installed or the requested form factor is unavailable.

◆ PollEvents()

virtual bool LLGL::XRSystem::PollEvents ( )
pure virtual

Polls the OpenXR runtime for events.

Remarks
Must be called regularly from the main loop; this drives session-state transitions reported through XRSession::GetState. Returns true if any events were processed.

◆ Release()

virtual void LLGL::XRSystem::Release ( XRSession & session)
pure virtual

Releases the specified session. After this call, the session must no longer be used.

◆ Unload()

void LLGL::XRSystem::Unload ( XRSystemPtr && xrSystem)
static

Unloads the specified XR system.

Remarks
After this call, all sessions and swap-chains created from this system must no longer be used.

The documentation for this class was generated from the following file: