Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: bccc4656ae3a49244121bd612f08e5dacff7ac64
      
https://github.com/WebKit/WebKit/commit/bccc4656ae3a49244121bd612f08e5dacff7ac64
  Author: Sergio Villar Senin <[email protected]>
  Date:   2026-06-23 (Tue, 23 Jun 2026)

  Changed paths:
    M Source/WebCore/Modules/webxr/WebXRWebGLLayer.cpp
    M Source/WebCore/Modules/webxr/WebXRWebGLSwapchain.cpp
    M Source/WebCore/Modules/webxr/WebXRWebGLSwapchain.h
    M Source/WebCore/Modules/webxr/XRCubeLayer.cpp
    M Source/WebCore/Modules/webxr/XRCubeLayer.h
    M Source/WebCore/Modules/webxr/XRWebGLBinding.cpp
    M Source/WebCore/Modules/webxr/XRWebGLBinding.h
    M Source/WebCore/Modules/webxr/XRWebGLBinding.idl
    A Source/WebCore/Modules/webxr/XRWebGLCubeLayerBacking.cpp
    A Source/WebCore/Modules/webxr/XRWebGLCubeLayerBacking.h
    M Source/WebCore/Modules/webxr/XRWebGLLayerBacking.cpp
    M Source/WebCore/Modules/webxr/XRWebGLLayerBacking.h
    M Source/WebCore/Modules/webxr/XRWebGLSubImage.cpp
    M Source/WebCore/Modules/webxr/XRWebGLSubImage.h
    M Source/WebCore/Sources.txt
    M Source/WebCore/platform/xr/PlatformXR.h
    M Source/WebKit/Shared/XR/PlatformXR.serialization.in
    M Source/WebKit/UIProcess/XR/openxr/OpenXRLayer.cpp
    M Source/WebKit/UIProcess/XR/openxr/OpenXRLayer.h
    M Source/WebKit/UIProcess/XR/openxr/OpenXRSwapchain.cpp
    M Source/WebKit/UIProcess/XR/openxr/PlatformXROpenXR.cpp
    M Source/WebKit/UIProcess/XR/openxr/PlatformXROpenXR.h

  Log Message:
  -----------
  [WebXR Layers] Implement Cube layer
https://bugs.webkit.org/show_bug.cgi?id=317134

Reviewed by Dan Glastonbury.

This implements the required changes to create cube layers on UIProcess
side and share them with the WebProcess so that web authors could use
them in their WebXR experiences.

Both mono and stereo cube layers are supported. This commit also
provides support for cube layers implemented with texture arrays.

This adds the platform implementation using OpenXR via the
XR_KHR_composition_layer_cube extension.

The cube layer is a bit special because it does not use regular textures
but texture cube maps. Those cannot be shared via DMABuf so we have to
"serialize" the faces of the cube in large side by side regular
textures. What's more, two texture cube maps cannot be concatenated as
we do with quad layers for example for the stereo case. We need to
create two different cube maps, and that requires slight changes to the
current code. In that sense this layer is a bit different to other
composition layers.

Cube layers can be backed by texture arrays too. In that case we need to
create a texture array with 6 slices or with 12 for the stereo case as
described by specs.

There are several similarities between the texture arrays and the
texture cube maps, both are composed by multiple slices/faces. That's
why we decided to generalize that common behaviour in a new abstract
MultiTextureSwapchain which is the new parent of the texture array
swapchain and also the cube swapchain.

* Source/WebCore/Modules/webxr/WebXRWebGLLayer.cpp:
(WebCore::WebXRWebGLLayer::endFrame):
* Source/WebCore/Modules/webxr/WebXRWebGLSwapchain.cpp:
(WebCore::WebXRWebGLStaticImageSwapchain::currentTexture):
(WebCore::WebXRWebGLStaticImageSwapchain::currentTextureAtIndex):
(WebCore::WebXRWebGLStaticImageSwapchain::bindCompositorTexturesForDisplay):
(WebCore::WebXRWebGLStaticImageSwapchain::clearTextureRegion):
(WebCore::WebXRWebGLStaticImageSwapchain::allTexturesAreBound const):
(WebCore::WebXRWebGLMultiTextureSwapchain::WebXRWebGLMultiTextureSwapchain):
(WebCore::WebXRWebGLMultiTextureSwapchain::~WebXRWebGLMultiTextureSwapchain):
(WebCore::WebXRWebGLMultiTextureSwapchain::TextureSet::release):
(WebCore::WebXRWebGLMultiTextureSwapchain::TextureSet::leakObject):
(WebCore::WebXRWebGLMultiTextureSwapchain::currentTexture):
(WebCore::WebXRWebGLMultiTextureSwapchain::currentTextureAtIndex):
(WebCore::WebXRWebGLMultiTextureSwapchain::releaseTexturesAtIndex):
(WebCore::WebXRWebGLMultiTextureSwapchain::reusableTextures const):
(WebCore::WebXRWebGLMultiTextureSwapchain::startFrame):
(WebCore::WebXRWebGLMultiTextureSwapchain::endFrame):
(WebCore::WebXRWebGLMultiTextureSwapchain::allTexturesAreBound const):
(WebCore::WebXRWebGLTextureArraySwapchain::create):
(WebCore::WebXRWebGLTextureArraySwapchain::WebXRWebGLTextureArraySwapchain):
(WebCore::WebXRWebGLTextureArraySwapchain::bindCompositorTexturesForDisplay):
(WebCore::WebXRWebGLTextureArraySwapchain::blitToSharedImage):
(WebCore::WebXRWebGLCubeSwapchain::create):
(WebCore::WebXRWebGLCubeSwapchain::WebXRWebGLCubeSwapchain):
(WebCore::WebXRWebGLCubeSwapchain::bindCompositorTexturesForDisplay):
(WebCore::WebXRWebGLCubeSwapchain::blitToSharedImage):
(WebCore::WebXRWebGLCubeSwapchain::clearTextureRegion):
(WebCore::WebXRWebGLTextureArraySwapchain::~WebXRWebGLTextureArraySwapchain): 
Deleted.
(WebCore::WebXRWebGLTextureArraySwapchain::TextureSet::release): Deleted.
(WebCore::WebXRWebGLTextureArraySwapchain::TextureSet::leakObject): Deleted.
(WebCore::WebXRWebGLTextureArraySwapchain::currentTexture): Deleted.
(WebCore::WebXRWebGLTextureArraySwapchain::releaseTexturesAtIndex): Deleted.
(WebCore::WebXRWebGLTextureArraySwapchain::reusableTextures const): Deleted.
(WebCore::WebXRWebGLTextureArraySwapchain::blitTextureArrayToSharedImage): 
Deleted.
(WebCore::WebXRWebGLTextureArraySwapchain::startFrame): Deleted.
(WebCore::WebXRWebGLTextureArraySwapchain::endFrame): Deleted.
(WebCore::WebXRWebGLTextureArraySwapchain::allTexturesAreBound const): Deleted.
* Source/WebCore/Modules/webxr/WebXRWebGLSwapchain.h:
(WebCore::WebXRWebGLSwapchain::currentTextureAtIndex):
(WebCore::WebXRWebGLMultiTextureSwapchain::TextureSet::operator bool const):
* Source/WebCore/Modules/webxr/XRCubeLayer.cpp:
(WebCore::XRCubeLayer::XRCubeLayer):
(WebCore::XRCubeLayer::setOrientation):
(WebCore::XRCubeLayer::fillInTypeSpecificDeviceLayerData const):
* Source/WebCore/Modules/webxr/XRCubeLayer.h:
(WebCore::XRCubeLayer::create):
(WebCore::XRCubeLayer::orientation const):
(WebCore::XRCubeLayer::space const): Deleted.
(WebCore::XRCubeLayer::setSpace): Deleted.
(WebCore::XRCubeLayer::setOrientation): Deleted.
* Source/WebCore/Modules/webxr/XRWebGLBinding.cpp:
(WebCore::XRWebGLBinding::allocateColorTexturesForLayer):
(WebCore::XRWebGLBinding::allocateDepthTexturesForLayer):
(WebCore::XRWebGLBinding::createCubeLayer):
(WebCore::XRWebGLBinding::getSubImage):
* Source/WebCore/Modules/webxr/XRWebGLBinding.h:
(WebCore::XRWebGLBinding::createCubeLayer): Deleted.
* Source/WebCore/Modules/webxr/XRWebGLBinding.idl:
* Source/WebCore/Modules/webxr/XRWebGLCubeLayerBacking.cpp: Copied from 
Source/WebCore/Modules/webxr/XRCubeLayer.h.
(WebCore::XRWebGLCubeLayerBacking::create):
(WebCore::XRWebGLCubeLayerBacking::XRWebGLCubeLayerBacking):
* Source/WebCore/Modules/webxr/XRWebGLCubeLayerBacking.h: Copied from 
Source/WebCore/Modules/webxr/XRCubeLayer.cpp.
* Source/WebCore/Modules/webxr/XRWebGLLayerBacking.cpp:
(WebCore::XRWebGLLayerBacking::currentColorTexture const):
(WebCore::XRWebGLLayerBacking::requiresPerViewColorTextures const):
(WebCore::XRWebGLLayerBacking::currentDepthTexture const):
(WebCore::XRWebGLLayerBacking::createCompositionLayerSwapchains):
(WebCore::XRWebGLLayerBacking::createColorAndDepthSwapchains):
* Source/WebCore/Modules/webxr/XRWebGLLayerBacking.h:
* Source/WebCore/Modules/webxr/XRWebGLSubImage.cpp:
(WebCore::XRWebGLSubImage::create):
* Source/WebCore/Modules/webxr/XRWebGLSubImage.h:
* Source/WebCore/Sources.txt:
* Source/WebCore/platform/graphics/gbm/GraphicsContextGLTextureMapperGBM.cpp:
(WebCore::GraphicsContextGLTextureMapperGBM::enableRequiredWebXRExtensionsImpl):
* 
Source/WebCore/platform/graphics/texmap/GraphicsContextGLTextureMapperANGLE.cpp:
(WebCore::GraphicsContextGLTextureMapperANGLE::enableRequiredWebXRExtensions):
* Source/WebCore/platform/xr/PlatformXR.h:
* Source/WebKit/Shared/XR/PlatformXR.serialization.in:
* Source/WebKit/UIProcess/XR/openxr/OpenXRLayer.cpp:
(WebKit::OpenXRLayer::exportOpenXRTextureAndroid):
(WebKit::OpenXRLayer::exportOpenXRTexture):
(WebKit::OpenXRCubeLayer::create):
(WebKit::OpenXRCubeLayer::OpenXRCubeLayer):
(WebKit::OpenXRCubeLayer::~OpenXRCubeLayer):
(WebKit::OpenXRCubeLayer::startFrame):
(WebKit::OpenXRCubeLayer::reconstructCubeFaces):
* Source/WebKit/UIProcess/XR/openxr/OpenXRLayer.h:
* Source/WebKit/UIProcess/XR/openxr/OpenXRSwapchain.cpp:
(WebKit::OpenXRSwapchain::create):
* Source/WebKit/UIProcess/XR/openxr/PlatformXROpenXR.cpp:
(WebKit::OpenXRCoordinator::createSwapchain const):
(WebKit::OpenXRCoordinator::createCompositionLayer):
(WebKit::OpenXRCoordinator::createInstance):
* Source/WebKit/UIProcess/XR/openxr/PlatformXROpenXR.h:

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



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

Reply via email to