diff --git a/index.bs b/index.bs index 42b2a758..a1f28101 100644 --- a/index.bs +++ b/index.bs @@ -231,7 +231,7 @@ XR {#xr-interface} [SecureContext, Exposed=Window] interface XR : EventTarget { // Methods Promise<void> supportsSession(XRSessionMode mode); - Promise<XRSession> requestSession(XRSessionMode mode); + Promise<XRSession> requestSession(XRSessionMode mode, optional XRSessionInit options); // Events attribute EventHandler ondevicechange; @@ -315,7 +315,7 @@ The {{XR}} object has a pending immersive session boolean, which MUST
true
if |mode| is {{XRSessionMode/"immersive-vr"}} or {{XRSessionMode/"immersive-ar"}}, and false
otherwise.
@@ -340,6 +340,11 @@ When the requestSession(|mode|) method is invoked, th
1. If |immersive| is true
, set [=pending immersive session=] to false
.
1. Abort these steps.
1. Let |session| be a new {{XRSession}} object.
+ 1. [=Resolve the requested features=] given by |options|' {{XRSessionInit/requiredFeatures}} and |options|' {{XRSessionInit/optionalFeatures}} values for |session|, and let |resolved| be the returned value.
+ 1. If |resolved| is false
, run the following steps:
+ 1. [=Reject=] |promise| with a "{{NotSupportedError}}" {{DOMException}}.
+ 1. If |immersive| is true
, set [=pending immersive session=] to false
.
+ 1. Abort these steps.
1. [=Initialize the session=] with |session|, |mode|, and |device|.
1. Potentially set the [=active immersive session=] based on the following:
+dictionary XRSessionInit { + sequence<DOMString> requiredFeatures; + sequence<DOMString> optionalFeatures; +}; ++ +Requested features are split into two groups: + + - Required features are passed by via the requiredFeatures array. If any value in the list is not a recognized [=feature name=] the {{XRSession}} will not be created. All features listed in the {{XRSessionInit/requiredFeatures}} array MUST be supported by the [=XRSession/XR Device=] and, if necessary, consented to by the user or the {{XRSession}} will not be created. + - Optional features are passed via the optionalFeatures array. If any value in the list is not a recognized [=feature name=] it will be ignored. Features listed in the {{XRSessionInit/optionalFeatures}} array will be enabled if supported by the [=XRSession/XR Device=] and, if necessary, consented to by the user, but will not block creation of the {{XRSession}} if absent. + +The feature lists accept any string. However, in order to be a considered a valid feature name, the string must be a value from the following enums: + + - {{XRReferenceSpaceType}} + +Some {{XRSessionMode}}s request certain [=feature names=] as optional features by default. The following table described the default features associated with each {{XRSessionMode}}: + +
Feature | +{{XRSessionMode}} | +
---|---|
{{XRReferenceSpaceType/"local"}} | +{{XRSessionMode/"immersive-vr"}} | +
false
.
+ 1. If the functionality described by |feature| is not supported by |session|'s [=XRSession/XR Device=], return false
.
+ 1. If the functionality described by |feature| [=requires consent=], append it to |consentRequired|.
+ 1. Else append |feature| to |session|'s [=list of enabled features=].
+ 1. For each |feature| in |optionalFeatures| perform the following steps:
+ 1. If |feature| is not a value in the {{XRReferenceSpaceType}} enum, continue to the next entry.
+ 1. If the functionality described by |feature| is not supported by |session|'s [=XRSession/XR Device=], continue to the next entry.
+ 1. If the functionality described by |feature| [=requires consent=], append it to |consentOptional|.
+ 1. Else append |feature| to |session|'s [=list of enabled features=].
+ 1. For each |feature| in the [=default features=] table perform the following steps:
+ 1. If |session|'s [=XRSession/mode=] is not one of the modes associated with |feature| in the [=default features=], continue to the next entry.
+ 1. If the functionality described by |feature| is not supported by |session|'s [=XRSession/XR Device=], continue to the next entry.
+ 1. If the functionality described by |feature| [=requires consent=], append it to |consentOptional|.
+ 1. Else append |feature| to |session|'s [=list of enabled features=].
+ 1. If |consentRequired| or |consentOptional| are not empty, [=request user consent=] to use the functionality described by those features.
+ 1. For each |feature| in |requiredFeatures| perform the following steps:
+ 1. If the user [=denied consent=] to use |feature|, return false
.
+ 1. Else append |feature| to |session|'s [=list of enabled features=].
+ 1. For each |feature| in |requiredFeatures| perform the following steps:
+ 1. If the user [=denied consent=] to use |feature|, continue to the next entry.
+ 1. Else append |feature| to |session|'s [=list of enabled features=].
+ 1. Return true
+
+null
.
The renderState attribute returns the {{XRSession}}'s [=active render state=].
@@ -973,6 +1051,7 @@ When an {{XRReferenceSpace}} is requested, the user agent MUST create a ref
To check if a reference space is supported for a given reference space type |type| and {{XRSession}} |session|, run the following steps:
1. If |type| is {{viewer}}, return true
.
+ 1. If |type| is not [=list/contain|contained=] in |session|'s [=list of enabled features=] return false
.
1. If |type| is {{local}} or {{local-floor}}, and |session| is an [=immersive session=], return true
.
1. If |type| is {{local}} or {{local-floor}}, and the [=XRSession/XR device=] supports reporting orientation data, return true
.
1. If |type| is {{bounded-floor}} and |session| is an [=immersive session=], return if [=bounded reference spaces are supported=] by the [=XRSession/XR device=].