mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
webgl: Throw an error when binding a deleted framebuffer.
The spec was recently changed to clarify that this should throw an error.
This commit is contained in:
parent
6029c927ee
commit
5fda437e88
1 changed files with 12 additions and 2 deletions
|
@ -804,13 +804,23 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
|
|||
return self.webgl_error(InvalidOperation);
|
||||
}
|
||||
|
||||
self.bound_framebuffer.set(framebuffer);
|
||||
if let Some(framebuffer) = framebuffer {
|
||||
framebuffer.bind(target)
|
||||
if framebuffer.is_deleted() {
|
||||
// From the WebGL spec:
|
||||
//
|
||||
// "An attempt to bind a deleted framebuffer will
|
||||
// generate an INVALID_OPERATION error, and the
|
||||
// current binding will remain untouched."
|
||||
return self.webgl_error(InvalidOperation);
|
||||
} else {
|
||||
framebuffer.bind(target);
|
||||
self.bound_framebuffer.set(Some(framebuffer));
|
||||
}
|
||||
} else {
|
||||
// Bind the default framebuffer
|
||||
let cmd = WebGLCommand::BindFramebuffer(target, WebGLFramebufferBindingRequest::Default);
|
||||
self.ipc_renderer.send(CanvasMsg::WebGL(cmd)).unwrap();
|
||||
self.bound_framebuffer.set(framebuffer);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue