Skip to content

Commit

Permalink
Merge pull request #1359 from cabanier/srgb
Browse files Browse the repository at this point in the history
Clarify rgb vs srgb behavior
  • Loading branch information
cabanier authored Feb 10, 2024
2 parents 47d14b6 + 656e17e commit 25be768
Showing 1 changed file with 19 additions and 5 deletions.
24 changes: 19 additions & 5 deletions index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ WPT Path Prefix: webxr
Editor: Brandon Jones 87824, Google https://google.com/, [email protected]
Former Editor: Nell Waliczek 93109, Amazon [Microsoft until 2018] https://amazon.com/, [email protected]
Editor: Manish Goregaokar 109489, Google [Mozilla until 2020], [email protected]
Editor: Rik Cabanier 106988, Meta https://facebook.com, cabanier@fb.com
Editor: Rik Cabanier 106988, Meta https://meta.com, cabanier@meta.com
Abstract: This specification describes support for accessing virtual reality (VR) and augmented reality (AR) devices, including sensors and head-mounted displays, on the Web.
Expand All @@ -33,11 +33,14 @@ spec:infra;
type:dfn; text:string
type:dfn; text:tuple
type:dfn; text:continue
spec:permissions-1;
spec:permissions;
type:dfn; text:powerful feature
spec:webidl;
type:dfn; text:new
type:interface; text:any
spec:dom;
type:dfn; text:ancestor
type:dfn; text:descendant
spec:webxr-ar-module-1;
type:dfn; text:first-person observer view
spec:html; type:interface; text:Navigator
Expand Down Expand Up @@ -80,8 +83,12 @@ spec: WebGL; urlPrefix: https://www.khronos.org/registry/webgl/specs/latest/1.0/
type: dfn; text: webgl context lost flag; for: WebGLRenderingContext; url: webgl-context-lost-flag
type: dfn; text: Fire a WebGL context event; url: fire-a-webgl-context-event
type: dfn; text: invalidated; for: WebGLObject; url: #webgl-object-invalidated-flag
type: typedef; text: RGBA; url: #5.14
type: typedef; text: RGB; url: #5.14
spec: WebGL 2.0; urlPrefix: https://www.khronos.org/registry/webgl/specs/latest/2.0/
type: interface; text: WebGL2RenderingContext; url: WebGL2RenderingContext
type: typedef; text: SRGB8; url: #5.14
type: typedef; text: SRGB8_ALPHA8; url: #5.14
spec: Orientation Sensor; urlPrefix: https://www.w3.org/TR/orientation-sensor/
type: interface; text: AbsoluteOrientationSensor; url: absoluteorientationsensor
type: interface; text: RelativeOrientationSensor; url: relativeorientationsensor
Expand Down Expand Up @@ -928,7 +935,7 @@ The <dfn attribute for="XRSession">onend</dfn> attribute is an [=Event handler I

The <dfn attribute for="XRSession">oninputsourceschange</dfn> attribute is an [=Event handler IDL attribute=] for the {{inputsourceschange}} event type.

The <dfn attribute for="XRSession">onselectstart</dfn> attribute is an [=Event handler IDL attribute=] for the {{selectstart}} event type.
The <dfn attribute for="XRSession">onselectstart</dfn> attribute is an [=Event handler IDL attribute=] for the {{XRSession/selectstart}} event type.

The <dfn attribute for="XRSession">onselectend</dfn> attribute is an [=Event handler IDL attribute=] for the {{selectend}} event type.

Expand Down Expand Up @@ -1890,7 +1897,7 @@ An [=XR input source=] is an <dfn>auxiliary input source</dfn> if it does not su
When an [=XR input source=] |source| for {{XRSession}} |session| begins its [=primary action=] the UA MUST run the following steps:

1. Let |frame| be a [=new=] {{XRFrame}} in the [=relevant realm=] of |session| with {{XRFrame/session}} |session| with [=XRFrame/time=] being the time the action occurred.
1. [=Queue a task=] to [=fire an input source event=] with name {{selectstart!!event}}, frame |frame|, and source |source|.
1. [=Queue a task=] to [=fire an input source event=] with name {{XRSession/selectstart!!event}}, frame |frame|, and source |source|.

</div>

Expand Down Expand Up @@ -1968,7 +1975,7 @@ When a [=transient input source=] |source| for {{XRSession}} |session| begins it
1. [=Queue a task=] to perform the following steps:
1. Fire any `"pointerdown"` events produced by the [=XR input source=]'s action, if necessary.
1. [=add input source|Add the XR input source=] to the [=list of active XR input sources=].
1. If the [=transient action=] is a [=primary action=], [=fire an input source event=] with name {{selectstart!!event}}, frame |frame|, and source |source|.
1. If the [=transient action=] is a [=primary action=], [=fire an input source event=] with name {{XRSession/selectstart!!event}}, frame |frame|, and source |source|.

</div>

Expand Down Expand Up @@ -2173,6 +2180,13 @@ The buffers attached to an [=opaque framebuffer=] MUST be cleared to the values

Note: Implementations may optimize away the required implicit clear operation of the [=opaque framebuffer=] as long as a guarantee can be made that the developer cannot gain access to buffer contents from another process. For instance, if the developer performs an explicit clear then the implicit clear is not needed.

If an {{XRWebGLLayer}} is created with an {{XRWebGLLayerInit/alpha}} set to `true`, the {{XRWebGLLayer/framebuffer}} must be backed by a texture with the {{RGBA}} color format.
If an {{XRWebGLLayer}} is created with an {{XRWebGLLayerInit/alpha}} set to `false`, the {{XRWebGLLayer/framebuffer}} must be backed by a texture with the {{RGB}} color format.

However, the [=XR Compositor=] MUST treat the {{XRWebGLLayer/framebuffer}}'s backing's pixels as if they were in the {{SRGB8_ALPHA8}} or {{SRGB8}} {{XRLayerInit/colorFormat}}.

NOTE: this means that the [=XR Compositor=] MUST not do any gamma conversion from linear {{RGBA}} or {{RGB}} when it processes the texture backing the {{XRWebGLLayer/framebuffer}}. Otherwise, the pixels in the final rendering will appear too bright which will not match the rendering on a regular 2D {{WebGLRenderingContext}} context.

When an {{XRWebGLLayer}} is set as an [=immersive session=]'s {{XRRenderState/baseLayer}} the content of the [=opaque framebuffer=] is 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 [=immersive session=]'s {{XRRenderState/baseLayer}} was changed.
Expand Down

0 comments on commit 25be768

Please sign in to comment.