From b3f6f2c6b98aaff98f573182d99294987251a29d Mon Sep 17 00:00:00 2001
From: Rik Cabanier Copyright © 2023 World Wide Web Consortium. W3C® liability, trademark and permissive document license rules apply. Copyright © 2024 World Wide Web Consortium. W3C® liability, trademark and permissive document license rules apply. This document is governed by the 2 November 2021 W3C Process Document. This document is governed by the 03 November 2023 W3C Process Document. WebXR Layers API Level 1
-
+
More details about this document
WebXR Layers API Level 1
made in connection with the deliverables of the group; that page also includes instructions for disclosing a patent. An individual who has actual knowledge of a patent which the individual believes contains Essential
Claim(s) must disclose the information in accordance with section
6 of the W3C Patent Policy.
-
"immersive-vr" or
"immersive-ar"
. "inline"
sessions MUST not support layers.
Layers are only supported for XRSessions created with XRSessionMode of "immersive-vr"
or "immersive-ar"
. "inline"
sessions MUST NOT support layers.
The "layers" feature descriptor has a feature requirement that it cannot be enabled when there is an active immersive session.
NOTE: This means that executing the request(permissionDesc)
API with "layers" will
not enable layers support for the current active session.
XRQuadLayer
renders a layer that takes up a flat rectangular space in the virtual environment.
-Only the front of the layer MUST be visible; the back face MUST not be drawn by the XR Compositor.
+Only the front of the layer MUST be visible; the back face MUST NOT be drawn by the XR Compositor.
A XRQuadLayer has no thicknes. It is a two-dimensional object positioned and oriented in 3D space. The position of a quad refers to the center of the quad.
@@ -1102,7 +1166,7 @@onredraw
attribute is an Event handler IDL attribute for the redraw
event type.
XRCylinderLayer
renders a layer that takes up a curved rectangular space in the virtual environment.
-Only the front of the layer MUST be visible; the back face MUST not be drawn by the XR Compositor.
+Only the front of the layer MUST be visible; the back face MUST NOT be drawn by the XR Compositor.
A XRCylinderLayer has no thicknes. It is a two-dimensional object positioned and oriented in 3D space. The position of the cylinder refers to the center of the quad.
@@ -1380,6 +1444,9 @@Allocation of the resources for layers (such as memory) MUST be done through the same mechanism as WebGL.
+If an XRLayer
is allocated with the RGBA
or RGB
colorFormat
, its colorTextures MUST be exposed as RGBA
or RGB
to the WebGLRenderingContext
context.
+However, the XR Compositor MUST treat the colorTextures's pixels as if they were in the SRGB8_ALPHA8
or SRGB8
colorFormat
.
NOTE: this means that the XR Compositor MUST NOT do any gamma conversion from linear RGBA
or RGB
when it processes the colorTextures. Otherwise, the pixels in the final rendering will appear too bright which will not match the rendering on a regular 2D WebGLRenderingContext
context.
XRProjectionLayerInit
dictionary represents a set of configurable values that describe how an XRProjectionLayer
is initialized.
dictionary { @@ -1392,12 +1459,12 @@
XRProjectionLayerInit
The
textureType
attribute defines the type of texture that the layer will have.The
-colorFormat
attribute defines the data type of the color texture data.This is the list of color formats for projection layers that the XR Compositor MUST support:
+This is the list of color formats for projection layers that the XR Compositor MUST support:
- - +
- - +
- @@ -1406,18 +1473,18 @@
For WebGL2 contexts these additional formats are supported:
- - +
- - +
- - +
- - +
The
-depthFormat
attribute defines the data type of the depth texture data. IfdepthFormat
is0
the layer will not provide a depth/stencil texture.This is the list of depth formats for projection layers that the XR Compositor MUST support:
-For
+WebGLRenderingContext
contexts with the 'WEBGL_depth_texture
' extension enabled or WebGL2 contexts:This is the list of depth formats for projection layers that the XR Compositor MUST support:
+For
WebGLRenderingContext
contexts with the 'WEBGL_depth_texture
' extension enabled or WebGL2 contexts:
- @@ -1429,9 +1496,9 @@
For WebGL2RenderingContext
contexts these additional formats are supported:The
scaleFactor
attribute defines the value that the session’s recommended WebGL framebuffer resolution MUST be multiplied by determining the resolution of the layer’s attachments.The
@@ -1441,7 +1508,7 @@clearOnAccess
attribute defines if the texture associated with this layer should be cleared in the initial frame or on every frame.XRLayerInit dictionary represents a set of common configurable values for
XRQuadLayer
,XRCylinderLayer
,XREquirectLayer
andXRCubeLayer
.dictionary {
XRLayerInit required XRSpace space ; -GLenum colorFormat = 0x1908; // RGBA +GLenum colorFormat = 0x1908; // RGBAGLenum ?depthFormat ;unsigned long mipLevels = 1;required unsigned long viewPixelWidth ; @@ -1453,12 +1520,12 @@
space
attribute defines the spatial relationship with the user’s physical environment.The
-colorFormat
attribute defines the data type of the color texture data.This is the list of color formats for non-projection layers that the XR Compositor MUST support:
+This is the list of color formats for non-projection layers that the XR Compositor MUST support:
- - +
- - +
- @@ -1467,13 +1534,13 @@
RGBA8 +
- - +
- - +
- - +
For contexts with the '
WEBGL_compressed_texture_etc
' extension enabled these additional formats are supported:@@ -1493,8 +1560,8 @@
WEBGL_compressed_texture_astc' extension enabled all the formats of that extension are supported.
The
-depthFormat
attribute defines the data type of the depth texture data. IfdepthFormat
is not supplied, the layer will not provide a depth/stencil texture.This is the list of depth formats for non-projection layers that the XR Compositor MUST support:
-For
+WebGLRenderingContext
contexts with the 'WEBGL_depth_texture
' extension enabled or WebGL2 contexts:This is the list of depth formats for non-projection layers that the XR Compositor MUST support:
+For
WebGLRenderingContext
contexts with the 'WEBGL_depth_texture
' extension enabled or WebGL2 contexts:
- @@ -1504,9 +1571,9 @@
WebGL2RenderingContext contexts these additional formats are supported:
The
mipLevels
attribute defines the desired number of mip levels in the color and texture data. If the user agent can’t create the requested number, it can create less. Authors MUST querymipLevels
to determine @@ -1575,7 +1642,7 @@
the init dictionaries shouldn’t be optional. This is bikeshed issue 1566.
Each
+of either aXRWebGLBinding
has a context object of typeXRWebGLRenderingContext
which is an instance -of either aWebGLRenderingContext
or aWebGL2RenderingContext
.WebGLRenderingContext
or aWebGL2RenderingContext
.Each
XRWebGLBinding
has an associated session, which is theXRSession
it was created with.NOTE: It is possible to create more than one
@@ -1590,7 +1657,7 @@XRWebGLBinding
. Any layer created with an instance ofXRWebGLBinding
can be used with another instance ofXRWebGLBinding
as long as both were created with the same session and the same context. The lifetime of layers or instances ofXRWebGLSubImage
is not tied to the lifetime of theXRWebGLBinding
that created them.
Let binding be a new
XRWebGLBinding
in the relevant realm of session.- -
If session’s ended value is
+true
, throw anInvalidStateError
and abort these steps.If session’s ended value is
true
, throw anInvalidStateError
and abort these steps.If context is lost, throw an
InvalidStateError
and abort these steps.- @@ -1607,8 +1674,8 @@
The
nativeProjectionScaleFactor
function returns the value that the session’s recommended WebGL framebuffer resolution MUST be multiplied by to yield the session’s native WebGL framebuffer resolution.special case UA behavior if the size causes the layout to change (ie if the requested width exceeds a limit with
-"stereo-left-right"
)The
+usesDepthValues
attribute, iffalse
, indicates that the XR Compositor MUST NOT make use of values if there is a depth buffer attachment. When the attribute -istrue
it indicates that the content of the depth buffer attachment will be used by the XR Compositor and is expected to be representative of the scene rendered into the layer.The
usesDepthValues
attribute, iffalse
, indicates that the XR Compositor MUST NOT make use of values if there is a depth buffer attachment. When the attribute +istrue
it indicates that the content of the depth buffer attachment will be used by the XR Compositor and is expected to be representative of the scene rendered into the layer.To determine the layout attribute using an
XRTextureType
textureType, anXRWebGLRenderingContext
context and anXRLayerLayout
layout, the user agent MUST run the following steps:@@ -1694,7 +1761,7 @@
@@ -1722,7 +1789,7 @@
Let height be the height of view’s recommended WebGL color texture resolution multiplied by scaleFactor.
- -
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.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.Append texture to array.
If textureFormat is
0
, return array and abort these steps.- -
If context is a
+WebGLRenderingContext
and theWEBGL_depth_texture
extension is not enabled in context, return array and abort these steps.If context is a
WebGLRenderingContext
and theWEBGL_depth_texture
extension is not enabled in context, return array and abort these steps.If textureFormat is not in the list of depth formats for projection layers, throw a
NotSupportedError
and abort these steps.- @@ -1750,7 +1817,7 @@
Let height be the height of view’s recommended WebGL depth texture resolution multiplied by scaleFactor.
- -
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.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.Append texture to array.
@@ -1778,7 +1845,7 @@
If session was not created with the "space-warp" feature descriptor, return array and abort these steps.
- -
If context is a
+WebGLRenderingContext
and theWEBGL_depth_texture
extension is not enabled in context, return array and abort these steps.If context is a
WebGLRenderingContext
and theWEBGL_depth_texture
extension is not enabled in context, return array and abort these steps.let numViews be the number of the session’s list of views excluding the secondary views.
- @@ -1791,7 +1858,7 @@
If layer’s
layout
is"mono"
or"default"
:
- If textureType is
"texture-array"
: -- 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. +- 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.- Return array and abort these steps.
- Otherwise
- @@ -1804,7 +1871,7 @@
Let height be the height of view’s recommended motion vector texture resolution multiplied by scaleFactor.
- -
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.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.Append texture to array.
@@ -1813,9 +1880,9 @@
If the session’s views in the list of views don’t all have the same recommended motion vector texture resolution excluding the secondary views, throw a
NotSupportedError
and abort these steps.- -
If layer’s
+layout
isstereo-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.If layer’s
layout
isstereo-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.- -
If layer’s
+layout
isstereo-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.If layer’s
layout
isstereo-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.return array.
@@ -1846,7 +1913,7 @@If textureType is
"texture-array"
:- Let texture be a new instance of an opaque texture in the relevant realm of context created as a
TEXTURE_2D_ARRAY
texture with context, textureFormat, width and height.- Otherwise -
- 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. +- 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.Append texture to array.
@@ -1865,7 +1932,7 @@
If textureFormat is
0
, return array and abort these steps.- -
If context is a
+WebGLRenderingContext
and theWEBGL_depth_texture
extension is not enabled in context, return array and abort these steps.If context is a
WebGLRenderingContext
and theWEBGL_depth_texture
extension is not enabled in context, return array and abort these steps.If textureFormat is not in the list of depth formats for projection layers, throw a
NotSupportedError
and abort these steps.- @@ -1885,7 +1952,7 @@
If textureType is
"texture-array"
:- Let texture be a new instance of an opaque texture in the relevant realm of context created as a
TEXTURE_2D_ARRAY
texture with context, textureFormat, stencil, width and height.- Otherwise -
- 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. +- 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.Append texture to array.
@@ -1903,7 +1970,7 @@
let context be layer’s context.
- -
If init’s
+colorFormat
is not in the list of color formats for non-projection layers, throw aNotSupportedError
and abort these steps.If init’s
colorFormat
is not in the list of color formats for non-projection layers, throw aNotSupportedError
and abort these steps.If init’s
mipLevels
is smaller than1
, throw aInvalidStateError
and abort these steps.- @@ -1912,26 +1979,26 @@
If layer’s
layout
is"mono"
:
- If textureType is
"texture-array"
: -- Initialize array with 1 new instance of an opaque texture in the relevant realm of this context created as a
TEXTURE_2D_ARRAY
texture with 1 internal texture using context and init’scolorFormat
,mipLevels
,viewPixelWidth
andviewPixelHeight
values. +- Initialize array with 1 new instance of an opaque texture in the relevant realm of this context created as a
TEXTURE_2D_ARRAY
texture with 1 internal texture using context and init’scolorFormat
,mipLevels
,viewPixelWidth
andviewPixelHeight
values.- Otherwise
- - Initialize array with 1 new instance of an opaque texture in the relevant realm of context created as a
TEXTURE_2D
texture with context and init’scolorFormat
,mipLevels
,viewPixelWidth
andviewPixelHeight
values. + Initialize array with 1 new instance of an opaque texture in the relevant realm of context created as aTEXTURE_2D
texture with context and init’scolorFormat
,mipLevels
,viewPixelWidth
andviewPixelHeight
values.
If layer’s
layout
is"stereo"
:
- If textureType is
"texture-array"
: -- Initialize array with 1 new instance of an opaque texture in the relevant realm of context created as a
TEXTURE_2D_ARRAY
texture with 2 layers using context and init’scolorFormat
,mipLevels
,viewPixelWidth
andviewPixelHeight
values. +- Initialize array with 1 new instance of an opaque texture in the relevant realm of context created as a
TEXTURE_2D_ARRAY
texture with 2 layers using context and init’scolorFormat
,mipLevels
,viewPixelWidth
andviewPixelHeight
values.- Return array and abort these steps.
- Otherwise -
- Initialize array with 2 new instances of an opaque texture in the relevant realm of context created as a
TEXTURE_2D
texture with context and init’scolorFormat
,mipLevels
,viewPixelWidth
andviewPixelHeight
values. +- Initialize array with 2 new instances of an opaque texture in the relevant realm of context created as a
TEXTURE_2D
texture with context and init’scolorFormat
,mipLevels
,viewPixelWidth
andviewPixelHeight
values.- Return array and abort these steps.
- -
If layer’s
+layout
isstereo-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 and init’scolorFormat
,mipLevels
, double ofviewPixelWidth
andviewPixelHeight
values.If layer’s
layout
isstereo-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 and init’scolorFormat
,mipLevels
, double ofviewPixelWidth
andviewPixelHeight
values.- -
If layer’s
+layout
isstereo-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 and init’scolorFormat
,mipLevels
,viewPixelWidth
and double ofviewPixelHeight
values.If layer’s
layout
isstereo-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 and init’scolorFormat
,mipLevels
,viewPixelWidth
and double ofviewPixelHeight
values.return array.
@@ -1957,7 +2024,7 @@If textureType is
"texture-array"
:- Initialize array with 1 new instance of an opaque texture in the relevant realm of context created as a
TEXTURE_2D_ARRAY
texture with 1 internal texture using context and init’sdepthFormat
,mipLevels
,viewPixelWidth
andviewPixelHeight
values.- Otherwise -
- Initialize array with 1 new instance of an opaque texture in the relevant realm of context created as a
TEXTURE_2D
texture with context and init’sdepthFormat
,mipLevels
,viewPixelWidth
andviewPixelHeight
values. +- Initialize array with 1 new instance of an opaque texture in the relevant realm of context created as a
TEXTURE_2D
texture with context and init’sdepthFormat
,mipLevels
,viewPixelWidth
andviewPixelHeight
values.If layer’s
@@ -1966,7 +2033,7 @@layout
is"stereo"
:Initialize array with 1 new instance of an opaque texture in the relevant realm of context created as a
TEXTURE_2D_ARRAY
texture with 2 layers using context and init’sdepthFormat
,mipLevels
,viewPixelWidth
andviewPixelHeight
values.- Return array and abort these steps.
- Otherwise -
- Initialize array with 2 new instances of an opaque texture in the relevant realm of context created as a
TEXTURE_2D
texture with context and init’sdepthFormat
,mipLevels
,viewPixelWidth
andviewPixelHeight
values. +- Initialize array with 2 new instances of an opaque texture in the relevant realm of context created as a
TEXTURE_2D
texture with context and init’sdepthFormat
,mipLevels
,viewPixelWidth
andviewPixelHeight
values.- Return array and abort these steps.
- @@ -1988,7 +2055,7 @@
Let layer be a new
XRProjectionLayer
in the relevant realm of this.- -
If session’s ended value is
+true
, throwInvalidStateError
and abort these steps.If session’s ended value is
true
, throwInvalidStateError
and abort these steps.If context is lost, throw
InvalidStateError
and abort these steps.- @@ -1998,7 +2065,7 @@
Initialize layer’s
ignoreDepthValues
as follows:-
- If init’s
depthFormat
isfalse
and the XR Compositor will make use of depth values +- If init’s
depthFormat
isfalse
and the XR Compositor will make use of depth values- Initialize layer’s
ignoreDepthValues
tofalse
- Otherwise
- Initialize layer’s
ignoreDepthValues
totrue
@@ -2016,7 +2083,7 @@
Initialize layer’s
needsRedraw
totrue
.- -
let layer’s colorTextures be the result of allocating color textures for projection layers with layer, init’s
+textureType
, init’scolorFormat
and init’sscaleFactor
.let layer’s colorTextures be the result of allocating color textures for projection layers with layer, init’s
textureType
, init’scolorFormat
and init’sscaleFactor
.let layer’s depthStencilTextures be the result of allocating depth textures for projection layers with layer, init’s
textureType
, init’sdepthFormat
and init’sscaleFactor
.- @@ -2038,7 +2105,7 @@
Let depthstenciltextures for secondary views be
null
.- -
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.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.Return layer.
@@ -2054,7 +2121,7 @@
- -
If session’s ended value is
+true
, throwInvalidStateError
and abort these steps.If session’s ended value is
true
, throwInvalidStateError
and abort these steps.If context is lost, throw
InvalidStateError
and abort these steps.- @@ -2072,13 +2139,13 @@
Initialize layer’s
needsRedraw
totrue
.- -
let layer’s colorTextures be the result of allocating color textures with layer, init’s
+textureType
and init.let layer’s colorTextures be the result of allocating color textures with layer, init’s
textureType
and init.let layer’s depthStencilTextures be the result of allocating depth textures with layer, init’s
textureType
and init.Let layer’s motionVectorTextures be a new array in the relevant realm of context.
- -
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.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.return layer.
@@ -2094,7 +2161,7 @@
- -
If session’s ended value is
+true
, throwInvalidStateError
and abort these steps.If session’s ended value is
true
, throwInvalidStateError
and abort these steps.If context is lost, throw
InvalidStateError
and abort these steps.- @@ -2112,13 +2179,13 @@
Initialize layer’s
needsRedraw
totrue
.- -
let layer’s colorTextures be the result of allocating color textures with layer, init’s
+textureType
and init.let layer’s colorTextures be the result of allocating color textures with layer, init’s
textureType
and init.let layer’s depthStencilTextures be the result of allocating depth textures with layer, init’s
textureType
and init.Let layer’s motionVectorTextures be a new array in the relevant realm of context.
- -
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.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.return layer.
@@ -2134,7 +2201,7 @@
- -
If session’s ended value is
+true
, throwInvalidStateError
and abort these steps.If session’s ended value is
true
, throwInvalidStateError
and abort these steps.If context is lost, throw
InvalidStateError
and abort these steps.- @@ -2156,13 +2223,13 @@
Initialize layer’s
needsRedraw
totrue
.- -
let layer’s colorTextures be the result of allocating color textures with layer, init’s
+textureType
and init.let layer’s colorTextures be the result of allocating color textures with layer, init’s
textureType
and init.let layer’s depthStencilTextures be the result of allocating depth textures with layer, init’s
textureType
and init.Let layer’s motionVectorTextures be a new array in the relevant realm of context.
- -
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.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.return layer.
@@ -2178,7 +2245,7 @@
- -
If session’s ended value is
+true
, throwInvalidStateError
and abort these steps.If session’s ended value is
true
, throwInvalidStateError
and abort these steps.If context is not a
WebGL2RenderingContext
context, throwInvalidStateError
and abort these steps.- @@ -2210,14 +2277,14 @@
If layout is
"default"
or"stereo-left-right"
or"stereo-top-bottom"
, throwTypeError
and abort these steps.- -
Let layer’s colorTextures be a new array in the relevant realm of this
+XRCubeLayer
.Let layer’s colorTextures be a new array in the relevant realm of this
XRCubeLayer
.- -
Initialize layer’s colorTextures as follows, based on the value of layout:
+Initialize layer’s colorTextures as follows, based on the value of layout:
"mono"
: -- Initialize colorTextures with 1 new instance of an opaque texture in the relevant realm of this
XRCubeLayer
created as aTEXTURE_CUBE_MAP
texture with context and init’scolorFormat
,viewPixelWidth
andviewPixelHeight
values. +- Initialize colorTextures with 1 new instance of an opaque texture in the relevant realm of this
XRCubeLayer
created as aTEXTURE_CUBE_MAP
texture with context and init’scolorFormat
,viewPixelWidth
andviewPixelHeight
values.- Otherwise -
- Initialize colorTextures with 2 new instances of an opaque texture in the relevant realm of this
XRCubeLayer
created as aTEXTURE_CUBE_MAP
texture with context and init’scolorFormat
,viewPixelWidth
andviewPixelHeight
values. +- Initialize colorTextures with 2 new instances of an opaque texture in the relevant realm of this
XRCubeLayer
created as aTEXTURE_CUBE_MAP
texture with context and init’scolorFormat
,viewPixelWidth
andviewPixelHeight
values.Let layer’s depthStencilTextures be a new array in the relevant realm of this
@@ -2229,12 +2296,12 @@XRCubeLayer
.If context is not a
WebGL2RenderingContext
and theWEBGL_depth_texture
extension is not enabled in context- Throw
TypeError
and abort these steps.- Else if layout is
"mono"
-- Initialize depthStencilTextures with 1 new instance of an opaque texture in the relevant realm of this
XRCubeLayer
created as aTEXTURE_CUBE_MAP
texture with context and init’sdepthFormat
,viewPixelWidth
andviewPixelHeight
values. +- Initialize depthStencilTextures with 1 new instance of an opaque texture in the relevant realm of this
XRCubeLayer
created as aTEXTURE_CUBE_MAP
texture with context and init’sdepthFormat
,viewPixelWidth
andviewPixelHeight
values.- Otherwise -
- Initialize depthStencilTextures with 2 new instances of an opaque texture in the relevant realm of this
XRCubeLayer
created as aTEXTURE_CUBE_MAP
texture with context and init’sdepthFormat
,viewPixelWidth
andviewPixelHeight
values. +- Initialize depthStencilTextures with 2 new instances of an opaque texture in the relevant realm of this
XRCubeLayer
created as aTEXTURE_CUBE_MAP
texture with context and init’sdepthFormat
,viewPixelWidth
andviewPixelHeight
values.- -
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.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.return layer.
@@ -2256,7 +2323,7 @@
If binding’s context is not equal to layer’s context, return
false
and abort these steps.- -
If the layer’s colorTextures array is empty or missing, return
+false
and abort these steps.If the layer’s colorTextures array is empty or missing, return
false
and abort these steps.If the layer’s isStatic is
true
and layer’sneedsRedraw
isfalse
, returnfalse
and abort these steps.- @@ -2331,9 +2398,9 @@
Initialize subimage’s
colorTexture
as follows:
- If the layer was created with a textureType of
"texture"
-- Initialize subimage’s
colorTexture
with the element at offset index of the layer’s colorTextures array. +- Initialize subimage’s
colorTexture
with the element at offset index of the layer’s colorTextures array.- Otherwise -
- Initialize subimage’s
colorTexture
with the first element of the layer’s colorTextures array. +- Initialize subimage’s
colorTexture
with the first element of the layer’s colorTextures array.Initialize subimage’s
@@ -2412,9 +2479,9 @@depthStencilTexture
as follows:If view is a secondary view from session’s list of views
- Initialize subimage’s
colorTexture
with the element at offset index of the layer’s colorTextures for secondary views.- Else if the layer’s
layout
is"default"
and the layer was created with a textureType of"texture"
-- Initialize subimage’s
colorTexture
with the element at offset index of the layer’s colorTextures array. +- Initialize subimage’s
colorTexture
with the element at offset index of the layer’s colorTextures array.- Otherwise -
- Initialize subimage’s
colorTexture
with the first element of the layer’s colorTextures array. +- Initialize subimage’s
colorTexture
with the first element of the layer’s colorTextures array.Initialize subimage’s
@@ -2460,15 +2527,15 @@depthStencilTexture
as follows:
NOTE: The session should try to defer calls to
-getSubImage()
andgetViewSubImage()
to the time that the experience starts drawing using WebGL. Typically that would be after the game logic runs. On certain user agents having distinct stages for CPU and GPU dependent code allows them to dynamically optimize system resources.When an
XRLayer
is a member of thelayers
array, it MUST be presented to the immersive XR device immediately after +When an
XRLayer
is a member of thelayers
array, it MUST be presented to the immersive XR device immediately after an XR animation frame completes, but only if at least one of the following has occurred since the previous XR animation frame:
- -
The
+XRLayer
was added tolayers
since the previous XR animation frame.The
XRLayer
was added tolayers
since the previous XR animation frame.- -
+
XRLayer
is anXRWebGLLayer
andclear
,drawArrays
,drawElements
, or any other rendering operation which similarly affects the framebuffer’s color values has been called while the opaque framebuffer is the currently bound framebuffer of theWebGLRenderingContext
associated with theXRWebGLLayer
.
XRLayer
is anXRWebGLLayer
andclear
,drawArrays
,drawElements
, or any other rendering operation which similarly affects the framebuffer’s color values has been called while the opaque framebuffer is the currently bound framebuffer of theWebGLRenderingContext
associated with theXRWebGLLayer
.- -
+
XRLayer
is anXRCompositionLayer
andgetSubImage()
orgetViewSubImage()
was called and any rendering operation has been called that affects the color value of thecolorTexture
texture.
XRLayer
is anXRCompositionLayer
andgetSubImage()
orgetViewSubImage()
was called and any rendering operation has been called that affects the color value of thecolorTexture
texture.Before the opaque framebuffer or
colorTexture
texture are presented to the immersive XR device the user agent MUST ensure that all rendering operations have been flushed.7. Video layer creation
@@ -2553,7 +2620,7 @@
@@ -2624,7 +2691,7 @@
- -
If session’s ended value is
+true
, throw anInvalidStateError
and abort these steps.If session’s ended value is
true
, throw anInvalidStateError
and abort these steps.If session is not an immersive session, throw an
InvalidStateError
and abort these steps.- @@ -2588,7 +2655,7 @@
If session was not created with "layers" enabled, throw a
NotSupportedError
and abort these steps.- -
If session’s ended value is
+true
, throwInvalidStateError
and abort these steps.If session’s ended value is
true
, throwInvalidStateError
and abort these steps.If init’s
layout
is"default"
, throw aTypeError
and abort these steps.- @@ -2610,7 +2677,7 @@
Run initialize a quad layer with layer and init.
- -
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.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.return layer.
If session was not created with "layers" enabled, throw a
NotSupportedError
and abort these steps.- -
If session’s ended value is
+true
, throwInvalidStateError
and abort these steps.If session’s ended value is
true
, throwInvalidStateError
and abort these steps.If init’s
layout
is"default"
, throw aTypeError
and abort these steps.- @@ -2642,7 +2709,7 @@
Run initialize a cylinder layer with layer and init.
- -
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.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.return layer.
@@ -2656,7 +2723,7 @@
If session was not created with "layers" enabled, throw a
NotSupportedError
and abort these steps.- -
If session’s ended value is
+true
, throwInvalidStateError
and abort these steps.If session’s ended value is
true
, throwInvalidStateError
and abort these steps.If init’s
layout
is"default"
, throw aTypeError
and abort these steps.- @@ -2674,7 +2741,7 @@
Run initialize a equirect layer with layer and init.
- -
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.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.return layer.
@@ -2682,21 +2749,21 @@define how the
XREquirectLayer
's parameters affect the video display.8. Events
8.1. XRLayerEvent
-+
XRLayerEvent
is fired to indicate changes to the state of anXRLayer
.
XRLayerEvent
is fired to indicate changes to the state of anXRLayer
.[-SecureContext ,Exposed =Window ]interface :
XRLayerEvent Event {(
constructor DOMString ,
type XRLayerEventInit ); - [
eventInitDict SameObject ]readonly attribute XRLayer layer ; + [SameObject ]readonly attribute XRLayer layer ; };dictionary :
XRLayerEventInit EventInit { -required XRLayer ; +
layer required XRLayer ; };
layer The
+layer
attribute indicates theXRLayer
that generated the event.The
layer
attribute indicates theXRLayer
that generated the event.8.2. Event Types
The user agent MUST provide the following new events. Registration for and firing of the events must follow the usual behavior of DOM4 Events.
-The user agent MAY fire a
+redraw
event on theXRLayer
object when the underlying resources of a layer are lost or -when the XR Compositor can no longer reproject the layer.The user agent MAY fire a
redraw
event on theXRLayer
object when the underlying resources of a layer are lost or +when the XR Compositor can no longer reproject the layer.The author SHOULD redraw the content of the layer at the next XR animation frame. The event must be of type
XRLayerEvent
.9. Depth sorting between layers
@@ -2705,28 +2772,28 @@If an
XRSession
is created with the "depth-sorted-layers" feature descriptor,XRProjectionLayer
,XRQuadLayer
andXRCylinderLayer
layers MUST be displayed based on their depth as opposed to the location in thelayers
array. Other layers types MUST continue to be sorted as before.-
XRQuadLayer
andXRCylinderLayer
layers MUST be sorted by their dimensions (for instancewidth
orcentralAngle
), transform and space.+
XRProjectionLayer
layers MUST be sorted according to the values in theirdepthStencilTexture
. This also implies that if "depth-sorted-layers" is enabled, the XR Compositor MUST make use of depth values andignoreDepthValues
andusesDepthValues
MUST be set to `true`.
XRProjectionLayer
layers MUST be sorted according to the values in theirdepthStencilTexture
. This also implies that if "depth-sorted-layers" is enabled, the XR Compositor MUST make use of depth values andignoreDepthValues
andusesDepthValues
MUST be set to `true`.10. Space warp
-Space warp is a technology that improves the XR Compositor's reprojection. -By submitting a
+motionVectorTexture
along with adepthStencilTexture
the XR Compositor can do high quality frame extrapolation and reprojection which allows the user agent to run at a reduced framerate but still provide a smooth experience to users.Space warp is a technology that improves the XR Compositor's reprojection. +By submitting a
motionVectorTexture
along with adepthStencilTexture
the XR Compositor can do high quality frame extrapolation and reprojection which allows the user agent to run at a reduced framerate but still provide a smooth experience to users.To enable space warp the
-XRSession
MUST be created with the "space-warp" feature descriptor. -If "space-warp" is enabled, the XR Compositor MUST make use of depth values,ignoreDepthValues
MUST be set to `false` andusesDepthValues
MUST be set to `true`.The
+If "space-warp" is enabled, the XR Compositor MUST make use of depth values,motionVectorTexture
MUST be inRGBA16F
format. The author SHOULD fill in the RGB components of this texture with the speed in meters per second of that area with the red pixel corresponding with the x axis, green the y axis and blue the z axis.ignoreDepthValues
MUST be set to `false` andusesDepthValues
MUST be set to `true`. +The
motionVectorTexture
MUST be inRGBA16F
format. The author SHOULD fill in the RGB components of this texture with the speed in meters per second of that area with the red pixel corresponding with the x axis, green the y axis and blue the z axis.11. WebXR Device API Integration
11.1. XRRenderState changes
This module extends theXRRenderStateInit
andXRRenderState
interfaces with a new optional arraylayers
containing -instances ofXRLayer
. +instances ofXRLayer
.[SecureContext ,Exposed =Window ]partial interface XRRenderState { -readonly attribute FrozenArray <XRLayer >layers ; +readonly attribute FrozenArray <XRLayer >layers ; };The
-layers
attribute returns an array containing -the instances ofXRLayer
that are displayed by the XR Compositor.By default, the
+the instances oflayers
array defines the order of the composition of the layers. The XR Compositor MUST draw each layer -in order of its position in the array using source-over blending. Unless the "depth-sorted-layers" feature descriptor is enabled, the XR Compositor MUST NOT apply any depth sorting of the layers.XRLayer
that are displayed by the XR Compositor. +By default, the
layers
array defines the order of the composition of the layers. The XR Compositor MUST draw each layer +in order of its position in the array using source-over blending. Unless the "depth-sorted-layers" feature descriptor is enabled, the XR Compositor MUST NOT apply any depth sorting of the layers.NOTE: this means that each layer can potentially overwrite the previous layers whether or not the previous layers are virtually closer to the viewer.
This module replaces the steps given by initialize the render state. Instead when anXRRenderState
object state is created for anXRSession
session, the user agent MUST initialize the render state by running the following steps: @@ -2778,9 +2845,9 @@
11.3. XRCompositor changes
- The XR Compositor MUST be extended so allXRLayer
instances from thelayers
array are composited -at the same time. All other requirements for WebXR MUST continue to apply. -If the XR Compositor is rendering to a view with an
XREye
of"none"
and drawing anXRCompositionLayer
which is NOT anXRProjectionLayer
and does NOT have alayout
of"mono"
, the XR Compositor MUST render that layer + The XR Compositor MUST be extended so allXRLayer
instances from thelayers
array are composited +at the same time. All other requirements for WebXR MUST continue to apply. +If the XR Compositor is rendering to a view with an
XREye
of"none"
and drawing anXRCompositionLayer
which is NOT anXRProjectionLayer
and does NOT have alayout
of"mono"
, the XR Compositor MUST render that layer as if the view had anXREye
of"left"
.NOTE: This means that the side for the right eye of the layer is ignored. This enables authors to use the same assets for stereoscopic and monoscopic devices.
@@ -2807,7 +2874,7 @@12. Security and Privacy Considerations
12.1. Timing of the composition
Composition timing MUST be independent of the content that is rendered. -Moreover, content in a layer MUST not be observable in other layers.
+Moreover, content in a layer MUST NOT be observable in other layers.If possible, composition of layers should happen outside the browser to reduce risk of timing attacks or other security vulnerabilities.
12.2. Allocation of layers
The user agent MAY put limits on any resource allocation such as the maximum pixel size or the number of layers to reduce the identifiability of the GPU hardware.
@@ -3239,6 +3306,11 @@
- source-over +
- + [CSS-WRITING-MODES-4] defines the following terms: +
+
- end +
- [DOM] defines the following terms:
@@ -3355,7 +3427,6 @@
animationframe
- baseLayer (for XRRenderState)
- baseLayer (for XRRenderStateInit) -
- ended
- feature descriptor
- feature requirements
- height @@ -3402,6 +3473,8 @@
N
- [COMPOSITING-1]
- Rik Cabanier; Nikos Andronikos. Compositing and Blending Level 1. URL: https://drafts.fxtf.org/compositing-1/ +
- [CSS-WRITING-MODES-4] +
- Elika Etemad; Koji Ishii. CSS Writing Modes Level 4. URL: https://drafts.csswg.org/css-writing-modes-4/
- [DOM]
- Anne van Kesteren. DOM Standard. Living Standard. URL: https://dom.spec.whatwg.org/
- [GEOMETRY-1] @@ -3658,7 +3731,160 @@
add a better algorithm to describe the drawing. ↵
define how the- + - - + - + \ No newline at end of fileXREquirectLayer
's parameters affect the video display. ↵