Bug 615003 - copyTex(Sub)Image methods also need to check/init the FBO - r=vlad
--- 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;
}