Add support for WebGL2 framebuffer attachments

Adds an initial implementation for the framebuffer attachments
introduced with WebGL2 and the related enums and constrains checks.
This commit is contained in:
Mátyás Mustoha 2020-02-20 13:32:38 +01:00
parent f5ff38b875
commit b41805a920
11 changed files with 463 additions and 433 deletions

View file

@ -276,6 +276,10 @@ impl WebGLRenderingContext {
}
}
pub fn webgl_version(&self) -> WebGLVersion {
self.webgl_version
}
pub fn limits(&self) -> &GLLimits {
&self.limits
}
@ -4266,6 +4270,15 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
return self.webgl_error(InvalidEnum);
}
// From the GLES 2.0.25 spec, page 113:
//
// "level specifies the mipmap level of the texture image
// to be attached to the framebuffer and must be
// 0. Otherwise, INVALID_VALUE is generated."
if level != 0 {
return self.webgl_error(InvalidValue);
}
match self.bound_draw_framebuffer.get() {
Some(fb) => handle_potential_webgl_error!(
self,