Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: d92d5a69f22d9b42cda91e6ae19674765616fee9
https://github.com/WebKit/WebKit/commit/d92d5a69f22d9b42cda91e6ae19674765616fee9
Author: Sergio Villar Senin <[email protected]>
Date: 2026-06-29 (Mon, 29 Jun 2026)
Changed paths:
M Source/WebKit/SourcesGTK.txt
M Source/WebKit/SourcesWPE.txt
A Source/WebKit/UIProcess/XR/openxr/OpenXRGraphicsBinding.h
A Source/WebKit/UIProcess/XR/openxr/OpenXRGraphicsBindingOpenGLES.cpp
A Source/WebKit/UIProcess/XR/openxr/OpenXRGraphicsBindingOpenGLES.h
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/OpenXRSwapchain.h
M Source/WebKit/UIProcess/XR/openxr/PlatformXROpenXR.cpp
M Source/WebKit/UIProcess/XR/openxr/PlatformXROpenXR.h
Log Message:
-----------
[OpenXR] Remove the dependency with OpenGLES
https://bugs.webkit.org/show_bug.cgi?id=317729
Reviewed by Dan Glastonbury.
The OpenXR backend was hardwired to OpenGLES/EGL: EGL display/context
creation, the XrGraphicsBinding struct, the graphics requirements check, the
required instance extensions and the render fence wait were all spread across
OpenXRCoordinator. OpenXR itself is graphics library agnostic so we
should try to keep that independence to eventually support other
graphics libraries (e.g. Vulkan) for WebXR.
Added an abstract OpenXRGraphicsBinding with a single concrete implementation,
OpenXRGraphicsBindingOpenGLES, that reproduces the current behavior. The
lifecycle is split into three phases so that it can also fit APIs whose device
creation requires the OpenXR instance/system (unlike EGL):
- requiredInstanceExtensions(): before xrCreateInstance (main thread).
- initializeDisplay(): creates the platform display (main thread).
- initializeForSession(): creates the context/device and fill the
XrGraphicsBinding
once the instance and system are known (render thread).
The OpenXRCoordinator now holds a unique_ptr<OpenXRGraphicsBinding> in place
of the GLDisplay/GLContext/GBMDevice/XrGraphicsBinding members, delegating the
instance extension list, display/context setup, session graphics binding, the
endFrame fence wait and the two-phase teardown to it. No behavior change.
Swapchains logic is also moved to the new OpenXRGraphicsBinding, in particular:
- the preferred color format selection that used to be hardcoded in
createSwapchain()
- enumerateSwapchainImages()
OpenXRSwapchain no longer depends on the OpenGLES image struct, it now stores
the
opaque uint64_t handles returned by the binding and delegates enumeration to it
at creation time.
The last step was to move the texture sharing code also to the new
graphics binding object:
- exportTexture(): the GL texture -> EGLImage -> DMABuf/AHardwareBuffer export
(includes Android, DMABuf and GBM paths).
- needsBlit()/blit(): used in those cases in which the texture sharing
mechanism uses its own resources (like Android and GBM paths).
- other specific paths (like setDevice in GBM code path) were also
moved.
We're using this change to merge needsBlit() with blitTexture() in a new
blitTextureIfNeeded() because they were exclusively used in pairs, there
were not other usages of needsBlit().
This is mostly about moving code, so there shouldn't be any behavioral
change and the original code should be nearly identical to the one in
the new abstract class (modulo trivial refactorings like the needsBlit).
* Source/WebKit/SourcesGTK.txt:
* Source/WebKit/SourcesWPE.txt:
* Source/WebKit/UIProcess/XR/openxr/OpenXRGraphicsBinding.h: Added.
* Source/WebKit/UIProcess/XR/openxr/OpenXRGraphicsBindingOpenGLES.cpp: Added.
(WebKit::OpenXRGraphicsBindingOpenGLES::create):
(WebKit::OpenXRGraphicsBindingOpenGLES::~OpenXRGraphicsBindingOpenGLES):
(WebKit::OpenXRGraphicsBindingOpenGLES::requiredInstanceExtensions const):
(WebKit::OpenXRGraphicsBindingOpenGLES::initializeDisplay):
(WebKit::OpenXRGraphicsBindingOpenGLES::initializeForSession):
(WebKit::OpenXRGraphicsBindingOpenGLES::sessionGraphicsBinding const):
(WebKit::OpenXRGraphicsBindingOpenGLES::selectColorFormat const):
(WebKit::OpenXRGraphicsBindingOpenGLES::enumerateSwapchainImages const):
(WebKit::OpenXRGraphicsBindingOpenGLES::waitFrameFence):
(WebKit::OpenXRGraphicsBindingOpenGLES::releaseSessionGraphics):
(WebKit::OpenXRGraphicsBindingOpenGLES::exportOpenXRTextureAndroid):
(WebKit::OpenXRGraphicsBindingOpenGLES::exportOpenXRTextureDMABuf):
(WebKit::OpenXRGraphicsBindingOpenGLES::exportOpenXRTextureGBM):
(WebKit::OpenXRGraphicsBindingOpenGLES::exportTexture):
(WebKit::OpenXRGraphicsBindingOpenGLES::commitFrame):
(WebKit::OpenXRGraphicsBindingOpenGLES::exportTexture2D):
(WebKit::OpenXRGraphicsBindingOpenGLES::blitTextureIfNeeded):
(WebKit::OpenXRGraphicsBindingOpenGLES::exportCubeBuffer):
(WebKit::OpenXRGraphicsBindingOpenGLES::reconstructCubeFaces):
* Source/WebKit/UIProcess/XR/openxr/OpenXRGraphicsBindingOpenGLES.h: Added.
* Source/WebKit/UIProcess/XR/openxr/OpenXRLayer.cpp:
(WebKit::OpenXRLayerProjection::startFrame):
(WebKit::OpenXRQuadLayer::startFrame):
(WebKit::OpenXREquirectLayer::startFrame):
(WebKit::OpenXRCylinderLayer::startFrame):
(WebKit::OpenXRCubeLayer::startFrame):
(WebKit::OpenXRLayer::~OpenXRLayer): Deleted.
(WebKit::OpenXRLayer::exportOpenXRTextureAndroid): Deleted.
(WebKit::OpenXRLayer::exportOpenXRTextureDMABuf): Deleted.
(WebKit::OpenXRLayer::setGBMDevice): Deleted.
(WebKit::OpenXRLayer::exportOpenXRTextureGBM): Deleted.
(WebKit::OpenXRLayer::blitTexture const): Deleted.
(WebKit::OpenXRLayer::exportOpenXRTexture): Deleted.
(WebKit::OpenXRCubeLayer::~OpenXRCubeLayer): Deleted.
(WebKit::OpenXRCubeLayer::reconstructCubeFaces): Deleted.
* Source/WebKit/UIProcess/XR/openxr/OpenXRLayer.h:
(WebKit::OpenXRLayer::needsBlitTexture const): Deleted.
* Source/WebKit/UIProcess/XR/openxr/OpenXRSwapchain.cpp:
(WebKit::OpenXRSwapchain::create):
(WebKit::OpenXRSwapchain::OpenXRSwapchain):
(WebKit::OpenXRSwapchain::acquireImage):
* Source/WebKit/UIProcess/XR/openxr/OpenXRSwapchain.h:
(WebKit::OpenXRSwapchain::acquiredTexture const):
(WebKit::OpenXRSwapchain::imageCount const):
* Source/WebKit/UIProcess/XR/openxr/PlatformXROpenXR.cpp:
(WebKit::OpenXRCoordinator::createSwapchain const):
(WebKit::OpenXRCoordinator::createLayerProjection):
(WebKit::OpenXRCoordinator::createCompositionLayer):
(WebKit::OpenXRCoordinator::createInstance):
(WebKit::OpenXRCoordinator::initializeDevice):
(WebKit::OpenXRCoordinator::createSessionIfNeeded):
(WebKit::OpenXRCoordinator::cleanupSessionAndAssociatedResources):
(WebKit::OpenXRCoordinator::cleanupInstanceAndAssociatedResources):
(WebKit::OpenXRCoordinator::populateFrameData):
(WebKit::OpenXRCoordinator::endFrame):
(WebKit::OpenXRCoordinator::createGLDisplay const): Deleted.
(WebKit::OpenXRCoordinator::tryInitializeGraphicsBinding): Deleted.
* Source/WebKit/UIProcess/XR/openxr/PlatformXROpenXR.h:
Canonical link: https://commits.webkit.org/316023@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications