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

@ -380,7 +380,7 @@ impl WebGLRenderingContext {
//
// The WebGL spec mentions a couple more operations that trigger
// this: clear() and getParameter(IMPLEMENTATION_COLOR_READ_*).
fn validate_framebuffer(&self) -> WebGLResult<()> {
pub fn validate_framebuffer(&self) -> WebGLResult<()> {
match self.bound_framebuffer.get() {
Some(fb) => match fb.check_status_for_rendering() {
CompleteForRendering::Complete => Ok(()),
@ -481,7 +481,7 @@ impl WebGLRenderingContext {
self.send_command(WebGLCommand::VertexAttrib(indx, x, y, z, w));
}
fn get_current_framebuffer_size(&self) -> Option<(i32, i32)> {
pub fn get_current_framebuffer_size(&self) -> Option<(i32, i32)> {
match self.bound_framebuffer.get() {
Some(fb) => return fb.size(),
@ -490,6 +490,10 @@ impl WebGLRenderingContext {
}
}
pub fn get_texture_packing_alignment(&self) -> u8 {
self.texture_packing_alignment.get()
}
// LINEAR filtering may be forbidden when using WebGL extensions.
// https://www.khronos.org/registry/webgl/extensions/OES_texture_float_linear/
fn validate_filterable_texture(