From bf5a3db745151f79aaa6cd45d4a1ebd4648bcb62 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Sat, 5 Nov 2016 10:30:40 -0700 Subject: [PATCH] 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. --- components/script/dom/webglframebuffer.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/components/script/dom/webglframebuffer.rs b/components/script/dom/webglframebuffer.rs index 029c794616c..44f9586adb1 100644 --- a/components/script/dom/webglframebuffer.rs +++ b/components/script/dom/webglframebuffer.rs @@ -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()) }