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
Initial implementation of WebGLQueries #24178
Conversation
Heads up! This PR modifies the following files:
|
Note: the patch doesn't pass match target {
constants::ANY_SAMPLES_PASSED |
constants::ANY_SAMPLES_PASSED_CONSERVATIVE => {
&self.occlusion_query
},
constants::TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN => {
&self.primitives_query
}, is more readable than this: match target {
constants::ANY_SAMPLES_PASSED | constants::ANY_SAMPLES_PASSED_CONSERVATIVE => {
&self.occlusion_query
},
constants::TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN => &self.primitives_query, Of course, I can apply Also I'm pretty sure many Option check could be simplified with some creative use of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The rest of the changes look good!
); | ||
match query.get_parameter(&self.base, pname) { | ||
Ok(value) => match pname { | ||
constants::QUERY_RESULT => UInt32Value(value), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To get the event loop integration right, I recommend this strategy:
- add
Option<u32>
andOption<bool>
members for storing cached versions of these results - if both these fields are None, get the query parameter from the GL thread and store the result in the appropriate field, and return the result
- if either field is Some, get the query parameter from the GL thread, queue a task that will update the cached values, and return the current cached value
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see, but what do you mean exactly by queuing a task? The query results should not change until the next time we're in the event loop; do we have a way for scheduling a callback to run at that time? Or you mean connect it somehow to the DOM's global scheduler?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean using the task!
macro to declare a closure that will run asynchronously on the script thread, and using the task source API to enqueue it to run later. This code is one example of many in the script/ code of queueing a task.
As for the question about tidy, you can add a |
0d459bd
to
bea2682
Compare
Ok, I've updated the patch with the task queue (thanks!), and I've also added a Drop implementation. The timing tests now pass, but the actual query results might fail ( |
@bors-servo try=wpt |
Initial implementation of WebGLQueries This patch adds initial support for WeGLQueries. Most related WebGL functions and objects ([1]) are implemented; what's still missing is: - syncing the result of `getQueryParameter` with the event loop - `EXT_disjoint_timer_query_webgl2` support [1]: https://www.khronos.org/registry/webgl/specs/latest/2.0/#3.7.12 <!-- Please describe your changes on the following line: --> cc @jdm @zakorgy --- <!-- 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 - [ ] `./mach test-tidy` does not report any errors - [ ] These changes fix #___ (GitHub issue number if applicable) <!-- Either: --> - [x] 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. --> <!-- 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/24178) <!-- Reviewable:end -->
💔 Test failed - linux-rel-wpt |
The following pull requests depend on it: servo#24250, servo#24178.
☔ The latest upstream changes (presumably #24242) made this pull request unmergeable. Please resolve the merge conflicts. |
Update sparkle crate The following pull requests depend on it: #24250, #24178. <!-- Please describe your changes on the following line: --> --- <!-- 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 <!-- Either: --> - [X] There are tests for these changes <!-- 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. --> <!-- 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/24266) <!-- Reviewable:end -->
Update sparkle crate The following pull requests depend on it: #24250, #24178. <!-- Please describe your changes on the following line: --> --- <!-- 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 <!-- Either: --> - [X] There are tests for these changes <!-- 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. --> <!-- 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/24266) <!-- Reviewable:end -->
bea2682
to
676a52d
Compare
Rebased to master. I've also improved the |
// | ||
|
||
[Exposed=Window] | ||
interface WebGLQuery : WebGLObject { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to be hidden behind the webgl2 preference:
[Pref="dom.webgl2.enabled"] |
Here's the reason for those failures - the test harness automatically adds a #N prefix to each test message in this code. Since it only calls testFailed if a method is missing, it now executes testFailed fewer times than previously since there are new methods present in the interface, to the test messages contain different #N prefixes than before. You should delete tests/wpt/webgl/meta/conformance2/context/methods-2.html.ini and regenerate it in order to update the expected error messages. |
Also some other interface test expectations needs updating:
|
This patch adds initial support for WeGLQueries. Most related WebGL functions and objects are implemented [1]. What's still missing is the `EXT_disjoint_timer_query_webgl2` support. [1]: https://www.khronos.org/registry/webgl/specs/latest/2.0/#3.7.12
86d971d
to
f2e2b3d
Compare
Thanks, updated with the |
@bors-servo r+ |
📌 Commit f2e2b3d has been approved by |
Initial implementation of WebGLQueries This patch adds initial support for WeGLQueries. Most related WebGL functions and objects ([1]) are implemented; what's still missing is: - syncing the result of `getQueryParameter` with the event loop - `EXT_disjoint_timer_query_webgl2` support [1]: https://www.khronos.org/registry/webgl/specs/latest/2.0/#3.7.12 <!-- Please describe your changes on the following line: --> cc @jdm @zakorgy --- <!-- 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 - [ ] `./mach test-tidy` does not report any errors - [ ] These changes fix #___ (GitHub issue number if applicable) <!-- Either: --> - [x] 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. --> <!-- 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/24178) <!-- Reviewable:end -->
💔 Test failed - status-taskcluster |
@bors-servo retry |
Initial implementation of WebGLQueries This patch adds initial support for WeGLQueries. Most related WebGL functions and objects ([1]) are implemented; what's still missing is: - syncing the result of `getQueryParameter` with the event loop - `EXT_disjoint_timer_query_webgl2` support [1]: https://www.khronos.org/registry/webgl/specs/latest/2.0/#3.7.12 <!-- Please describe your changes on the following line: --> cc @jdm @zakorgy --- <!-- 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 - [ ] `./mach test-tidy` does not report any errors - [ ] These changes fix #___ (GitHub issue number if applicable) <!-- Either: --> - [x] 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. --> <!-- 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/24178) <!-- Reviewable:end -->
☀️ Test successful - linux-rel-css, linux-rel-wpt, status-taskcluster |
This patch adds initial support for WeGLQueries. Most related WebGL functions and objects (1) are implemented; what's still missing is:
getQueryParameter
with the event loopEXT_disjoint_timer_query_webgl2
supportcc @jdm @zakorgy
./mach build -d
does not report any errors./mach test-tidy
does not report any errorsThis change is