@@ -47,8 +47,8 @@ namespace gfx {
4747// and mapped files if we have both release and nightlies
4848// running at the same time? Or...what if we have multiple
4949// release builds running on same machine? (Bug 1563232)
50- #define SHMEM_VERSION " 0.0.4 "
51- static const int32_t kVRExternalVersion = 11 ;
50+ #define SHMEM_VERSION " 0.0.5 "
51+ static const int32_t kVRExternalVersion = 12 ;
5252
5353// We assign VR presentations to groups with a bitmask.
5454// Currently, we will only display either content or chrome.
@@ -63,6 +63,7 @@ static const uint32_t kVRGroupAll = 0xffffffff;
6363
6464static const int kVRDisplayNameMaxLen = 256 ;
6565static const int kVRControllerNameMaxLen = 256 ;
66+ static const int kProfileNameListMaxLen = 256 ;
6667static const int kVRControllerMaxCount = 16 ;
6768static const int kVRControllerMaxButtons = 64 ;
6869static const int kVRControllerMaxAxis = 16 ;
@@ -118,14 +119,22 @@ enum class ControllerCapabilityFlags : uint16_t {
118119 * linear acceleration.
119120 */
120121 Cap_LinearAcceleration = 1 << 4 ,
122+ /* *
123+ * Cap_GripSpacePosition is set if the Gamepad has a grip space position.
124+ */
125+ Cap_GripSpacePosition = 1 << 5 ,
121126 /* *
122127 * Cap_All used for validity checking during IPC serialization
123128 */
124- Cap_All = (1 << 5 ) - 1
129+ Cap_All = (1 << 6 ) - 1
125130};
126131
127132#endif // ifndef MOZILLA_INTERNAL_API
128133
134+ enum class TargetRayMode : uint8_t { Gaze, TrackedPointer, Screen };
135+
136+ enum class GamepadMappingType : uint8_t { _empty, Standard, XRStandard };
137+
129138enum class VRDisplayBlendMode : uint8_t { Opaque, Additive, AlphaBlend };
130139
131140enum class VRDisplayCapabilityFlags : uint16_t {
@@ -332,6 +341,37 @@ struct VRControllerState {
332341#else
333342 ControllerHand hand;
334343#endif
344+ // https://immersive-web.github.io/webxr/#enumdef-xrtargetraymode
345+ TargetRayMode targetRayMode;
346+
347+ // Space-delimited list of input profile names, in decending order
348+ // of specificity.
349+ // https://immersive-web.github.io/webxr/#dom-xrinputsource-profiles
350+ char profiles[kProfileNameListMaxLen ];
351+
352+ // https://immersive-web.github.io/webxr-gamepads-module/#enumdef-gamepadmappingtype
353+ GamepadMappingType mappingType;
354+
355+ // Start frame ID of the most recent primary select
356+ // action, or 0 if the select action has never occurred.
357+ uint64_t selectActionStartFrameId;
358+ // End frame Id of the most recent primary select
359+ // action, or 0 if action never occurred.
360+ // If selectActionStopFrameId is less than
361+ // selectActionStartFrameId, then the select
362+ // action has not ended yet.
363+ uint64_t selectActionStopFrameId;
364+
365+ // start frame Id of the most recent primary squeeze
366+ // action, or 0 if the squeeze action has never occurred.
367+ uint64_t squeezeActionStartFrameId;
368+ // End frame Id of the most recent primary squeez
369+ // action, or 0 if action never occurred.
370+ // If squeezeActionStopFrameId is less than
371+ // squeezetActionStartFrameId, then the squeeze
372+ // action has not ended yet.
373+ uint64_t squeezeActionEndFrameId;
374+
335375 uint32_t numButtons;
336376 uint32_t numAxes;
337377 uint32_t numHaptics;
@@ -347,9 +387,20 @@ struct VRControllerState {
347387#else
348388 ControllerCapabilityFlags flags;
349389#endif
390+
391+ // When Cap_Position is set in flags, pose corresponds
392+ // to the controllers' pose in target ray space:
393+ // https://immersive-web.github.io/webxr/#dom-xrinputsource-targetrayspace
350394 VRPose pose;
395+
396+ // When Cap_GripSpacePosition is set in flags, gripPose corresponds
397+ // to the controllers' pose in grip space:
398+ // https://immersive-web.github.io/webxr/#dom-xrinputsource-gripspace
399+ VRPose gripPose;
400+
351401 bool isPositionValid;
352402 bool isOrientationValid;
403+
353404#ifdef MOZILLA_INTERNAL_API
354405 void Clear () { memset (this , 0 , sizeof (VRControllerState)); }
355406#endif
@@ -421,6 +472,23 @@ struct VRBrowserState {
421472#if defined(__ANDROID__)
422473 bool shutdown;
423474#endif // defined(__ANDROID__)
475+ /* *
476+ * In order to support WebXR's navigator.xr.IsSessionSupported call without
477+ * displaying any permission dialogue, it is necessary to have a safe way to
478+ * detect the capability of running a VR or AR session without activating XR
479+ * runtimes or powering on hardware.
480+ *
481+ * API's such as OpenVR make no guarantee that hardware and software won't be
482+ * left activated after enumerating devices, so each backend in gfx/vr/service
483+ * must allow for more granular detection of capabilities.
484+ *
485+ * When detectRuntimesOnly is true, the initialization exits early after
486+ * reporting the presence of XR runtime software.
487+ *
488+ * The result of the runtime detection is reported with the Cap_ImmersiveVR
489+ * and Cap_ImmersiveAR bits in VRDisplayState.flags.
490+ */
491+ bool detectRuntimesOnly;
424492 bool presentationActive;
425493 bool navigationTransitionActive;
426494 VRLayerState layerState[kVRLayerMaxCount ];
0 commit comments