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

Add WebGLSampler support #24333

Merged
merged 1 commit into from Oct 8, 2019
Merged

Add WebGLSampler support #24333

merged 1 commit into from Oct 8, 2019

Conversation

@mmatyas
Copy link
Contributor

mmatyas commented Oct 1, 2019

Reference: https://www.khronos.org/registry/webgl/specs/latest/2.0/#3.7.13

cc @jdm @zakorgy


  • ./mach build -d does not report any errors
  • ./mach test-tidy does not report any errors
  • These changes fix #___ (GitHub issue number if applicable)
  • There are tests for these changes OR
  • These changes do not require tests because ___

This change is Reviewable

@highfive
Copy link

highfive commented Oct 1, 2019

Heads up! This PR modifies the following files:

  • @asajeffrey: components/script/dom/macros.rs, components/script/dom/webidls/WebGL2RenderingContext.webidl, components/script/dom/webidls/WebGLSampler.webidl, components/script/dom/webglsampler.rs, components/script/dom/mod.rs and 3 more
  • @jgraham: tests/wpt/webgl/meta/conformance2/samplers/samplers.html.ini, tests/wpt/webgl/meta/conformance2/context/methods-2.html.ini, tests/wpt/webgl/meta/conformance2/state/gl-object-get-calls.html.ini, tests/wpt/webgl/meta/conformance2/samplers/multi-context-sampler-test.html.ini, tests/wpt/webgl/meta/conformance2/misc/expando-loss-2.html.ini and 3 more
  • @KiChjang: components/script/dom/macros.rs, components/script/dom/webidls/WebGL2RenderingContext.webidl, components/script/dom/webidls/WebGLSampler.webidl, components/script/dom/webglsampler.rs, components/script/dom/mod.rs and 3 more
@highfive
Copy link

highfive commented Oct 1, 2019

warning Warning warning

  • These commits modify unsafe code. Please review it carefully!
@bors-servo
Copy link
Contributor

bors-servo commented Oct 1, 2019

The latest upstream changes (presumably #24178) made this pull request unmergeable. Please resolve the merge conflicts.

@mmatyas mmatyas force-pushed the mmatyas:webgl_fns_samplers branch from 9dff313 to 37b79d9 Oct 2, 2019
@mmatyas
Copy link
Contributor Author

mmatyas commented Oct 2, 2019

Rebased to master.

@bors-servo
Copy link
Contributor

bors-servo commented Oct 2, 2019

The latest upstream changes (presumably #24250) made this pull request unmergeable. Please resolve the merge conflicts.

Copy link
Member

jdm left a comment

Looks good, with a couple questions about new test results!

match value {
WebGLSamplerValue::GLenum(value) => {
let allowed_values = match pname {
constants::TEXTURE_MIN_FILTER => vec![

This comment has been minimized.

@jdm

jdm Oct 2, 2019

Member

Rather than using vecs here, which requires allocation, we should be able to use slices (&[...]) instead.

This comment has been minimized.

@mmatyas

mmatyas Oct 3, 2019

Author Contributor

Yes, that's what I tried first, but the compiler refuses it because different branches return slices with different number of elements. Perhaps we should use something like SmallVec?

This comment has been minimized.

@jdm

jdm Oct 3, 2019

Member

Use &[FOO][..] to force slices instead of sized arrays.

@@ -1,5 +1,5 @@
[gl-object-get-calls.html]
expected: ERROR
expected: TIMEOUT

This comment has been minimized.

@jdm

jdm Oct 2, 2019

Member

We should figure out why this is timing out now.

This comment has been minimized.

@mmatyas

mmatyas Oct 3, 2019

Author Contributor

Actually there are some (unrelated) buffer drawing calls in the tests that produce GL errors with my integrated GPU, yet work fine for others, including the CI. For the tests in this PR, the crash to timeout changes are due to an error message appearing while running the test, which stops executing the rest of the JS code, while the enum error happens because I've uncommented the failing drawing call during development (and forgot to remove these tests from the PR). I'd be interested if the CI reports any errors other than these, then I do plan to take a look into the buffer implementation and its issues too.

@@ -1,2 +1,2 @@
[sampler-uniforms.html]
expected: CRASH
expected: TIMEOUT

This comment has been minimized.

@jdm

jdm Oct 2, 2019

Member

We should figure out why this is timing out now.

@@ -51,3 +51,9 @@
[WebGL test #32: successfullyParsed should be true (of type boolean). Was undefined (of type undefined).]
expected: FAIL

[WebGL test #33: getError expected: NO_ERROR. Was INVALID_ENUM : after evaluating: gl.bindSampler(0, sampler)]

This comment has been minimized.

@jdm

jdm Oct 2, 2019

Member

We should fix this.

@mmatyas mmatyas force-pushed the mmatyas:webgl_fns_samplers branch from 37b79d9 to 21db457 Oct 3, 2019
@mmatyas
Copy link
Contributor Author

mmatyas commented Oct 3, 2019

Rebased to master.

@mmatyas mmatyas force-pushed the mmatyas:webgl_fns_samplers branch from 21db457 to bdfcbab Oct 4, 2019
@mmatyas
Copy link
Contributor Author

mmatyas commented Oct 4, 2019

Fixed the format, updated with the array slices and removed the tests I'm not certain about.

@jdm
Copy link
Member

jdm commented Oct 4, 2019

@bors-servo try=wpt

@bors-servo
Copy link
Contributor

bors-servo commented Oct 4, 2019

Trying commit bdfcbab with merge 0078eb6...

bors-servo added a commit that referenced this pull request Oct 4, 2019
Add WebGLSampler support

Reference: https://www.khronos.org/registry/webgl/specs/latest/2.0/#3.7.13

<!-- 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
- [x] `./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/24333)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

bors-servo commented Oct 4, 2019

💔 Test failed - linux-rel-wpt

@jdm
Copy link
Member

jdm commented Oct 4, 2019

{
    "status": "FAIL", 
    "group": "default", 
    "message": "assert_true: should be green\nat (0, 0) expected: 0,255,0,255 was 0,0,0,255 expected true got false", 
    "stack": "reportTestResultsToHarness/<@http://web-platform.test:8000/_webgl/js/js-test-pre.js:123:9\nTest.prototype.step@http://web-platform.test:8000/resources/testharness.js:1908:25\ntest@http://web-platform.test:8000/resources/testharness.js:544:30\nreportTestResultsToHarness@http://web-platform.test:8000/_webgl/js/js-test-pre.js:122:7\ntestFailed@http://web-platform.test:8000/_webgl/js/js-test-pre.js:249:5\ncheckCanvasRect/<@http://web-platform.test:8000/_webgl/js/webgl-test-utils.js:1269:9\ncheckCanvasRectColor@http://web-platform.test:8000/_webgl/js/webgl-test-utils.js:1225:9\ncheckCanvasRect@http://web-platform.test:8000/_webgl/js/webgl-test-utils.js:1257:3\nrunTest@http://web-platform.test:8000/_webgl/conformance2/samplers/multi-context-sampler-test.html:95:9\n@http://web-platform.test:8000/_webgl/conformance2/samplers/multi-context-sampler-test.html:101:1\n", 
    "subtest": "WebGL test #2: should be green\nat (0, 0) expected: 0,255,0,255 was 0,0,0,255", 
    "test": "/_webgl/conformance2/samplers/multi-context-sampler-test.html", 
    "line": 228082, 
    "action": "test_result", 
    "expected": "PASS"
}
{
    "status": "FAIL", 
    "group": "default", 
    "message": "assert_true: getError expected: NO_ERROR. Was INVALID_ENUM : there should be no errors expected true got false", 
    "stack": "reportTestResultsToHarness/<@http://web-platform.test:8000/_webgl/js/js-test-pre.js:123:9\nTest.prototype.step@http://web-platform.test:8000/resources/testharness.js:1908:25\ntest@http://web-platform.test:8000/resources/testharness.js:544:30\nreportTestResultsToHarness@http://web-platform.test:8000/_webgl/js/js-test-pre.js:122:7\ntestFailed@http://web-platform.test:8000/_webgl/js/js-test-pre.js:249:5\nglErrorShouldBeImpl@http://web-platform.test:8000/_webgl/js/webgl-test-utils.js:1679:5\nglErrorShouldBe@http://web-platform.test:8000/_webgl/js/webgl-test-utils.js:1653:10\nrunTest@http://web-platform.test:8000/_webgl/conformance2/samplers/multi-context-sampler-test.html:98:9\n@http://web-platform.test:8000/_webgl/conformance2/samplers/multi-context-sampler-test.html:101:1\n", 
    "subtest": "WebGL test #3: getError expected: NO_ERROR. Was INVALID_ENUM : there should be no errors", 
    "test": "/_webgl/conformance2/samplers/multi-context-sampler-test.html", 
    "line": 228083, 
    "action": "test_result", 
    "expected": "PASS"
}
{
    "status": "FAIL", 
    "group": "default", 
    "message": "assert_true: getError expected: NO_ERROR. Was INVALID_ENUM : after evaluating: gl.bindSampler(0, sampler) expected true got false", 
    "stack": "reportTestResultsToHarness/<@http://web-platform.test:8000/_webgl/js/js-test-pre.js:123:9\nTest.prototype.step@http://web-platform.test:8000/resources/testharness.js:1908:25\ntest@http://web-platform.test:8000/resources/testharness.js:544:30\nreportTestResultsToHarness@http://web-platform.test:8000/_webgl/js/js-test-pre.js:122:7\ntestFailed@http://web-platform.test:8000/_webgl/js/js-test-pre.js:249:5\nglErrorShouldBeImpl@http://web-platform.test:8000/_webgl/js/webgl-test-utils.js:1679:5\nglErrorShouldBe@http://web-platform.test:8000/_webgl/js/webgl-test-utils.js:1653:10\nshouldGenerateGLError@http://web-platform.test:8000/_webgl/js/webgl-test-utils.js:1623:12\n@http://web-platform.test:8000/_webgl/conformance2/misc/object-deletion-behaviour-2.html:98:1\n", 
    "subtest": "WebGL test #33: getError expected: NO_ERROR. Was INVALID_ENUM : after evaluating: gl.bindSampler(0, sampler)", 
    "test": "/_webgl/conformance2/misc/object-deletion-behaviour-2.html", 
    "line": 228759, 
    "action": "test_result", 
    "expected": "PASS"
}
{
    "status": "FAIL", 
    "group": "default", 
    "message": "assert_true: successfullyParsed should be true (of type boolean). Was undefined (of type undefined). expected true got false", 
    "stack": "reportTestResultsToHarness/<@http://web-platform.test:8000/_webgl/js/js-test-pre.js:123:9\nTest.prototype.step@http://web-platform.test:8000/resources/testharness.js:1908:25\ntest@http://web-platform.test:8000/resources/testharness.js:544:30\nreportTestResultsToHarness@http://web-platform.test:8000/_webgl/js/js-test-pre.js:122:7\ntestFailed@http://web-platform.test:8000/_webgl/js/js-test-pre.js:249:5\nshouldBe@http://web-platform.test:8000/_webgl/js/js-test-pre.js:406:9\nshouldBeTrue@http://web-platform.test:8000/_webgl/js/js-test-pre.js:432:29\n@http://web-platform.test:8000/_webgl/js/js-test-post.js:24:1\n", 
    "subtest": "WebGL test #40: successfullyParsed should be true (of type boolean). Was undefined (of type undefined).", 
    "test": "/_webgl/conformance2/misc/object-deletion-behaviour-2.html", 
    "line": 228766, 
    "action": "test_result", 
    "expected": "PASS"
}
@mmatyas
Copy link
Contributor Author

mmatyas commented Oct 7, 2019

Interesting; for me, multi-context-sampler-test.html crashes/hangs with a Last GL operation failed: VertexAttribPointer(0, 2, 5126, false, 0, 0) message, while object-deletion-behaviour-2.html reports a gl.createVertexArray is not a function error on start.

@jdm
Copy link
Member

jdm commented Oct 7, 2019

Is it any different if you run those tests with --headless?

@mmatyas
Copy link
Contributor Author

mmatyas commented Oct 8, 2019

I've managed to reproduce the errors with headless; looking into it, they seem to be actually unrelated to samplers:

  • object-deletion-behaviour-2.html seems to be failing due to an earlier test producing an invalid enum, which isn't cleared before the sampler calls. gl.bindSampler itself can't even produce this kind of error (only invalid value).
  • multi-context-sampler-test.html fails due to drawing issues. These still happen even if I remove any sampler related call from the test.
@jdm
Copy link
Member

jdm commented Oct 8, 2019

In that case, adding the new expected failures values sounds fine. Thanks for looking into the failures!

@mmatyas mmatyas force-pushed the mmatyas:webgl_fns_samplers branch from bdfcbab to 26df196 Oct 8, 2019
@highfive highfive removed the S-tests-failed label Oct 8, 2019
@mmatyas
Copy link
Contributor Author

mmatyas commented Oct 8, 2019

Ok, updated with the test changes.

@jdm
Copy link
Member

jdm commented Oct 8, 2019

@bors-servo
Copy link
Contributor

bors-servo commented Oct 8, 2019

📌 Commit 26df196 has been approved by jdm

@bors-servo
Copy link
Contributor

bors-servo commented Oct 8, 2019

Testing commit 26df196 with merge a7d48dc...

bors-servo added a commit that referenced this pull request Oct 8, 2019
Add WebGLSampler support

Reference: https://www.khronos.org/registry/webgl/specs/latest/2.0/#3.7.13

<!-- 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
- [x] `./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/24333)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

bors-servo commented Oct 8, 2019

☀️ Test successful - linux-rel-css, linux-rel-wpt, status-taskcluster
Approved by: jdm
Pushing a7d48dc to master...

@bors-servo bors-servo merged commit 26df196 into servo:master Oct 8, 2019
1 of 3 checks passed
1 of 3 checks passed
Taskcluster (pull_request) TaskGroup: failure
Details
continuous-integration/appveyor/pr AppVeyor build failed
Details
homu Test successful
Details
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

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