Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 15b4ecd31e2260916c12b6612545a2055c4173a8
      
https://github.com/WebKit/WebKit/commit/15b4ecd31e2260916c12b6612545a2055c4173a8
  Author: Sergio Villar Senin <[email protected]>
  Date:   2026-05-26 (Tue, 26 May 2026)

  Changed paths:
    A 
LayoutTests/imported/w3c/web-platform-tests/webxr/layers/xrCylinderLayer_textureType.https-expected.txt
    A 
LayoutTests/imported/w3c/web-platform-tests/webxr/layers/xrCylinderLayer_textureType.https.html
    A 
LayoutTests/imported/w3c/web-platform-tests/webxr/layers/xrEquirectLayer_textureType.https-expected.txt
    A 
LayoutTests/imported/w3c/web-platform-tests/webxr/layers/xrEquirectLayer_textureType.https.html
    A 
LayoutTests/imported/w3c/web-platform-tests/webxr/layers/xrQuadLayer_textureType.https-expected.txt
    A 
LayoutTests/imported/w3c/web-platform-tests/webxr/layers/xrQuadLayer_textureType.https.html
    M Source/WebCore/Modules/webxr/WebXRWebGLSwapchain.cpp
    M Source/WebCore/Modules/webxr/XRWebGLBinding.cpp
    M Source/WebCore/Modules/webxr/XRWebGLBinding.h
    M Source/WebCore/Modules/webxr/XRWebGLLayerBacking.cpp
    M Source/WebCore/Modules/webxr/XRWebGLLayerBacking.h

  Log Message:
  -----------
  [WebXR Layers] Enable texture array support for non-projection layers
https://bugs.webkit.org/show_bug.cgi?id=315208

Reviewed by Dan Glastonbury.

Support for texture arrays was added in d158677@main. With this commit
quad, cylinder and equirect composition layers created with
textureType="texture-array" now also allocate a GL_TEXTURE_2D_ARRAY
instead of a regular texture so JS could render into them via
XRWebGLBinding.getSubImage.

Three things were needed:

1. determineLayout(): the "stereo" requested layout was always rewritten
   to "stereo-left-right". For texture arrays the requested layout must
   be preserved, i.e., each array slice already is a full per-view
   texture, there is no side-by-side packing,

2. allocate{Color|Depth}TexturesForLayer() and initializeViewport():
   both were duplicating the layout/textureType decision tree to either
   reject "texture-array" or compute a per-eye half-viewport. All of
   that is already baked into the swapchain (size, target, array length)
   at construction time, so there is no need to treat each case
   separatedely as described in the specs. The backing will return the
   right object to use for rendering.

3. createCompositionLayerSwapchains(): the texture array length was
   using session.views().size(), conflating session view count with
   per-layer view count. That was valid for projection layers but it was
   causing issues with other composition layers. In particular we were
   getting invalid value errors ("Offset overflows texture dimensions")
   due to not properly handling stereo layouts.

Apart from that, this change also requires adjustments in the layer
backing code as we were calling endFrame() in some swapchains without
previously calling startFrame() because the latter may early return in
those cases in which the platform code has not yet produced valid
LayerData for a layer that has been added via updateRenderState. That
was not a problem for other swapchains but it matters for the texture
array one because it performs an extra blit in endFrame() which requires
access to valid m_textureSets data.

Tests: 
imported/w3c/web-platform-tests/webxr/layers/xrCylinderLayer_textureType.https.html
       
imported/w3c/web-platform-tests/webxr/layers/xrEquirectLayer_textureType.https.html
       
imported/w3c/web-platform-tests/webxr/layers/xrQuadLayer_textureType.https.html

* 
LayoutTests/imported/w3c/web-platform-tests/webxr/layers/xrCylinderLayer_textureType.https-expected.txt:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/webxr/layers/xrCylinderLayer_textureType.https.html:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/webxr/layers/xrEquirectLayer_textureType.https-expected.txt:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/webxr/layers/xrEquirectLayer_textureType.https.html:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/webxr/layers/xrQuadLayer_textureType.https-expected.txt:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/webxr/layers/xrQuadLayer_textureType.https.html:
 Added.
* Source/WebCore/Modules/webxr/WebXRWebGLSwapchain.cpp:
(WebCore::WebXRWebGLTextureArraySwapchain::bindCompositorTexturesForDisplay):
(WebCore::WebXRWebGLTextureArraySwapchain::blitTextureArrayToSharedImage):
* Source/WebCore/Modules/webxr/XRWebGLBinding.cpp:
(WebCore::XRWebGLBinding::determineLayout):
(WebCore::XRWebGLBinding::allocateColorTexturesForLayer):
(WebCore::XRWebGLBinding::allocateDepthTexturesForLayer):
(WebCore::XRWebGLBinding::validateCompositionLayerInitParameters const):
(WebCore::XRWebGLBinding::initializeViewport):
(WebCore::XRWebGLBinding::getSubImage):
* Source/WebCore/Modules/webxr/XRWebGLBinding.h:
* Source/WebCore/Modules/webxr/XRWebGLLayerBacking.cpp:
(WebCore::XRWebGLLayerBacking::startFrame):
(WebCore::XRWebGLLayerBacking::endFrame):
(WebCore::XRWebGLLayerBacking::createCompositionLayerSwapchains):
* Source/WebCore/Modules/webxr/XRWebGLLayerBacking.h:

Canonical link: https://commits.webkit.org/313872@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to