Ralith / openxrs

OpenXR bindings for Rust
Apache License 2.0
282 stars 59 forks source link

add headless graphics api #167

Closed galister closed 3 months ago

galister commented 3 months ago

Currently, creating a headless session is needlessly complicated, and developers effectively need to lie that they use a graphics API that they are not actually intending to use.

Since no graphics API is a valid choice of graphics API, I made a implementation that simplifies creating such sessions.

The inner create_session will fail with the correct XrResult if headless session is attempted without first enabling XR_MND_headless.

Usage example:

let (session, _, _) = unsafe {
     instance.create_session(system, &xr::headless::SessionCreateInfo {})?
};