[webkit-changes] [WebKit/WebKit] 88d7c4: [WebXR] Correct WebGL content over camera feed
Dan Glastonbury
noreply at github.com
Thu Nov 16 14:59:39 PST 2023
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 88d7c41f6d42a67e5236ea7f8c358c1934ee8ee3
https://github.com/WebKit/WebKit/commit/88d7c41f6d42a67e5236ea7f8c358c1934ee8ee3
Author: Dan Glastonbury <djg at apple.com>
Date: 2023-11-16 (Thu, 16 Nov 2023)
Changed paths:
M Source/WebCore/platform/xr/cocoa/PlatformXRPose.cpp
M Source/WebCore/platform/xr/cocoa/PlatformXRPose.h
M Source/WebKit/UIProcess/XR/ios/PlatformXRARKit.mm
M Source/WebKit/UIProcess/XR/ios/WKARPresentationSession.h
M Source/WebKit/UIProcess/XR/ios/WKARPresentationSession.mm
Log Message:
-----------
[WebXR] Correct WebGL content over camera feed
https://bugs.webkit.org/show_bug.cgi?id=264925
rdar://118494318
Reviewed by Dean Jackson.
Bug 262774 introduced rendering for WebGL content over ARKit provided camera
feed using a CAMetalLayer hosted swap chain. It was intended that the
MTLSharedEvent active.completionEvent would be used to pace the frames and delay
the present until the frame has been rendered in the GPUP. This didn't work and
would lead to Metal preventing from processing our content for misbehaving.
This patch removes blocking on completionEvent and replaces it with blocking on
a semaphore. This is the same approach present in the visionOS WebXR
system. While this means that we could be racing the rendering, resulting in
glitches, we no long lock up.
In addition, set frame views and origin correctly to make the device behave as
an "interactive camera" in the WebXR scene.
* Source/WebCore/platform/xr/cocoa/PlatformXRPose.cpp:
(PlatformXRPose::toColumnMajorFloatArray const):
* Source/WebCore/platform/xr/cocoa/PlatformXRPose.h:
helper toColumnMajorFloatArray() converts simd_float4x4 into a flat float[16]
for serialization.
* Source/WebKit/UIProcess/XR/ios/PlatformXRARKit.mm:
(WebKit::ARKitCoordinator::scheduleAnimationFrame):
(WebKit::ARKitCoordinator::submitFrame):
(WebKit::ARKitCoordinator::renderLoop):
* Source/WebKit/UIProcess/XR/ios/WKARPresentationSession.h:
* Source/WebKit/UIProcess/XR/ios/WKARPresentationSession.mm:
(-[_WKARPresentationSession currentFrame]):
(-[_WKARPresentationSession startFrame]):
(-[_WKARPresentationSession viewDidLoad]):
Vertically flip the CAMetalLayer so the WebGL is displayed the correct way up.
(-[_WKARPresentationSession present]):
(-[_WKARPresentationSession _loadMetal]):
Remote Metal command queue and command buffer.
Canonical link: https://commits.webkit.org/270848@main
More information about the webkit-changes
mailing list