webgl: Don't update texture attachment state if we throw an error.

If we're going to return from this function without updating the
underlying GL state because of a WebGLError, we shouldn't have updated
our shadow of the GL state.
This commit is contained in:
Eric Anholt 2016-11-05 10:30:40 -07:00
parent 59634cf78e
commit bf5a3db745

View file

@ -190,11 +190,6 @@ impl WebGLFramebuffer {
// Note, from the GLES 2.0.25 spec, page 113:
// "If texture is zero, then textarget and level are ignored."
Some(texture) => {
*binding.borrow_mut() = Some(WebGLFramebufferAttachment::Texture {
texture: JS::from_ref(texture),
level: level }
);
// From the GLES 2.0.25 spec, page 113:
//
// "level specifies the mipmap level of the texture image
@ -234,6 +229,11 @@ impl WebGLFramebuffer {
_ => return Err(WebGLError::InvalidOperation),
}
*binding.borrow_mut() = Some(WebGLFramebufferAttachment::Texture {
texture: JS::from_ref(texture),
level: level }
);
Some(texture.id())
}