Metal stereo shader on Vision Pro

Hi there, I have some existing metal rendering / shader views that I would like to use to present stereoscopic content on the Vision Pro. Is there a metal shader function / variable that lets me know which eye we're currently rendering to inside my shader? Something like Unity's unity_StereoEyeIndex? I know RealityKit has GeometrySwitchCameraIndex, so I want something similar (but outside of a RealityKit context).

Many thanks,

Rich

Any updates here? Would like a way to affect stereo layers in a metal shader on a swift UI view.

IIRC AVPlayerViewController has the same limitation -- it can show 3D if it's in its own window, but falls back to 2D if embedded in a SwiftUI windows. It sounds like the OS might be rendering UI to a monocular target, so your best bet might be rendering to a stereo render target, and displaying it on a RealityKit quad with a custom RK shader for showing the correct image on each eye.

Metal stereo shader on Vision Pro
 
 
Q