Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement hit testing API #26171

Merged
merged 18 commits into from Apr 20, 2020
Merged

Implement hit testing API #26171

merged 18 commits into from Apr 20, 2020

Conversation

@Manishearth
Copy link
Member

Manishearth commented Apr 11, 2020

Depends on servo/webxr#149 , #26170

This implements non-transient hit tests.

The tests that do not pass are due to web-platform-tests/wpt#22898 , web-platform-tests/wpt#22900, web-platform-tests/wpt#22901 , and immersive-web/hit-test#86

@highfive
Copy link

highfive commented Apr 11, 2020

Heads up! This PR modifies the following files:

  • @asajeffrey: components/script/dom/webidls/XRSession.webidl, components/script/dom/webidls/XRRay.webidl, components/script/canvas_state.rs, components/script/dom/xrreferencespace.rs, components/script/dom/mod.rs and 21 more
  • @KiChjang: components/script/dom/webidls/XRSession.webidl, components/script/dom/webidls/XRRay.webidl, components/script/canvas_state.rs, components/script/dom/xrreferencespace.rs, components/script/dom/mod.rs and 21 more
@highfive
Copy link

highfive commented Apr 11, 2020

warning Warning warning

  • These commits modify unsafe code. Please review it carefully!
@servo-wpt-sync
Copy link
Collaborator

servo-wpt-sync commented Apr 11, 2020

Opened new PR for upstreamable changes.

Completed upstream sync of web-platform-test changes at web-platform-tests/wpt#22868.

@Manishearth
Copy link
Member Author

Manishearth commented Apr 11, 2020

I haven't gone through all the tests but the reason we fail the refSpace one, for example, is both because of immersive-web/hit-test#86 and because of another bug in the test where it's assuming hit test results get duplicated

@Manishearth Manishearth force-pushed the Manishearth:hittest branch from 31e0eee to d40442a Apr 13, 2020
@servo-wpt-sync
Copy link
Collaborator

servo-wpt-sync commented Apr 13, 2020

Transplanted upstreamable changes to existing PR.

Completed upstream sync of web-platform-test changes at web-platform-tests/wpt#22868.

@Manishearth Manishearth force-pushed the Manishearth:hittest branch from d40442a to 3184d61 Apr 14, 2020
@servo-wpt-sync
Copy link
Collaborator

servo-wpt-sync commented Apr 14, 2020

No upstreamable changes; closed existing PR.

Completed upstream sync of web-platform-test changes at web-platform-tests/wpt#22868.

@Manishearth
Copy link
Member Author

Manishearth commented Apr 14, 2020

Rebased over test updates that I landed upstream early.

@jdm
Copy link
Member

jdm commented Apr 14, 2020

@highfive highfive assigned asajeffrey and unassigned jdm Apr 14, 2020
@Manishearth Manishearth force-pushed the Manishearth:hittest branch from 3184d61 to 8115657 Apr 14, 2020
Copy link
Member

asajeffrey left a comment

Mostly LGTM, we're generating a lot of objects per frame, but hey ho.

One thing I don't understand is how to do hit tests relative to a moving refererence, e.g. from the users's hands or eyes? Does this require generating a new ray each frame?

.hit_test_results
.iter()
.filter(|r| r.id == source.id())
.map(|r| XRHitTestResult::new(&self.global(), *r, self))

This comment has been minimized.

@asajeffrey

asajeffrey Apr 15, 2020

Member

Ouch, creating a new hit test result for each hit test, every frame? This might be putting strain on the GC?

This comment has been minimized.

@Manishearth

Manishearth Apr 15, 2020

Author Member

I don't see any other way to do it? Note that it's possible for a single hit test to have multiple results.

fn GetPose(&self, base: &XRSpace) -> Option<DomRoot<XRPose>> {
let base = self.frame.get_pose(base)?;
let pose = base.inverse().pre_transform(&self.result.space);
Some(XRPose::new(&self.global(), pose.cast_unit()))

This comment has been minimized.

@asajeffrey

asajeffrey Apr 15, 2020

Member

Ditto, creating a new XRPose object every frame?

This comment has been minimized.

@Manishearth

Manishearth Apr 15, 2020

Author Member

We already do this with getPose in views

@CYBAI
Copy link
Collaborator

CYBAI commented Apr 16, 2020

Needs a ./mach fmt 👀

Diff in /repo/components/script/dom/xrsession.rs at line 747:
             .granted_features()
             .iter()
             .find(|f| &**f == "hit-test")
-            .is_none() {
�(B+            .is_none()
�(B+        {
�(B             p.reject_error(Error::NotSupported);
             return p;
         }
clang-format not installed. Skipping CPP formatting.
Run `./mach fmt` to fix the formatting
@Manishearth
Copy link
Member Author

Manishearth commented Apr 16, 2020

Strangely I do not get that error locally

@Manishearth
Copy link
Member Author

Manishearth commented Apr 16, 2020

That patch is also already applied here and on github. I suspect tc is doing something weird.

(tc won't pass anyway until servo/webxr#149 lands)

@Manishearth Manishearth force-pushed the Manishearth:hittest branch from 8115657 to 3837bf4 Apr 16, 2020
@CYBAI
Copy link
Collaborator

CYBAI commented Apr 17, 2020

Checking files for tidiness...
./Cargo.lock:1: duplicate versions for package `autocfg`
	The following packages depend on version 0.1.7 from 'crates.io':
	The following packages depend on version 1.0.0 from 'crates.io':
./components/script/dom/webidls/XRHitTestResult.webidl:10: no newline at EOF
bors-servo added a commit to servo/webxr that referenced this pull request Apr 19, 2020
Implement support for hit testing, use in mock backend

Servo side: servo/servo#26171

This adds support for all non-transient parts of he [WebXR Hit Test Module](https://immersive-web.github.io/hit-test), including mocking support.

This has not yet been hooked up to script and is thus completely untested.

r? @jdm
@Manishearth Manishearth force-pushed the Manishearth:hittest branch from 3837bf4 to 4bb19ee Apr 19, 2020
@Manishearth
Copy link
Member Author

Manishearth commented Apr 19, 2020

@Manishearth Manishearth force-pushed the Manishearth:hittest branch from 4bb19ee to 2a57966 Apr 20, 2020
@Manishearth
Copy link
Member Author

Manishearth commented Apr 20, 2020

Ah, our webxr tests need to be updated for supportedModes

@Manishearth
Copy link
Member Author

Manishearth commented Apr 20, 2020

@bors-servo r=asajeffrey

@bors-servo
Copy link
Contributor

bors-servo commented Apr 20, 2020

📌 Commit 2a57966 has been approved by asajeffrey

@bors-servo
Copy link
Contributor

bors-servo commented Apr 20, 2020

Testing commit 2a57966 with merge 575c8ed...

bors-servo added a commit that referenced this pull request Apr 20, 2020
Implement hit testing API

Depends on servo/webxr#149 , #26170

This implements non-transient hit tests.

The tests that do not pass are due to web-platform-tests/wpt#22898 , web-platform-tests/wpt#22900, web-platform-tests/wpt#22901 , and immersive-web/hit-test#86
@bors-servo
Copy link
Contributor

bors-servo commented Apr 20, 2020

💔 Test failed - status-taskcluster

@jdm
Copy link
Member

jdm commented Apr 20, 2020

@bors-servo retry

@bors-servo
Copy link
Contributor

bors-servo commented Apr 20, 2020

Testing commit 2a57966 with merge 99cd30e...

@bors-servo
Copy link
Contributor

bors-servo commented Apr 20, 2020

☀️ Test successful - status-taskcluster
Approved by: asajeffrey
Pushing 99cd30e to master...

@bors-servo bors-servo merged commit 99cd30e into servo:master Apr 20, 2020
2 checks passed
2 checks passed
Community-TC (pull_request) TaskGroup: success
Details
homu Test successful
Details
@Manishearth Manishearth deleted the Manishearth:hittest branch Apr 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

7 participants
You can’t perform that action at this time.