Skip to content

Commit 734b8ed

Browse files
authored
Merge pull request #316 from cabanier/layer-rejection
add exceptions when layer creation fails
2 parents 66f1173 + 247948f commit 734b8ed

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

webxrlayers-1.bs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -855,7 +855,8 @@ The various layer types are created with the create____Layer series of methods o
855855
such as whether or not to allocate a depth buffer or alpha channel, are passed in at layer creation time and will be immutable for the lifetime of the layer.
856856
The method will return the associated XRCompositionLayer type.
857857

858-
Some layer types may not be supported by the {{XRSession}}. If a layer type isn't supported the method will throw an exception. {{XRProjectionLayer}} MUST be supported by all {{XRSession}}s.
858+
If an {{XRSession}} was created with the "[=feature descriptor/layers=]" [=feature descriptor=], it MUST support all layer types.
859+
If a layer type isn't supported its creation method MUST throw an exception. {{XRProjectionLayer}} MUST be supported by all {{XRSession}}s, whether it was created with the "[=feature descriptor/layers=]" [=feature descriptor=] or not.
859860
</section>
860861

861862
Opaque textures {#xropaquetextures}
@@ -1229,19 +1230,22 @@ To <dfn>allocate color textures for projection layers</dfn> using an {{XRProject
12291230
<dt> If |textureType| is {{"texture-array"}}:
12301231
<dd> If the session’s [=view|views=] in the [=list of views=] don't all have the same [=recommended WebGL color texture resolution=] excluding the [=secondary view|secondary views=], throw a {{NotSupportedError}} and abort these steps.
12311232
<dd> Initialize |array| with 1 [=new=] instance of an [=opaque texture=] in the [=relevant realm=] of |context| created as a {{TEXTURE_2D_ARRAY}} texture with |numViews| layers using |context|, |textureFormat|, |width| and |height|.
1233+
<dd> If the [=opaque texture=] was unable to be created for any reason, throw an {{OperationError}} and abort these steps.
12321234
<dd> Return |array| and abort these steps.
12331235
<dt> Otherwise
12341236
<dd> For each |view| in the |session|'s [=list of views=]:
12351237
1. If |view| is a [=secondary view=], continue.
12361238
1. Let |width| be the width of |view|'s [=recommended WebGL color texture resolution=] multiplied by |scaleFactor|.
12371239
1. Let |height| be the height of |view|'s [=recommended WebGL color texture resolution=] multiplied by |scaleFactor|.
12381240
1. let |texture| be a [=new=] instance of an [=opaque texture=] in the [=relevant realm=] of |context| created as a {{TEXTURE_2D}} texture with |context|, |textureFormat|, |width| and |height|.
1241+
1. If the |texture| was unable to be created for any reason, throw an {{OperationError}} and abort these steps.
12391242
1. Append |texture| to |array|.
12401243
<dd> Return |array| and abort these steps.
12411244
</dl>
12421245
1. If the session’s [=view|views=] in the [=list of views=] don't all have the same [=recommended WebGL color texture resolution=] excluding the [=secondary view|secondary views=], throw a {{NotSupportedError}} and abort these steps.
12431246
1. If |layer|'s {{XRCompositionLayer/layout}} is {{XRLayerLayout/stereo-left-right}}, initialize |array| with 1 [=new=] instance of [=opaque texture=] in the [=relevant realm=] of |context| created as a |textureType| texture using |context| , |textureFormat|, |numViews| multiplied by |width| and |height|.
12441247
1. If |layer|'s {{XRCompositionLayer/layout}} is {{XRLayerLayout/stereo-top-bottom}}, initialize |array| with 1 [=new=] instance of [=opaque texture=] in the [=relevant realm=] of |context| created as a |textureType| texture using |context| , |textureFormat|, |width| and |numViews| multiplied by |height|.
1248+
1. If the [=opaque texture=] was unable to be created for any reason, throw an {{OperationError}} and abort these steps.
12451249
1. return |array|.
12461250

12471251
</div>
@@ -1263,19 +1267,22 @@ To <dfn>allocate depth textures for projection layers</dfn> using an {{XRProject
12631267
<dl class="switch">
12641268
<dt> If |textureType| is {{"texture-array"}}:
12651269
<dd> Initialize |array| with 1 [=new=] instance of an [=opaque texture=] in the [=relevant realm=] of |context| created as a {{TEXTURE_2D_ARRAY}} texture with |numViews| layers using |context|, |textureFormat|, |stencil|, |width| and |height|.
1270+
<dd> If the [=opaque texture=] was unable to be created for any reason, throw an {{OperationError}} and abort these steps.
12661271
<dd> Return |array| and abort these steps.
12671272
<dt> Otherwise
12681273
<dd> For each |view| in the |session|'s [=list of views=]:
12691274
1. If |view| is a [=secondary view=], continue.
12701275
1. Let |width| be the width of |view|'s [=recommended WebGL depth texture resolution=] multiplied by |scaleFactor|.
12711276
1. Let |height| be the height of |view|'s [=recommended WebGL depth texture resolution=] multiplied by |scaleFactor|.
12721277
1. let |texture| be a [=new=] instance of an [=opaque texture=] in the [=relevant realm=] of |context| created as a {{TEXTURE_2D}} texture with |context|, |textureFormat|, |stencil|, |width| and |height|.
1278+
1. If the |texture| was unable to be created for any reason, throw an {{OperationError}} and abort these steps.
12731279
1. Append |texture| to |array|.
12741280
<dd> Return |array| and abort these steps.
12751281
</dl>
12761282
1. If the session’s [=view|views=] in the [=list of views=] don't all have the same [=recommended WebGL color texture resolution=] excluding the [=secondary view|secondary views=], throw a {{NotSupportedError}} and abort these steps.
12771283
1. If |layer|'s {{XRCompositionLayer/layout}} is {{XRLayerLayout/stereo-left-right}}, initialize |array| with 1 [=new=] instance of an [=opaque texture=] in the [=relevant realm=] of |context| created as a |textureType| texture using |context|, |textureFormat|, |stencil|, |numViews| multiplied by |width| and |height|.
12781284
1. If |layer|'s {{XRCompositionLayer/layout}} is {{XRLayerLayout/stereo-top-bottom}}, initialize |array| with 1 [=new=] instance of an [=opaque texture=] in the [=relevant realm=] of |context| created as a |textureType| texture using |context|, |textureFormat|, |stencil|, |width| and |numViews| multiplied by |height|.
1285+
1. If the [=opaque texture=] was unable to be created for any reason, throw an {{OperationError}} and abort these steps.
12791286
1. return |array|.
12801287

12811288
</div>
@@ -1296,19 +1303,22 @@ To <dfn>allocate motion vector textures for projection layers</dfn> using an {{X
12961303
<dl class="switch">
12971304
<dt> If |textureType| is {{"texture-array"}}:
12981305
<dd> Initialize |array| with 1 [=new=] instance of an [=opaque texture=] in the [=relevant realm=] of |context| created as a {{TEXTURE_2D_ARRAY}} texture with |numViews| layers using |context|, {{RGBA16F}}, |width| and |height|.
1306+
<dd> If the [=opaque texture=] was unable to be created for any reason, throw an {{OperationError}} and abort these steps.
12991307
<dd> Return |array| and abort these steps.
13001308
<dt> Otherwise
13011309
<dd> For each |view| in the |session|'s [=list of views=]:
13021310
1. If |view| is a [=secondary view=], continue.
13031311
1. Let |width| be the width of |view|'s [=recommended motion vector texture resolution=] multiplied by |scaleFactor|.
13041312
1. Let |height| be the height of |view|'s [=recommended motion vector texture resolution=] multiplied by |scaleFactor|.
13051313
1. let |texture| be a [=new=] instance of an [=opaque texture=] in the [=relevant realm=] of |context| created as a {{TEXTURE_2D}} texture with |context|, {{RGBA16F}}, |width| and |height|.
1314+
1. If the |texture| was unable to be created for any reason, throw an {{OperationError}} and abort these steps.
13061315
1. Append |texture| to |array|.
13071316
<dd> Return |array| and abort these steps.
13081317
</dl>
13091318
1. If the session’s [=view|views=] in the [=list of views=] don't all have the same [=recommended motion vector texture resolution=] excluding the [=secondary view|secondary views=], throw a {{NotSupportedError}} and abort these steps.
13101319
1. If |layer|'s {{XRCompositionLayer/layout}} is {{XRLayerLayout/stereo-left-right}}, initialize |array| with 1 [=new=] instance of an [=opaque texture=] in the [=relevant realm=] of |context| created as a |textureType| texture using |context|, {{RGBA16F}}, |numViews| multiplied by |width| and |height|.
13111320
1. If |layer|'s {{XRCompositionLayer/layout}} is {{XRLayerLayout/stereo-top-bottom}}, initialize |array| with 1 [=new=] instance of an [=opaque texture=] in the [=relevant realm=] of |context| created as a |textureType| texture using |context|, {{RGBA16F}}, |width| and |numViews| multiplied by |height|.
1321+
1. If the [=opaque texture=] was unable to be created for any reason, throw an {{OperationError}} and abort these steps.
13121322
1. return |array|.
13131323

13141324
</div>
@@ -1331,6 +1341,7 @@ To <dfn>allocate the color textures for the secondary views</dfn> using an {{XRP
13311341
<dt> Otherwise
13321342
<dd> Let |texture| be a [=new=] instance of an [=opaque texture=] in the [=relevant realm=] of |context| created as a {{TEXTURE_2D}} texture with |context|, |textureFormat|, |width| and |height|.
13331343
</dl>
1344+
1. If the |texture| was unable to be created for any reason, throw an {{OperationError}} and abort these steps.
13341345
1. Append |texture| to |array|.
13351346
1. Return |array| and abort these steps.
13361347

0 commit comments

Comments
 (0)