WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
238968
[WebXR] Implement the WebXRFrame methods for getting joints' poses and radii
https://bugs.webkit.org/show_bug.cgi?id=238968
Summary
[WebXR] Implement the WebXRFrame methods for getting joints' poses and radii
Ada Chan
Reported
2022-04-07 16:12:56 PDT
[WebXR] Implement the WebXR Hand Input module
Attachments
Patch
(79.72 KB, patch)
2022-04-07 17:46 PDT
,
Ada Chan
dino
: review+
Details
Formatted Diff
Diff
Patch for landing
(79.72 KB, patch)
2022-04-08 14:31 PDT
,
Ada Chan
ews-feeder
: commit-queue-
Details
Formatted Diff
Diff
Patch for landing 2
(80.41 KB, patch)
2022-04-08 19:03 PDT
,
Ada Chan
ews-feeder
: commit-queue-
Details
Formatted Diff
Diff
Patch for landing 3
(80.64 KB, patch)
2022-04-09 23:38 PDT
,
Ada Chan
ews-feeder
: commit-queue-
Details
Formatted Diff
Diff
Patch for landing 4
(80.63 KB, patch)
2022-04-11 17:13 PDT
,
Ada Chan
no flags
Details
Formatted Diff
Diff
Patch for landing 5
(80.73 KB, patch)
2022-04-12 10:50 PDT
,
Ada Chan
no flags
Details
Formatted Diff
Diff
Show Obsolete
(3)
View All
Add attachment
proposed patch, testcase, etc.
Ada Chan
Comment 1
2022-04-07 17:46:53 PDT
Created
attachment 456998
[details]
Patch
Ada Chan
Comment 2
2022-04-08 14:31:40 PDT
Created
attachment 457119
[details]
Patch for landing
Ada Chan
Comment 3
2022-04-08 19:03:32 PDT
Created
attachment 457134
[details]
Patch for landing 2
Chris Dumez
Comment 4
2022-04-08 19:47:24 PDT
Comment on
attachment 457134
[details]
Patch for landing 2 View in context:
https://bugs.webkit.org/attachment.cgi?id=457134&action=review
Nothing critical that would prevent committing as is but here is some feedback.
> Source/WebCore/Modules/webxr/WebXRFrame.cpp:282 > +ExceptionOr<bool> WebXRFrame::fillJointRadii(const Vector<RefPtr<WebXRJointSpace>> jointSpaces, Float32Array& radii)
Why is the second array passed as non-const reference?
> Source/WebCore/Modules/webxr/WebXRHand.cpp:52 > + m_joints.append(WebXRJointSpace::create(*document, *this, static_cast<XRHandJoint>(i)));
It seems the size of m_joint is static. Ideally, it would be a FixedVector instead of a Vector.
> Source/WebCore/Modules/webxr/WebXRHand.cpp:95 > + const PlatformXR::Device::FrameData::HandJointsVector& handJoints = *(inputSource.handJoints);
that's a long type, I would use auto&
> Source/WebCore/Modules/webxr/WebXRHand.h:50 > + unsigned size() { return m_joints.size(); }
should be const.
> Source/WebCore/Modules/webxr/WebXRJointSpace.cpp:45 > +WebXRJointSpace::WebXRJointSpace(Document& document, WebXRHand& hand, XRHandJoint jointName, const std::optional<PlatformXR::Device::FrameData::InputSourceHandJoint>& joint)
std::optional<PlatformXR::Device::FrameData::InputSourceHandJoint>&&
> Source/WebCore/Modules/webxr/WebXRJointSpace.cpp:50 > + updateFromJoint(joint);
m_joint(WTFMove(joint)) in the initializer list?
> Source/WebCore/Modules/webxr/WebXRJointSpace.h:45 > class WebXRJointSpace : public RefCounted<WebXRJointSpace>, public WebXRSpace {
This class can probably be marked as final.
> Source/WebCore/platform/xr/PlatformXR.h:326 > + typedef Vector<std::optional<InputSourceHandJoint>> HandJointsVector;
We prefer the modern: using HandJointsVector = Vector<std::optional<InputSourceHandJoint>>;
> Source/WebCore/platform/xr/PlatformXR.h:651 > + if (!decoder.decode(handJoint.pose))
This is the old style of decoding, modern code should use: std::optional<InputSourcePose> pose; decoder >> pose; if (!pose) return std::nullopt; std::optional<float> radius; decoder >> radius; if (!radius) return std::nullopt; return { { WTFMove(*pose), *radius } };
> Source/WebCore/testing/WebFakeXRInputController.h:91 > + std::optional<PlatformXR::Device::FrameData::HandJointsVector> m_handJoints;
So we will need to distinguish the vector not being initialized vs the vector being empty and that's why it is optional? I might have missed it but the patch doesn't seem to rely on that.
Ada Chan
Comment 5
2022-04-09 23:31:12 PDT
(In reply to Chris Dumez from
comment #4
) Thanks Chris! I really appreciate your detailed review and feedback.
> Comment on
attachment 457134
[details]
> Patch for landing 2 > > View in context: >
https://bugs.webkit.org/attachment.cgi?id=457134&action=review
> > Nothing critical that would prevent committing as is but here is some > feedback. > > > Source/WebCore/Modules/webxr/WebXRFrame.cpp:282 > > +ExceptionOr<bool> WebXRFrame::fillJointRadii(const Vector<RefPtr<WebXRJointSpace>> jointSpaces, Float32Array& radii) > > Why is the second array passed as non-const reference?
In this method, we'll be filling in that radii array so it can't be a const reference.
> > > Source/WebCore/Modules/webxr/WebXRHand.cpp:52 > > + m_joints.append(WebXRJointSpace::create(*document, *this, static_cast<XRHandJoint>(i))); > > It seems the size of m_joint is static. Ideally, it would be a FixedVector > instead of a Vector.
Fixed!
> > > Source/WebCore/Modules/webxr/WebXRHand.cpp:95 > > + const PlatformXR::Device::FrameData::HandJointsVector& handJoints = *(inputSource.handJoints); > > that's a long type, I would use auto&
Fixed!
> > > Source/WebCore/Modules/webxr/WebXRHand.h:50 > > + unsigned size() { return m_joints.size(); } > > should be const.
Fixed!
> > > Source/WebCore/Modules/webxr/WebXRJointSpace.cpp:45 > > +WebXRJointSpace::WebXRJointSpace(Document& document, WebXRHand& hand, XRHandJoint jointName, const std::optional<PlatformXR::Device::FrameData::InputSourceHandJoint>& joint) > > std::optional<PlatformXR::Device::FrameData::InputSourceHandJoint>&& > > > Source/WebCore/Modules/webxr/WebXRJointSpace.cpp:50 > > + updateFromJoint(joint); > > m_joint(WTFMove(joint)) in the initializer list?
Fixed!
> > > Source/WebCore/Modules/webxr/WebXRJointSpace.h:45 > > class WebXRJointSpace : public RefCounted<WebXRJointSpace>, public WebXRSpace { > > This class can probably be marked as final.
Fixed!
> > > Source/WebCore/platform/xr/PlatformXR.h:326 > > + typedef Vector<std::optional<InputSourceHandJoint>> HandJointsVector; > > We prefer the modern: > using HandJointsVector = Vector<std::optional<InputSourceHandJoint>>;
Fixed!
> > > Source/WebCore/platform/xr/PlatformXR.h:651 > > + if (!decoder.decode(handJoint.pose)) > > This is the old style of decoding, modern code should use: > std::optional<InputSourcePose> pose; > decoder >> pose; > if (!pose) > return std::nullopt; > std::optional<float> radius; > decoder >> radius; > if (!radius) > return std::nullopt; > return { { WTFMove(*pose), *radius } };
Fixed!
> > > Source/WebCore/testing/WebFakeXRInputController.h:91 > > + std::optional<PlatformXR::Device::FrameData::HandJointsVector> m_handJoints; > > So we will need to distinguish the vector not being initialized vs the > vector being empty and that's why it is optional? > I might have missed it but the patch doesn't seem to rely on that.
I made it optional to be consistent with how PlatformXR::Device::InputSource's handJoints is also optional. By making it optional, I feel it matches better the semantics that specifying joints is optional. If there's a compelling reason that omitting the optional is better, please let me know!
Ada Chan
Comment 6
2022-04-09 23:38:05 PDT
Created
attachment 457192
[details]
Patch for landing 3
EWS
Comment 7
2022-04-11 16:41:30 PDT
ChangeLog entry in LayoutTests/ChangeLog contains OOPS!.
Ada Chan
Comment 8
2022-04-11 17:13:47 PDT
Created
attachment 457301
[details]
Patch for landing 4
Chris Dumez
Comment 9
2022-04-12 10:23:02 PDT
Comment on
attachment 457301
[details]
Patch for landing 4 View in context:
https://bugs.webkit.org/attachment.cgi?id=457301&action=review
> Source/WebCore/Modules/webxr/WebXRHand.cpp:55 > + joints.append(WebXRJointSpace::create(*document, *this, static_cast<XRHandJoint>(i)));
FYI, you can use uncheckedAppend() here since you called reserveInitialCapacity earlier.
Ada Chan
Comment 10
2022-04-12 10:46:34 PDT
(In reply to Chris Dumez from
comment #9
)
> Comment on
attachment 457301
[details]
> Patch for landing 4 > > View in context: >
https://bugs.webkit.org/attachment.cgi?id=457301&action=review
> > > Source/WebCore/Modules/webxr/WebXRHand.cpp:55 > > + joints.append(WebXRJointSpace::create(*document, *this, static_cast<XRHandJoint>(i))); > > FYI, you can use uncheckedAppend() here since you called > reserveInitialCapacity earlier.
OK, will fix!
Ada Chan
Comment 11
2022-04-12 10:50:57 PDT
Created
attachment 457345
[details]
Patch for landing 5
EWS
Comment 12
2022-04-12 11:53:41 PDT
Committed
r292780
(
249564@main
): <
https://commits.webkit.org/249564@main
> All reviewed patches have been landed. Closing bug and clearing flags on
attachment 457345
[details]
.
Radar WebKit Bug Importer
Comment 13
2022-04-12 11:54:17 PDT
<
rdar://problem/91640876
>
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug