Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upAdd support for WebGL2 ReadPixels functions #24783
Conversation
highfive
commented
Nov 19, 2019
|
Heads up! This PR modifies the following files:
|
highfive
commented
Nov 19, 2019
|
Started a review but have yet to finish it. |
|
|
e85c8dc
to
0ef11db
|
Updated to master, and also opened a pull request to Sparkle. |
|
@nox Re-review ping. |
|
I have some concerns about the sparkle changes, but the code here looks good. We need to publish sparkle and make the corresponding manifest changes here and then it's ready to be landed. |
|
Sparkle has been published. |
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
|
Ok, updated with the Sparkle related changes. |
|
@bors-servo 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](mmatyas/sparkle@45d8bb2). 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. -->
|
|
mmatyas commentedNov 19, 2019
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
This is a work in progress patch, but I think it might be ready for comments. There are a few issues left:
read_pixelsfunctions return/work on top of arrays, so for now I've made a workaround patch. I wonder if that's okay or should we do it somehow differently?read_pixelsreturns 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 ofread_pixels_intovs.ReadPixels_).Result<Option<Rect<u32>>, WebGLError>, which I'm not sure is readable enough to help.cc @jdm @zakorgy
./mach build -ddoes not report any errors./mach test-tidydoes not report any errors