mirror of
https://github.com/servo/servo.git
synced 2025-08-28 08:38:20 +01:00
Auto merge of #24783 - mmatyas:webgl_fns_readpixels, r=nox
Add support for WebGL2 ReadPixels functions
Adds support for the new ReadPixels functions introduced with WebGL2 and the relevant PixelStorei parameters..
Reference: https://www.khronos.org/registry/webgl/specs/latest/2.0/#3.7.10
<!-- Please describe your changes on the following line: -->
---
This is a work in progress patch, but I think it might be ready for comments. There are a few issues left:
- When the target is the pixel pack buffer, the GL function expects a byte offset as a pointer. In Sparkle the `read_pixels` functions return/work on top of arrays, so for now I've made a [workaround patch](45d8bb263d
). I wonder if that's okay or should we do it somehow differently?
- When writing to the pixel pack buffer, padding bytes on the destination are properly ignored. When writing to client buffers, Sparkle `read_pixels` returns a buffer with 1 byte alignment, which I think is fine (less stuff to move between threads), but requires positioning the rows manually (see the bottom of `read_pixels_into` vs. `ReadPixels_`).
- There are some duplicated code between the array buffer and pixel pack buffer variants, eg. the detection of intersection with the framebuffer. This could be refactored, but that results in a function with `Result<Option<Rect<u32>>, WebGLError>`, which I'm not sure is readable enough to help.
- There is a duplication with the WebGL1 code. WebGL2 introduces row length, skip pixels and skip rows as pixel pack parameters which affect the ReadPixels operation. The helper functions could be moved to be usable in WebGL1, but then these new modifiers would also need to be passed as a function parameter, which is somewhat ugly (but would work). What's your opinion about this?
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
- [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. -->
This commit is contained in:
commit
8e0aa68aaa
9 changed files with 385 additions and 404 deletions
|
@ -1,8 +0,0 @@
|
|||
[read-pixels-into-pixel-pack-buffer.html]
|
||||
expected: CRASH
|
||||
[WebGL test #1: getError expected: INVALID_OPERATION. Was INVALID_ENUM : should generate INVALID_OPERATION if pixel pack buffer is bound]
|
||||
expected: FAIL
|
||||
|
||||
[WebGL test #2: successfullyParsed should be true (of type boolean). Was undefined (of type undefined).]
|
||||
expected: FAIL
|
||||
|
|
@ -1,380 +0,0 @@
|
|||
[read-pixels-pack-parameters.html]
|
||||
expected: ERROR
|
||||
[WebGL test #15: getError expected: INVALID_OPERATION. Was INVALID_ENUM : buffer too small]
|
||||
expected: FAIL
|
||||
|
||||
[WebGL test #125: Padding byte 0 of row 1 changed: expected 1, got 2]
|
||||
expected: FAIL
|
||||
|
||||
[WebGL test #52: Padding byte 0 of row 0 changed: expected 1, got 249]
|
||||
expected: FAIL
|
||||
|
||||
[WebGL test #54: Padding byte 0 of row 1 changed: expected 1, got 2]
|
||||
expected: FAIL
|
||||
|
||||
[WebGL test #44: getError expected: INVALID_OPERATION. Was INVALID_ENUM : buffer too small]
|
||||
expected: FAIL
|
||||
|
||||
[WebGL test #177: first pixel of row 0: expected [249,102,0,255\], got [1,2,3,4\]]
|
||||
expected: FAIL
|
||||
|
||||
[WebGL test #55: last pixel of row 2: expected [2,200,102,255\], got [1,2,3,4\]]
|
||||
expected: FAIL
|
||||
|
||||
[WebGL test #147: Padding byte 4 of row 0 changed: expected 1, got 99]
|
||||
expected: FAIL
|
||||
|
||||
[WebGL test #141: first pixel of row 1: expected [2,200,102,255\], got [1,2,3,4\]]
|
||||
expected: FAIL
|
||||
|
||||
[WebGL test #163: skipped bytes changed at index 0: expected 1 got 249]
|
||||
expected: FAIL
|
||||
|
||||
[WebGL test #148: last pixel of row 1: expected [99,5,76,255\], got [1,2,3,4\]]
|
||||
expected: FAIL
|
||||
|
||||
[WebGL test #85: last pixel of row 2: expected [2,200,102,255\], got [1,2,3,4\]]
|
||||
expected: FAIL
|
||||
|
||||
[WebGL test #88: first pixel of row 1: expected [1,2,3,4\], got [249,102,0,255\]]
|
||||
expected: FAIL
|
||||
|
||||
[WebGL test #131: last pixel of row 1: expected [249,102,0,255\], got [2,200,102,255\]]
|
||||
expected: FAIL
|
||||
|
||||
[WebGL test #115: Padding byte 8 of row 0 changed: expected 1, got 2]
|
||||
expected: FAIL
|
||||
|
||||
[WebGL test #120: getError expected: INVALID_OPERATION. Was INVALID_ENUM : buffer too small]
|
||||
expected: FAIL
|
||||
|
||||
[WebGL test #22: getError expected: INVALID_OPERATION. Was INVALID_ENUM : buffer too small]
|
||||
expected: FAIL
|
||||
|
||||
[WebGL test #92: getError expected: INVALID_OPERATION. Was INVALID_ENUM : buffer too small]
|
||||
expected: FAIL
|
||||
|
||||
[WebGL test #83: last pixel of row 1: expected [249,102,0,255\], got [1,2,3,4\]]
|
||||
expected: FAIL
|
||||
|
||||
[WebGL test #171: getError expected: INVALID_OPERATION. Was NO_ERROR : Invalid pack params combination]
|
||||
expected: FAIL
|
||||
|
||||
[WebGL test #132: Padding byte 0 of row 1 changed: expected 1, got 2]
|
||||
expected: FAIL
|
||||
|
||||
[WebGL test #172: getError expected: INVALID_OPERATION. Was INVALID_ENUM : buffer too small]
|
||||
expected: FAIL
|
||||
|
||||
[WebGL test #124: last pixel of row 1: expected [249,102,0,255\], got [2,200,102,255\]]
|
||||
expected: FAIL
|
||||
|
||||
[WebGL test #170: getError expected: INVALID_OPERATION. Was INVALID_ENUM : buffer too small]
|
||||
expected: FAIL
|
||||
|
||||
[WebGL test #17: getError expected: NO_ERROR. Was INVALID_ENUM : readPixels should succeed]
|
||||
expected: FAIL
|
||||
|
||||
[WebGL test #80: getError expected: INVALID_OPERATION. Was INVALID_ENUM : buffer too small]
|
||||
expected: FAIL
|
||||
|
||||
[WebGL test #180: last pixel of row 1: expected [2,200,102,255\], got [1,2,3,4\]]
|
||||
expected: FAIL
|
||||
|
||||
[WebGL test #110: Padding byte 0 of row 1 changed: expected 1, got 134]
|
||||
expected: FAIL
|
||||
|
||||
[WebGL test #56: getError expected: INVALID_OPERATION. Was INVALID_ENUM : buffer too small]
|
||||
expected: FAIL
|
||||
|
||||
[WebGL test #74: getError expected: INVALID_OPERATION. Was INVALID_ENUM : buffer too small]
|
||||
expected: FAIL
|
||||
|
||||
[WebGL test #58: first pixel of row 1: expected [1,2,3,4\], got [249,102,0,255\]]
|
||||
expected: FAIL
|
||||
|
||||
[WebGL test #89: last pixel of row 1: expected [249,102,0,255\], got [1,2,3,4\]]
|
||||
expected: FAIL
|
||||
|
||||
[WebGL test #152: first pixel of row 1: expected [99,5,76,255\], got [1,2,3,4\]]
|
||||
expected: FAIL
|
||||
|
||||
[WebGL test #108: Padding byte 4 of row 0 changed: expected 1, got 2]
|
||||
expected: FAIL
|
||||
|
||||
[WebGL test #62: getError expected: INVALID_OPERATION. Was INVALID_ENUM : buffer too small]
|
||||
expected: FAIL
|
||||
|
||||
[WebGL test #7: getError expected: INVALID_OPERATION. Was INVALID_ENUM : buffer too small]
|
||||
expected: FAIL
|
||||
|
||||
[WebGL test #158: getError expected: INVALID_OPERATION. Was NO_ERROR : Invalid pack params combination]
|
||||
expected: FAIL
|
||||
|
||||
[WebGL test #166: first pixel of row 1: expected [2,200,102,255\], got [1,2,3,4\]]
|
||||
expected: FAIL
|
||||
|
||||
[WebGL test #144: first pixel of row 2: expected [134,87,234,255\], got [1,2,3,4\]]
|
||||
expected: FAIL
|
||||
|
||||
[WebGL test #106: getError expected: INVALID_OPERATION. Was INVALID_ENUM : buffer too small]
|
||||
expected: FAIL
|
||||
|
||||
[WebGL test #53: last pixel of row 1: expected [249,102,0,255\], got [1,2,3,4\]]
|
||||
expected: FAIL
|
||||
|
||||
[WebGL test #9: getError expected: INVALID_OPERATION. Was INVALID_ENUM : buffer too small]
|
||||
expected: FAIL
|
||||
|
||||
[WebGL test #59: last pixel of row 1: expected [249,102,0,255\], got [1,2,3,4\]]
|
||||
expected: FAIL
|
||||
|
||||
[WebGL test #164: first pixel of row 0: expected [249,102,0,255\], got [1,2,3,4\]]
|
||||
expected: FAIL
|
||||
|
||||
[WebGL test #76: getError expected: INVALID_OPERATION. Was INVALID_ENUM : buffer too small]
|
||||
expected: FAIL
|
||||
|
||||
[WebGL test #34: getError expected: INVALID_OPERATION. Was INVALID_ENUM : buffer too small]
|
||||
expected: FAIL
|
||||
|
||||
[WebGL test #142: last pixel of row 1: expected [1,2,3,4\], got [134,87,234,255\]]
|
||||
expected: FAIL
|
||||
|
||||
[WebGL test #143: Padding byte 0 of row 1 changed: expected 1, got 134]
|
||||
expected: FAIL
|
||||
|
||||
[WebGL test #134: getError expected: INVALID_OPERATION. Was INVALID_ENUM : buffer too small]
|
||||
expected: FAIL
|
||||
|
||||
[WebGL test #91: last pixel of row 2: expected [2,200,102,255\], got [1,2,3,4\]]
|
||||
expected: FAIL
|
||||
|
||||
[WebGL test #40: getError expected: INVALID_OPERATION. Was INVALID_ENUM : buffer too small]
|
||||
expected: FAIL
|
||||
|
||||
[WebGL test #169: last pixel of row 2: expected [134,87,234,255\], got [1,2,3,4\]]
|
||||
expected: FAIL
|
||||
|
||||
[WebGL test #182: last pixel of row 2: expected [134,87,234,255\], got [1,2,3,4\]]
|
||||
expected: FAIL
|
||||
|
||||
[WebGL test #18: getError expected: INVALID_OPERATION. Was INVALID_ENUM : buffer too small]
|
||||
expected: FAIL
|
||||
|
||||
[WebGL test #140: Padding byte 4 of row 0 changed: expected 1, got 2]
|
||||
expected: FAIL
|
||||
|
||||
[WebGL test #174: getError expected: INVALID_OPERATION. Was INVALID_ENUM : buffer too small]
|
||||
expected: FAIL
|
||||
|
||||
[WebGL test #20: getError expected: INVALID_OPERATION. Was INVALID_ENUM : buffer too small]
|
||||
expected: FAIL
|
||||
|
||||
[WebGL test #42: getError expected: INVALID_OPERATION. Was INVALID_ENUM : buffer too small]
|
||||
expected: FAIL
|
||||
|
||||
[WebGL test #136: getError expected: INVALID_OPERATION. Was INVALID_ENUM : buffer too small]
|
||||
expected: FAIL
|
||||
|
||||
[WebGL test #155: getError expected: INVALID_OPERATION. Was INVALID_ENUM : buffer too small]
|
||||
expected: FAIL
|
||||
|
||||
[WebGL test #78: getError expected: INVALID_OPERATION. Was INVALID_ENUM : buffer too small]
|
||||
expected: FAIL
|
||||
|
||||
[WebGL test #104: getError expected: INVALID_OPERATION. Was INVALID_ENUM : buffer too small]
|
||||
expected: FAIL
|
||||
|
||||
[WebGL test #145: getError expected: INVALID_OPERATION. Was INVALID_ENUM : buffer too small]
|
||||
expected: FAIL
|
||||
|
||||
[WebGL test #118: Padding byte 0 of row 1 changed: expected 1, got 134]
|
||||
expected: FAIL
|
||||
|
||||
[WebGL test #165: last pixel of row 0: expected [249,102,0,255\], got [1,2,3,4\]]
|
||||
expected: FAIL
|
||||
|
||||
[WebGL test #11: getError expected: INVALID_OPERATION. Was INVALID_ENUM : buffer too small]
|
||||
expected: FAIL
|
||||
|
||||
[WebGL test #3: getError expected: INVALID_OPERATION. Was INVALID_ENUM : buffer too small]
|
||||
expected: FAIL
|
||||
|
||||
[WebGL test #176: skipped bytes changed at index 0: expected 1 got 249]
|
||||
expected: FAIL
|
||||
|
||||
[WebGL test #94: getError expected: INVALID_OPERATION. Was INVALID_ENUM : buffer too small]
|
||||
expected: FAIL
|
||||
|
||||
[WebGL test #102: getError expected: INVALID_OPERATION. Was INVALID_ENUM : buffer too small]
|
||||
expected: FAIL
|
||||
|
||||
[WebGL test #5: getError expected: INVALID_OPERATION. Was INVALID_ENUM : buffer too small]
|
||||
expected: FAIL
|
||||
|
||||
[WebGL test #126: first pixel of row 2: expected [2,200,102,255\], got [1,2,3,4\]]
|
||||
expected: FAIL
|
||||
|
||||
[WebGL test #24: getError expected: INVALID_OPERATION. Was INVALID_ENUM : buffer too small]
|
||||
expected: FAIL
|
||||
|
||||
[WebGL test #157: getError expected: INVALID_OPERATION. Was INVALID_ENUM : buffer too small]
|
||||
expected: FAIL
|
||||
|
||||
[WebGL test #117: last pixel of row 1: expected [2,200,102,255\], got [1,2,3,4\]]
|
||||
expected: FAIL
|
||||
|
||||
[WebGL test #98: getError expected: INVALID_OPERATION. Was INVALID_ENUM : buffer too small]
|
||||
expected: FAIL
|
||||
|
||||
[WebGL test #161: getError expected: INVALID_OPERATION. Was INVALID_ENUM : buffer too small]
|
||||
expected: FAIL
|
||||
|
||||
[WebGL test #178: last pixel of row 0: expected [249,102,0,255\], got [1,2,3,4\]]
|
||||
expected: FAIL
|
||||
|
||||
[WebGL test #66: getError expected: INVALID_OPERATION. Was INVALID_ENUM : buffer too small]
|
||||
expected: FAIL
|
||||
|
||||
[WebGL test #36: getError expected: INVALID_OPERATION. Was INVALID_ENUM : buffer too small]
|
||||
expected: FAIL
|
||||
|
||||
[WebGL test #32: getError expected: INVALID_OPERATION. Was INVALID_ENUM : buffer too small]
|
||||
expected: FAIL
|
||||
|
||||
[WebGL test #111: first pixel of row 2: expected [134,87,234,255\], got [1,2,3,4\]]
|
||||
expected: FAIL
|
||||
|
||||
[WebGL test #151: Padding byte 4 of row 0 changed: expected 1, got 99]
|
||||
expected: FAIL
|
||||
|
||||
[WebGL test #28: getError expected: INVALID_OPERATION. Was INVALID_ENUM : buffer too small]
|
||||
expected: FAIL
|
||||
|
||||
[WebGL test #179: first pixel of row 1: expected [2,200,102,255\], got [1,2,3,4\]]
|
||||
expected: FAIL
|
||||
|
||||
[WebGL test #112: last pixel of row 2: expected [134,87,234,255\], got [1,2,3,4\]]
|
||||
expected: FAIL
|
||||
|
||||
[WebGL test #82: Padding byte 0 of row 0 changed: expected 1, got 249]
|
||||
expected: FAIL
|
||||
|
||||
[WebGL test #84: Padding byte 0 of row 1 changed: expected 1, got 2]
|
||||
expected: FAIL
|
||||
|
||||
[WebGL test #61: last pixel of row 2: expected [2,200,102,255\], got [1,2,3,4\]]
|
||||
expected: FAIL
|
||||
|
||||
[WebGL test #38: getError expected: INVALID_OPERATION. Was INVALID_ENUM : buffer too small]
|
||||
expected: FAIL
|
||||
|
||||
[WebGL test #64: getError expected: INVALID_OPERATION. Was INVALID_ENUM : buffer too small]
|
||||
expected: FAIL
|
||||
|
||||
[WebGL test #173: getError expected: INVALID_OPERATION. Was NO_ERROR : Invalid pack params combination]
|
||||
expected: FAIL
|
||||
|
||||
[WebGL test #109: last pixel of row 1: expected [2,200,102,255\], got [134,87,234,255\]]
|
||||
expected: FAIL
|
||||
|
||||
[WebGL test #119: last pixel of row 2: expected [134,87,234,255\], got [1,2,3,4\]]
|
||||
expected: FAIL
|
||||
|
||||
[WebGL test #86: getError expected: INVALID_OPERATION. Was INVALID_ENUM : buffer too small]
|
||||
expected: FAIL
|
||||
|
||||
[WebGL test #153: getError expected: INVALID_OPERATION. Was INVALID_ENUM : buffer too small]
|
||||
expected: FAIL
|
||||
|
||||
[WebGL test #90: first pixel of row 2: expected [1,2,3,4\], got [2,200,102,255\]]
|
||||
expected: FAIL
|
||||
|
||||
[WebGL test #68: getError expected: INVALID_OPERATION. Was INVALID_ENUM : buffer too small]
|
||||
expected: FAIL
|
||||
|
||||
[WebGL test #122: Padding byte 0 of row 0 changed: expected 1, got 249]
|
||||
expected: FAIL
|
||||
|
||||
[WebGL test #116: first pixel of row 1: expected [1,2,3,4\], got [2,200,102,255\]]
|
||||
expected: FAIL
|
||||
|
||||
[WebGL test #113: getError expected: INVALID_OPERATION. Was INVALID_ENUM : buffer too small]
|
||||
expected: FAIL
|
||||
|
||||
[WebGL test #26: getError expected: INVALID_OPERATION. Was INVALID_ENUM : buffer too small]
|
||||
expected: FAIL
|
||||
|
||||
[WebGL test #96: getError expected: INVALID_OPERATION. Was INVALID_ENUM : buffer too small]
|
||||
expected: FAIL
|
||||
|
||||
[WebGL test #46: getError expected: INVALID_OPERATION. Was INVALID_ENUM : buffer too small]
|
||||
expected: FAIL
|
||||
|
||||
[WebGL test #123: first pixel of row 1: expected [249,102,0,255\], got [1,2,3,4\]]
|
||||
expected: FAIL
|
||||
|
||||
[WebGL test #183: successfullyParsed should be true (of type boolean). Was undefined (of type undefined).]
|
||||
expected: FAIL
|
||||
|
||||
[WebGL test #168: first pixel of row 2: expected [134,87,234,255\], got [1,2,3,4\]]
|
||||
expected: FAIL
|
||||
|
||||
[WebGL test #60: first pixel of row 2: expected [1,2,3,4\], got [2,200,102,255\]]
|
||||
expected: FAIL
|
||||
|
||||
[WebGL test #128: getError expected: INVALID_OPERATION. Was INVALID_ENUM : buffer too small]
|
||||
expected: FAIL
|
||||
|
||||
[WebGL test #72: getError expected: INVALID_OPERATION. Was INVALID_ENUM : buffer too small]
|
||||
expected: FAIL
|
||||
|
||||
[WebGL test #13: getError expected: INVALID_OPERATION. Was INVALID_ENUM : buffer too small]
|
||||
expected: FAIL
|
||||
|
||||
[WebGL test #130: Padding byte 4 of row 0 changed: expected 1, got 249]
|
||||
expected: FAIL
|
||||
|
||||
[WebGL test #167: last pixel of row 1: expected [2,200,102,255\], got [1,2,3,4\]]
|
||||
expected: FAIL
|
||||
|
||||
[WebGL test #160: getError expected: INVALID_OPERATION. Was NO_ERROR : Invalid pack params combination]
|
||||
expected: FAIL
|
||||
|
||||
[WebGL test #100: getError expected: INVALID_OPERATION. Was INVALID_ENUM : buffer too small]
|
||||
expected: FAIL
|
||||
|
||||
[WebGL test #70: getError expected: INVALID_OPERATION. Was INVALID_ENUM : buffer too small]
|
||||
expected: FAIL
|
||||
|
||||
[WebGL test #181: first pixel of row 2: expected [134,87,234,255\], got [1,2,3,4\]]
|
||||
expected: FAIL
|
||||
|
||||
[WebGL test #50: getError expected: INVALID_OPERATION. Was INVALID_ENUM : buffer too small]
|
||||
expected: FAIL
|
||||
|
||||
[WebGL test #48: getError expected: INVALID_OPERATION. Was INVALID_ENUM : buffer too small]
|
||||
expected: FAIL
|
||||
|
||||
[WebGL test #1: getError expected: INVALID_OPERATION. Was INVALID_ENUM : buffer too small]
|
||||
expected: FAIL
|
||||
|
||||
[WebGL test #149: getError expected: INVALID_OPERATION. Was INVALID_ENUM : buffer too small]
|
||||
expected: FAIL
|
||||
|
||||
[WebGL test #133: last pixel of row 2: expected [2,200,102,255\], got [1,2,3,4\]]
|
||||
expected: FAIL
|
||||
|
||||
[WebGL test #159: getError expected: INVALID_OPERATION. Was INVALID_ENUM : buffer too small]
|
||||
expected: FAIL
|
||||
|
||||
[WebGL test #30: getError expected: INVALID_OPERATION. Was INVALID_ENUM : buffer too small]
|
||||
expected: FAIL
|
||||
|
||||
[WebGL test #127: last pixel of row 2: expected [2,200,102,255\], got [1,2,3,4\]]
|
||||
expected: FAIL
|
||||
|
||||
[WebGL test #138: getError expected: INVALID_OPERATION. Was INVALID_ENUM : buffer too small]
|
||||
expected: FAIL
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue