diff --git a/index.bs b/index.bs index 54adab5..97748a9 100755 --- a/index.bs +++ b/index.bs @@ -19,7 +19,8 @@ Abstract: Depth Sensing API is a module extending the capabilities of WebXR Devi
-spec:webxr device api - level 1; type:dfn; for:/; text:xr device +spec:webxr device api - level 1; + type:dfn; for:/; text:xr device
@@ -52,6 +53,8 @@ spec: WebXR Device API - Level 1; urlPrefix: https://www.w3.org/TR/webxr/# type: dfn; text: time; url: xrframe-time type: interface; text: XRSession; url: xrsession-interface for: XRSession; + type: dfn; text: animation frame; url: xrsession-animation-frame + type: dfn; text: ended; url: ended type: dfn; text: mode; url: xrsession-mode type: dfn; text: XR device; url: xrsession-xr-device for: XRView; @@ -250,7 +253,7 @@ If the depth sensing feature is a required feature but the application did not s If the depth sensing feature is a required feature but the result of finding supported configuration combination algorithm invoked with {{XRDepthStateInit}} isnull
, the user agent MUST treat this as an unresolved required feature and reject the {{XRSystem/requestSession(mode, options)}} promise with a {{NotSupportedError}}. If it was requested as an optional feature, the user agent MUST ignore the feature request and not enable depth sensing on the newly created session. -When an {{XRSession}} is created with depth sensing enabled, the {{XRSession/depthUsage}}, {{XRSession/depthDataFormat}}, and {{XRSession/depthType}} attributes MUST be set to the result of finding supported configuration combination algorithm invoked with {{XRDepthStateInit}}. +When an {{XRSession}} is created with depth sensing enabled, the {{XRSession/depthUsage}}, {{XRSession/depthDataFormat}}, and {{XRSession/depthType}} attributes MUST be set to the result of finding supported configuration combination algorithm invoked with {{XRDepthStateInit}}. {{XRSession/depthActive}} MUST default totrue
. Note: The intention of the algorithm is to process preferences from most restrictive to least restrictive. Thus, we begin processing items where only a single item is indicated, then multiple, and finally where no preference is indicated. @@ -306,6 +309,10 @@ partial interface XRSession { readonly attribute XRDepthUsage depthUsage; readonly attribute XRDepthDataFormat depthDataFormat; readonly attribute XRDepthType? depthType; + readonly attribute boolean? depthActive; + + undefined pauseDepthSensing(); + undefined resumeDepthSensing(); }; @@ -313,7 +320,31 @@ The {{XRSession/depthUsage}} describes depth sensing usage with which the sessio The {{XRSession/depthDataFormat}} describes depth sensing data format with which the session was configured. If this attribute is accessed on a session that does not have depth sensing enabled, the user agent MUST throw an {{InvalidStateError}}. -The {{XRSession/depthType}} describes the depth sensing type with which the session was configured. If this attribute is accessed on a session that does not have depth sensing enabled, the user agent MUST throw an {{InvalidStateError}}. If the runtime only supports a single {{XRDepthType}} or otherwise ignored {XRDepthStateInit/depthTypeRequest}} this may returnnull
. +The {{XRSession/depthType}} describes the depth sensing type with which the session was configured. If this attribute is accessed on a session that does not have depth sensing enabled, the user agent MUST throw an {{InvalidStateError}}. If the runtime only supports a single {{XRDepthType}} or otherwise ignored {{XRDepthStateInit/depthTypeRequest}} this may returnnull
. + +The {{XRSession/depthActive}} returns the current [=depth sensing active state=]. If this attribute is accessed on a session that does not have depth sensing enabled, the user agent MUST throw an {{InvalidStateError}}. When this value isfalse
, the user agent MUST reject attempts to get depth data. When this value istrue
the user agent MAY return valid depth data ornull
. + ++ +When {{XRSession/resumeDepthSensing()}} is invoked on an {{XRSession}} |session|, the User Agent MUST run the following steps: + +1. If |session|'s [=XRSession/ended=] value istrue
, throw an {{InvalidStateError}} and abort these steps. +1. Let |frame| be |session|'s [=XRSession/animation frame=]. +1. If |frame|'s [=XRFrame/active=] boolean isfalse
, throw an {{InvalidStateError}} and abort these steps. +1. If [=depth-sensing=] feature descriptor is not [=list/contain|contained=] in the |session|'s [=XRSession/XR device=]'s [=XR device/list of enabled features=] for |session|'s [=XRSession/mode=], [=exception/throw=] a {{NotSupportedError}} and abort these steps. +1. If [=depth sensing active state=] istrue
, abort these steps. +1. Set [=depth sensing active state=] totrue
. + ++When {{XRSession/pauseDepthSensing()}} is invoked on an {{XRSession}} |session|, the User Agent MUST run the following steps: + + +1. If |session|'s [=XRSession/ended=] value istrue
, throw an {{InvalidStateError}} and abort these steps. +1. Let |frame| be |session|'s [=XRSession/animation frame=]. +1. If |frame|'s [=XRFrame/active=] boolean isfalse
, throw an {{InvalidStateError}} and abort these steps. +1. If [=depth-sensing=] feature descriptor is not [=list/contain|contained=] in the |session|'s [=XRSession/XR device=]'s [=XR device/list of enabled features=] for |session|'s [=XRSession/mode=], [=exception/throw=] a {{NotSupportedError}} and abort these steps. +1. If [=depth sensing active state=] isfalse
, abort these steps. +1. Set [=depth sensing active state=] tofalse
. Obtaining depth data {#obtaining-data} ==================== @@ -429,6 +460,7 @@ In order to create a CPU depth information instance given {{XRFrame}} 1. Let |time| be |frame|'s [=XRFrame/time=]. 1. Let |session| be |frame|'s {{XRFrame/session}}. 1. Let |device| be the |session|'s [=XRSession/XR device=]. + 1. If {{XRSession/depthActive}} isfalse
, returnnull
and abort these steps. 1. Let |nativeDepthInformation| be a result of querying |device| for the depth information valid as of |time|, for specified |view|, taking into account |session|'s {{XRSession/depthType}}, {{XRSession/depthUsage}}, and {{XRSession/depthDataFormat}}. 1. If |nativeDepthInformation| isnull
, returnnull
and abort these steps. 1. If the depth buffer present in |nativeDepthInformation| meets user agent's criteria to [=block access=] to the depth data, returnnull
and abort these steps. @@ -534,6 +566,7 @@ In order to create a WebGL depth information instance given {{XRFrame 1. Let |session| be |frame|'s {{XRFrame/session}}. 1. Let |device| be the |session|'s [=XRSession/XR device=]. + 1. If {{XRSession/depthActive}} isfalse
, returnnull
and abort these steps. 1. Let |nativeDepthInformation| be a result of querying |device|'s [=native depth sensing=] for the depth information valid as of |time|, for specified |view|, taking into account |session|'s {{XRSession/depthType}}, {{XRSession/depthUsage}}, and {{XRSession/depthDataFormat}}. 1. If |nativeDepthInformation| isnull
, returnnull
and abort these steps. 1. If the depth buffer present in |nativeDepthInformation| meets user agent's criteria to [=block access=] to the depth data, returnnull
and abort these steps. @@ -698,6 +731,8 @@ Note: the support of depth sensing API is not limited only to hardware classifie For each of {{XRDepthStateInit/depthTypeRequest}}, {{XRDepthStateInit/usagePreference}}, and {{XRDepthStateInit/dataFormatPreference}}, The device MUST have a preferred [=native depth sensing=] capability that MUST be used if the corresponding array is empty. The type, usage, and format SHOULD reflect the most efficient ones of the device, though they may be dependent upon each other. +The device can be said to have a depth sensing active state, which is a boolean representing if depth sensing capabilities are actively running. This state MUST begin astrue
. The user agent SHOULD take steps to mitigate the performance impact of this feature being enabled when this state isfalse
. + Privacy & Security Considerations {#privacy-security}