← All issues

WebXR Quad layer support for OpenXR

a4de8c8

Source/WebCore/Modules/webxr/WebXRWebGLSwapchain.cpp

+bool WebXRWebGLSharedImageSwapchain::allTexturesAreBound() const
+{
+ return m_displayImagesSets.size() == m_imageCount && std::all_of(m_displayImagesSets.begin(), m_displayImagesSets.end(), [](const auto& imageSet) {
+ return imageSet && imageSet.colorBuffer.tex;
+ });
+}

Source/WebCore/Modules/webxr/XRCompositionLayer.h

- bool blendTextureSourceAlpha() const { return false; }
- void setBlendTextureSourceAlpha(bool) { }
- bool forceMonoPresentation() const { return false; }
- void setForceMonoPresentation(bool) { }
+ bool blendTextureSourceAlpha() const { return m_blendTextureSourceAlpha; }
+ void setBlendTextureSourceAlpha(bool blendTextureSourceAlpha) { m_blendTextureSourceAlpha = blendTextureSourceAlpha; }
+ bool forceMonoPresentation() const { return m_forceMonoPresentation; }
+ void setForceMonoPresentation(bool forceMonoPresentation) { m_forceMonoPresentation = forceMonoPresentation; }

WebXR Layers allows web authors to create GPU-composited XR layers submitted directly to the XR compositor rather than going through the WebGL framebuffer. Each layer has a "backing" object that owns GPU textures via a swapchain — a ring buffer of GPU images. In WebKit's multi-process architecture, the XR device lives in the UIProcess for security isolation, while WebGL rendering happens in the WebProcess; layer creation requires an IPC round-trip that allocates GPU resources in UIProcess and returns a LayerInfo handle to WebProcess.

This commit implements WebXR Quad layer support for OpenXR, covering mono, top-bottom, and left-right stereo layouts. It adds XRWebGLQuadLayerBacking, wires up the full UIProcess-WebProcess IPC path for quad layer creation, and fixes depth swapchain buffering so depth textures are allocated 1:1 with color textures instead of sharing a single one across all frames.

The depth buffer fix silently changes allocation semantics: createDepthSwapchain() now uses m_imageCount sourced from the UIProcess-supplied LayerInfo::imageCount, meaning a new IPC-sourced integer drives GPU resource allocation in the WebProcess.

🔒

New IPC-driven allocation paths and stereo/mono presentation switching surface several audit-worthy edge cases.

Subscribe to read more