Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: d158677d4a0286d4927090bbd206fc111c17f62f
https://github.com/WebKit/WebKit/commit/d158677d4a0286d4927090bbd206fc111c17f62f
Author: Sergio Villar Senin <[email protected]>
Date: 2026-05-19 (Tue, 19 May 2026)
Changed paths:
A
LayoutTests/imported/w3c/web-platform-tests/webxr/layers/xrProjectionLayer_textureType.https-expected.txt
A
LayoutTests/imported/w3c/web-platform-tests/webxr/layers/xrProjectionLayer_textureType.https.html
M Source/WebCore/Modules/webxr/WebGLOpaqueTexture.cpp
M Source/WebCore/Modules/webxr/WebGLOpaqueTexture.h
M Source/WebCore/Modules/webxr/WebXRWebGLSwapchain.cpp
M Source/WebCore/Modules/webxr/WebXRWebGLSwapchain.h
M Source/WebCore/Modules/webxr/XRWebGLBinding.cpp
M Source/WebCore/Modules/webxr/XRWebGLBinding.h
M Source/WebCore/Modules/webxr/XRWebGLCylinderLayerBacking.cpp
M Source/WebCore/Modules/webxr/XRWebGLCylinderLayerBacking.h
M Source/WebCore/Modules/webxr/XRWebGLEquirectLayerBacking.cpp
M Source/WebCore/Modules/webxr/XRWebGLEquirectLayerBacking.h
M Source/WebCore/Modules/webxr/XRWebGLLayerBacking.cpp
M Source/WebCore/Modules/webxr/XRWebGLLayerBacking.h
M Source/WebCore/Modules/webxr/XRWebGLProjectionLayerBacking.cpp
M Source/WebCore/Modules/webxr/XRWebGLProjectionLayerBacking.h
M Source/WebCore/Modules/webxr/XRWebGLQuadLayerBacking.cpp
M Source/WebCore/Modules/webxr/XRWebGLQuadLayerBacking.h
Log Message:
-----------
[WebXR Layers] Enable texture array support for projection layer
https://bugs.webkit.org/show_bug.cgi?id=314547
Reviewed by Dan Glastonbury.
The WebXR Layers API allows author to specify a XRTextureType in the
layer init parameters. By default it's a regular WebGL texture but
authors can decide to use a texture array instead. Texture arrays would
eventually be very useful in combination with the multiview extension to
improve the performance of stereo rendering.
In WPE and GTK ports the current texture sharing mechanisms
(DMABuf/GBM/AndroidHardwareBuffer) don't allow natively sharing a
texture array. That's why we were forced to create a new type of
swapchain which provides a valid texture array to JavaScript but that
blits the multiple layers of a single texture array in a larger side by
side single texture that would be used to share the rendered content
with the UI process.
We're already working on a new way to share textures between processes
using Vulkan. Vulkan natively supports sharing texture arrays since the
VkImageCreateInfor structure used to create VkImages already contain an
attribute to specify the number of array layers. In theory we could get
rid of this extra blit (and higher memory allocation) with Vulkan.
Leaving the door open to further changes that could also accomodate
other texture sharing mechanisms in other ports.
Test:
imported/w3c/web-platform-tests/webxr/layers/xrProjectionLayer_textureType.https.html
*
LayoutTests/imported/w3c/web-platform-tests/webxr/layers/xrProjectionLayer_textureType.https-expected.txt:
Added.
*
LayoutTests/imported/w3c/web-platform-tests/webxr/layers/xrProjectionLayer_textureType.https.html:
Added.
* Source/WebCore/Modules/webxr/WebGLOpaqueTexture.cpp:
(WebCore::WebGLOpaqueTexture::create):
(WebCore::WebGLOpaqueTexture::WebGLOpaqueTexture):
* Source/WebCore/Modules/webxr/WebGLOpaqueTexture.h:
* Source/WebCore/Modules/webxr/WebXRWebGLSwapchain.cpp:
(WebCore::WebXRWebGLSwapchain::clearTextureLayers):
(WebCore::WebXRWebGLSwapchain::clearCurrentTexture):
(WebCore::toIntSize):
(WebCore::calcImagePhysicalSize):
(WebCore::WebXRWebGLSwapchain::setupExternalImage):
(WebCore::WebXRWebGLSwapchain::signalEndFrame):
(WebCore::WebXRWebGLSharedImageSwapchain::bindCompositorTexturesForDisplay):
(WebCore::WebXRWebGLSharedImageSwapchain::startFrame):
(WebCore::WebXRWebGLSharedImageSwapchain::endFrame):
(WebCore::WebXRWebGLStaticImageSwapchain::bindCompositorTexturesForDisplay):
(WebCore::WebXRWebGLStaticImageSwapchain::clearCurrentTexture):
(WebCore::WebXRWebGLTextureArraySwapchain::create):
(WebCore::WebXRWebGLTextureArraySwapchain::WebXRWebGLTextureArraySwapchain):
(WebCore::WebXRWebGLTextureArraySwapchain::~WebXRWebGLTextureArraySwapchain):
(WebCore::WebXRWebGLTextureArraySwapchain::TextureSet::release):
(WebCore::WebXRWebGLTextureArraySwapchain::TextureSet::leakObject):
(WebCore::WebXRWebGLTextureArraySwapchain::currentTexture):
(WebCore::WebXRWebGLTextureArraySwapchain::releaseTexturesAtIndex):
(WebCore::WebXRWebGLTextureArraySwapchain::reusableTextures const):
(WebCore::WebXRWebGLTextureArraySwapchain::bindCompositorTexturesForDisplay):
(WebCore::WebXRWebGLTextureArraySwapchain::blitTextureArrayToSharedImage):
(WebCore::WebXRWebGLTextureArraySwapchain::clearCurrentTexture):
(WebCore::WebXRWebGLTextureArraySwapchain::startFrame):
(WebCore::WebXRWebGLTextureArraySwapchain::endFrame):
(WebCore::WebXRWebGLTextureArraySwapchain::allTexturesAreBound const):
(WebCore::WebXRWebGLSharedImageSwapchain::setupExternalImage): Deleted.
* Source/WebCore/Modules/webxr/WebXRWebGLSwapchain.h:
(WebCore::WebXRWebGLSwapchain::size const):
(WebCore::WebXRWebGLSwapchain::textureTarget const):
* Source/WebCore/Modules/webxr/XRWebGLBinding.cpp:
(WebCore::XRWebGLBinding::createProjectionLayer):
(WebCore::XRWebGLBinding::validateCompositionLayerInitParameters const):
(WebCore::XRWebGLBinding::rectForView const):
(WebCore::XRWebGLBinding::allocateColorTexturesForProjectionLayer):
(WebCore::XRWebGLBinding::allocateDepthTexturesForProjectionLayer):
(WebCore::XRWebGLBinding::getViewSubImage):
* Source/WebCore/Modules/webxr/XRWebGLBinding.h:
* Source/WebCore/Modules/webxr/XRWebGLCylinderLayerBacking.cpp:
(WebCore::XRWebGLCylinderLayerBacking::create):
(WebCore::XRWebGLCylinderLayerBacking::XRWebGLCylinderLayerBacking):
* Source/WebCore/Modules/webxr/XRWebGLCylinderLayerBacking.h:
* Source/WebCore/Modules/webxr/XRWebGLEquirectLayerBacking.cpp:
(WebCore::XRWebGLEquirectLayerBacking::create):
(WebCore::XRWebGLEquirectLayerBacking::XRWebGLEquirectLayerBacking):
* Source/WebCore/Modules/webxr/XRWebGLEquirectLayerBacking.h:
* Source/WebCore/Modules/webxr/XRWebGLLayerBacking.cpp:
(WebCore::XRWebGLLayerBacking::XRWebGLLayerBacking):
(WebCore::XRWebGLLayerBacking::colorTextureArrayLength const):
(WebCore::XRWebGLLayerBacking::currentColorTexture const):
(WebCore::XRWebGLLayerBacking::currentDepthTexture const):
(WebCore::computeArrayLength):
(WebCore::XRWebGLLayerBacking::createCompositionLayerSwapchains):
(WebCore::XRWebGLLayerBacking::createProjectionLayerSwapchains):
(WebCore::XRWebGLLayerBacking::createColorAndDepthSwapchains):
(WebCore::swapchainFormatsForLayerFormat):
(WebCore::XRWebGLLayerBacking::createDepthSwapchain):
(): Deleted.
* Source/WebCore/Modules/webxr/XRWebGLLayerBacking.h:
* Source/WebCore/Modules/webxr/XRWebGLProjectionLayerBacking.cpp:
(WebCore::XRWebGLProjectionLayerBacking::create):
(WebCore::XRWebGLProjectionLayerBacking::XRWebGLProjectionLayerBacking):
* Source/WebCore/Modules/webxr/XRWebGLProjectionLayerBacking.h:
* Source/WebCore/Modules/webxr/XRWebGLQuadLayerBacking.cpp:
(WebCore::XRWebGLQuadLayerBacking::create):
(WebCore::XRWebGLQuadLayerBacking::XRWebGLQuadLayerBacking):
* Source/WebCore/Modules/webxr/XRWebGLQuadLayerBacking.h:
Canonical link: https://commits.webkit.org/313477@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications