Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: a4de8c837ee957de9f5a88d56d27c9887347dcd4
      
https://github.com/WebKit/WebKit/commit/a4de8c837ee957de9f5a88d56d27c9887347dcd4
  Author: Sergio Villar Senin <[email protected]>
  Date:   2026-04-20 (Mon, 20 Apr 2026)

  Changed paths:
    M 
Source/WebCore/Modules/WebGPU/Implementation/WebGPUXRProjectionLayerImpl.cpp
    M Source/WebCore/Modules/WebGPU/Implementation/WebGPUXRProjectionLayerImpl.h
    M Source/WebCore/Modules/webxr/WebXRSession.cpp
    M Source/WebCore/Modules/webxr/WebXRSession.h
    M Source/WebCore/Modules/webxr/WebXRSystem.h
    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/XRCompositionLayer.cpp
    M Source/WebCore/Modules/webxr/XRCompositionLayer.h
    M Source/WebCore/Modules/webxr/XRLayerBacking.h
    M Source/WebCore/Modules/webxr/XRProjectionLayer.cpp
    M Source/WebCore/Modules/webxr/XRProjectionLayer.h
    M Source/WebCore/Modules/webxr/XRQuadLayer.cpp
    M Source/WebCore/Modules/webxr/XRQuadLayer.h
    M Source/WebCore/Modules/webxr/XRWebGLBinding.cpp
    M Source/WebCore/Modules/webxr/XRWebGLBinding.h
    M Source/WebCore/Modules/webxr/XRWebGLBinding.idl
    M Source/WebCore/Modules/webxr/XRWebGLLayerBacking.cpp
    M Source/WebCore/Modules/webxr/XRWebGLLayerBacking.h
    M Source/WebCore/Modules/webxr/XRWebGLProjectionLayerBacking.cpp
    A Source/WebCore/Modules/webxr/XRWebGLQuadLayerBacking.cpp
    A Source/WebCore/Modules/webxr/XRWebGLQuadLayerBacking.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/WebCore/testing/WebFakeXRDevice.cpp
    M Source/WebCore/testing/WebFakeXRDevice.h
    M Source/WebKit/Scripts/webkit/messages.py
    M Source/WebKit/Shared/XR/PlatformXR.serialization.in
    M Source/WebKit/Shared/XR/XRDeviceProxy.cpp
    M Source/WebKit/Shared/XR/XRDeviceProxy.h
    M Source/WebKit/UIProcess/XR/PlatformXRCoordinator.h
    M Source/WebKit/UIProcess/XR/PlatformXRSystem.cpp
    M Source/WebKit/UIProcess/XR/PlatformXRSystem.h
    M Source/WebKit/UIProcess/XR/PlatformXRSystem.messages.in
    M Source/WebKit/UIProcess/XR/openxr/OpenXRLayer.cpp
    M Source/WebKit/UIProcess/XR/openxr/OpenXRLayer.h
    M Source/WebKit/UIProcess/XR/openxr/OpenXRSwapchain.h
    M Source/WebKit/UIProcess/XR/openxr/PlatformXROpenXR.cpp
    M Source/WebKit/UIProcess/XR/openxr/PlatformXROpenXR.h
    M Source/WebKit/UIProcess/XR/openxr/PlatformXRSystemOpenXR.cpp
    M 
Source/WebKit/WebProcess/GPU/graphics/WebGPU/RemoteXRProjectionLayerProxy.h
    M Source/WebKit/WebProcess/XR/PlatformXRSystemProxy.cpp
    M Source/WebKit/WebProcess/XR/PlatformXRSystemProxy.h

  Log Message:
  -----------
  [WebXR][OpenXR] Support Quad layer
https://bugs.webkit.org/show_bug.cgi?id=311621

Reviewed by Dan Glastonbury.

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

This includes not only mono quad layers (same image in both eyes) but
also top-bottom and left-to-right which are also supported. Authors can
even force a stereo layer to be presented as a mono layer at any point
in time, something that is also supported.

As in the case of the projection layer, texture arrays are not supported
yet. They'll be eventually added. The nice thing is that the swapchain
mechanism used to create the projection layers worked seamlessly for
quads and required no changes.

The projection layer patch added static swapchain images for depth
textures, however it was a very limitted implementation that only
provided 1 depth texture for all the color textures. That's clearly
wrong. We use this patch to allow multiple buffering for depth layers.
In order to do that, the XR device provides the amount of color textures per
layer it creates. Then the swapchain will create (on demand) as
many depth textures as color textures.

The only platform implementation supporting the quad layer will
initially be OpenXR which natively supportis the quad layer
without the need of any special extensions. Special code had to be added
for the top-bottom cases to support different graphics libraries that
might treat the Y-axis direction in different ways (OpenGL vs Vulkan).

No new tests required as the API to create the quad layers is already
being tested by current tests.

* Source/WebCore/Modules/WebGPU/Implementation/WebGPUXRProjectionLayerImpl.cpp:
(WebCore::WebGPU::XRProjectionLayerImpl::allColorTexturesAreBound const):
* Source/WebCore/Modules/WebGPU/Implementation/WebGPUXRProjectionLayerImpl.h:
* Source/WebCore/Modules/webxr/WebXRSession.cpp:
(WebCore::WebXRSession::supportsFeature const):
* Source/WebCore/Modules/webxr/WebXRSession.h:
* Source/WebCore/Modules/webxr/WebXRSystem.h:
* Source/WebCore/Modules/webxr/WebXRWebGLLayer.cpp:
(WebCore::createOpaqueFramebuffer):
(WebCore::WebXRWebGLLayer::endFrame):
* Source/WebCore/Modules/webxr/WebXRWebGLSwapchain.cpp:
(WebCore::WebXRWebGLSwapchain::WebXRWebGLSwapchain):
(WebCore::WebXRWebGLSharedImageSwapchain::create):
(WebCore::WebXRWebGLSharedImageSwapchain::WebXRWebGLSharedImageSwapchain):
(WebCore::WebXRWebGLSharedImageSwapchain::currentTexture):
(WebCore::WebXRExternalImage::leakObject):
(WebCore::WebXRWebGLSharedImageSwapchain::allTexturesAreBound const):
(WebCore::WebXRWebGLStaticImageSwapchain::endFrame):
(WebCore::WebXRWebGLStaticImageSwapchain::allTexturesAreBound const):
* Source/WebCore/Modules/webxr/WebXRWebGLSwapchain.h:
* Source/WebCore/Modules/webxr/XRCompositionLayer.cpp:
(WebCore::XRCompositionLayer::XRCompositionLayer):
(WebCore::XRCompositionLayer::fillInCommonDeviceLayerData const):
* Source/WebCore/Modules/webxr/XRCompositionLayer.h:
(WebCore::XRCompositionLayer::init const):
(WebCore::XRCompositionLayer::blendTextureSourceAlpha const):
(WebCore::XRCompositionLayer::setBlendTextureSourceAlpha):
(WebCore::XRCompositionLayer::forceMonoPresentation const):
(WebCore::XRCompositionLayer::setForceMonoPresentation):
* Source/WebCore/Modules/webxr/XRLayerBacking.h:
* Source/WebCore/Modules/webxr/XRProjectionLayer.cpp:
(WebCore::XRProjectionLayer::XRProjectionLayer):
* Source/WebCore/Modules/webxr/XRProjectionLayer.h:
(WebCore::XRProjectionLayer::init const): Deleted.
* Source/WebCore/Modules/webxr/XRQuadLayer.cpp:
(WebCore::XRQuadLayer::XRQuadLayer):
(WebCore::XRQuadLayer::space const):
(WebCore::XRQuadLayer::setSpace):
(WebCore::XRQuadLayer::transform const):
(WebCore::XRQuadLayer::setTransform):
(WebCore::XRQuadLayer::startFrame):
(WebCore::XRQuadLayer::recomputePose):
(WebCore::XRQuadLayer::endFrame):
* Source/WebCore/Modules/webxr/XRQuadLayer.h:
(WebCore::XRQuadLayer::create):
(WebCore::XRQuadLayer::width const):
(WebCore::XRQuadLayer::setWidth):
(WebCore::XRQuadLayer::height const):
(WebCore::XRQuadLayer::setHeight):
(WebCore::XRQuadLayer::space const): Deleted.
(WebCore::XRQuadLayer::setSpace): Deleted.
(WebCore::XRQuadLayer::transform const): Deleted.
(WebCore::XRQuadLayer::setTransform): Deleted.
* Source/WebCore/Modules/webxr/XRWebGLBinding.cpp:
(WebCore::XRWebGLBinding::colorFormatIsSupportedForNonProjectionLayer const):
(WebCore::XRWebGLBinding::depthFormatIsSupportedForNonProjectionLayer const):
(WebCore::XRWebGLBinding::createProjectionLayer):
(WebCore::XRWebGLBinding::allocateColorTexturesForLayer):
(WebCore::XRWebGLBinding::allocateDepthTexturesForLayer):
(WebCore::checkCanSetSpace):
(WebCore::XRWebGLBinding::createQuadLayer):
(WebCore::XRWebGLBinding::validateXRWebGLSubImageCreation const):
(WebCore::XRWebGLBinding::initializeViewport):
(WebCore::XRWebGLBinding::getSubImage):
(WebCore::XRWebGLBinding::getViewSubImage):
* Source/WebCore/Modules/webxr/XRWebGLBinding.h:
(WebCore::XRWebGLBinding::createQuadLayer): Deleted.
(WebCore::XRWebGLBinding::getSubImage): Deleted.
* Source/WebCore/Modules/webxr/XRWebGLBinding.idl:
* Source/WebCore/Modules/webxr/XRWebGLLayerBacking.cpp:
(WebCore::XRWebGLLayerBacking::currentColorTexture const):
(WebCore::XRWebGLLayerBacking::currentDepthTexture const):
(WebCore::swapchainFormatsForLayerFormat):
(WebCore::XRWebGLLayerBacking::createDepthSwapchain):
(WebCore::XRWebGLLayerBacking::allColorTexturesAreBound const):
(WebCore::XRWebGLLayerBacking::swapchainFormatsForLayerFormat): Deleted.
(WebCore::XRWebGLLayerBacking::formatHasStencil): Deleted.
* Source/WebCore/Modules/webxr/XRWebGLLayerBacking.h:
(): Deleted.
* Source/WebCore/Modules/webxr/XRWebGLProjectionLayerBacking.cpp:
(WebCore::XRWebGLProjectionLayerBacking::create):
* Source/WebCore/Modules/webxr/XRWebGLQuadLayerBacking.cpp: Copied from 
Source/WebCore/Modules/webxr/XRWebGLProjectionLayerBacking.cpp.
(WebCore::XRWebGLQuadLayerBacking::create):
(WebCore::XRWebGLQuadLayerBacking::XRWebGLQuadLayerBacking):
* Source/WebCore/Modules/webxr/XRWebGLQuadLayerBacking.h: Copied from 
Source/WebCore/Modules/webxr/XRQuadLayer.cpp.
* Source/WebCore/Modules/webxr/XRWebGLSubImage.cpp:
(WebCore::XRWebGLSubImage::create):
* Source/WebCore/Modules/webxr/XRWebGLSubImage.h:
(WebCore::XRWebGLSubImage::imageIndex const):
(WebCore::XRWebGLSubImage::setImageIndex):
* Source/WebCore/Sources.txt:
* Source/WebCore/platform/xr/PlatformXR.h:
* Source/WebCore/testing/WebFakeXRDevice.cpp:
(WebCore::SimulatedXRDevice::createLayer):
(WebCore::SimulatedXRDevice::createLayerProjection):
(WebCore::SimulatedXRDevice::createQuadLayer):
* Source/WebCore/testing/WebFakeXRDevice.h:
* Source/WebKit/Scripts/webkit/messages.py:
(types_that_cannot_be_forward_declared):
(headers_for_type):
* Source/WebKit/Shared/XR/PlatformXR.serialization.in:
* Source/WebKit/Shared/XR/XRDeviceProxy.cpp:
(WebKit::XRDeviceProxy::createLayerProjection):
(WebKit::XRDeviceProxy::createQuadLayer):
* Source/WebKit/Shared/XR/XRDeviceProxy.h:
* Source/WebKit/UIProcess/XR/PlatformXRCoordinator.h:
* Source/WebKit/UIProcess/XR/PlatformXRSystem.cpp:
(WebKit::PlatformXRSystem::xrCoordinator):
(WebKit::PlatformXRSystem::createQuadLayer):
* Source/WebKit/UIProcess/XR/PlatformXRSystem.h:
* Source/WebKit/UIProcess/XR/PlatformXRSystem.messages.in:
* Source/WebKit/UIProcess/XR/openxr/OpenXRLayer.cpp:
(WebKit::OpenXRQuadLayer::create):
(WebKit::OpenXRQuadLayer::OpenXRQuadLayer):
(WebKit::OpenXRQuadLayer::startFrame):
(WebKit::OpenXRLayerProjection::endFrame): Deleted.
* Source/WebKit/UIProcess/XR/openxr/OpenXRLayer.h:
* Source/WebKit/UIProcess/XR/openxr/OpenXRSwapchain.h:
(WebKit::OpenXRSwapchain::imageCount const):
* Source/WebKit/UIProcess/XR/openxr/PlatformXROpenXR.cpp:
(WebKit::OpenXRCoordinator::createLayerProjection):
(WebKit::OpenXRCoordinator::createQuadLayer):
(WebKit::OpenXRCoordinator::endFrame):
* Source/WebKit/UIProcess/XR/openxr/PlatformXROpenXR.h:
* Source/WebKit/UIProcess/XR/openxr/PlatformXRSystemOpenXR.cpp:
(WebKit::PlatformXRSystem::createLayerProjection):
(WebKit::PlatformXRSystem::createQuadLayer):
* Source/WebKit/WebProcess/GPU/graphics/WebGPU/RemoteXRProjectionLayerProxy.h:
* Source/WebKit/WebProcess/XR/PlatformXRSystemProxy.cpp:
(WebKit::PlatformXRSystemProxy::createLayerProjection):
(WebKit::PlatformXRSystemProxy::createQuadLayer):
* Source/WebKit/WebProcess/XR/PlatformXRSystemProxy.h:

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



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

Reply via email to