webgl: Add support for FBO attachments.

This allows many FBO tests to start running as their framebuffers
start coming back as framebuffer complete.
This commit is contained in:
Eric Anholt 2016-09-17 12:20:24 +01:00
parent 989c936e67
commit 6c10d5ca75
17 changed files with 310 additions and 83 deletions

View file

@ -2602,6 +2602,32 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
// FIXME: We need to clear the renderbuffer before it can be
// accessed. See https://github.com/servo/servo/issues/13710
}
fn FramebufferRenderbuffer(&self, target: u32, attachment: u32,
renderbuffertarget: u32,
rb: Option<&WebGLRenderbuffer>) {
if target != constants::FRAMEBUFFER || renderbuffertarget != constants::RENDERBUFFER {
return self.webgl_error(InvalidEnum);
}
match self.bound_framebuffer.get() {
Some(fb) => handle_potential_webgl_error!(self, fb.renderbuffer(attachment, rb)),
None => self.webgl_error(InvalidOperation),
};
}
fn FramebufferTexture2D(&self, target: u32, attachment: u32,
textarget: u32, texture: Option<&WebGLTexture>,
level: i32) {
if target != constants::FRAMEBUFFER {
return self.webgl_error(InvalidEnum);
}
match self.bound_framebuffer.get() {
Some(fb) => handle_potential_webgl_error!(self, fb.texture2d(attachment, textarget, texture, level)),
None => self.webgl_error(InvalidOperation),
};
}
}
pub trait LayoutCanvasWebGLRenderingContextHelpers {