Skip to content

Commit 8337ae8

Browse files
committed
Allow creation of projection layers if depth support isn't enabled in the context
1 parent e469bac commit 8337ae8

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

‎webxrlayers-1.bs‎

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -874,12 +874,16 @@ If {{XRProjectionLayerInit/depthFormat}} is <code>0</code> the layer will not pr
874874

875875
This is the <dfn>list of depth formats for projection layers</dfn> that the [=XR Compositor=] MUST support:
876876

877-
For WebGL1 contexts with the '{{WEBGL_depth_texture}}' [=extension=] enabled or WebGL2 contexts:
877+
For {{WebGLRenderingContext}} contexts with the '{{WEBGL_depth_texture}}' [=extension=] enabled or WebGL2 contexts:
878878

879879
- {{DEPTH_COMPONENT}}
880880
- {{DEPTH_STENCIL}}
881881

882-
For WebGL2 contexts these additional formats are supported:
882+
If the extension was not enabled, the request for a depth texture is ignored.
883+
884+
NOTE: this could be confusing to authors because they might expect a depth texture. If possible, provide a warning with the reason why the texture was not created.
885+
886+
For {{WebGL2RenderingContext}} contexts these additional formats are supported:
883887

884888
- {{DEPTH_COMPONENT24}}
885889
- {{DEPTH24_STENCIL8}}
@@ -940,12 +944,12 @@ If {{XRLayerInit/depthFormat}} is not supplied, the layer will not provide a dep
940944

941945
This is the <dfn>list of depth formats for non-projection layers</dfn> that the [=XR Compositor=] MUST support:
942946

943-
For WebGL1 contexts with the '{{WEBGL_depth_texture}}' [=extension=] enabled or WebGL2 contexts:
947+
For {{WebGLRenderingContext}} contexts with the '{{WEBGL_depth_texture}}' [=extension=] enabled or WebGL2 contexts:
944948

945949
- {{DEPTH_COMPONENT}}
946950
- {{DEPTH_STENCIL}}
947951

948-
For WebGL2 contexts these additional formats are supported:
952+
For {{WebGL2RenderingContext}} contexts these additional formats are supported:
949953

950954
- {{DEPTH_COMPONENT24}}
951955
- {{DEPTH24_STENCIL8}}
@@ -1147,10 +1151,11 @@ To <dfn>allocate color textures for projection layers</dfn> using an {{XRProject
11471151
<div class="algorithm" data-algorithm="allocate depth textures for projection layers">
11481152

11491153
To <dfn>allocate depth textures for projection layers</dfn> using an {{XRProjectionLayer}} |layer|, an {{XRTextureType}} |textureType|, a {{GLenum}} |textureFormat| and a float |scaleFactor|, the user agent MUST run the following steps:
1150-
1. let |array| be a [=new=] array in the [=relevant realm=] of |context|.
1151-
1. let |context| be |layer|'s [=XRCompositionLayer/context=].
1152-
1. let |session| be |layer|'s [=XRCompositionLayer/session=].
1154+
1. Let |array| be a [=new=] array in the [=relevant realm=] of |context|.
1155+
1. Let |context| be |layer|'s [=XRCompositionLayer/context=].
1156+
1. Let |session| be |layer|'s [=XRCompositionLayer/session=].
11531157
1. If |textureFormat| is <code>0</code>, return |array| and abort these steps.
1158+
1. If |context| is a {{WebGLRenderingContext}} and the {{WEBGL_depth_texture}} [=extension=] is not enabled in |context|, return |array| and abort these steps.
11541159
1. If |textureFormat| is not in the [=list of depth formats for projection layers=], throw a {{NotSupportedError}} and abort these steps.
11551160
1. let |numViews| be the number of the |session|'s [=list of views=] excluding the [=secondary view|secondary views=].
11561161
1. Let |view| be the first entry in the |session|'s [=list of views=] that is not a [=secondary view=].
@@ -1206,6 +1211,7 @@ To <dfn>allocate the depth textures for the secondary views</dfn> using an {{XRP
12061211
1. Let |context| be |layer|'s [=XRCompositionLayer/context=].
12071212
1. Let |session| be |layer|'s [=XRCompositionLayer/session=].
12081213
1. If |textureFormat| is <code>0</code>, return |array| and abort these steps.
1214+
1. If |context| is a {{WebGLRenderingContext}} and the {{WEBGL_depth_texture}} [=extension=] is not enabled in |context|, return |array| and abort these steps.
12091215
1. If |textureFormat| is not in the [=list of depth formats for projection layers=], throw a {{NotSupportedError}} and abort these steps.
12101216
1. Let |array| be a [=new=] array in the [=relevant realm=] of |context|.
12111217
1. For each |view| in the |session|'s [=list of views=]:

0 commit comments

Comments
 (0)