mirror of
https://github.com/servo/servo.git
synced 2025-08-05 05:30:08 +01:00
Auto merge of #25975 - mmatyas:webgl_fns_read_draw_buffers_p2, r=jdm
Do not try to read pixels from an FBO without read buffer
A follow up to #25905, this adds another check to the WebGL2 ReadPixels implementation to fix
an OpenGL invalid operation crash when the method is called on a bound framebuffer that has no read buffer.
<!-- Please describe your changes on the following line: -->
cc @jdm @zakorgy
However, it seems there's an issue with the headless mode: when ReadBuffer is called on the default framebuffer with the value `GL_BACK`, like [here](e1103176e3/tests/wpt/webgl/tests/conformance2/renderbuffers/readbuffer.html (L77)
), in headless mode an invalid operation is generated. In non-headless mode the whole test completes successfully:

---
<!-- 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
59c68e2eb7
2 changed files with 5 additions and 7 deletions
|
@ -349,7 +349,11 @@ impl WebGL2RenderingContext {
|
|||
}
|
||||
|
||||
let fb_slot = self.base.get_draw_framebuffer_slot();
|
||||
if fb_slot.get().is_none() && self.default_fb_readbuffer.get() == constants::NONE {
|
||||
let fb_readbuffer_valid = match fb_slot.get() {
|
||||
Some(fb) => fb.attachment(fb.read_buffer()).is_some(),
|
||||
None => self.default_fb_readbuffer.get() != constants::NONE,
|
||||
};
|
||||
if !fb_readbuffer_valid {
|
||||
return self.base.webgl_error(InvalidOperation);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,8 +1,2 @@
|
|||
[readbuffer.html]
|
||||
expected: TIMEOUT
|
||||
[WebGL test #3: gl.getParameter(gl.READ_BUFFER) should be 1029 (of type number). Was null (of type object).]
|
||||
expected: FAIL
|
||||
|
||||
[WebGL test #4: successfullyParsed should be true (of type boolean). Was undefined (of type undefined).]
|
||||
expected: FAIL
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue