Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

webgl: Add basic support for framebuffer attachments #13872

Merged
merged 7 commits into from Oct 28, 2016
Next

webgl: Throw an error when binding a deleted framebuffer.

The spec was recently changed to clarify that this should throw an
error.
  • Loading branch information
anholt committed Oct 25, 2016
commit 5fda437e886834f715e692272239f273a216c16e
@@ -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() {

This comment has been minimized.

Copy link
@emilio

emilio Oct 21, 2016

Member

The spec changed and this case should be ignored now (don't change the state of the binding), plus produce an INVALID_OP.

// 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);
}
}

ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.