Skip to content

Add WebGLSampler support - #24333

Merged
bors-servo merged 1 commit into
servo:masterfrom
mmatyas:webgl_fns_samplers
Oct 8, 2019
Merged

bors-servo merged 1 commit into
servo:masterfrom
mmatyas:webgl_fns_samplers

Conversation

@mmatyas

@mmatyas mmatyas commented Oct 1, 2019 •

Copy link
Copy Markdown
Contributor

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

highfive commented Oct 1, 2019

Copy link
Copy Markdown

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 highfive added the S-awaiting-review There is new code that needs to be reviewed. label Oct 1, 2019
@highfive

highfive commented Oct 1, 2019

Copy link
Copy Markdown

warning Warning warning

  • These commits modify unsafe code. Please review it carefully!

@bors-servo

Copy link
Copy Markdown
Contributor

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

@highfive highfive added the S-needs-rebase There are merge conflict errors. label Oct 1, 2019
@mmatyas
mmatyas force-pushed the webgl_fns_samplers branch from 9dff313 to 37b79d9 Compare October 2, 2019 08:50
@mmatyas

mmatyas commented Oct 2, 2019

Copy link
Copy Markdown
Contributor Author

Rebased to master.

@bors-servo

Copy link
Copy Markdown
Contributor

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

@jdm jdm left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Comment thread components/script/dom/webglsampler.rs Outdated
match value {
WebGLSamplerValue::GLenum(value) => {
let allowed_values = match pname {
constants::TEXTURE_MIN_FILTER => vec![

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should figure out why this is timing out now.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should figure out why this is timing out now.

[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)]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should fix this.

@jdm jdm added S-needs-code-changes Changes have not yet been made that were requested by a reviewer. and removed S-awaiting-review There is new code that needs to be reviewed. labels Oct 2, 2019
@mmatyas
mmatyas force-pushed the webgl_fns_samplers branch from 37b79d9 to 21db457 Compare October 3, 2019 11:10
@highfive highfive added S-awaiting-review There is new code that needs to be reviewed. and removed S-needs-code-changes Changes have not yet been made that were requested by a reviewer. labels Oct 3, 2019
@mmatyas

mmatyas commented Oct 3, 2019

Copy link
Copy Markdown
Contributor Author

Rebased to master.

@mmatyas
mmatyas force-pushed the webgl_fns_samplers branch from 21db457 to bdfcbab Compare October 4, 2019 09:28
@mmatyas

mmatyas commented Oct 4, 2019

Copy link
Copy Markdown
Contributor Author

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

@jdm

jdm commented Oct 4, 2019

Copy link
Copy Markdown
Member

@bors-servo try=wpt

@bors-servo

Copy link
Copy Markdown
Contributor

⌛ Trying commit bdfcbab with merge 0078eb6...

bors-servo pushed 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
Copy Markdown
Contributor

💔 Test failed - linux-rel-wpt

@highfive highfive added the S-tests-failed The changes caused existing tests to fail. label Oct 4, 2019
@jdm

jdm commented Oct 4, 2019

Copy link
Copy Markdown
Member
{
    "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

mmatyas commented Oct 7, 2019

Copy link
Copy Markdown
Contributor Author

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

jdm commented Oct 7, 2019 •

Copy link
Copy Markdown
Member

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

@mmatyas

mmatyas commented Oct 8, 2019

Copy link
Copy Markdown
Contributor Author

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

jdm commented Oct 8, 2019

Copy link
Copy Markdown
Member

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

@mmatyas
mmatyas force-pushed the webgl_fns_samplers branch from bdfcbab to 26df196 Compare October 8, 2019 14:22
@highfive highfive removed the S-tests-failed The changes caused existing tests to fail. label Oct 8, 2019
@mmatyas

mmatyas commented Oct 8, 2019

Copy link
Copy Markdown
Contributor Author

Ok, updated with the test changes.

@jdm

jdm commented Oct 8, 2019

Copy link
Copy Markdown
Member

@bors-servo r+

@bors-servo

Copy link
Copy Markdown
Contributor

📌 Commit 26df196 has been approved by jdm

@highfive highfive added S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. and removed S-awaiting-review There is new code that needs to be reviewed. S-needs-rebase There are merge conflict errors. labels Oct 8, 2019
@bors-servo

Copy link
Copy Markdown
Contributor

⌛ Testing commit 26df196 with merge a7d48dc...

bors-servo pushed 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
Copy Markdown
Contributor

☀️ 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
@highfive highfive removed the S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. label Oct 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants