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

Implement WebGLContext resize #14075

Merged
merged 1 commit into from Dec 1, 2016
Merged

Conversation

@MortimerGoro
Copy link
Contributor

MortimerGoro commented Nov 4, 2016

Related PR: servo/webrender#519

Implement WebGLContext resize (canvas.width & canvas.height). I have tested:

  • Fixes WebGL apps that initialize canvas size after calling canvas.getContext("webgl")
  • Support WebGL apps that change the canvas size & viewport on window.onresize

  • ./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 Nov 4, 2016

Heads up! This PR modifies the following files:

  • @emilio: components/canvas/webgl_paint_thread.rs
@emilio
Copy link
Member

emilio commented Nov 5, 2016

@bors-servo
Copy link
Contributor

bors-servo commented Nov 5, 2016

📌 Commit 8379c47 has been approved by emilio

@highfive highfive assigned emilio and unassigned KiChjang Nov 5, 2016
@bors-servo
Copy link
Contributor

bors-servo commented Nov 5, 2016

Testing commit 8379c47 with merge df3d72b...

bors-servo added a commit that referenced this pull request Nov 5, 2016
Implement WebGLContext resize

<!-- Please describe your changes on the following line: -->

Related PR: servo/webrender#519

Implement WebGLContext resize (canvas.width & canvas.height). I have tested:

- Fixes WebGL apps that initialize canvas size after calling canvas.getContext("webgl")
- Support WebGL apps that change the canvas size & viewport on window.onresize

---
<!-- 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 _____

<!-- 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/14075)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

bors-servo commented Nov 5, 2016

💔 Test failed - linux-rel-wpt

@emilio
Copy link
Member

emilio commented Nov 9, 2016

@bors-servo retry

Maybe intermittent?

@bors-servo
Copy link
Contributor

bors-servo commented Nov 9, 2016

Testing commit 8379c47 with merge fad2164...

bors-servo added a commit that referenced this pull request Nov 9, 2016
Implement WebGLContext resize

<!-- Please describe your changes on the following line: -->

Related PR: servo/webrender#519

Implement WebGLContext resize (canvas.width & canvas.height). I have tested:

- Fixes WebGL apps that initialize canvas size after calling canvas.getContext("webgl")
- Support WebGL apps that change the canvas size & viewport on window.onresize

---
<!-- 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 _____

<!-- 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/14075)
<!-- Reviewable:end -->
@jdm
Copy link
Member

jdm commented Nov 9, 2016

The test includes modifiying the canvas width and height, so this should probably be investigated!

  ▶ Unexpected subtest result in /webgl/conformance-1.0.3/conformance/rendering/gl-scissor-canvas-dimensions.html:
  │ FAIL [expected PASS] WebGL test #4: at (26, 21) expected: 0,0,0,0 was 69,14,0,0
  │   → assert_true: at (26, 21) expected: 0,0,0,0 was 69,14,0,0 expected true got false
  │ 
  │ reportTestResultsToHarness/<@http://web-platform.test:8000/webgl/conformance-1.0.3/resources/js-test-pre.js:88:9
  │ Test.prototype.step@http://web-platform.test:8000/resources/testharness.js:1401:20
  │ test@http://web-platform.test:8000/resources/testharness.js:501:9
  │ reportTestResultsToHarness@http://web-platform.test:8000/webgl/conformance-1.0.3/resources/js-test-pre.js:87:7
  │ testFailed@http://web-platform.test:8000/webgl/conformance-1.0.3/resources/js-test-pre.js:153:5
  │ checkCanvasRectColor@http://web-platform.test:8000/webgl/conformance-1.0.3/conformance/resources/webgl-test-utils.js:1047:9
  │ checkCanvasRect@http://web-platform.test:8000/webgl/conformance-1.0.3/conformance/resources/webgl-test-utils.js:1073:3
  │ testCanvasSizeChange@http://web-platform.test:8000/webgl/conformance-1.0.3/conformance/rendering/gl-scissor-canvas-dimensions.html:37:3
  └ @http://web-platform.test:8000/webgl/conformance-1.0.3/conformance/rendering/gl-scissor-canvas-dimensions.html:43:1
@bors-servo
Copy link
Contributor

bors-servo commented Nov 9, 2016

💔 Test failed - mac-rel-wpt2

@emilio
Copy link
Member

emilio commented Nov 9, 2016

Yup, seems legit. Seems like we need to zero out the pixels that aren't in the current viewport set by scissor.

@MortimerGoro
Copy link
Contributor Author

MortimerGoro commented Nov 9, 2016

@emilio After a resize we need to keep the default scissor that offscreen sets initially: https://github.com/emilio/rust-offscreen-rendering-context/blob/44e331217f958737349118969c4e73c96202440f/src/gl_context.rs#L187

I'll push a PR to conform the spec.

@MortimerGoro
Copy link
Contributor Author

MortimerGoro commented Nov 9, 2016

@emilio We could do the change in Servo or offscreen-context, some pros an cons:

  • If we change servo, there will be 2 calls to glScissor(), the first one is unneeded.
  • If we change offscreen-context, It will be only one call to glScissor, but it's a "browser spec". Not sure if thats a problem for you (I'm thinking about this library being used in other non browser projects).

Let me know what do you think about this.

@emilio
Copy link
Member

emilio commented Nov 9, 2016

I guess ideally we'll keep the WebGL-specific logic in Servo. I don't think an extra scissor call will be a perf issue here, but we can always re-consider if needed.

@MortimerGoro MortimerGoro force-pushed the MortimerGoro:webgl-resize branch from 8379c47 to a928e5f Nov 10, 2016
bors-servo added a commit that referenced this pull request Nov 28, 2016
Implement WebGLContext resize

<!-- Please describe your changes on the following line: -->

Related PR: servo/webrender#519

Implement WebGLContext resize (canvas.width & canvas.height). I have tested:

- Fixes WebGL apps that initialize canvas size after calling canvas.getContext("webgl")
- Support WebGL apps that change the canvas size & viewport on window.onresize

---
<!-- 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 _____

<!-- 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/14075)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

bors-servo commented Nov 28, 2016

💔 Test failed - mac-rel-wpt2

@jdm
Copy link
Member

jdm commented Nov 28, 2016

  ▶ Unexpected subtest result in /webgl/conformance-1.0.3/conformance/rendering/gl-scissor-canvas-dimensions.html:
  │ FAIL [expected PASS] WebGL test #4: at (18, 16) expected: 0,0,0,0 was 192,96,83,11
  │   → assert_true: at (18, 16) expected: 0,0,0,0 was 192,96,83,11 expected true got false
  │ 
  │ reportTestResultsToHarness/<@http://web-platform.test:8000/webgl/conformance-1.0.3/resources/js-test-pre.js:88:9
  │ Test.prototype.step@http://web-platform.test:8000/resources/testharness.js:1406:20
  │ test@http://web-platform.test:8000/resources/testharness.js:501:9
  │ reportTestResultsToHarness@http://web-platform.test:8000/webgl/conformance-1.0.3/resources/js-test-pre.js:87:7
  │ testFailed@http://web-platform.test:8000/webgl/conformance-1.0.3/resources/js-test-pre.js:153:5
  │ checkCanvasRectColor@http://web-platform.test:8000/webgl/conformance-1.0.3/conformance/resources/webgl-test-utils.js:1047:9
  │ checkCanvasRect@http://web-platform.test:8000/webgl/conformance-1.0.3/conformance/resources/webgl-test-utils.js:1073:3
  │ testCanvasSizeChange@http://web-platform.test:8000/webgl/conformance-1.0.3/conformance/rendering/gl-scissor-canvas-dimensions.html:37:3
  └ @http://web-platform.test:8000/webgl/conformance-1.0.3/conformance/rendering/gl-scissor-canvas-dimensions.html:43:1

  ▶ Unexpected subtest result in /webgl/conformance-1.0.3/conformance/rendering/gl-scissor-canvas-dimensions.html:
  │ FAIL [expected PASS] WebGL test #5: at (16, 0) expected: 0,0,0,0 was 128,21,83,11
  │   → assert_true: at (16, 0) expected: 0,0,0,0 was 128,21,83,11 expected true got false
  │ 
  │ reportTestResultsToHarness/<@http://web-platform.test:8000/webgl/conformance-1.0.3/resources/js-test-pre.js:88:9
  │ Test.prototype.step@http://web-platform.test:8000/resources/testharness.js:1406:20
  │ test@http://web-platform.test:8000/resources/testharness.js:501:9
  │ reportTestResultsToHarness@http://web-platform.test:8000/webgl/conformance-1.0.3/resources/js-test-pre.js:87:7
  │ testFailed@http://web-platform.test:8000/webgl/conformance-1.0.3/resources/js-test-pre.js:153:5
  │ checkCanvasRectColor@http://web-platform.test:8000/webgl/conformance-1.0.3/conformance/resources/webgl-test-utils.js:1047:9
  │ checkCanvasRect@http://web-platform.test:8000/webgl/conformance-1.0.3/conformance/resources/webgl-test-utils.js:1073:3
  │ testCanvasSizeChange@http://web-platform.test:8000/webgl/conformance-1.0.3/conformance/rendering/gl-scissor-canvas-dimensions.html:38:3
  └ @http://web-platform.test:8000/webgl/conformance-1.0.3/conformance/rendering/gl-scissor-canvas-dimensions.html:43:1

The only other failure is #14380.

@MortimerGoro MortimerGoro force-pushed the MortimerGoro:webgl-resize branch from f021f24 to c35b17d Nov 30, 2016
@MortimerGoro MortimerGoro force-pushed the MortimerGoro:webgl-resize branch 3 times, most recently from 44a0dff to 4761e51 Nov 30, 2016
@MortimerGoro
Copy link
Contributor Author

MortimerGoro commented Nov 30, 2016

It should be fixed now. Related PR: servo/surfman#75

Why does AppVeyor say that there is a conflict? I ran "./mach cargo-update -p offscreen_gl_context" after a clean rebase onto the latest master

@emilio
Copy link
Member

emilio commented Nov 30, 2016

It seems you need to rebase according to github too... r=me when that's done.

@bors-servo delegate+

@bors-servo
Copy link
Contributor

bors-servo commented Nov 30, 2016

✌️ @MortimerGoro can now approve this pull request

@emilio
Copy link
Member

emilio commented Nov 30, 2016

It seems you need to rebase according to github too... r=me when that's done.

@bors-servo delegate+

@bors-servo
Copy link
Contributor

bors-servo commented Nov 30, 2016

✌️ @MortimerGoro can now approve this pull request

@MortimerGoro MortimerGoro force-pushed the MortimerGoro:webgl-resize branch from 4761e51 to 8ba75c0 Nov 30, 2016
@MortimerGoro
Copy link
Contributor Author

MortimerGoro commented Nov 30, 2016

@emilio ouch, I did the merge upstream/master but forgot the rebase. Signals that it's time to go to bed ;)

@MortimerGoro
Copy link
Contributor Author

MortimerGoro commented Dec 1, 2016

@bors-servo
Copy link
Contributor

bors-servo commented Dec 1, 2016

📌 Commit 8ba75c0 has been approved by MortimerGoro

@bors-servo
Copy link
Contributor

bors-servo commented Dec 1, 2016

Testing commit 8ba75c0 with merge 94eefc4...

bors-servo added a commit that referenced this pull request Dec 1, 2016
Implement WebGLContext resize

<!-- Please describe your changes on the following line: -->

Related PR: servo/webrender#519

Implement WebGLContext resize (canvas.width & canvas.height). I have tested:

- Fixes WebGL apps that initialize canvas size after calling canvas.getContext("webgl")
- Support WebGL apps that change the canvas size & viewport on window.onresize

---
<!-- 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 _____

<!-- 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/14075)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

bors-servo commented Dec 1, 2016

@bors-servo bors-servo merged commit 8ba75c0 into servo:master Dec 1, 2016
3 checks passed
3 checks passed
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
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

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