Skip to content

Commit 608bacd

Browse files
authored
Merge pull request #254 from cabanier/gputexturecreation
Removed synchronous GPU allocation in layer creation + added validation in getsubimage/getviewsubimage
2 parents bd830d0 + 38a7e8f commit 608bacd

File tree

1 file changed

+10
-16
lines changed

1 file changed

+10
-16
lines changed

‎webxrlayers-1.bs‎

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1334,8 +1334,7 @@ When this method is invoked, the user agent MUST run the following steps:
13341334
<dt> Otherwise
13351335
<dd> Let [=XRProjectionLayer/depthstenciltextures for secondary views=] be <code>null</code>.
13361336
</dl>
1337-
1. Allocate and initialize resources compatible with |session|'s [=/XR device=], including GPU accessible memory buffers, as required to support the compositing of |layer|.
1338-
1. If |layer|’s resources were unable to be created for any reason, throw an {{OperationError}} and abort these steps.
1337+
1. If the [=XR Compositor=] knows that it will be unable to create the resources for the |layer| for any reason, throw an {{OperationError}} and abort these steps.
13391338
1. Return |layer|.
13401339

13411340
</div>
@@ -1359,8 +1358,7 @@ When this method is invoked, the user agent MUST run the following steps:
13591358
1. Initialize |layer|'s {{XRCompositionLayer/needsRedraw}} to <code>true</code>.
13601359
1. let |layer|'s [=colorTextures=] be the result of [=allocate color textures|allocating color textures=] with |layer|, |init|'s {{XRQuadLayerInit/textureType}} and |init|.
13611360
1. let |layer|'s [=depthStencilTextures=] be the result of [=allocate depth textures|allocating depth textures=] with |layer|, |init|'s {{XRQuadLayerInit/textureType}} and |init|.
1362-
1. Allocate and initialize resources compatible with |session|'s [=/XR device=], including GPU accessible memory buffers, as required to support the compositing of |layer|.
1363-
1. If |layer|’s resources were unable to be created for any reason, throw an {{OperationError}} and abort these steps.
1361+
1. If the [=XR Compositor=] knows that it will be unable to create the resources for the |layer| for any reason, throw an {{OperationError}} and abort these steps.
13641362
1. return |layer|.
13651363

13661364
</div>
@@ -1384,8 +1382,7 @@ When this method is invoked, the user agent MUST run the following steps:
13841382
1. Initialize |layer|'s {{XRCompositionLayer/needsRedraw}} to <code>true</code>.
13851383
1. let |layer|'s [=colorTextures=] be the result of [=allocate color textures|allocating color textures=] with |layer|, |init|'s {{XRCylinderLayerInit/textureType}} and |init|.
13861384
1. let |layer|'s [=depthStencilTextures=] be the result of [=allocate depth textures|allocating depth textures=] with |layer|, |init|'s {{XRCylinderLayerInit/textureType}} and |init|.
1387-
1. Allocate and initialize resources compatible with |session|'s [=/XR device=], including GPU accessible memory buffers, as required to support the compositing of |layer|.
1388-
1. If |layer|’s resources were unable to be created for any reason, throw an {{OperationError}} and abort these steps.
1385+
1. If the [=XR Compositor=] knows that it will be unable to create the resources for the |layer| for any reason, throw an {{OperationError}} and abort these steps.
13891386
1. return |layer|.
13901387

13911388
</div>
@@ -1411,8 +1408,7 @@ When this method is invoked, the user agent MUST run the following steps:
14111408
1. Initialize |layer|'s {{XRCompositionLayer/needsRedraw}} to <code>true</code>.
14121409
1. let |layer|'s [=colorTextures=] be the result of [=allocate color textures|allocating color textures=] with |layer|, |init|'s {{XRCylinderLayerInit/textureType}} and |init|.
14131410
1. let |layer|'s [=depthStencilTextures=] be the result of [=allocate depth textures|allocating depth textures=] with |layer|, |init|'s {{XRCylinderLayerInit/textureType}} and |init|.
1414-
1. Allocate and initialize resources compatible with |session|'s [=/XR device=], including GPU accessible memory buffers, as required to support the compositing of |layer|.
1415-
1. If |layer|’s resources were unable to be created for any reason, throw an {{OperationError}} and abort these steps.
1411+
1. If the [=XR Compositor=] knows that it will be unable to create the resources for the |layer| for any reason, throw an {{OperationError}} and abort these steps.
14161412
1. return |layer|.
14171413

14181414
</div>
@@ -1462,8 +1458,7 @@ When this method is invoked, the user agent MUST run the following steps:
14621458
<dt> Otherwise
14631459
<dd> Initialize [=depthStencilTextures=] with 2 [=new=] instances of an [=opaque texture=] in the [=relevant realm=] of this {{XRCubeLayer}} created as a {{TEXTURE_CUBE_MAP}} texture with |context| and |init|'s {{XRLayerInit/depthFormat}}, {{XRLayerInit/viewPixelWidth}} and {{XRLayerInit/viewPixelHeight}} values.
14641460
</dl>
1465-
1. Allocate and initialize resources compatible with |session|'s [=/XR device=], including GPU accessible memory buffers, as required to support the compositing of |layer|.
1466-
1. If |layer|’s resources were unable to be created for any reason, throw an {{OperationError}} and abort these steps.
1461+
1. If the [=XR Compositor=] knows that it will be unable to create the resources for the |layer| for any reason, throw an {{OperationError}} and abort these steps.
14671462
1. return |layer|.
14681463

14691464
</div>
@@ -1521,6 +1516,7 @@ When this method is invoked on an {{XRWebGLBinding}} |binding|, it MUST run the
15211516
<dd> Let |subimage| be a [=new=] {{XRWebGLSubImage}} in the [=relevant realm=] of [=this=].
15221517
<dd> Let |subimage|'s {{XRSubImage/viewport}} be a [=new=] {{XRViewport}} in the [=relevant realm=] of [=this=].
15231518
</dl>
1519+
1. If |layer| is not in the |session|'s {{XRRenderState/layers}} array, throw a {{TypeError}} and abort these steps.
15241520
1. If |layer|'s type is {{XRProjectionLayer}}, throw a {{TypeError}} and abort these steps.
15251521
1. If |layer|'s {{XRCompositionLayer/layout}} attribute is {{XRLayerLayout/"default"}}, throw a {{TypeError}} and abort these steps.
15261522
1. Let |index| be <code>0</code>.
@@ -1579,6 +1575,7 @@ When this method is invoked on an {{XRWebGLBinding}} |binding|, it MUST run the
15791575
1. Let |frame| be |view|'s {{frame}}.
15801576
1. Let |session| be [=this=] [=XRWebGLBinding/session=].
15811577
1. If [=validate the state of the XRWebGLSubImage creation function=] with |layer| and |frame| is <code>false</code>, throw an {{InvalidStateError}} and abort these steps.
1578+
1. If |layer| is not in the |session|'s {{XRRenderState/layers}} array, throw a {{TypeError}} and abort these steps.
15821579
1. If |view|'s [=view/active=] flag is <code>false</code>, throw an {{InvalidStateError}} and abort these steps.
15831580
1. Initialize |index| as follows:
15841581
<dl class="switch">
@@ -1791,8 +1788,7 @@ When this method is invoked, the user agent MUST run the following steps:
17911788
1. If |init|'s {{XRMediaQuadLayerInit/height}} is <code>undefined</code>, set {{XRMediaQuadLayerInit/height}} to {{XRMediaQuadLayerInit/width}} divided by |aspectRatio|.
17921789
1. If |init|'s {{XRMediaQuadLayerInit/width}} is <code>undefined</code>, set {{XRMediaQuadLayerInit/width}} to {{XRMediaQuadLayerInit/height}} multiplied by |aspectRatio|.
17931790
1. Run [=initialize a quad layer=] with |layer| and |init|.
1794-
1. Allocate and initialize resources compatible with |session|'s [=/XR device=], including GPU accessible memory buffers, as required to support the compositing of |layer|.
1795-
1. If |layer|’s resources were unable to be created for any reason, throw an {{OperationError}} and abort these steps.
1791+
1. If the [=XR Compositor=] knows that it will be unable to create the resources for the |layer| for any reason, throw an {{OperationError}} and abort these steps.
17961792
1. return |layer|.
17971793

17981794
</div>
@@ -1813,8 +1809,7 @@ When this method is invoked, the user agent MUST run the following steps:
18131809
1. Let |aspectRatio| be the result of [=calculate the aspect ratio=] with |video| and |init|'s {{XRMediaLayerInit/layout}}.
18141810
1. If |init|'s {{XRMediaCylinderLayerInit/aspectRatio}} is <code>undefined</code>, set {{XRMediaCylinderLayerInit/aspectRatio}} to |aspectRatio|.
18151811
1. Run [=initialize a cylinder layer=] with |layer| and |init|.
1816-
1. Allocate and initialize resources compatible with |session|'s [=/XR device=], including GPU accessible memory buffers, as required to support the compositing of |layer|.
1817-
1. If |layer|’s resources were unable to be created for any reason, throw an {{OperationError}} and abort these steps.
1812+
1. If the [=XR Compositor=] knows that it will be unable to create the resources for the |layer| for any reason, throw an {{OperationError}} and abort these steps.
18181813
1. return |layer|.
18191814

18201815
</div>
@@ -1835,8 +1830,7 @@ When this method is invoked, the user agent MUST run the following steps:
18351830
1. Initialize |layer|'s [=XRCompositionLayer/media=] to |video|.
18361831
1. Initialize |layer|'s {{XRCompositionLayer/needsRedraw}} to <code>false</code>.
18371832
1. Run [=initialize a equirect layer=] with |layer| and |init|.
1838-
1. Allocate and initialize resources compatible with |session|'s [=/XR device=], including GPU accessible memory buffers, as required to support the compositing of |layer|.
1839-
1. If |layer|’s resources were unable to be created for any reason, throw an {{OperationError}} and abort these steps.
1833+
1. If the [=XR Compositor=] knows that it will be unable to create the resources for the |layer| for any reason, throw an {{OperationError}} and abort these steps.
18401834
1. return |layer|.
18411835

18421836
</div>

0 commit comments

Comments
 (0)