Skip to content
Chris Birkhold edited this page Aug 29, 2018 · 4 revisions

OpenVRMetal

OpenVRMetal is a collection of utility classes to make it easier to work with OpenVR + Metal on macOS. At of August 2018 Vive/SteamVR is the only officially supported combination of HMD/runtime supported on macOS.

OpenVR as it relates to Metal

Metal Specifics

The Metal specific part of OpenVR is quite small:

  1. IVRCompositor::Submit accepts Texture_t descriptors of type:
    1. TextureType_IOSurface (macOS 11.13)
    2. TextureType_Metal (macOS 10.14+)
  2. IVRSystem::GetOutputDevice returns the Metal device representing the GPU the HMD is connected to.

Though however small the API surfaces may be there is a few details to be aware of:

  1. TextureType_IOSurface
    1. The kIOSurfaceIsGlobal property must be set to true/yes on creation of the IOSurface. While kIOSurfaceIsGlobal was deprecated in favor of using IOSurfaceCreateMachPort or IOSurfaceCreateXPCObject, as of August 2018 SteamVR still uses shared memory to submit IOSurface-backed textures to the compositor so this property must be set for now.
    2. The same two IOSurface backed Metal texture (one for each eye) must be used for all frames submitted to the compositor.
    3. ...
  2. TextureType_Metal
    1. ...

Metal Related

There are a few generic OpenVR types that need to be converted for use with the Metal framework:

  1. Math types (vectors, matrices, ...)
  2. Hidden area meshes
Clone this wiki locally