aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/webglrenderingcontext.rs
diff options
context:
space:
mode:
authorJosh Matthews <josh@joshmatthews.net>2018-08-24 16:10:28 -0400
committerJosh Matthews <josh@joshmatthews.net>2018-09-10 16:31:30 -0400
commitbb8d9ba74c024a317fbbd49811541632404ef51c (patch)
treedd7e34c9665c5f4e5935d947e6de8129654887a4 /components/script/dom/webglrenderingcontext.rs
parent1b08dd523274b1fb346b413cb986cd47409f3aa7 (diff)
downloadservo-bb8d9ba74c024a317fbbd49811541632404ef51c.tar.gz
servo-bb8d9ba74c024a317fbbd49811541632404ef51c.zip
webgl: Ensure that depth and stencil attachments are rebound after messing with DEPTH_STENCIL attachments.
Diffstat (limited to 'components/script/dom/webglrenderingcontext.rs')
-rw-r--r--components/script/dom/webglrenderingcontext.rs34
1 files changed, 8 insertions, 26 deletions
diff --git a/components/script/dom/webglrenderingcontext.rs b/components/script/dom/webglrenderingcontext.rs
index 6ca010a0b6e..19b0c20f260 100644
--- a/components/script/dom/webglrenderingcontext.rs
+++ b/components/script/dom/webglrenderingcontext.rs
@@ -1072,6 +1072,10 @@ impl WebGLRenderingContext {
stencil: clear_bits & constants::STENCIL_BUFFER_BIT != 0,
});
}
+
+ pub fn bound_framebuffer(&self) -> Option<DomRoot<WebGLFramebuffer>> {
+ self.bound_framebuffer.get()
+ }
}
impl Drop for WebGLRenderingContext {
@@ -1587,6 +1591,10 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
renderbuffer.bind(target);
}
_ => {
+ if renderbuffer.is_some() {
+ self.webgl_error(InvalidOperation);
+ }
+
self.bound_renderbuffer.set(None);
// Unbind the currently bound renderbuffer
self.send_command(WebGLCommand::BindRenderbuffer(target, None));
@@ -1986,20 +1994,6 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
handle_potential_webgl_error!(self, self.validate_ownership(renderbuffer), return);
handle_object_deletion!(self, self.bound_renderbuffer, renderbuffer,
Some(WebGLCommand::BindRenderbuffer(constants::RENDERBUFFER, None)));
- // From the GLES 2.0.25 spec, page 113:
- //
- // "If a renderbuffer object is deleted while its
- // image is attached to the currently bound
- // framebuffer, then it is as if
- // FramebufferRenderbuffer had been called, with a
- // renderbuffer of 0, for each attachment point to
- // which this image was attached in the currently
- // bound framebuffer."
- //
- if let Some(fb) = self.bound_framebuffer.get() {
- fb.detach_renderbuffer(renderbuffer);
- }
-
renderbuffer.delete()
}
}
@@ -2035,18 +2029,6 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
));
}
- // From the GLES 2.0.25 spec, page 113:
- //
- // "If a texture object is deleted while its image is
- // attached to the currently bound framebuffer, then
- // it is as if FramebufferTexture2D had been called,
- // with a texture of 0, for each attachment point to
- // which this image was attached in the currently
- // bound framebuffer."
- if let Some(fb) = self.bound_framebuffer.get() {
- fb.detach_texture(texture);
- }
-
texture.delete()
}
}