# HG changeset patch
# Parent 50279bda70bb802be20e508ef1f2d7deebf9bc64
diff --git a/gfx/angle/src/libGLESv2/Renderbuffer.cpp b/gfx/angle/src/libGLESv2/Renderbuffer.cpp
--- a/gfx/angle/src/libGLESv2/Renderbuffer.cpp
+++ b/gfx/angle/src/libGLESv2/Renderbuffer.cpp
@@ -241,61 +241,61 @@ Colorbuffer::~Colorbuffer()
     }
 }
 
 bool Colorbuffer::isColorbuffer() const
 {
     return true;
 }
 
-GLuint Colorbuffer::getRedSize() const
+GLuint Colorbuffer::getRedSize()
 {
-    if (mRenderTarget)
+    if (getRenderTarget())
     {
         D3DSURFACE_DESC description;
-        mRenderTarget->GetDesc(&description);
+        getRenderTarget()->GetDesc(&description);
 
         return es2dx::GetRedSize(description.Format);
     }
 
     return 0;
 }
 
-GLuint Colorbuffer::getGreenSize() const
+GLuint Colorbuffer::getGreenSize()
 {
-    if (mRenderTarget)
+    if (getRenderTarget())
     {
         D3DSURFACE_DESC description;
-        mRenderTarget->GetDesc(&description);
+        getRenderTarget()->GetDesc(&description);
 
         return es2dx::GetGreenSize(description.Format);
     }
 
     return 0;
 }
 
-GLuint Colorbuffer::getBlueSize() const
+GLuint Colorbuffer::getBlueSize()
 {
-    if (mRenderTarget)
+    if (getRenderTarget())
     {
         D3DSURFACE_DESC description;
-        mRenderTarget->GetDesc(&description);
+        getRenderTarget()->GetDesc(&description);
 
         return es2dx::GetBlueSize(description.Format);
     }
 
     return 0;
 }
 
-GLuint Colorbuffer::getAlphaSize() const
+GLuint Colorbuffer::getAlphaSize()
 {
-    if (mRenderTarget)
+    if (getRenderTarget())
     {
         D3DSURFACE_DESC description;
-        mRenderTarget->GetDesc(&description);
+        getRenderTarget()->GetDesc(&description);
 
         return es2dx::GetAlphaSize(description.Format);
     }
 
     return 0;
 }
 
 IDirect3DSurface9 *Colorbuffer::getRenderTarget()
diff --git a/gfx/angle/src/libGLESv2/Renderbuffer.h b/gfx/angle/src/libGLESv2/Renderbuffer.h
--- a/gfx/angle/src/libGLESv2/Renderbuffer.h
+++ b/gfx/angle/src/libGLESv2/Renderbuffer.h
@@ -104,20 +104,20 @@ class Colorbuffer : public RenderbufferS
     explicit Colorbuffer(IDirect3DSurface9 *renderTarget);
     explicit Colorbuffer(const Texture* texture);
     Colorbuffer(int width, int height, GLenum format, GLsizei samples);
 
     ~Colorbuffer();
 
     bool isColorbuffer() const;
 
-    GLuint getRedSize() const;
-    GLuint getGreenSize() const;
-    GLuint getBlueSize() const;
-    GLuint getAlphaSize() const;
+    GLuint getRedSize();
+    GLuint getGreenSize();
+    GLuint getBlueSize();
+    GLuint getAlphaSize();
 
     IDirect3DSurface9 *getRenderTarget();
 
   protected:
     IDirect3DSurface9 *mRenderTarget;
 
   private:
     DISALLOW_COPY_AND_ASSIGN(Colorbuffer);
diff --git a/gfx/angle/src/libGLESv2/Texture.cpp b/gfx/angle/src/libGLESv2/Texture.cpp
--- a/gfx/angle/src/libGLESv2/Texture.cpp
+++ b/gfx/angle/src/libGLESv2/Texture.cpp
@@ -1313,16 +1313,19 @@ bool Texture2D::redefineTexture(GLint le
             mTexture = NULL;
             dropTexture();
         }
 
         mWidth = width << level;
         mHeight = height << level;
         mImageArray[0].format = internalFormat;
         mType = type;
+
+        if (mColorbufferProxy.get())
+            mColorbufferProxy->setStorage(new TextureColorbufferProxy(this, GL_TEXTURE_2D));
     }
 
     return !textureOkay;
 }
 
 void Texture2D::setImage(GLint level, GLenum internalFormat, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint unpackAlignment, const void *pixels)
 {
     redefineTexture(level, internalFormat, width, height, type);
@@ -2210,16 +2213,22 @@ bool TextureCubeMap::redefineTexture(GLi
         }
 
         mWidth = width << level;
         mImageArray[0][0].width = width << level;
         mHeight = width << level;
         mImageArray[0][0].height = width << level;
 
         mImageArray[0][0].format = internalFormat;
+
+        for (int i = 0; i < 6; i++)
+        {
+            if (mFaceProxies[i].get())
+                mFaceProxies[i]->setStorage(new TextureColorbufferProxy(this, GL_TEXTURE_CUBE_MAP_POSITIVE_X + i));
+        }
     }
 
     return !textureOkay;
 }
 
 void TextureCubeMap::copyImage(GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLsizei height, Framebuffer *source)
 {
     IDirect3DSurface9 *renderTarget = source->getRenderTarget();
