Bug 629538 - Upgrade ANGLE to r550 - 2/3 - r=vlad, a=blocking2.0
authorBenoit Jacob <bjacob@mozilla.com>
Sat, 29 Jan 2011 22:31:21 -0500
changeset 61599 af518fbee5648062828ba6bc074d7812820738fd
parent 61598 268957af2047b4565587b46f052669b18b9079fd
child 61600 e0cc3c15ef087fccbcede7409fcc6c2d66a85600
push idunknown
push userunknown
push dateunknown
reviewersvlad, blocking2.0
bugs629538
milestone2.0b11pre
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 629538 - Upgrade ANGLE to r550 - 2/3 - r=vlad, a=blocking2.0
gfx/angle/README.mozilla
gfx/angle/angle-fixes.patch
gfx/angle/angle-nspr-misc.patch
gfx/angle/angle-shared.patch
gfx/angle/include/GLSLANG/ShaderLang.h
gfx/angle/src/compiler/osinclude.h
gfx/angle/src/libGLESv2/Renderbuffer.cpp
gfx/angle/src/libGLESv2/Renderbuffer.h
gfx/angle/src/libGLESv2/Texture.cpp
--- a/gfx/angle/README.mozilla
+++ b/gfx/angle/README.mozilla
@@ -1,21 +1,19 @@
 This is the ANGLE project, from http://code.google.com/p/angleproject/.
 
-Current revision: r515
+Current revision: r550
 
-Local patches:
+Applied local patches:
     angle-shared.patch - add declspec dllexport/dllimport support on win32
 
     angle-fixes.patch - fix angle issues 51 & 52
 
     angle-nspr-misc.patch - don't bother with ANGLE_OS detection with NSPR
 
-    angle-pbuffers.patch - add pbuffer support to ANGLE, and d3d texture handle query (angle issue 91)
-
 == Visual Studio Solution Files ==
 
 The VS solution/project files that are used to build ANGLE are built
 with VS2008 in upstream ANGLE.  Because our build machines use VS2005,
 they need to be downgraded using
 http://www.emmet-gray.com/Articles/ProjectConverter.htm before being
 checked in with an ANGLE update.
 
--- a/gfx/angle/angle-fixes.patch
+++ b/gfx/angle/angle-fixes.patch
@@ -1,116 +1,153 @@
-Fixes for angle defects 51 and 52
-
-Index: src/libGLESv2/Texture.cpp
-===================================================================
---- src/libGLESv2/Texture.cpp	(revision 474)
-+++ src/libGLESv2/Texture.cpp	(working copy)
-@@ -1207,6 +1207,9 @@
-         mHeight = height << level;
-         mImageArray[0].format = internalFormat;
-         mType = type;
-+
-+        if (mColorbufferProxy.get())
-+            mColorbufferProxy->setStorage(new TextureColorbufferProxy(this, GL_TEXTURE_2D));
+# 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()
      }
+ }
  
-     return !textureOkay;
-@@ -2081,6 +2084,12 @@
-         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;
-Index: src/libGLESv2/Renderbuffer.cpp
-===================================================================
---- src/libGLESv2/Renderbuffer.cpp	(revision 474)
-+++ src/libGLESv2/Renderbuffer.cpp	(working copy)
-@@ -246,12 +246,12 @@
+ 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);
      }
-@@ -259,12 +259,12 @@
+ 
      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);
      }
-@@ -272,12 +272,12 @@
+ 
      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);
      }
-@@ -285,12 +285,12 @@
+ 
      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);
      }
-Index: src/libGLESv2/Renderbuffer.h
-===================================================================
---- src/libGLESv2/Renderbuffer.h	(revision 474)
-+++ src/libGLESv2/Renderbuffer.h	(working copy)
-@@ -109,10 +109,10 @@
+ 
+     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();
--- a/gfx/angle/angle-nspr-misc.patch
+++ b/gfx/angle/angle-nspr-misc.patch
@@ -1,17 +1,26 @@
 # HG changeset patch
-# Parent f0e6e4c311dd940147f1589d72cc87f8ce755697
+# Parent 3f4e2a35c49bb865018798a76b62c169d8e3537b
 diff --git a/gfx/angle/src/compiler/osinclude.h b/gfx/angle/src/compiler/osinclude.h
 --- a/gfx/angle/src/compiler/osinclude.h
 +++ b/gfx/angle/src/compiler/osinclude.h
-@@ -12,8 +12,10 @@
+@@ -7,17 +7,19 @@
+ #ifndef __OSINCLUDE_H
+ #define __OSINCLUDE_H
+ 
+ //
+ // This file contains contains os-specific datatypes and
  // declares any os-specific functions.
  //
  
 -#if defined(_WIN32) || defined(_WIN64)
 +#if defined(ANGLE_USE_NSPR)
 +/* no need to define anything when using NSPR */
 +#elif defined(_WIN32) || defined(_WIN64)
  #define ANGLE_OS_WIN
  #elif defined(__APPLE__) || defined(__linux__) || \
        defined(__FreeBSD__) || defined(__OpenBSD__) || \
        defined(__sun)
+ #define ANGLE_OS_POSIX
+ #else
+ #error Unsupported platform.
+ #endif
--- a/gfx/angle/angle-shared.patch
+++ b/gfx/angle/angle-shared.patch
@@ -1,8 +1,10 @@
+# HG changeset patch
+# Parent 0f2a334e5049bffe457bd31d3d8f5550af7ba299
 diff --git a/gfx/angle/include/GLSLANG/ShaderLang.h b/gfx/angle/include/GLSLANG/ShaderLang.h
 --- a/gfx/angle/include/GLSLANG/ShaderLang.h
 +++ b/gfx/angle/include/GLSLANG/ShaderLang.h
 @@ -1,16 +1,36 @@
  //
  // Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
  // Use of this source code is governed by a BSD-style license that can be
  // found in the LICENSE file.
@@ -33,41 +35,17 @@ diff --git a/gfx/angle/include/GLSLANG/S
  //
  // This is the platform independent interface between an OGL driver
  // and the shading language compiler.
  //
  
  #ifdef __cplusplus
  extern "C" {
  #endif
-@@ -73,21 +93,21 @@ typedef enum {
-   SH_OBJECT_CODE            = 0x0004,
-   SH_ATTRIBUTES_UNIFORMS    = 0x0008
- } ShCompileOptions;
- 
- //
- // Driver must call this first, once, before doing any other
- // compiler operations.
- //
--int ShInitialize();
-+ANGLE_API int ShInitialize();
- //
- // Driver should call this at shutdown.
- //
--int ShFinalize();
-+ANGLE_API int ShFinalize();
- 
- //
- // Implementation dependent built-in resources (constants and extensions).
- // The names for these resources has been obtained by stripping gl_/GL_.
- //
- typedef struct
- {
-     // Constants.
-@@ -103,17 +123,17 @@ typedef struct
+@@ -107,17 +127,17 @@ typedef struct
      // Extensions.
      // Set to 1 to enable the extension, else 0.
      int OES_standard_derivatives;
  } ShBuiltInResources;
  
  //
  // Initialize built-in resources with minimum expected values.
  //
@@ -76,17 +54,17 @@ diff --git a/gfx/angle/include/GLSLANG/S
  
  //
  // ShHandle held by but opaque to the driver.  It is allocated,
  // managed, and de-allocated by the compiler. It's contents 
  // are defined by and used by the compiler.
  //
  // If handle creation fails, 0 will be returned.
  //
-@@ -123,19 +143,19 @@ typedef void* ShHandle;
+@@ -127,19 +147,19 @@ typedef void* ShHandle;
  // Driver calls these to create and destroy compiler objects.
  //
  // Returns the handle of constructed compiler.
  // Parameters:
  // type: Specifies the type of shader - SH_FRAGMENT_SHADER or SH_VERTEX_SHADER.
  // spec: Specifies the language spec the compiler must conform to -
  //       SH_GLES2_SPEC or SH_WEBGL_SPEC.
  // resources: Specifies the built-in resources.
@@ -98,17 +76,17 @@ diff --git a/gfx/angle/include/GLSLANG/S
  
  //
  // Compiles the given shader source.
  // If the function succeeds, the return value is nonzero, else zero.
  // Parameters:
  // handle: Specifies the handle of compiler to be used.
  // shaderStrings: Specifies an array of pointers to null-terminated strings
  //                containing the shader source code.
-@@ -152,17 +172,17 @@ void ShDestruct(ShHandle handle);
+@@ -156,17 +176,17 @@ void ShDestruct(ShHandle handle);
  // SH_INTERMEDIATE_TREE: Writes intermediate tree to info log.
  //                       Can be queried by calling ShGetInfoLog().
  // SH_OBJECT_CODE: Translates intermediate tree to glsl or hlsl shader.
  //                 Can be queried by calling ShGetObjectCode().
  // SH_ATTRIBUTES_UNIFORMS: Extracts attributes and uniforms.
  //                         Can be queried by calling ShGetActiveAttrib() and
  //                         ShGetActiveUniform().
  //
@@ -117,17 +95,17 @@ diff --git a/gfx/angle/include/GLSLANG/S
      const ShHandle handle,
      const char* const shaderStrings[],
      const int numStrings,
      int compileOptions
      );
  
  // Returns a parameter from a compiled shader.
  // Parameters:
-@@ -178,53 +198,53 @@ int ShCompile(
+@@ -182,53 +202,53 @@ int ShCompile(
  //                                 variable name including the null
  //                                 termination character.
  // SH_ACTIVE_UNIFORMS: the number of active uniform variables.
  // SH_ACTIVE_UNIFORM_MAX_LENGTH: the length of the longest active uniform
  //                               variable name including the null
  //                               termination character.
  // 
  // params: Requested parameter
@@ -175,17 +153,17 @@ diff --git a/gfx/angle/include/GLSLANG/S
                         int index,
                         int* length,
                         int* size,
                         ShDataType* type,
                         char* name);
  
  // Returns information about an active uniform variable.
  // Parameters:
-@@ -235,17 +255,17 @@ void ShGetActiveAttrib(const ShHandle ha
+@@ -239,17 +259,17 @@ void ShGetActiveAttrib(const ShHandle ha
  //         other than NULL is passed.
  // size: Returns the size of the uniform variable.
  // type: Returns the data type of the uniform variable.
  // name: Returns a null terminated string containing the name of the
  //       uniform variable. It is assumed that name has enough memory to
  //       accomodate the uniform variable name. The size of the buffer required
  //       to store the uniform variable name can be obtained by calling
  //       ShGetInfo with SH_ACTIVE_UNIFORMS_MAX_LENGTH.
--- a/gfx/angle/include/GLSLANG/ShaderLang.h
+++ b/gfx/angle/include/GLSLANG/ShaderLang.h
@@ -1,16 +1,36 @@
 //
 // Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 //
 #ifndef _COMPILER_INTERFACE_INCLUDED_
 #define _COMPILER_INTERFACE_INCLUDED_
 
+#ifdef MOZILLA_VERSION
+#include "nscore.h"
+
+#ifdef WIN32
+# if !defined(MOZ_ENABLE_LIBXUL) && !defined(MOZ_STATIC_BUILD)
+#  ifdef ANGLE_BUILD
+#   define ANGLE_API NS_EXPORT
+#  else
+#   define ANGLE_API NS_IMPORT
+#  endif
+# else
+#  define ANGLE_API  /*nothing*/
+# endif
+#else
+# define ANGLE_API NS_EXTERNAL_VIS
+#endif
+#else
+#define ANGLE_API /*nothing*/
+#endif
+
 //
 // This is the platform independent interface between an OGL driver
 // and the shading language compiler.
 //
 
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -107,17 +127,17 @@ typedef struct
     // Extensions.
     // Set to 1 to enable the extension, else 0.
     int OES_standard_derivatives;
 } ShBuiltInResources;
 
 //
 // Initialize built-in resources with minimum expected values.
 //
-void ShInitBuiltInResources(ShBuiltInResources* resources);
+ANGLE_API void ShInitBuiltInResources(ShBuiltInResources* resources);
 
 //
 // ShHandle held by but opaque to the driver.  It is allocated,
 // managed, and de-allocated by the compiler. It's contents 
 // are defined by and used by the compiler.
 //
 // If handle creation fails, 0 will be returned.
 //
@@ -127,19 +147,19 @@ typedef void* ShHandle;
 // Driver calls these to create and destroy compiler objects.
 //
 // Returns the handle of constructed compiler.
 // Parameters:
 // type: Specifies the type of shader - SH_FRAGMENT_SHADER or SH_VERTEX_SHADER.
 // spec: Specifies the language spec the compiler must conform to -
 //       SH_GLES2_SPEC or SH_WEBGL_SPEC.
 // resources: Specifies the built-in resources.
-ShHandle ShConstructCompiler(ShShaderType type, ShShaderSpec spec,
+ANGLE_API ShHandle ShConstructCompiler(ShShaderType type, ShShaderSpec spec,
                              const ShBuiltInResources* resources);
-void ShDestruct(ShHandle handle);
+ANGLE_API void ShDestruct(ShHandle handle);
 
 //
 // Compiles the given shader source.
 // If the function succeeds, the return value is nonzero, else zero.
 // Parameters:
 // handle: Specifies the handle of compiler to be used.
 // shaderStrings: Specifies an array of pointers to null-terminated strings
 //                containing the shader source code.
@@ -156,17 +176,17 @@ void ShDestruct(ShHandle handle);
 // SH_INTERMEDIATE_TREE: Writes intermediate tree to info log.
 //                       Can be queried by calling ShGetInfoLog().
 // SH_OBJECT_CODE: Translates intermediate tree to glsl or hlsl shader.
 //                 Can be queried by calling ShGetObjectCode().
 // SH_ATTRIBUTES_UNIFORMS: Extracts attributes and uniforms.
 //                         Can be queried by calling ShGetActiveAttrib() and
 //                         ShGetActiveUniform().
 //
-int ShCompile(
+ANGLE_API int ShCompile(
     const ShHandle handle,
     const char* const shaderStrings[],
     const int numStrings,
     int compileOptions
     );
 
 // Returns a parameter from a compiled shader.
 // Parameters:
@@ -182,53 +202,53 @@ int ShCompile(
 //                                 variable name including the null
 //                                 termination character.
 // SH_ACTIVE_UNIFORMS: the number of active uniform variables.
 // SH_ACTIVE_UNIFORM_MAX_LENGTH: the length of the longest active uniform
 //                               variable name including the null
 //                               termination character.
 // 
 // params: Requested parameter
-void ShGetInfo(const ShHandle handle, ShShaderInfo pname, int* params);
+ANGLE_API void ShGetInfo(const ShHandle handle, ShShaderInfo pname, int* params);
 
 // Returns nul-terminated information log for a compiled shader.
 // Parameters:
 // handle: Specifies the compiler
 // infoLog: Specifies an array of characters that is used to return
 //          the information log. It is assumed that infoLog has enough memory
 //          to accomodate the information log. The size of the buffer required
 //          to store the returned information log can be obtained by calling
 //          ShGetInfo with SH_INFO_LOG_LENGTH.
-void ShGetInfoLog(const ShHandle handle, char* infoLog);
+ANGLE_API void ShGetInfoLog(const ShHandle handle, char* infoLog);
 
 // Returns null-terminated object code for a compiled shader.
 // Parameters:
 // handle: Specifies the compiler
 // infoLog: Specifies an array of characters that is used to return
 //          the object code. It is assumed that infoLog has enough memory to
 //          accomodate the object code. The size of the buffer required to
 //          store the returned object code can be obtained by calling
 //          ShGetInfo with SH_OBJECT_CODE_LENGTH.
-void ShGetObjectCode(const ShHandle handle, char* objCode);
+ANGLE_API void ShGetObjectCode(const ShHandle handle, char* objCode);
 
 // Returns information about an active attribute variable.
 // Parameters:
 // handle: Specifies the compiler
 // index: Specifies the index of the attribute variable to be queried.
 // length: Returns the number of characters actually written in the string
 //         indicated by name (excluding the null terminator) if a value other
 //         than NULL is passed.
 // size: Returns the size of the attribute variable.
 // type: Returns the data type of the attribute variable.
 // name: Returns a null terminated string containing the name of the
 //       attribute variable. It is assumed that name has enough memory to
 //       accomodate the attribute variable name. The size of the buffer
 //       required to store the attribute variable name can be obtained by
 //       calling ShGetInfo with SH_ACTIVE_ATTRIBUTE_MAX_LENGTH.
-void ShGetActiveAttrib(const ShHandle handle,
+ANGLE_API void ShGetActiveAttrib(const ShHandle handle,
                        int index,
                        int* length,
                        int* size,
                        ShDataType* type,
                        char* name);
 
 // Returns information about an active uniform variable.
 // Parameters:
@@ -239,17 +259,17 @@ void ShGetActiveAttrib(const ShHandle ha
 //         other than NULL is passed.
 // size: Returns the size of the uniform variable.
 // type: Returns the data type of the uniform variable.
 // name: Returns a null terminated string containing the name of the
 //       uniform variable. It is assumed that name has enough memory to
 //       accomodate the uniform variable name. The size of the buffer required
 //       to store the uniform variable name can be obtained by calling
 //       ShGetInfo with SH_ACTIVE_UNIFORMS_MAX_LENGTH.
-void ShGetActiveUniform(const ShHandle handle,
+ANGLE_API void ShGetActiveUniform(const ShHandle handle,
                         int index,
                         int* length,
                         int* size,
                         ShDataType* type,
                         char* name);
 
 #ifdef __cplusplus
 }
--- a/gfx/angle/src/compiler/osinclude.h
+++ b/gfx/angle/src/compiler/osinclude.h
@@ -7,17 +7,19 @@
 #ifndef __OSINCLUDE_H
 #define __OSINCLUDE_H
 
 //
 // This file contains contains os-specific datatypes and
 // declares any os-specific functions.
 //
 
-#if defined(_WIN32) || defined(_WIN64)
+#if defined(ANGLE_USE_NSPR)
+/* no need to define anything when using NSPR */
+#elif defined(_WIN32) || defined(_WIN64)
 #define ANGLE_OS_WIN
 #elif defined(__APPLE__) || defined(__linux__) || \
       defined(__FreeBSD__) || defined(__OpenBSD__) || \
       defined(__sun)
 #define ANGLE_OS_POSIX
 #else
 #error Unsupported platform.
 #endif
--- 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()
--- 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);
--- 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();