Bug 1258061 - Clarify FramebufferTexture2D handling for tex2D and cubeMap; r=jgilbert
authorDaosheng Mu <daoshengmu@gmail.com>
Wed, 30 Mar 2016 16:41:42 +0800
changeset 347732 f001332ad789062c28a73f0bef1ace98569c5d50
parent 347731 725a9dc9e9bf0dedbbfabe8481b28eaad329ac46
child 347733 ff6c2806545ebe2f2fa9ea9fd5b0d65cba478d59
push id14653
push userolivier@olivieryiptong.com
push dateTue, 05 Apr 2016 19:21:01 +0000
reviewersjgilbert
bugs1258061
milestone48.0a1
Bug 1258061 - Clarify FramebufferTexture2D handling for tex2D and cubeMap; r=jgilbert MozReview-Commit-ID: B2oAcP6zzKZ
dom/canvas/WebGLFramebuffer.cpp
--- a/dom/canvas/WebGLFramebuffer.cpp
+++ b/dom/canvas/WebGLFramebuffer.cpp
@@ -625,19 +625,18 @@ WebGLFramebuffer::FramebufferTexture2D(G
 
     if (tex) {
         if (!tex->HasEverBeenBound()) {
             mContext->ErrorInvalidOperation("framebufferTexture2D: the texture"
                                             " is not the name of a texture.");
             return;
         }
 
-        bool isTexture2D = tex->Target() == LOCAL_GL_TEXTURE_2D;
-        bool isTexTarget2D = texImageTarget == LOCAL_GL_TEXTURE_2D;
-        if (isTexture2D != isTexTarget2D) {
+        const TexTarget destTexTarget = TexImageTargetToTexTarget(texImageTarget);
+        if (tex->Target() != destTexTarget) {
             mContext->ErrorInvalidOperation("framebufferTexture2D: Mismatched"
                                             " texture and texture target.");
             return;
         }
     }
 
     RefPtr<WebGLTexture> tex_ = tex; // Bug 1201275
     const auto fnAttach = [this, &tex_, texImageTarget, level](GLenum attachment) {