Skip to content

Commit dc11b6b

Browse files
committed
Introduce depthActive property
Introduces the `depthActive` property to allow pages to request starting or stopping the depth activity.
1 parent c2b6e95 commit dc11b6b

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

index.bs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ If the depth sensing feature is a required feature but the application did not s
245245

246246
If the depth sensing feature is a required feature but the result of <a lt="find supported configuration combination">finding supported configuration combination</a> algorithm invoked with {{XRDepthStateInit}} is <code>null</code>, 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.
247247

248-
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 <a lt="find supported configuration combination">finding supported configuration combination</a> algorithm invoked with {{XRDepthStateInit}}.
248+
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 <a lt="find supported configuration combination">finding supported configuration combination</a> algorithm invoked with {{XRDepthStateInit}}. {{XRSession/depthActive}} SHOULD default to <code>true</code>.
249249

250250
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.
251251

@@ -301,6 +301,7 @@ partial interface XRSession {
301301
readonly attribute XRDepthUsage depthUsage;
302302
readonly attribute XRDepthDataFormat depthDataFormat;
303303
readonly attribute XRDepthType? depthType;
304+
attribute boolean? depthActive;
304305
};
305306
</script>
306307

@@ -310,6 +311,8 @@ The {{XRSession/depthDataFormat}} describes depth sensing data format with which
310311

311312
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 return <code>null</code>.
312313

314+
The {{XRSession/depthActive}} describes and attempts to set the current [=depth sensing active state=]. If this attribute is accessed or attempted to be set on a session that does not have depth sensing enabled, the user agent MUST throw an {{InvalidStateError}}. If the user agent or device does not support this attribute, they should return <code>null</code> on getting, and setting should be a <code>no-op</code>. Setting {{XRSession/depthActive}} to null should be a <code>no-op</code>. While the value is set immediately, it may be an indeterminate amount of frames before the user agent is able to begin returning depth data again when changing from <code>false</code> to <code>true</code>. It is up to the user agent to determine the most appropriate way to stop processing depth data when this is set to <code>true</code>.
315+
313316
Obtaining depth data {#obtaining-data}
314317
====================
315318

@@ -421,6 +424,7 @@ In order to <dfn>create a CPU depth information instance</dfn> given {{XRFrame}}
421424
1. Let |time| be |frame|'s [=XRFrame/time=].
422425
1. Let |session| be |frame|'s {{XRFrame/session}}.
423426
1. Let |device| be the |session|'s [=XRSession/XR device=].
427+
1. If {{XRSession/depthActive}} is <code>false</code>, return <code>null</code> and abort these steps.
424428
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}}.
425429
1. If |nativeDepthInformation| is <code>null</code>, return <code>null</code> and abort these steps.
426430
1. If the depth buffer present in |nativeDepthInformation| meets user agent's criteria to [=block access=] to the depth data, return <code>null</code> and abort these steps.
@@ -520,6 +524,7 @@ In order to <dfn>create a WebGL depth information instance</dfn> given {{XRFrame
520524
1. Let |time| be |frame|'s [=XRFrame/time=].
521525
1. Let |session| be |frame|'s {{XRFrame/session}}.
522526
1. Let |device| be the |session|'s [=XRSession/XR device=].
527+
1. If {{XRSession/depthActive}} is <code>false</code>, return <code>null</code> and abort these steps.
523528
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}}.
524529
1. If |nativeDepthInformation| is <code>null</code>, return <code>null</code> and abort these steps.
525530
1. If the depth buffer present in |nativeDepthInformation| meets user agent's criteria to [=block access=] to the depth data, return <code>null</code> and abort these steps.
@@ -684,6 +689,8 @@ Note: the support of depth sensing API is not limited only to hardware classifie
684689

685690
For each of {{XRDepthStateInit/depthTypeRequest}}, {{XRDepthStateInit/usagePreference}}, and {{XRDepthStateInit/dataFormatPreference}}, The device MUST have a <dfn>preferred [=native depth sensing=] capability</dfn> 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.
686691

692+
The device can be said to have a <dfn>depth sensing active state</dfn>, which represents if depth sensing capabilities are actively running. This state may either be "started" (<code>true</code>) or "stopped" (<code>false</code>), and should begin as "started". If the native device cannot simulate this state, the user agent can simply not process any depth data when the state is otherwise "stopped".
693+
687694
</section>
688695

689696
Privacy & Security Considerations {#privacy-security}

0 commit comments

Comments
 (0)