aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/webglrenderbuffer.rs
diff options
context:
space:
mode:
authorMátyás Mustoha <matyas.mustoha@h-lab.eu>2020-02-14 11:57:11 +0100
committerMátyás Mustoha <matyas.mustoha@h-lab.eu>2020-02-14 12:10:16 +0100
commit796ee705976f8072032a0fc88579ca18aed85999 (patch)
tree96f82216a560567509a08609cf22f33a127535c0 /components/script/dom/webglrenderbuffer.rs
parent833485887e9e8a4ae4beb71c473df101a4106ee4 (diff)
downloadservo-796ee705976f8072032a0fc88579ca18aed85999.tar.gz
servo-796ee705976f8072032a0fc88579ca18aed85999.zip
Add initial support for WebGL2 read framebuffer
Adds support for binding to the read framebuffer slot and querying its status.
Diffstat (limited to 'components/script/dom/webglrenderbuffer.rs')
-rw-r--r--components/script/dom/webglrenderbuffer.rs24
1 files changed, 14 insertions, 10 deletions
diff --git a/components/script/dom/webglrenderbuffer.rs b/components/script/dom/webglrenderbuffer.rs
index ca75f83c336..8c8164f6243 100644
--- a/components/script/dom/webglrenderbuffer.rs
+++ b/components/script/dom/webglrenderbuffer.rs
@@ -96,20 +96,24 @@ impl WebGLRenderbuffer {
if !self.is_deleted.get() {
self.is_deleted.set(true);
+ let context = self.upcast::<WebGLObject>().context();
+
/*
- 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.
- - GLES 2.0, 4.4.3, "Attaching Renderbuffer Images to a Framebuffer"
- */
- let currently_bound_framebuffer =
- self.upcast::<WebGLObject>().context().bound_framebuffer();
- if let Some(fb) = currently_bound_framebuffer {
+ If a renderbuffer object is deleted while its image is attached to one or more
+ attachment points in a currently bound framebuffer object, then it is as if
+ FramebufferRenderbuffer had been called, with a renderbuffer of zero, for each
+ attachment point to which this image was attached in that framebuffer object.
+ In other words,the renderbuffer image is first detached from all attachment points
+ in that frame-buffer object.
+ - GLES 3.0, 4.4.2.3, "Attaching Renderbuffer Images to a Framebuffer"
+ */
+ if let Some(fb) = context.get_draw_framebuffer_slot().get() {
+ let _ = fb.detach_renderbuffer(self);
+ }
+ if let Some(fb) = context.get_read_framebuffer_slot().get() {
let _ = fb.detach_renderbuffer(self);
}
- let context = self.upcast::<WebGLObject>().context();
let cmd = WebGLCommand::DeleteRenderbuffer(self.id);
if fallible {
context.send_command_ignored(cmd);