webgl: Add destructors for texture, program, shader, buffer and framebuffer

This allows to cleanup resources earlier if they stop being used. Right
now all resources were cleaned up when the context was destroyed, this is
a slightly better approach.

We ignore the possible failure of the send() call, since we don't keep
track of these resources from the `WebGLRenderingContext` structure, so
a texture could be destroyed after the context and give us problems.
This commit is contained in:
Emilio Cobos Álvarez 2015-11-01 13:29:46 +01:00
parent 601169c0e5
commit 95a0d0584f
6 changed files with 36 additions and 6 deletions

View file

@ -59,7 +59,7 @@ impl WebGLRenderbuffer {
pub fn delete(&self) {
if !self.is_deleted.get() {
self.is_deleted.set(true);
self.renderer.send(CanvasMsg::WebGL(CanvasWebGLMsg::DeleteRenderbuffer(self.id))).unwrap();
let _ = self.renderer.send(CanvasMsg::WebGL(CanvasWebGLMsg::DeleteRenderbuffer(self.id)));
}
}
}