Bug 230370 - Add an experimental SceneKit mode to explore <model> and separated layers
Summary: Add an experimental SceneKit mode to explore <model> and separated layers
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Tim Horton
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2021-09-16 12:52 PDT by Tim Horton
Modified: 2021-09-23 12:53 PDT (History)
9 users (show)

See Also:


Attachments
Patch (203.47 KB, patch)
2021-09-16 12:52 PDT, Tim Horton
ews-feeder: commit-queue-
Details | Formatted Diff | Diff
Patch (203.46 KB, patch)
2021-09-16 13:04 PDT, Tim Horton
ews-feeder: commit-queue-
Details | Formatted Diff | Diff
Patch (203.46 KB, patch)
2021-09-16 14:02 PDT, Tim Horton
thorton: review?
ews-feeder: commit-queue-
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Tim Horton 2021-09-16 12:52:13 PDT
Add an experimental SceneKit mode to explore <model> and separated layers
Comment 1 Tim Horton 2021-09-16 12:52:36 PDT
Created attachment 438389 [details]
Patch
Comment 2 Tim Horton 2021-09-16 13:04:30 PDT
Created attachment 438390 [details]
Patch
Comment 3 Tim Horton 2021-09-16 14:02:38 PDT
Created attachment 438399 [details]
Patch
Comment 4 Simon Fraser (smfr) 2021-09-16 14:16:41 PDT
Comment on attachment 438390 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=438390&action=review

> Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm:3640
> +    _page->preferences().setCSSTransformStyleOptimized3DEnabled(true);
> +    _page->preferences().setModelElementEnabled(true);

A bit weird that setting a SceneKit node has side effects.

> Source/WebKit/UIProcess/API/Cocoa/WKWebViewInternal.h:216
> +    RetainPtr<SCNNode> _sceneKitNode;

_sceneKitRootNode?

> Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivate.h:416
> +// Assign a node that has this view as a material.
> +@property (nonatomic, retain, setter=_setSceneKitNode:) SCNNode *_sceneKitNode;

So does the caller have to set this view as a material or does that happen automatically?

> Source/WebKit/UIProcess/RemoteLayerTree/cocoa/SceneKitHost.h:50
> +    static constexpr uint64_t portalContentsCategory = 2;
> +    static constexpr uint64_t portalMaskCategory = 4;

Magic

> Source/WebKit/UIProcess/RemoteLayerTree/cocoa/SceneKitHost.mm:80
> +SCNNode *SceneKitHost::ensureNodeForLayer(CALayer *layer)

Could this return a RetainPtr<SCNNode> so I don't have to think too hard about ownership?

> Source/WebKit/UIProcess/RemoteLayerTree/cocoa/SceneKitHost.mm:94
> +void SceneKitHost::setCustomChildNodeForLayer(CALayer *layer, SCNNode *node)

Take a RetainPtr<SCNNode>&&?

> Source/WebKit/UIProcess/RemoteLayerTree/cocoa/SceneKitHost.mm:99
> +static SCNNode *customNodeForLayer(CALayer *layer)

Return a RetainPtr<SCNNode>?

> Source/WebKit/UIProcess/RemoteLayerTree/cocoa/SceneKitHost.mm:104
> +static SCNNode *ensurePortalNodeForLayer(CALayer *layer)

Return a RetainPtr<SCNNode>?

> Source/WebKit/UIProcess/RemoteLayerTree/cocoa/SceneKitHost.mm:117
> +void SceneKitHost::updateLayer(CALayer *layer, bool isInPortalSubtree, bool& isPortal)

This looks like it's updating the node for the layer, not updating the layer?

> Source/WebKit/UIProcess/RemoteLayerTree/cocoa/SceneKitHost.mm:130
> +    node.transform = SCNMatrix4Translate(toSCN(layer.transform), position.x - (parentSize.width / 2), -position.y + (parentSize.height / 2), layer.zPosition + zEpsilon);
> +    node.pivot = SCNMatrix4MakeTranslation(-(0.5 - layer.anchorPoint.x) * size.width, (0.5 - layer.anchorPoint.y) * size.height, -layer.anchorPointZ);

I guess at some point we'll have to map animation of transform and transform origin to node animations? How does that work?

> Tools/3DMiniBrowser/3DMiniBrowser/sample.html:39
> +        document.getElementById("flap").style.transform = `translateZ(10px) rotateX(${ 15 * (Math.sin(ts / 300) + 1) }deg)`;

CSS animations??
Comment 5 Radar WebKit Bug Importer 2021-09-23 12:53:23 PDT
<rdar://problem/83461384>