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
This commit is contained in:
Mátyás Mustoha 2019-10-28 13:12:41 +01:00
parent ea32495504
commit 8fefa23019
9 changed files with 385 additions and 404 deletions

View file

@ -33,7 +33,7 @@ num-traits = "0.2"
raqote = {git = "https://github.com/jrmuizel/raqote", optional = true}
pixels = {path = "../pixels"}
servo_config = {path = "../config"}
sparkle = "0.1.8"
sparkle = "0.1.12"
webrender = {git = "https://github.com/servo/webrender"}
webrender_api = {git = "https://github.com/servo/webrender", features = ["ipc"]}
webrender_traits = {path = "../webrender_traits"}

View file

@ -1166,6 +1166,17 @@ impl WebGLImpl {
);
sender.send(&pixels).unwrap();
},
WebGLCommand::ReadPixelsPP(rect, format, pixel_type, offset) => unsafe {
gl.read_pixels_into_pixel_pack_buffer(
rect.origin.x,
rect.origin.y,
rect.size.width,
rect.size.height,
format,
pixel_type,
offset,
);
},
WebGLCommand::RenderbufferStorage(target, format, width, height) => {
gl.renderbuffer_storage(target, format, width, height)
},