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 upHandle detached arrays in XRView #26153
Comments
|
Hi! If you have any questions regarding this issue, feel free to make a comment here, or ask it in the If you intend to work on this issue, then add |
|
Hi! I wanted to get started with contributing to servo and this issue was listed on
Can you link me with a example where this case is already being handled, it will help me figure out what exactly I need to implement here! |
|
@daemon1024 in all the other cases the array is lazy initialized so fetching it when it's null after detachment just reinitializes it |
|
@Manishearth Thanks for reference. Got it now, will get started to work on it. |
|
@highfive: assign me |
|
Hey @daemon1024! Thanks for your interest in working on this issue. It's now assigned to you! |
|
From what I understood I need to initialise Underlying view can be referenced as Also view field in the struct XRView is Heap here, I think it should be of the type @Manishearth ,can you assist me with where am I going wrong? |
|
Yes, you need to copy the projection matrix into the XRView as a new field during construction. You still need the Heap to be able to make the array. |
|
Logically it should be something like this i guess
But I can't seem to figure how access the projection matrix source ( |
|
You have |
|
I added a new field as u suggested
I tried to store it out from
But I am getting an error
I am not sure how else do I copy it out. |
|
It needs to be a |
|
@Manishearth Thank You so much for the help, I have made the required changes and made a PR. Can you please review it? |
handle detached array in XRView <!-- Please describe your changes on the following line: --> Recompute XRView.projectionmatrix when the buffer is detached --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [x] These changes fix #26153 (GitHub issue number if applicable) <!-- Either: --> - [ ] There are tests for these changes OR - [ ] These changes do not require tests because ___ <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
handle detached array in XRView <!-- Please describe your changes on the following line: --> Recompute XRView.projectionmatrix when the buffer is detached --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [x] These changes fix #26153 (GitHub issue number if applicable) <!-- Either: --> - [ ] There are tests for these changes OR - [ ] These changes do not require tests because ___ <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
handle detached array in XRView <!-- Please describe your changes on the following line: --> Recompute XRView.projectionmatrix when the buffer is detached --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [x] These changes fix #26153 (GitHub issue number if applicable) <!-- Either: --> - [ ] There are tests for these changes OR - [ ] These changes do not require tests because ___ <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
handle detached array in XRView <!-- Please describe your changes on the following line: --> Recompute XRView.projectionmatrix when the buffer is detached --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [x] These changes fix #26153 (GitHub issue number if applicable) <!-- Either: --> - [ ] There are tests for these changes OR - [ ] These changes do not require tests because ___ <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
There are a bunch of places in the WebXR spec where arrays are returned. If you call
.transfer()on these, their buffers are "detached", and need to be recomputed. You can check if a buffer is detached by callingis_null()on it.We handle most of these cases, except for
XRView.projectionMatrixWe need to store the projection matrix on the XRView and use a null check in
ProjectionMatrixto recompute it if necessary:servo/components/script/dom/xrview.rs
Line 83 in 5e91e48