Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upUse new WebXR API in script #23731
Use new WebXR API in script #23731
Conversation
highfive
commented
Jul 8, 2019
|
Heads up! This PR modifies the following files:
|
highfive
commented
Jul 8, 2019
2dd8c3e
to
59c8d85
|
Can start reviewing now |
|
OK, this looks good so far. There are a few sources of panic that we should probably get rid of before merging, and there's an annoying extra thread kept alive because script doesn't support serializable tasks. I see what you mean about the typed transforms, the types are just getting in the way because by the time the transforms get to JS they're untyped. |
|
|
||
| #[allow(unsafe_code)] | ||
| pub fn cast_transform<T, U, V, W>(transform: TypedRigidTransform3D<f32, T, U>) -> TypedRigidTransform3D<f32, V, W> { | ||
| unsafe { mem::transmute(transform) } |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
| // XXXManishearth handle inline sessions and composition disabled flag | ||
| let layer = pending.GetBaseLayer(); | ||
| if let Some(layer) = layer { | ||
| let layer = layer.downcast::<XRWebGLLayer>().unwrap(); |
This comment has been minimized.
This comment has been minimized.
| .dom_manipulation_task_source_with_canceller(); | ||
| let (sender, receiver) = ipc::channel(global.time_profiler_chan().clone()).unwrap(); | ||
| *self.raf_sender.borrow_mut() = Some(sender); | ||
| ROUTER.add_route( |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
gterzian
Jul 10, 2019
•
Member
Ok so, if the goal is really removing the router from the equation for this specific workflow, here's an idea for your consideration:
At this very line, instead of using the ROUTER, queue a task that does the below:
let frame = raf_receiver.recv();(or return if you're inactive)- self.raf_callback(frame);
- If !self.raf_callback_list.is_empty()
- request_animation_frame
- queue a task to start at 1
- Or, if there are no callbacks or the session has ended, skip 4 and 5
If you don't need to actually run tasks, or handle messages from the constellation, you could try an even more drastic approach where instead of running one callback in one task, you'd keep requesting frames and running callbacks for as long as new callbacks are added inside a callback, and for as long as the session remains active(and the pipeline isn't closed?). And that from within the same task, effectively blocking the script-thread in the meantime(but running the callbacks as "fast" as possible, I guess).
So you could just queue a task in the first requestAnimationFrame call, and after that just loop inside the same task, running a mini-event-loop inside the otherwise blocked window event-loop...
This comment has been minimized.
This comment has been minimized.
asajeffrey
Jul 10, 2019
Member
We could do something like that, but this would mean blocking the script thread while waiting for the raf_receiver.recv(), and IPC channels don't support recv_timeout(). Sigh. I think this would need quite a drastic re-think of how Servo approaches IPC.
|
Addressed. |
|
There are no untyped functions on half the euclid types https://docs.rs/euclid/0.19.7/euclid/struct.TypedRigidTransform3D.html |
|
Mocking works! I'll still need to fix the test again |
|
input's done, as well. ready for review. I haven't yet tested locally (can't test on my laptop), will do after this meeting |
|
Argh, did you know github gets very confused if you force-push while there's a review being written? |
|
Yay, looks pretty good. Usual collection of nip-picks and bikesheds. |
| } | ||
|
|
||
| pub fn get_views(views: &[FakeXRViewInit]) -> Fallible<(MockVRView, MockVRView)> { | ||
| pub fn get_views(views: &[FakeXRViewInit]) -> Fallible<Views> { | ||
| if views.len() != 2 { | ||
| return Err(Error::NotSupported); |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
The failure with glwindow is probably OK, but we should fix the mock API. In particular, mirroring isn't working, possibly because we're not marking the canvas as dirty after an XR rAF? |
|
The tests still work, which makes me kinda okay with the mock API being broken. |
|
Yes, I think it's display mirroring that's broken. I think it's OK to merge with that. You can r=me. Can we enable some webxr tests now? |
|
@bors-servo r=asajeffrey not yet, Chrome is still fixing them |
|
|
Use new WebXR API in script Todo: - [x] Hook new `Frame` information into `XRFrame` - [x] Make spaces use new transform info - [x] Hook up session view metadata correctly - [x] Get mocking working again - [x] Get inputs working Optional todos: - [x] Add support for active and animationFrame bool on XRFrame - [x] Correctly handle viewer and offset spaces instead of casting - [x] Error on zero-length quaternions <s>Not really ready for review yet, but you can go ahead and review what I have so far. It doesn't do anything yet, aside from crash horribly. I'm opening this PR early so i have a place to track progress.</s> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/23731) <!-- Reviewable:end -->
|
|
Manishearth commentedJul 8, 2019
•
edited
Todo:
Frameinformation intoXRFrameOptional todos:
Not really ready for review yet, but you can go ahead and review what I have so far. It doesn't do anything yet, aside from crash horribly. I'm opening this PR early so i have a place to track progress.This change is