Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: b9704aaeaa380b95d093e0e362ba8464236a6df4
https://github.com/WebKit/WebKit/commit/b9704aaeaa380b95d093e0e362ba8464236a6df4
Author: Sergio Villar Senin <[email protected]>
Date: 2026-05-25 (Mon, 25 May 2026)
Changed paths:
M Source/WebCore/Modules/webxr/XRCylinderLayer.cpp
M Source/WebCore/Modules/webxr/XREquirectLayer.cpp
M Source/WebCore/Modules/webxr/XRQuadLayer.cpp
Log Message:
-----------
[WebXR Layers] Incorrect rendering of layers in
https://flagged.apple.com:443/proxy?t2=DU6m0D7uB6&o=aHR0cHM6Ly90aHJlZWpzLm9yZy9leGFtcGxlcy8/cT1sYXllcnMlMjBuI3dlYmdwdV94cl9uYXRpdmVfbGF5ZXJz&emid=9227c0d1-848c-4f56-805e-68c2a759e98b&c=11
https://bugs.webkit.org/show_bug.cgi?id=314634
Reviewed by Dan Glastonbury.
XRQuadLayer, XRCylinderLayer and XREquirectLayer were submitting their
poses to the device with an inverted offset along the Y axis when the
layer was
anchored to a reference space whose nativeOrigin is not the
identity (most notably 'local-floor', which is the three.js default).
The reference space's
nativeOrigin() returns the transform that maps
from the space's local coordinates into the session's local space, i.e.
spaceTransform * pointInSpace = pointInLocalSpace. To express a layer's
transform in local space we should do:
layerInLocalSpace = spaceTransform * layerInSpace
recomputePose() was instead doing:
layerInLocalSpace = inverse(spaceTransform) * layerInSpace
In the threejs specific example the 'local-floor' space had the floor at
Y = -HEIGHT in local space. This flipped the sign of the floor offset and
pushed any layer placed at Y = 0 in local-floor up to Y = +HEIGHT in local
space (above the user's head) instead of the intended Y = -HEIGHT (the
floor). That's why non-projection layers ended up roughly at the room
ceiling and were invisible in the user's natural forward
gaze.
XRProjectionLayer was unaffected because it does not go through this
code path. Its per-view poses are obtained from xrLocateViews() and
submitted directly.
No new
tests as the bug lives in the conversion from m_transform
(reference-space coords) to m_poseInLocalSpace (the value passed to
Device::submitFrame), and the result is never exposed to JavaScript.
* Source/WebCore/Modules/webxr/XRCylinderLayer.cpp:
(WebCore::XRCylinderLayer::recomputePose):
* Source/WebCore/Modules/webxr/XREquirectLayer.cpp:
(WebCore::XREquirectLayer::recomputePose):
* Source/WebCore/Modules/webxr/XRQuadLayer.cpp:
(WebCore::XRQuadLayer::recomputePose):
Canonical link:
https://flagged.apple.com:443/proxy?t2=DI4l7r0gu9&o=aHR0cHM6Ly9jb21taXRzLndlYmtpdC5vcmcvMzEzODQzQG1haW4=&emid=9227c0d1-848c-4f56-805e-68c2a759e98b&c=11
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications