Bug 615003 - copyTex(Sub)Image methods also need to check/init the FBO - r=vlad
authorBenoit Jacob <bjacob@mozilla.com>
Mon, 06 Dec 2010 06:34:35 -0500
changeset 58666 7125f195f026dd64c23caee7a5db671c9e62c9eb
parent 58665 7a5f86926fe4e31f038f711c758d570d8c0f4d91
child 58667 ed4a6c4db3580d72c262d4ead6b7a480abdd9ae3
push id1
push usershaver@mozilla.com
push dateTue, 04 Jan 2011 17:58:04 +0000
reviewersvlad
bugs615003
milestone2.0b8pre
Bug 615003 - copyTex(Sub)Image methods also need to check/init the FBO - r=vlad
content/canvas/src/WebGLContextGL.cpp
--- a/content/canvas/src/WebGLContextGL.cpp
+++ b/content/canvas/src/WebGLContextGL.cpp
@@ -616,16 +616,20 @@ WebGLContext::CopyTexImage2D(WebGLenum t
         if (!(is_pot_assuming_nonnegative(width) &&
               is_pot_assuming_nonnegative(height)))
             return ErrorInvalidValue("copyTexImage2D: with level > 0, width and height must be powers of two");
     }
 
     if (!CanvasUtils::CheckSaneSubrectSize(x,y,width, height, mWidth, mHeight))
         return ErrorInvalidOperation("CopyTexImage2D: copied rectangle out of bounds");
 
+
+    if (mBoundFramebuffer && !mBoundFramebuffer->CheckAndInitializeRenderbuffers())
+        return NS_OK;
+
     WebGLTexture *tex = activeBoundTextureForTarget(target);
     if (!tex)
         return ErrorInvalidOperation("copyTexImage2D: no texture bound to this target");
 
     tex->SetImageInfo(target, level, width, height);
 
     MakeContextCurrent();
 
@@ -655,16 +659,19 @@ WebGLContext::CopyTexSubImage2D(WebGLenu
             break;
         default:
             return ErrorInvalidEnumInfo("CopyTexSubImage2D: target", target);
     }
 
     if (!CanvasUtils::CheckSaneSubrectSize(x,y,width, height, mWidth, mHeight))
         return ErrorInvalidOperation("CopyTexSubImage2D: copied rectangle out of bounds");
 
+    if (mBoundFramebuffer && !mBoundFramebuffer->CheckAndInitializeRenderbuffers())
+        return NS_OK;
+
     MakeContextCurrent();
 
     gl->fCopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height);
 
     return NS_OK;
 }