[webkit-changes] [WebKit/WebKit] 637134: [WebXR] Display ARKit captured image in overlay view
Dan Glastonbury
noreply at github.com
Sun Oct 8 19:23:06 PDT 2023
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 6371344eac3bee4950ffe9516e098a6aa0f4dc03
https://github.com/WebKit/WebKit/commit/6371344eac3bee4950ffe9516e098a6aa0f4dc03
Author: Dan Glastonbury <djg at apple.com>
Date: 2023-10-08 (Sun, 08 Oct 2023)
Changed paths:
M Source/WebKit/SourcesCocoa.txt
M Source/WebKit/UIProcess/XR/ios/PlatformXRARKit.h
M Source/WebKit/UIProcess/XR/ios/PlatformXRARKit.mm
A Source/WebKit/UIProcess/XR/ios/WKARPresentationSession.h
A Source/WebKit/UIProcess/XR/ios/WKARPresentationSession.mm
M Source/WebKit/WebKit.xcodeproj/project.pbxproj
Log Message:
-----------
[WebXR] Display ARKit captured image in overlay view
https://bugs.webkit.org/show_bug.cgi?id=262773
rdar://116502294
Reviewed by Dean Jackson.
Unlike other WebXR compositor systems, ARKit doesn't provide a framework for
rendering immersive AR content, just a series of captured camera images with
camera transformation, so we need to implement our own compositor.
This patch introduces WKARPresentationSession that is responsible for managing a
view and compositing the captured camera images with WebGL rendering. On
entering an immersive AR session, WKARPresentationSession creates a new
UIViewController and makes it the presenting view controller for UIKit. The
camera images, which are provided in CVPixelBuffers, are displayed by setting
them as the CALayer content of a UIView. In a following patch, the WebGL content
will be composited on top of the camera image.
Update of the captured camera image is driven off the main thread using the
setting of the animation frame callback from the page to trigger the update.
It is intended that the view should be fullscreen but currently it is rendered
as a small view to allow exiting an immersive AR session by touching outside the
view to dismiss it.
* Source/WebKit/SourcesCocoa.txt:
* Source/WebKit/UIProcess/XR/ios/PlatformXRARKit.h:
* Source/WebKit/UIProcess/XR/ios/PlatformXRARKit.mm:
(WebKit::ARKitCoordinator::startSession):
(WebKit::ARKitCoordinator::endSessionIfExists):
(WebKit::ARKitCoordinator::scheduleAnimationFrame):
(WebKit::ARKitCoordinator::createSessionIfNeeded):
(WebKit::ARKitCoordinator::renderLoop):
* Source/WebKit/UIProcess/XR/ios/WKARPresentationSession.h: Added.
* Source/WebKit/UIProcess/XR/ios/WKARPresentationSession.mm: Added.
(-[WKARPresentationSessionDescriptor copyWithZone:]):
(-[WKARPresentationSessionDescriptor presentingViewController]):
(-[WKARPresentationSessionDescriptor setPresentingViewController:]):
(-[ARSession presentationSessionWithDescriptor:]):
(-[_WKARPresentationSession initWithSession:descriptor:]):
(-[_WKARPresentationSession session]):
(-[_WKARPresentationSession startFrame]):
(-[_WKARPresentationSession present]):
(-[_WKARPresentationSession terminate]):
(-[_WKARPresentationSession loadView]):
(-[_WKARPresentationSession viewDidLoad]):
(-[_WKARPresentationSession preferStatusBarHidden]):
(-[_WKARPresentationSession viewWillAppear:]):
(-[_WKARPresentationSession viewWillDisappear:]):
(-[_WKARPresentationSession _enterFullscreen]):
* Source/WebKit/WebKit.xcodeproj/project.pbxproj:
Canonical link: https://commits.webkit.org/269064@main
More information about the webkit-changes
mailing list