Use GLenum instead of GLint to store internal format variables.

TRAC #23785

Signed-off-by: Jamie Madill
Signed-off-by: Shannon Woods
diff --git a/src/libGLESv2/Context.cpp b/src/libGLESv2/Context.cpp
index 15bc10d..53becf2 100644
--- a/src/libGLESv2/Context.cpp
+++ b/src/libGLESv2/Context.cpp
@@ -1737,8 +1737,7 @@
       case GL_IMPLEMENTATION_COLOR_READ_TYPE:
       case GL_IMPLEMENTATION_COLOR_READ_FORMAT:
         {
-            GLint internalFormat;
-            GLenum format, type;
+            GLenum internalFormat, format, type;
             if (getCurrentReadFormatType(&internalFormat, &format, &type))
             {
                 if (pname == GL_IMPLEMENTATION_COLOR_READ_FORMAT)
@@ -2706,8 +2705,8 @@
         return gl::error(GL_INVALID_OPERATION);
     }
 
-    GLint sizedInternalFormat = IsSizedInternalFormat(format, mClientVersion) ? format
-        : GetSizedInternalFormat(format, type, mClientVersion);
+    GLenum sizedInternalFormat = IsSizedInternalFormat(format, mClientVersion) ? format
+                                                                               : GetSizedInternalFormat(format, type, mClientVersion);
 
     GLsizei outputPitch = GetRowPitch(sizedInternalFormat, type, mClientVersion, width, getPackAlignment());
     // sized query sanity check
@@ -2962,17 +2961,17 @@
     return mRenderer->getMaxSupportedSamples();
 }
 
-GLsizei Context::getMaxSupportedFormatSamples(GLint internalFormat) const
+GLsizei Context::getMaxSupportedFormatSamples(GLenum internalFormat) const
 {
     return mRenderer->getMaxSupportedFormatSamples(internalFormat);
 }
 
-GLsizei Context::getNumSampleCounts(GLint internalFormat) const
+GLsizei Context::getNumSampleCounts(GLenum internalFormat) const
 {
     return mRenderer->getNumSampleCounts(internalFormat);
 }
 
-void Context::getSampleCounts(GLint internalFormat, GLsizei bufSize, GLint *params) const
+void Context::getSampleCounts(GLenum internalFormat, GLsizei bufSize, GLint *params) const
 {
     mRenderer->getSampleCounts(internalFormat, bufSize, params);
 }
@@ -3138,7 +3137,7 @@
     return mMaxTextureAnisotropy;
 }
 
-bool Context::getCurrentReadFormatType(GLint *internalFormat, GLenum *format, GLenum *type)
+bool Context::getCurrentReadFormatType(GLenum *internalFormat, GLenum *format, GLenum *type)
 {
     Framebuffer *framebuffer = getReadFramebuffer();
     if (!framebuffer || framebuffer->completeness() != GL_FRAMEBUFFER_COMPLETE)
diff --git a/src/libGLESv2/Context.h b/src/libGLESv2/Context.h
index 76fb810..e5d5eb1 100644
--- a/src/libGLESv2/Context.h
+++ b/src/libGLESv2/Context.h
@@ -400,9 +400,9 @@
     int getMaximum2DArrayTextureLevel() const;
     unsigned int getMaximumRenderTargets() const;
     GLsizei getMaxSupportedSamples() const;
-    GLsizei getMaxSupportedFormatSamples(GLint internalFormat) const;
-    GLsizei getNumSampleCounts(GLint internalFormat) const;
-    void getSampleCounts(GLint internalFormat, GLsizei bufSize, GLint *params) const;
+    GLsizei getMaxSupportedFormatSamples(GLenum internalFormat) const;
+    GLsizei getNumSampleCounts(GLenum internalFormat) const;
+    void getSampleCounts(GLenum internalFormat, GLsizei bufSize, GLint *params) const;
     unsigned int getMaxTransformFeedbackBufferBindings() const;
     GLintptr getUniformBufferOffsetAlignment() const;
     const char *getCombinedExtensionsString() const;
@@ -429,7 +429,7 @@
     bool supportsInstancing() const;
     bool supportsTextureFilterAnisotropy() const;
 
-    bool getCurrentReadFormatType(GLint *internalFormat, GLenum *format, GLenum *type);
+    bool getCurrentReadFormatType(GLenum *internalFormat, GLenum *format, GLenum *type);
 
     float getTextureMaxAnisotropy() const;
 
diff --git a/src/libGLESv2/Framebuffer.cpp b/src/libGLESv2/Framebuffer.cpp
index 92b18bd..97d37d0 100644
--- a/src/libGLESv2/Framebuffer.cpp
+++ b/src/libGLESv2/Framebuffer.cpp
@@ -485,7 +485,7 @@
             }
             else if (IsInternalTextureTarget(mColorbuffers[colorAttachment].type(), mRenderer->getCurrentClientVersion()))
             {
-                GLint internalformat = colorbuffer->getInternalFormat();
+                GLenum internalformat = colorbuffer->getInternalFormat();
 
                 if (!gl::IsColorRenderingSupported(internalformat, mRenderer))
                 {
@@ -575,7 +575,7 @@
         }
         else if (IsInternalTextureTarget(mDepthbuffer.type(), mRenderer->getCurrentClientVersion()))
         {
-            GLint internalformat = depthbuffer->getInternalFormat();
+            GLenum internalformat = depthbuffer->getInternalFormat();
 
             // depth texture attachments require OES/ANGLE_depth_texture
             if (!mRenderer->getDepthTextureSupport())
@@ -634,7 +634,7 @@
         }
         else if (IsInternalTextureTarget(mStencilbuffer.type(), mRenderer->getCurrentClientVersion()))
         {
-            GLint internalformat = stencilbuffer->getInternalFormat();
+            GLenum internalformat = stencilbuffer->getInternalFormat();
 
             // texture stencil attachments come along as part
             // of OES_packed_depth_stencil + OES/ANGLE_depth_texture
diff --git a/src/libGLESv2/Texture.cpp b/src/libGLESv2/Texture.cpp
index 41ad63a..16179c5 100644
--- a/src/libGLESv2/Texture.cpp
+++ b/src/libGLESv2/Texture.cpp
@@ -223,7 +223,7 @@
     }
 }
 
-bool Texture::isFastUnpackable(const PixelUnpackState &unpack, GLint sizedInternalFormat)
+bool Texture::isFastUnpackable(const PixelUnpackState &unpack, GLenum sizedInternalFormat)
 {
     return unpack.pixelBuffer.id() != 0 && mRenderer->supportsFastCopyBufferToTexture(sizedInternalFormat);
 }
@@ -407,14 +407,14 @@
         return D3DFMT_UNKNOWN;
 }
 
-void Texture2D::redefineImage(GLint level, GLint internalformat, GLsizei width, GLsizei height)
+void Texture2D::redefineImage(GLint level, GLenum internalformat, GLsizei width, GLsizei height)
 {
     releaseTexImage();
 
     // If there currently is a corresponding storage texture image, it has these parameters
     const int storageWidth = std::max(1, getBaseLevelWidth() >> level);
     const int storageHeight = std::max(1, getBaseLevelHeight() >> level);
-    const int storageFormat = getBaseLevelInternalFormat();
+    const GLenum storageFormat = getBaseLevelInternalFormat();
 
     mImageArray[level]->redefine(mRenderer, GL_TEXTURE_2D, internalformat, width, height, 1, false);
 
@@ -439,11 +439,11 @@
     }
 }
 
-void Texture2D::setImage(GLint level, GLsizei width, GLsizei height, GLint internalFormat, GLenum format, GLenum type, const PixelUnpackState &unpack, const void *pixels)
+void Texture2D::setImage(GLint level, GLsizei width, GLsizei height, GLenum internalFormat, GLenum format, GLenum type, const PixelUnpackState &unpack, const void *pixels)
 {
     GLuint clientVersion = mRenderer->getCurrentClientVersion();
-    GLint sizedInternalFormat = IsSizedInternalFormat(internalFormat, clientVersion) ? internalFormat
-                                                                                     : GetSizedInternalFormat(format, type, clientVersion);
+    GLenum sizedInternalFormat = IsSizedInternalFormat(internalFormat, clientVersion) ? internalFormat
+                                                                                      : GetSizedInternalFormat(format, type, clientVersion);
     redefineImage(level, sizedInternalFormat, width, height);
 
     bool fastUnpacked = false;
@@ -474,7 +474,7 @@
 {
     releaseTexImage();
 
-    GLint internalformat = surface->getFormat();
+    GLenum internalformat = surface->getFormat();
 
     mImageArray[0]->redefine(mRenderer, GL_TEXTURE_2D, internalformat, surface->getWidth(), surface->getHeight(), 1, true);
 
@@ -561,8 +561,8 @@
 void Texture2D::copyImage(GLint level, GLenum format, GLint x, GLint y, GLsizei width, GLsizei height, Framebuffer *source)
 {
     GLuint clientVersion = mRenderer->getCurrentClientVersion();
-    GLint sizedInternalFormat = IsSizedInternalFormat(format, clientVersion) ? format
-                                                                             : GetSizedInternalFormat(format, GL_UNSIGNED_BYTE, clientVersion);
+    GLenum sizedInternalFormat = IsSizedInternalFormat(format, clientVersion) ? format
+                                                                              : GetSizedInternalFormat(format, GL_UNSIGNED_BYTE, clientVersion);
     redefineImage(level, sizedInternalFormat, width, height);
 
     if (!mImageArray[level]->isRenderableFormat())
@@ -1052,32 +1052,32 @@
         return D3DFMT_UNKNOWN;
 }
 
-void TextureCubeMap::setImagePosX(GLint level, GLsizei width, GLsizei height, GLint internalFormat, GLenum format, GLenum type, const PixelUnpackState &unpack, const void *pixels)
+void TextureCubeMap::setImagePosX(GLint level, GLsizei width, GLsizei height, GLenum internalFormat, GLenum format, GLenum type, const PixelUnpackState &unpack, const void *pixels)
 {
     setImage(0, level, width, height, internalFormat, format, type, unpack, pixels);
 }
 
-void TextureCubeMap::setImageNegX(GLint level, GLsizei width, GLsizei height, GLint internalFormat, GLenum format, GLenum type, const PixelUnpackState &unpack, const void *pixels)
+void TextureCubeMap::setImageNegX(GLint level, GLsizei width, GLsizei height, GLenum internalFormat, GLenum format, GLenum type, const PixelUnpackState &unpack, const void *pixels)
 {
     setImage(1, level, width, height, internalFormat, format, type, unpack, pixels);
 }
 
-void TextureCubeMap::setImagePosY(GLint level, GLsizei width, GLsizei height, GLint internalFormat, GLenum format, GLenum type, const PixelUnpackState &unpack, const void *pixels)
+void TextureCubeMap::setImagePosY(GLint level, GLsizei width, GLsizei height, GLenum internalFormat, GLenum format, GLenum type, const PixelUnpackState &unpack, const void *pixels)
 {
     setImage(2, level, width, height, internalFormat, format, type, unpack, pixels);
 }
 
-void TextureCubeMap::setImageNegY(GLint level, GLsizei width, GLsizei height, GLint internalFormat, GLenum format, GLenum type, const PixelUnpackState &unpack, const void *pixels)
+void TextureCubeMap::setImageNegY(GLint level, GLsizei width, GLsizei height, GLenum internalFormat, GLenum format, GLenum type, const PixelUnpackState &unpack, const void *pixels)
 {
     setImage(3, level, width, height, internalFormat, format, type, unpack, pixels);
 }
 
-void TextureCubeMap::setImagePosZ(GLint level, GLsizei width, GLsizei height, GLint internalFormat, GLenum format, GLenum type, const PixelUnpackState &unpack, const void *pixels)
+void TextureCubeMap::setImagePosZ(GLint level, GLsizei width, GLsizei height, GLenum internalFormat, GLenum format, GLenum type, const PixelUnpackState &unpack, const void *pixels)
 {
     setImage(4, level, width, height, internalFormat, format, type, unpack, pixels);
 }
 
-void TextureCubeMap::setImageNegZ(GLint level, GLsizei width, GLsizei height, GLint internalFormat, GLenum format, GLenum type, const PixelUnpackState &unpack, const void *pixels)
+void TextureCubeMap::setImageNegZ(GLint level, GLsizei width, GLsizei height, GLenum internalFormat, GLenum format, GLenum type, const PixelUnpackState &unpack, const void *pixels)
 {
     setImage(5, level, width, height, internalFormat, format, type, unpack, pixels);
 }
@@ -1346,11 +1346,11 @@
     mDirtyImages = true;
 }
 
-void TextureCubeMap::setImage(int faceIndex, GLint level, GLsizei width, GLsizei height, GLint internalFormat, GLenum format, GLenum type, const PixelUnpackState &unpack, const void *pixels)
+void TextureCubeMap::setImage(int faceIndex, GLint level, GLsizei width, GLsizei height, GLenum internalFormat, GLenum format, GLenum type, const PixelUnpackState &unpack, const void *pixels)
 {
     GLuint clientVersion = mRenderer->getCurrentClientVersion();
-    GLint sizedInternalFormat = IsSizedInternalFormat(internalFormat, clientVersion) ? internalFormat
-                                                                                     : GetSizedInternalFormat(format, type, clientVersion);
+    GLenum sizedInternalFormat = IsSizedInternalFormat(internalFormat, clientVersion) ? internalFormat
+                                                                                      : GetSizedInternalFormat(format, type, clientVersion);
 
     redefineImage(faceIndex, level, sizedInternalFormat, width, height);
 
@@ -1368,12 +1368,12 @@
     return face - GL_TEXTURE_CUBE_MAP_POSITIVE_X;
 }
 
-void TextureCubeMap::redefineImage(int face, GLint level, GLint internalformat, GLsizei width, GLsizei height)
+void TextureCubeMap::redefineImage(int face, GLint level, GLenum internalformat, GLsizei width, GLsizei height)
 {
     // If there currently is a corresponding storage texture image, it has these parameters
     const int storageWidth = std::max(1, getBaseLevelWidth() >> level);
     const int storageHeight = std::max(1, getBaseLevelHeight() >> level);
-    const int storageFormat = getBaseLevelInternalFormat();
+    const GLenum storageFormat = getBaseLevelInternalFormat();
 
     mImageArray[face][level]->redefine(mRenderer, GL_TEXTURE_CUBE_MAP, internalformat, width, height, 1, false);
 
@@ -1406,8 +1406,8 @@
 {
     unsigned int faceindex = faceIndex(target);
     GLuint clientVersion = mRenderer->getCurrentClientVersion();
-    GLint sizedInternalFormat = IsSizedInternalFormat(format, clientVersion) ? format
-                                                                             : GetSizedInternalFormat(format, GL_UNSIGNED_BYTE, clientVersion);
+    GLenum sizedInternalFormat = IsSizedInternalFormat(format, clientVersion) ? format
+                                                                              : GetSizedInternalFormat(format, GL_UNSIGNED_BYTE, clientVersion);
     redefineImage(faceindex, level, sizedInternalFormat, width, height);
 
     if (!mImageArray[faceindex][level]->isRenderableFormat())
@@ -1716,11 +1716,11 @@
     return GetDepthBits(getInternalFormat(level), mRenderer->getCurrentClientVersion()) > 0;
 }
 
-void Texture3D::setImage(GLint level, GLsizei width, GLsizei height, GLsizei depth, GLint internalFormat, GLenum format, GLenum type, const PixelUnpackState &unpack, const void *pixels)
+void Texture3D::setImage(GLint level, GLsizei width, GLsizei height, GLsizei depth, GLenum internalFormat, GLenum format, GLenum type, const PixelUnpackState &unpack, const void *pixels)
 {
     GLuint clientVersion = mRenderer->getCurrentClientVersion();
-    GLint sizedInternalFormat = IsSizedInternalFormat(internalFormat, clientVersion) ? internalFormat
-                                                                                     : GetSizedInternalFormat(format, type, clientVersion);
+    GLenum sizedInternalFormat = IsSizedInternalFormat(internalFormat, clientVersion) ? internalFormat
+                                                                                      : GetSizedInternalFormat(format, type, clientVersion);
     redefineImage(level, sizedInternalFormat, width, height, depth);
 
     bool fastUnpacked = false;
@@ -2170,13 +2170,13 @@
     return mTexStorage;
 }
 
-void Texture3D::redefineImage(GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth)
+void Texture3D::redefineImage(GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth)
 {
     // If there currently is a corresponding storage texture image, it has these parameters
     const int storageWidth = std::max(1, getBaseLevelWidth() >> level);
     const int storageHeight = std::max(1, getBaseLevelHeight() >> level);
     const int storageDepth = std::max(1, getBaseLevelDepth() >> level);
-    const int storageFormat = getBaseLevelInternalFormat();
+    const GLenum storageFormat = getBaseLevelInternalFormat();
 
     mImageArray[level]->redefine(mRenderer, GL_TEXTURE_3D, internalformat, width, height, depth, false);
 
@@ -2274,11 +2274,11 @@
     return GetDepthBits(getInternalFormat(level), mRenderer->getCurrentClientVersion()) > 0;
 }
 
-void Texture2DArray::setImage(GLint level, GLsizei width, GLsizei height, GLsizei depth, GLint internalFormat, GLenum format, GLenum type, const PixelUnpackState &unpack, const void *pixels)
+void Texture2DArray::setImage(GLint level, GLsizei width, GLsizei height, GLsizei depth, GLenum internalFormat, GLenum format, GLenum type, const PixelUnpackState &unpack, const void *pixels)
 {
     GLuint clientVersion = mRenderer->getCurrentClientVersion();
-    GLint sizedInternalFormat = IsSizedInternalFormat(internalFormat, clientVersion) ? internalFormat
-                                                                                     : GetSizedInternalFormat(format, type, clientVersion);
+    GLenum sizedInternalFormat = IsSizedInternalFormat(internalFormat, clientVersion) ? internalFormat
+                                                                                      : GetSizedInternalFormat(format, type, clientVersion);
     redefineImage(level, sizedInternalFormat, width, height, depth);
 
     GLsizei inputDepthPitch = gl::GetDepthPitch(sizedInternalFormat, type, clientVersion, width, height, unpack.alignment);
@@ -2307,7 +2307,7 @@
 
 void Texture2DArray::subImage(GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const PixelUnpackState &unpack, const void *pixels)
 {
-    GLint internalformat = getInternalFormat(level);
+    GLenum internalformat = getInternalFormat(level);
     GLuint clientVersion =  mRenderer->getCurrentClientVersion();
     GLsizei inputDepthPitch = gl::GetDepthPitch(internalformat, type, clientVersion, width, height, unpack.alignment);
 
@@ -2732,13 +2732,13 @@
     return mTexStorage;
 }
 
-void Texture2DArray::redefineImage(GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth)
+void Texture2DArray::redefineImage(GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth)
 {
     // If there currently is a corresponding storage texture image, it has these parameters
     const int storageWidth = std::max(1, getBaseLevelWidth() >> level);
     const int storageHeight = std::max(1, getBaseLevelHeight() >> level);
     const int storageDepth = getBaseLevelDepth();
-    const int storageFormat = getBaseLevelInternalFormat();
+    const GLenum storageFormat = getBaseLevelInternalFormat();
 
     for (int layer = 0; layer < mLayerCounts[level]; layer++)
     {
diff --git a/src/libGLESv2/Texture.h b/src/libGLESv2/Texture.h
index 14704f6..67333bd 100644
--- a/src/libGLESv2/Texture.h
+++ b/src/libGLESv2/Texture.h
@@ -118,7 +118,7 @@
     void setCompressedImage(GLsizei imageSize, const void *pixels, rx::Image *image);
     bool subImageCompressed(GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth,
                             GLenum format, GLsizei imageSize, const void *pixels, rx::Image *image);
-    bool isFastUnpackable(const PixelUnpackState &unpack, GLint sizedInternalFormat);
+    bool isFastUnpackable(const PixelUnpackState &unpack, GLenum sizedInternalFormat);
     bool fastUnpackPixels(const PixelUnpackState &unpack, const void *pixels, const Box &destArea,
                           GLenum sizedInternalFormat, GLenum type, rx::RenderTarget *destRenderTarget);
 
@@ -169,7 +169,7 @@
     bool isCompressed(GLint level) const;
     bool isDepth(GLint level) const;
 
-    void setImage(GLint level, GLsizei width, GLsizei height, GLint internalFormat, GLenum format, GLenum type, const PixelUnpackState &unpack, const void *pixels);
+    void setImage(GLint level, GLsizei width, GLsizei height, GLenum internalFormat, GLenum format, GLenum type, const PixelUnpackState &unpack, const void *pixels);
     void setCompressedImage(GLint level, GLenum format, GLsizei width, GLsizei height, GLsizei imageSize, const void *pixels);
     void subImage(GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const PixelUnpackState &unpack, const void *pixels);
     void subImageCompressed(GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *pixels);
@@ -205,7 +205,7 @@
     bool isLevelComplete(int level) const;
     void updateTextureLevel(int level);
 
-    void redefineImage(GLint level, GLint internalformat, GLsizei width, GLsizei height);
+    void redefineImage(GLint level, GLenum internalformat, GLsizei width, GLsizei height);
     void commitRect(GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height);
 
     rx::Image *mImageArray[IMPLEMENTATION_MAX_TEXTURE_LEVELS];
@@ -228,12 +228,12 @@
     bool isCompressed(GLenum target, GLint level) const;
     bool isDepth(GLenum target, GLint level) const;
 
-    void setImagePosX(GLint level, GLsizei width, GLsizei height, GLint internalFormat, GLenum format, GLenum type, const PixelUnpackState &unpack, const void *pixels);
-    void setImageNegX(GLint level, GLsizei width, GLsizei height, GLint internalFormat, GLenum format, GLenum type, const PixelUnpackState &unpack, const void *pixels);
-    void setImagePosY(GLint level, GLsizei width, GLsizei height, GLint internalFormat, GLenum format, GLenum type, const PixelUnpackState &unpack, const void *pixels);
-    void setImageNegY(GLint level, GLsizei width, GLsizei height, GLint internalFormat, GLenum format, GLenum type, const PixelUnpackState &unpack, const void *pixels);
-    void setImagePosZ(GLint level, GLsizei width, GLsizei height, GLint internalFormat, GLenum format, GLenum type, const PixelUnpackState &unpack, const void *pixels);
-    void setImageNegZ(GLint level, GLsizei width, GLsizei height, GLint internalFormat, GLenum format, GLenum type, const PixelUnpackState &unpack, const void *pixels);
+    void setImagePosX(GLint level, GLsizei width, GLsizei height, GLenum internalFormat, GLenum format, GLenum type, const PixelUnpackState &unpack, const void *pixels);
+    void setImageNegX(GLint level, GLsizei width, GLsizei height, GLenum internalFormat, GLenum format, GLenum type, const PixelUnpackState &unpack, const void *pixels);
+    void setImagePosY(GLint level, GLsizei width, GLsizei height, GLenum internalFormat, GLenum format, GLenum type, const PixelUnpackState &unpack, const void *pixels);
+    void setImageNegY(GLint level, GLsizei width, GLsizei height, GLenum internalFormat, GLenum format, GLenum type, const PixelUnpackState &unpack, const void *pixels);
+    void setImagePosZ(GLint level, GLsizei width, GLsizei height, GLenum internalFormat, GLenum format, GLenum type, const PixelUnpackState &unpack, const void *pixels);
+    void setImageNegZ(GLint level, GLsizei width, GLsizei height, GLenum internalFormat, GLenum format, GLenum type, const PixelUnpackState &unpack, const void *pixels);
 
     void setCompressedImage(GLenum face, GLint level, GLenum format, GLsizei width, GLsizei height, GLsizei imageSize, const void *pixels);
 
@@ -272,9 +272,9 @@
     bool isFaceLevelComplete(int face, int level) const;
     void updateTextureFaceLevel(int face, int level);
 
-    void setImage(int faceIndex, GLint level, GLsizei width, GLsizei height, GLint internalFormat, GLenum format, GLenum type, const PixelUnpackState &unpack, const void *pixels);
+    void setImage(int faceIndex, GLint level, GLsizei width, GLsizei height, GLenum internalFormat, GLenum format, GLenum type, const PixelUnpackState &unpack, const void *pixels);
     void commitRect(int faceIndex, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height);
-    void redefineImage(int faceIndex, GLint level, GLint internalformat, GLsizei width, GLsizei height);
+    void redefineImage(int faceIndex, GLint level, GLenum internalformat, GLsizei width, GLsizei height);
 
     rx::Image *mImageArray[6][IMPLEMENTATION_MAX_TEXTURE_LEVELS];
 
@@ -296,7 +296,7 @@
     bool isCompressed(GLint level) const;
     bool isDepth(GLint level) const;
 
-    void setImage(GLint level, GLsizei width, GLsizei height, GLsizei depth, GLint internalFormat, GLenum format, GLenum type, const PixelUnpackState &unpack, const void *pixels);
+    void setImage(GLint level, GLsizei width, GLsizei height, GLsizei depth, GLenum internalFormat, GLenum format, GLenum type, const PixelUnpackState &unpack, const void *pixels);
     void setCompressedImage(GLint level, GLenum format, GLsizei width, GLsizei height, GLsizei depth, GLsizei imageSize, const void *pixels);
     void subImage(GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const PixelUnpackState &unpack, const void *pixels);
     void subImageCompressed(GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *pixels);
@@ -327,7 +327,7 @@
     virtual rx::TextureStorageInterface *getStorage(bool renderTarget);
     virtual const rx::Image *getBaseLevelImage() const;
 
-    void redefineImage(GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth);
+    void redefineImage(GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
     void commitRect(GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth);
 
     bool isLevelComplete(int level) const;
@@ -353,7 +353,7 @@
     bool isCompressed(GLint level) const;
     bool isDepth(GLint level) const;
 
-    void setImage(GLint level, GLsizei width, GLsizei height, GLsizei depth, GLint internalFormat, GLenum format, GLenum type, const PixelUnpackState &unpack, const void *pixels);
+    void setImage(GLint level, GLsizei width, GLsizei height, GLsizei depth, GLenum internalFormat, GLenum format, GLenum type, const PixelUnpackState &unpack, const void *pixels);
     void setCompressedImage(GLint level, GLenum format, GLsizei width, GLsizei height, GLsizei depth, GLsizei imageSize, const void *pixels);
     void subImage(GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const PixelUnpackState &unpack, const void *pixels);
     void subImageCompressed(GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *pixels);
@@ -383,7 +383,7 @@
     virtual rx::TextureStorageInterface *getStorage(bool renderTarget);
     virtual const rx::Image *getBaseLevelImage() const;
 
-    void redefineImage(GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth);
+    void redefineImage(GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
     void commitRect(GLint level, GLint xoffset, GLint yoffset, GLint layerTarget, GLsizei width, GLsizei height);
 
     bool isLevelComplete(int level) const;
diff --git a/src/libGLESv2/formatutils.cpp b/src/libGLESv2/formatutils.cpp
index c0f6d9e..3696c5a 100644
--- a/src/libGLESv2/formatutils.cpp
+++ b/src/libGLESv2/formatutils.cpp
@@ -23,10 +23,10 @@
 
 struct FormatTypeInfo
 {
-    GLint mInternalFormat;
+    GLenum mInternalFormat;
     ColorWriteFunction mColorWriteFunction;
 
-    FormatTypeInfo(GLint internalFormat, ColorWriteFunction writeFunc)
+    FormatTypeInfo(GLenum internalFormat, ColorWriteFunction writeFunc)
         : mInternalFormat(internalFormat), mColorWriteFunction(writeFunc)
     { }
 };
@@ -36,7 +36,7 @@
 typedef std::map<FormatTypePair, FormatTypeInfo> FormatMap;
 
 // A helper function to insert data into the format map with fewer characters.
-static inline void InsertFormatMapping(FormatMap *map, GLenum format, GLenum type, GLint internalFormat, ColorWriteFunction writeFunc)
+static inline void InsertFormatMapping(FormatMap *map, GLenum format, GLenum type, GLenum internalFormat, ColorWriteFunction writeFunc)
 {
     map->insert(FormatPair(FormatTypePair(format, type), FormatTypeInfo(internalFormat, writeFunc)));
 }
@@ -196,11 +196,11 @@
 
 struct FormatInfo
 {
-    GLint mInternalformat;
+    GLenum mInternalformat;
     GLenum mFormat;
     GLenum mType;
 
-    FormatInfo(GLint internalformat, GLenum format, GLenum type)
+    FormatInfo(GLenum internalformat, GLenum format, GLenum type)
         : mInternalformat(internalformat), mFormat(format), mType(type) { }
 
     bool operator<(const FormatInfo& other) const
@@ -642,8 +642,8 @@
     }
 };
 
-typedef std::pair<GLuint, InternalFormatInfo> InternalFormatInfoPair;
-typedef std::map<GLuint, InternalFormatInfo> InternalFormatInfoMap;
+typedef std::pair<GLenum, InternalFormatInfo> InternalFormatInfoPair;
+typedef std::map<GLenum, InternalFormatInfo> InternalFormatInfoMap;
 
 static InternalFormatInfoMap BuildES3InternalFormatInfoMap()
 {
@@ -850,7 +850,7 @@
     return map;
 }
 
-static bool GetInternalFormatInfo(GLint internalFormat, GLuint clientVersion, InternalFormatInfo *outFormatInfo)
+static bool GetInternalFormatInfo(GLenum internalFormat, GLuint clientVersion, InternalFormatInfo *outFormatInfo)
 {
     const InternalFormatInfoMap* map = NULL;
 
@@ -1009,7 +1009,7 @@
     return set;
 }
 
-bool IsValidInternalFormat(GLint internalFormat, const Context *context)
+bool IsValidInternalFormat(GLenum internalFormat, const Context *context)
 {
     if (!context)
     {
@@ -1066,7 +1066,7 @@
     }
 }
 
-bool IsValidFormatCombination(GLint internalFormat, GLenum format, GLenum type, GLuint clientVersion)
+bool IsValidFormatCombination(GLenum internalFormat, GLenum format, GLenum type, GLuint clientVersion)
 {
     if (clientVersion == 2)
     {
@@ -1147,7 +1147,7 @@
     }
 }
 
-bool IsSizedInternalFormat(GLint internalFormat, GLuint clientVersion)
+bool IsSizedInternalFormat(GLenum internalFormat, GLuint clientVersion)
 {
     InternalFormatInfo internalFormatInfo;
     if (GetInternalFormatInfo(internalFormat, clientVersion, &internalFormatInfo))
@@ -1161,14 +1161,14 @@
     }
 }
 
-GLint GetSizedInternalFormat(GLenum format, GLenum type, GLuint clientVersion)
+GLenum GetSizedInternalFormat(GLenum format, GLenum type, GLuint clientVersion)
 {
     const FormatMap &formats = GetFormatMap(clientVersion);
     FormatMap::const_iterator iter = formats.find(FormatTypePair(format, type));
     return (iter != formats.end()) ? iter->second.mInternalFormat : GL_NONE;
 }
 
-GLuint GetPixelBytes(GLint internalFormat, GLuint clientVersion)
+GLuint GetPixelBytes(GLenum internalFormat, GLuint clientVersion)
 {
     InternalFormatInfo internalFormatInfo;
     if (GetInternalFormatInfo(internalFormat, clientVersion, &internalFormatInfo))
@@ -1182,7 +1182,7 @@
     }
 }
 
-GLuint GetAlphaBits(GLint internalFormat, GLuint clientVersion)
+GLuint GetAlphaBits(GLenum internalFormat, GLuint clientVersion)
 {
     InternalFormatInfo internalFormatInfo;
     if (GetInternalFormatInfo(internalFormat, clientVersion, &internalFormatInfo))
@@ -1196,7 +1196,7 @@
     }
 }
 
-GLuint GetRedBits(GLint internalFormat, GLuint clientVersion)
+GLuint GetRedBits(GLenum internalFormat, GLuint clientVersion)
 {
     InternalFormatInfo internalFormatInfo;
     if (GetInternalFormatInfo(internalFormat, clientVersion, &internalFormatInfo))
@@ -1210,7 +1210,7 @@
     }
 }
 
-GLuint GetGreenBits(GLint internalFormat, GLuint clientVersion)
+GLuint GetGreenBits(GLenum internalFormat, GLuint clientVersion)
 {
     InternalFormatInfo internalFormatInfo;
     if (GetInternalFormatInfo(internalFormat, clientVersion, &internalFormatInfo))
@@ -1224,7 +1224,7 @@
     }
 }
 
-GLuint GetBlueBits(GLint internalFormat, GLuint clientVersion)
+GLuint GetBlueBits(GLenum internalFormat, GLuint clientVersion)
 {
     InternalFormatInfo internalFormatInfo;
     if (GetInternalFormatInfo(internalFormat, clientVersion, &internalFormatInfo))
@@ -1238,7 +1238,7 @@
     }
 }
 
-GLuint GetLuminanceBits(GLint internalFormat, GLuint clientVersion)
+GLuint GetLuminanceBits(GLenum internalFormat, GLuint clientVersion)
 {
     InternalFormatInfo internalFormatInfo;
     if (GetInternalFormatInfo(internalFormat, clientVersion, &internalFormatInfo))
@@ -1252,7 +1252,7 @@
     }
 }
 
-GLuint GetDepthBits(GLint internalFormat, GLuint clientVersion)
+GLuint GetDepthBits(GLenum internalFormat, GLuint clientVersion)
 {
     InternalFormatInfo internalFormatInfo;
     if (GetInternalFormatInfo(internalFormat, clientVersion, &internalFormatInfo))
@@ -1266,7 +1266,7 @@
     }
 }
 
-GLuint GetStencilBits(GLint internalFormat, GLuint clientVersion)
+GLuint GetStencilBits(GLenum internalFormat, GLuint clientVersion)
 {
     InternalFormatInfo internalFormatInfo;
     if (GetInternalFormatInfo(internalFormat, clientVersion, &internalFormatInfo))
@@ -1308,7 +1308,7 @@
     }
 }
 
-GLenum GetFormat(GLint internalFormat, GLuint clientVersion)
+GLenum GetFormat(GLenum internalFormat, GLuint clientVersion)
 {
     InternalFormatInfo internalFormatInfo;
     if (GetInternalFormatInfo(internalFormat, clientVersion, &internalFormatInfo))
@@ -1322,7 +1322,7 @@
     }
 }
 
-GLenum GetType(GLint internalFormat, GLuint clientVersion)
+GLenum GetType(GLenum internalFormat, GLuint clientVersion)
 {
     InternalFormatInfo internalFormatInfo;
     if (GetInternalFormatInfo(internalFormat, clientVersion, &internalFormatInfo))
@@ -1336,7 +1336,7 @@
     }
 }
 
-GLuint GetComponentType(GLint internalFormat, GLuint clientVersion)
+GLuint GetComponentType(GLenum internalFormat, GLuint clientVersion)
 {
     InternalFormatInfo internalFormatInfo;
     if (GetInternalFormatInfo(internalFormat, clientVersion, &internalFormatInfo))
@@ -1350,7 +1350,7 @@
     }
 }
 
-GLuint GetComponentCount(GLint internalFormat, GLuint clientVersion)
+GLuint GetComponentCount(GLenum internalFormat, GLuint clientVersion)
 {
     InternalFormatInfo internalFormatInfo;
     if (GetInternalFormatInfo(internalFormat, clientVersion, &internalFormatInfo))
@@ -1364,7 +1364,7 @@
     }
 }
 
-GLenum GetColorEncoding(GLint internalFormat, GLuint clientVersion)
+GLenum GetColorEncoding(GLenum internalFormat, GLuint clientVersion)
 {
     InternalFormatInfo internalFormatInfo;
     if (GetInternalFormatInfo(internalFormat, clientVersion, &internalFormatInfo))
@@ -1378,7 +1378,7 @@
     }
 }
 
-bool IsColorRenderingSupported(GLint internalFormat, const rx::Renderer *renderer)
+bool IsColorRenderingSupported(GLenum internalFormat, const rx::Renderer *renderer)
 {
     InternalFormatInfo internalFormatInfo;
     if (renderer && GetInternalFormatInfo(internalFormat, renderer->getCurrentClientVersion(), &internalFormatInfo))
@@ -1392,7 +1392,7 @@
     }
 }
 
-bool IsColorRenderingSupported(GLint internalFormat, const Context *context)
+bool IsColorRenderingSupported(GLenum internalFormat, const Context *context)
 {
     InternalFormatInfo internalFormatInfo;
     if (context && GetInternalFormatInfo(internalFormat, context->getClientVersion(), &internalFormatInfo))
@@ -1406,7 +1406,7 @@
     }
 }
 
-bool IsTextureFilteringSupported(GLint internalFormat, const rx::Renderer *renderer)
+bool IsTextureFilteringSupported(GLenum internalFormat, const rx::Renderer *renderer)
 {
     InternalFormatInfo internalFormatInfo;
     if (renderer && GetInternalFormatInfo(internalFormat, renderer->getCurrentClientVersion(), &internalFormatInfo))
@@ -1420,7 +1420,7 @@
     }
 }
 
-bool IsTextureFilteringSupported(GLint internalFormat, const Context *context)
+bool IsTextureFilteringSupported(GLenum internalFormat, const Context *context)
 {
     InternalFormatInfo internalFormatInfo;
     if (context && GetInternalFormatInfo(internalFormat, context->getClientVersion(), &internalFormatInfo))
@@ -1434,7 +1434,7 @@
     }
 }
 
-bool IsDepthRenderingSupported(GLint internalFormat, const rx::Renderer *renderer)
+bool IsDepthRenderingSupported(GLenum internalFormat, const rx::Renderer *renderer)
 {
     InternalFormatInfo internalFormatInfo;
     if (renderer && GetInternalFormatInfo(internalFormat, renderer->getCurrentClientVersion(), &internalFormatInfo))
@@ -1448,7 +1448,7 @@
     }
 }
 
-bool IsDepthRenderingSupported(GLint internalFormat, const Context *context)
+bool IsDepthRenderingSupported(GLenum internalFormat, const Context *context)
 {
     InternalFormatInfo internalFormatInfo;
     if (context && GetInternalFormatInfo(internalFormat, context->getClientVersion(), &internalFormatInfo))
@@ -1462,7 +1462,7 @@
     }
 }
 
-bool IsStencilRenderingSupported(GLint internalFormat, const rx::Renderer *renderer)
+bool IsStencilRenderingSupported(GLenum internalFormat, const rx::Renderer *renderer)
 {
     InternalFormatInfo internalFormatInfo;
     if (renderer && GetInternalFormatInfo(internalFormat, renderer->getCurrentClientVersion(), &internalFormatInfo))
@@ -1476,7 +1476,7 @@
     }
 }
 
-bool IsStencilRenderingSupported(GLint internalFormat, const Context *context)
+bool IsStencilRenderingSupported(GLenum internalFormat, const Context *context)
 {
     InternalFormatInfo internalFormatInfo;
     if (context && GetInternalFormatInfo(internalFormat, context->getClientVersion(), &internalFormatInfo))
@@ -1490,18 +1490,18 @@
     }
 }
 
-GLuint GetRowPitch(GLint internalFormat, GLenum type, GLuint clientVersion, GLsizei width, GLint alignment)
+GLuint GetRowPitch(GLenum internalFormat, GLenum type, GLuint clientVersion, GLsizei width, GLint alignment)
 {
     ASSERT(alignment > 0 && isPow2(alignment));
     return (GetBlockSize(internalFormat, type, clientVersion, width, 1) + alignment - 1) & ~(alignment - 1);
 }
 
-GLuint GetDepthPitch(GLint internalFormat, GLenum type, GLuint clientVersion, GLsizei width, GLsizei height, GLint alignment)
+GLuint GetDepthPitch(GLenum internalFormat, GLenum type, GLuint clientVersion, GLsizei width, GLsizei height, GLint alignment)
 {
     return GetRowPitch(internalFormat, type, clientVersion, width, alignment) * height;
 }
 
-GLuint GetBlockSize(GLint internalFormat, GLenum type, GLuint clientVersion, GLsizei width, GLsizei height)
+GLuint GetBlockSize(GLenum internalFormat, GLenum type, GLuint clientVersion, GLsizei width, GLsizei height)
 {
     InternalFormatInfo internalFormatInfo;
     if (GetInternalFormatInfo(internalFormat, clientVersion, &internalFormatInfo))
@@ -1541,7 +1541,7 @@
     }
 }
 
-bool IsFormatCompressed(GLint internalFormat, GLuint clientVersion)
+bool IsFormatCompressed(GLenum internalFormat, GLuint clientVersion)
 {
     InternalFormatInfo internalFormatInfo;
     if (GetInternalFormatInfo(internalFormat, clientVersion, &internalFormatInfo))
@@ -1555,7 +1555,7 @@
     }
 }
 
-GLuint GetCompressedBlockWidth(GLint internalFormat, GLuint clientVersion)
+GLuint GetCompressedBlockWidth(GLenum internalFormat, GLuint clientVersion)
 {
     InternalFormatInfo internalFormatInfo;
     if (GetInternalFormatInfo(internalFormat, clientVersion, &internalFormatInfo))
@@ -1569,7 +1569,7 @@
     }
 }
 
-GLuint GetCompressedBlockHeight(GLint internalFormat, GLuint clientVersion)
+GLuint GetCompressedBlockHeight(GLenum internalFormat, GLuint clientVersion)
 {
     InternalFormatInfo internalFormatInfo;
     if (GetInternalFormatInfo(internalFormat, clientVersion, &internalFormatInfo))
diff --git a/src/libGLESv2/formatutils.h b/src/libGLESv2/formatutils.h
index 323a981..0c0731b 100644
--- a/src/libGLESv2/formatutils.h
+++ b/src/libGLESv2/formatutils.h
@@ -40,51 +40,51 @@
 
 class Context;
 
-bool IsValidInternalFormat(GLint internalFormat, const Context *context);
+bool IsValidInternalFormat(GLenum internalFormat, const Context *context);
 bool IsValidFormat(GLenum format, GLuint clientVersion);
 bool IsValidType(GLenum type, GLuint clientVersion);
 
-bool IsValidFormatCombination(GLint internalFormat, GLenum format, GLenum type, GLuint clientVersion);
+bool IsValidFormatCombination(GLenum internalFormat, GLenum format, GLenum type, GLuint clientVersion);
 bool IsValidCopyTexImageCombination(GLenum textureInternalFormat, GLenum frameBufferInternalFormat, GLuint clientVersion);
 
-bool IsSizedInternalFormat(GLint internalFormat, GLuint clientVersion);
-GLint GetSizedInternalFormat(GLenum format, GLenum type, GLuint clientVersion);
+bool IsSizedInternalFormat(GLenum internalFormat, GLuint clientVersion);
+GLenum GetSizedInternalFormat(GLenum format, GLenum type, GLuint clientVersion);
 
-GLuint GetPixelBytes(GLint internalFormat, GLuint clientVersion);
-GLuint GetAlphaBits(GLint internalFormat, GLuint clientVersion);
-GLuint GetRedBits(GLint internalFormat, GLuint clientVersion);
-GLuint GetGreenBits(GLint internalFormat, GLuint clientVersion);
-GLuint GetBlueBits(GLint internalFormat, GLuint clientVersion);
-GLuint GetLuminanceBits(GLint internalFormat, GLuint clientVersion);
-GLuint GetDepthBits(GLint internalFormat, GLuint clientVersion);
-GLuint GetStencilBits(GLint internalFormat, GLuint clientVersion);
+GLuint GetPixelBytes(GLenum internalFormat, GLuint clientVersion);
+GLuint GetAlphaBits(GLenum internalFormat, GLuint clientVersion);
+GLuint GetRedBits(GLenum internalFormat, GLuint clientVersion);
+GLuint GetGreenBits(GLenum internalFormat, GLuint clientVersion);
+GLuint GetBlueBits(GLenum internalFormat, GLuint clientVersion);
+GLuint GetLuminanceBits(GLenum internalFormat, GLuint clientVersion);
+GLuint GetDepthBits(GLenum internalFormat, GLuint clientVersion);
+GLuint GetStencilBits(GLenum internalFormat, GLuint clientVersion);
 
 GLuint GetTypeBytes(GLenum type);
 bool IsSpecialInterpretationType(GLenum type);
 
-GLenum GetFormat(GLint internalFormat, GLuint clientVersion);
-GLenum GetType(GLint internalFormat, GLuint clientVersion);
+GLenum GetFormat(GLenum internalFormat, GLuint clientVersion);
+GLenum GetType(GLenum internalFormat, GLuint clientVersion);
 
-GLenum GetComponentType(GLint internalFormat, GLuint clientVersion);
-GLuint GetComponentCount(GLint internalFormat, GLuint clientVersion);
-GLenum GetColorEncoding(GLint internalFormat, GLuint clientVersion);
+GLenum GetComponentType(GLenum internalFormat, GLuint clientVersion);
+GLuint GetComponentCount(GLenum internalFormat, GLuint clientVersion);
+GLenum GetColorEncoding(GLenum internalFormat, GLuint clientVersion);
 
-bool IsColorRenderingSupported(GLint internalFormat, const rx::Renderer *renderer);
-bool IsColorRenderingSupported(GLint internalFormat, const Context *context);
-bool IsTextureFilteringSupported(GLint internalFormat, const rx::Renderer *renderer);
-bool IsTextureFilteringSupported(GLint internalFormat, const Context *context);
-bool IsDepthRenderingSupported(GLint internalFormat, const rx::Renderer *renderer);
-bool IsDepthRenderingSupported(GLint internalFormat, const Context *context);
-bool IsStencilRenderingSupported(GLint internalFormat, const rx::Renderer *renderer);
-bool IsStencilRenderingSupported(GLint internalFormat, const Context *context);
+bool IsColorRenderingSupported(GLenum internalFormat, const rx::Renderer *renderer);
+bool IsColorRenderingSupported(GLenum internalFormat, const Context *context);
+bool IsTextureFilteringSupported(GLenum internalFormat, const rx::Renderer *renderer);
+bool IsTextureFilteringSupported(GLenum internalFormat, const Context *context);
+bool IsDepthRenderingSupported(GLenum internalFormat, const rx::Renderer *renderer);
+bool IsDepthRenderingSupported(GLenum internalFormat, const Context *context);
+bool IsStencilRenderingSupported(GLenum internalFormat, const rx::Renderer *renderer);
+bool IsStencilRenderingSupported(GLenum internalFormat, const Context *context);
 
-GLuint GetRowPitch(GLint internalFormat, GLenum type, GLuint clientVersion, GLsizei width, GLint alignment);
-GLuint GetDepthPitch(GLint internalFormat, GLenum type, GLuint clientVersion, GLsizei width, GLsizei height, GLint alignment);
-GLuint GetBlockSize(GLint internalFormat, GLenum type, GLuint clientVersion, GLsizei width, GLsizei height);
+GLuint GetRowPitch(GLenum internalFormat, GLenum type, GLuint clientVersion, GLsizei width, GLint alignment);
+GLuint GetDepthPitch(GLenum internalFormat, GLenum type, GLuint clientVersion, GLsizei width, GLsizei height, GLint alignment);
+GLuint GetBlockSize(GLenum internalFormat, GLenum type, GLuint clientVersion, GLsizei width, GLsizei height);
 
-bool IsFormatCompressed(GLint internalFormat, GLuint clientVersion);
-GLuint GetCompressedBlockWidth(GLint internalFormat, GLuint clientVersion);
-GLuint GetCompressedBlockHeight(GLint internalFormat, GLuint clientVersion);
+bool IsFormatCompressed(GLenum internalFormat, GLuint clientVersion);
+GLuint GetCompressedBlockWidth(GLenum internalFormat, GLuint clientVersion);
+GLuint GetCompressedBlockHeight(GLenum internalFormat, GLuint clientVersion);
 
 ColorWriteFunction GetColorWriteFunction(GLenum format, GLenum type, GLuint clientVersion);
 
diff --git a/src/libGLESv2/libGLESv2.cpp b/src/libGLESv2/libGLESv2.cpp
index bf8dc17..e85fe64 100644
--- a/src/libGLESv2/libGLESv2.cpp
+++ b/src/libGLESv2/libGLESv2.cpp
@@ -2211,7 +2211,7 @@
                 return gl::error(GL_INVALID_OPERATION);
             }
 
-            GLint internalFormat = texture->getBaseLevelInternalFormat();
+            GLenum internalFormat = texture->getBaseLevelInternalFormat();
 
             // Internally, all texture formats are sized so checking if the format
             // is color renderable and filterable will not fail.
@@ -4604,8 +4604,7 @@
 
         if (context)
         {
-            GLint currentInternalFormat;
-            GLenum currentFormat, currentType;
+            GLenum currentInternalFormat, currentFormat, currentType;
 
             // Failure in getCurrentReadFormatType indicates that no color attachment is currently bound,
             // and attempting to read back if that's the case is an error. The error will be registered
@@ -4648,8 +4647,7 @@
 
         if (context)
         {
-            GLint currentInternalFormat;
-            GLenum currentFormat, currentType;
+            GLenum currentInternalFormat, currentFormat, currentType;
 
             // Failure in getCurrentReadFormatType indicates that no color attachment is currently bound,
             // and attempting to read back if that's the case is an error. The error will be registered
diff --git a/src/libGLESv2/renderer/Image.h b/src/libGLESv2/renderer/Image.h
index 0bebdfa..b24a524 100644
--- a/src/libGLESv2/renderer/Image.h
+++ b/src/libGLESv2/renderer/Image.h
@@ -53,7 +53,7 @@
     virtual bool updateSurface(TextureStorageInterface3D *storage, int level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth) = 0;
     virtual bool updateSurface(TextureStorageInterface2DArray *storage, int level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height) = 0;
 
-    virtual bool redefine(Renderer *renderer, GLenum target, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, bool forceRelease) = 0;
+    virtual bool redefine(Renderer *renderer, GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, bool forceRelease) = 0;
 
     virtual void loadData(GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth,
                           GLint unpackAlignment, GLenum type, const void *input) = 0;
@@ -66,7 +66,7 @@
     GLsizei mWidth;
     GLsizei mHeight;
     GLsizei mDepth;
-    GLint mInternalFormat;
+    GLenum mInternalFormat;
     GLenum mActualFormat;
     bool mRenderable;
     GLenum mTarget;
diff --git a/src/libGLESv2/renderer/Renderer.h b/src/libGLESv2/renderer/Renderer.h
index dde569e..ef44874 100644
--- a/src/libGLESv2/renderer/Renderer.h
+++ b/src/libGLESv2/renderer/Renderer.h
@@ -203,9 +203,9 @@
     virtual int getMaxSwapInterval() const = 0;
 
     virtual GLsizei getMaxSupportedSamples() const = 0;
-    virtual GLsizei getMaxSupportedFormatSamples(GLint internalFormat) const = 0;
-    virtual GLsizei getNumSampleCounts(GLint internalFormat) const = 0;
-    virtual void getSampleCounts(GLint internalFormat, GLsizei bufSize, GLint *params) const = 0;
+    virtual GLsizei getMaxSupportedFormatSamples(GLenum internalFormat) const = 0;
+    virtual GLsizei getNumSampleCounts(GLenum internalFormat) const = 0;
+    virtual void getSampleCounts(GLenum internalFormat, GLsizei bufSize, GLint *params) const = 0;
 
     virtual unsigned int getMaxRenderTargets() const = 0;
 
@@ -260,12 +260,12 @@
     int getCurrentClientVersion() const { return mCurrentClientVersion; }
 
     // Buffer-to-texture and Texture-to-buffer copies
-    virtual bool supportsFastCopyBufferToTexture(GLint internalFormat) const = 0;
+    virtual bool supportsFastCopyBufferToTexture(GLenum internalFormat) const = 0;
     virtual bool fastCopyBufferToTexture(const gl::PixelUnpackState &unpack, unsigned int offset, RenderTarget *destRenderTarget,
                                          GLenum destinationFormat, GLenum sourcePixelsType, const gl::Box &destArea) = 0;
 
     virtual bool getLUID(LUID *adapterLuid) const = 0;
-    virtual GLint getNativeTextureFormat(GLint internalFormat) const = 0;
+    virtual GLenum getNativeTextureFormat(GLenum internalFormat) const = 0;
 
   protected:
     bool initializeCompiler();
diff --git a/src/libGLESv2/renderer/d3d11/Blit11.cpp b/src/libGLESv2/renderer/d3d11/Blit11.cpp
index 5bbc64f..c3411cb 100644
--- a/src/libGLESv2/renderer/d3d11/Blit11.cpp
+++ b/src/libGLESv2/renderer/d3d11/Blit11.cpp
@@ -335,7 +335,7 @@
     // be GL_XXXX_INTEGER but it does not tell us if it is signed or unsigned.
     D3D11_SHADER_RESOURCE_VIEW_DESC sourceSRVDesc;
     source->GetDesc(&sourceSRVDesc);
-    GLint sourceInternalFormat = d3d11_gl::GetInternalFormat(sourceSRVDesc.Format, mRenderer->getCurrentClientVersion());
+    GLenum sourceInternalFormat = d3d11_gl::GetInternalFormat(sourceSRVDesc.Format, mRenderer->getCurrentClientVersion());
 
     BlitParameters parameters = { 0 };
     parameters.mDestinationFormat = destFormat;
diff --git a/src/libGLESv2/renderer/d3d11/Clear11.cpp b/src/libGLESv2/renderer/d3d11/Clear11.cpp
index 09b0ad6..2a45f25 100644
--- a/src/libGLESv2/renderer/d3d11/Clear11.cpp
+++ b/src/libGLESv2/renderer/d3d11/Clear11.cpp
@@ -221,7 +221,7 @@
                     return;
                 }
 
-                GLint internalFormat = renderbuffer->getInternalFormat();
+                GLenum internalFormat = renderbuffer->getInternalFormat();
                 GLenum componentType = gl::GetComponentType(internalFormat, clientVersion);
                 if (clearParams.colorClearType == GL_FLOAT &&
                     !(componentType == GL_FLOAT || componentType == GL_UNSIGNED_NORMALIZED || componentType == GL_SIGNED_NORMALIZED))
@@ -279,7 +279,7 @@
                 return;
             }
 
-            GLuint actualFormat = renderbuffer->getActualFormat();
+            GLenum actualFormat = renderbuffer->getActualFormat();
 
             unsigned int stencilUnmasked = frameBuffer->hasStencil() ? (1 << gl::GetStencilBits(actualFormat, clientVersion)) - 1 : 0;
             bool needMaskedStencilClear = clearParams.clearStencil && (clearParams.stencilWriteMask & stencilUnmasked) != stencilUnmasked;
diff --git a/src/libGLESv2/renderer/d3d11/Image11.cpp b/src/libGLESv2/renderer/d3d11/Image11.cpp
index 0bebec1..26bc773 100644
--- a/src/libGLESv2/renderer/d3d11/Image11.cpp
+++ b/src/libGLESv2/renderer/d3d11/Image11.cpp
@@ -108,7 +108,7 @@
     return storage11->updateSubresourceLevel(getStagingTexture(), getStagingSubresource(), level, arrayLayer, xoffset, yoffset, 0, width, height, 1);
 }
 
-bool Image11::redefine(Renderer *renderer, GLenum target, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, bool forceRelease)
+bool Image11::redefine(Renderer *renderer, GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, bool forceRelease)
 {
     if (mWidth != width ||
         mHeight != height ||
diff --git a/src/libGLESv2/renderer/d3d11/Image11.h b/src/libGLESv2/renderer/d3d11/Image11.h
index 8bb2b10..bb6e71e 100644
--- a/src/libGLESv2/renderer/d3d11/Image11.h
+++ b/src/libGLESv2/renderer/d3d11/Image11.h
@@ -43,7 +43,7 @@
     virtual bool updateSurface(TextureStorageInterface3D *storage, int level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth);
     virtual bool updateSurface(TextureStorageInterface2DArray *storage, int level, GLint xoffset, GLint yoffset, GLint arrayLayer, GLsizei width, GLsizei height);
 
-    virtual bool redefine(Renderer *renderer, GLenum target, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, bool forceRelease);
+    virtual bool redefine(Renderer *renderer, GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, bool forceRelease);
 
     DXGI_FORMAT getDXGIFormat() const;
     
diff --git a/src/libGLESv2/renderer/d3d11/Renderer11.cpp b/src/libGLESv2/renderer/d3d11/Renderer11.cpp
index e9e13b3..938e4b4 100644
--- a/src/libGLESv2/renderer/d3d11/Renderer11.cpp
+++ b/src/libGLESv2/renderer/d3d11/Renderer11.cpp
@@ -2216,14 +2216,14 @@
     return mMaxSupportedSamples;
 }
 
-GLsizei Renderer11::getMaxSupportedFormatSamples(GLint internalFormat) const
+GLsizei Renderer11::getMaxSupportedFormatSamples(GLenum internalFormat) const
 {
     DXGI_FORMAT format = gl_d3d11::GetRenderableFormat(internalFormat, getCurrentClientVersion());
     MultisampleSupportMap::const_iterator iter = mMultisampleSupportMap.find(format);
     return (iter != mMultisampleSupportMap.end()) ? iter->second.maxSupportedSamples : 0;
 }
 
-GLsizei Renderer11::getNumSampleCounts(GLint internalFormat) const
+GLsizei Renderer11::getNumSampleCounts(GLenum internalFormat) const
 {
     unsigned int numCounts = 0;
 
@@ -2250,7 +2250,7 @@
     return numCounts;
 }
 
-void Renderer11::getSampleCounts(GLint internalFormat, GLsizei bufSize, GLint *params) const
+void Renderer11::getSampleCounts(GLenum internalFormat, GLsizei bufSize, GLint *params) const
 {
     // D3D11 supports multisampling for signed and unsigned format, but ES 3.0 does not
     GLenum componentType = gl::GetComponentType(internalFormat, getCurrentClientVersion());
@@ -2767,7 +2767,7 @@
     return new Fence11(this);
 }
 
-bool Renderer11::supportsFastCopyBufferToTexture(GLint internalFormat) const
+bool Renderer11::supportsFastCopyBufferToTexture(GLenum internalFormat) const
 {
     int clientVersion = getCurrentClientVersion();
 
@@ -3067,7 +3067,7 @@
 
     GLuint clientVersion = getCurrentClientVersion();
 
-    GLint sourceInternalFormat = d3d11_gl::GetInternalFormat(textureDesc.Format, clientVersion);
+    GLenum sourceInternalFormat = d3d11_gl::GetInternalFormat(textureDesc.Format, clientVersion);
     GLenum sourceFormat = gl::GetFormat(sourceInternalFormat, clientVersion);
     GLenum sourceType = gl::GetType(sourceInternalFormat, clientVersion);
 
@@ -3084,7 +3084,7 @@
     }
     else
     {
-        GLint destInternalFormat = gl::GetSizedInternalFormat(format, type, clientVersion);
+        GLenum destInternalFormat = gl::GetSizedInternalFormat(format, type, clientVersion);
         GLuint destPixelSize = gl::GetPixelBytes(destInternalFormat, clientVersion);
 
         ColorCopyFunction fastCopyFunc = d3d11::GetFastCopyFunction(textureDesc.Format, format, type, getCurrentClientVersion());
@@ -3369,7 +3369,7 @@
     return true;
 }
 
-GLint Renderer11::getNativeTextureFormat(GLint internalFormat) const
+GLenum Renderer11::getNativeTextureFormat(GLenum internalFormat) const
 {
     int clientVersion = getCurrentClientVersion();
     return d3d11_gl::GetInternalFormat(gl_d3d11::GetTexFormat(internalFormat, clientVersion), clientVersion);
diff --git a/src/libGLESv2/renderer/d3d11/Renderer11.h b/src/libGLESv2/renderer/d3d11/Renderer11.h
index f28ca34..14e64b0 100644
--- a/src/libGLESv2/renderer/d3d11/Renderer11.h
+++ b/src/libGLESv2/renderer/d3d11/Renderer11.h
@@ -147,9 +147,9 @@
     virtual int getMaxSwapInterval() const;
 
     virtual GLsizei getMaxSupportedSamples() const;
-    virtual GLsizei getMaxSupportedFormatSamples(GLint internalFormat) const;
-    virtual GLsizei getNumSampleCounts(GLint internalFormat) const;
-    virtual void getSampleCounts(GLint internalFormat, GLsizei bufSize, GLint *params) const;
+    virtual GLsizei getMaxSupportedFormatSamples(GLenum internalFormat) const;
+    virtual GLsizei getNumSampleCounts(GLenum internalFormat) const;
+    virtual void getSampleCounts(GLenum internalFormat, GLsizei bufSize, GLint *params) const;
     int getNearestSupportedSamples(DXGI_FORMAT format, unsigned int requested) const;
 
     virtual unsigned int getMaxRenderTargets() const;
@@ -208,7 +208,7 @@
     Blit11 *getBlitter() { return mBlit; }
 
     // Buffer-to-texture and Texture-to-buffer copies
-    virtual bool supportsFastCopyBufferToTexture(GLint internalFormat) const;
+    virtual bool supportsFastCopyBufferToTexture(GLenum internalFormat) const;
     virtual bool fastCopyBufferToTexture(const gl::PixelUnpackState &unpack, unsigned int offset, RenderTarget *destRenderTarget,
                                          GLenum destinationFormat, GLenum sourcePixelsType, const gl::Box &destArea);
 
@@ -217,7 +217,7 @@
     void setOneTimeRenderTarget(ID3D11RenderTargetView *renderTargetView);
 
     virtual bool getLUID(LUID *adapterLuid) const;
-    virtual GLint getNativeTextureFormat(GLint internalFormat) const;
+    virtual GLenum getNativeTextureFormat(GLenum internalFormat) const;
 
   private:
     DISALLOW_COPY_AND_ASSIGN(Renderer11);
diff --git a/src/libGLESv2/renderer/d3d11/TextureStorage11.cpp b/src/libGLESv2/renderer/d3d11/TextureStorage11.cpp
index 51f3b3d..308e23b 100644
--- a/src/libGLESv2/renderer/d3d11/TextureStorage11.cpp
+++ b/src/libGLESv2/renderer/d3d11/TextureStorage11.cpp
@@ -49,7 +49,7 @@
     return static_cast<TextureStorage11*>(storage);
 }
 
-DWORD TextureStorage11::GetTextureBindFlags(GLint internalFormat, GLuint clientVersion, GLenum glusage)
+DWORD TextureStorage11::GetTextureBindFlags(GLenum internalFormat, GLuint clientVersion, GLenum glusage)
 {
     UINT bindFlags = 0;
 
diff --git a/src/libGLESv2/renderer/d3d11/TextureStorage11.h b/src/libGLESv2/renderer/d3d11/TextureStorage11.h
index f8edc38..6955339 100644
--- a/src/libGLESv2/renderer/d3d11/TextureStorage11.h
+++ b/src/libGLESv2/renderer/d3d11/TextureStorage11.h
@@ -29,7 +29,7 @@
 
     static TextureStorage11 *makeTextureStorage11(TextureStorage *storage);
 
-    static DWORD GetTextureBindFlags(GLint internalFormat, GLuint clientVersion, GLenum glusage);
+    static DWORD GetTextureBindFlags(GLenum internalFormat, GLuint clientVersion, GLenum glusage);
 
     UINT getBindFlags() const;
 
diff --git a/src/libGLESv2/renderer/d3d11/formatutils11.cpp b/src/libGLESv2/renderer/d3d11/formatutils11.cpp
index aab2e9d..3207816 100644
--- a/src/libGLESv2/renderer/d3d11/formatutils11.cpp
+++ b/src/libGLESv2/renderer/d3d11/formatutils11.cpp
@@ -35,8 +35,8 @@
 // For sized GL internal formats, there is only one corresponding D3D11 format. This map type allows
 // querying for the DXGI texture formats to use for textures, SRVs, RTVs and DSVs given a GL internal
 // format.
-typedef std::pair<GLint, D3D11ES3FormatInfo> D3D11ES3FormatPair;
-typedef std::map<GLint, D3D11ES3FormatInfo> D3D11ES3FormatMap;
+typedef std::pair<GLenum, D3D11ES3FormatInfo> D3D11ES3FormatPair;
+typedef std::map<GLenum, D3D11ES3FormatInfo> D3D11ES3FormatMap;
 
 static D3D11ES3FormatMap BuildD3D11ES3FormatMap()
 {
@@ -154,7 +154,7 @@
     return map;
 }
 
-static bool GetD3D11ES3FormatInfo(GLint internalFormat, GLuint clientVersion, D3D11ES3FormatInfo *outFormatInfo)
+static bool GetD3D11ES3FormatInfo(GLenum internalFormat, GLuint clientVersion, D3D11ES3FormatInfo *outFormatInfo)
 {
     static const D3D11ES3FormatMap formatMap = BuildD3D11ES3FormatMap();
     D3D11ES3FormatMap::const_iterator iter = formatMap.find(internalFormat);
@@ -176,7 +176,7 @@
 // this map type determines the loading function from the internal format and type supplied
 // to glTex*Image*D and the destination DXGI_FORMAT. Source formats and types are taken from
 // Tables 3.2 and 3.3 of the ES 3 spec.
-typedef std::pair<GLint, GLenum> InternalFormatTypePair;
+typedef std::pair<GLenum, GLenum> InternalFormatTypePair;
 typedef std::pair<InternalFormatTypePair, LoadImageFunction> D3D11LoadFunctionPair;
 typedef std::map<InternalFormatTypePair, LoadImageFunction> D3D11LoadFunctionMap;
 
@@ -195,7 +195,7 @@
 }
 
 // A helper function to insert data into the D3D11LoadFunctionMap with fewer characters.
-static inline void insertLoadFunction(D3D11LoadFunctionMap *map, GLint internalFormat, GLenum type,
+static inline void insertLoadFunction(D3D11LoadFunctionMap *map, GLenum internalFormat, GLenum type,
                                       LoadImageFunction loadFunc)
 {
     map->insert(D3D11LoadFunctionPair(InternalFormatTypePair(internalFormat, type), loadFunc));
@@ -363,8 +363,8 @@
 };
 
 // ES2 internal formats can map to DXGI formats and loading functions
-typedef std::pair<GLint, D3D11ES2FormatInfo> D3D11ES2FormatPair;
-typedef std::map<GLint, D3D11ES2FormatInfo> D3D11ES2FormatMap;
+typedef std::pair<GLenum, D3D11ES2FormatInfo> D3D11ES2FormatPair;
+typedef std::map<GLenum, D3D11ES2FormatInfo> D3D11ES2FormatMap;
 
 static D3D11ES2FormatMap BuildD3D11ES2FormatMap()
 {
@@ -410,7 +410,7 @@
     return map;
 }
 
-static bool GetD3D11ES2FormatInfo(GLint internalFormat, GLuint clientVersion, D3D11ES2FormatInfo *outFormatInfo)
+static bool GetD3D11ES2FormatInfo(GLenum internalFormat, GLuint clientVersion, D3D11ES2FormatInfo *outFormatInfo)
 {
     static const D3D11ES2FormatMap formatMap = BuildD3D11ES2FormatMap();
     D3D11ES2FormatMap::const_iterator iter = formatMap.find(internalFormat);
@@ -434,7 +434,7 @@
     GLuint mPixelBits;
     GLuint mBlockWidth;
     GLuint mBlockHeight;
-    GLint mInternalFormat;
+    GLenum mInternalFormat;
     GLuint mClientVersion;
 
     MipGenerationFunction mMipGenerationFunction;
@@ -445,7 +445,7 @@
           mColorReadFunction(NULL), mClientVersion(0)
     { }
 
-    DXGIFormatInfo(GLuint pixelBits, GLuint blockWidth, GLuint blockHeight, GLint internalFormat,
+    DXGIFormatInfo(GLuint pixelBits, GLuint blockWidth, GLuint blockHeight, GLenum internalFormat,
                    MipGenerationFunction mipFunc, ColorReadFunction readFunc, GLuint clientVersion)
         : mPixelBits(pixelBits), mBlockWidth(blockWidth), mBlockHeight(blockHeight), mInternalFormat(internalFormat),
           mMipGenerationFunction(mipFunc), mColorReadFunction(readFunc), mClientVersion(clientVersion)
@@ -708,7 +708,7 @@
     }
 }
 
-LoadImageFunction GetImageLoadFunction(GLint internalFormat, GLenum type, GLuint clientVersion)
+LoadImageFunction GetImageLoadFunction(GLenum internalFormat, GLenum type, GLuint clientVersion)
 {
     if (clientVersion == 2)
     {
@@ -906,7 +906,7 @@
 namespace gl_d3d11
 {
 
-DXGI_FORMAT GetTexFormat(GLint internalFormat, GLuint clientVersion)
+DXGI_FORMAT GetTexFormat(GLenum internalFormat, GLuint clientVersion)
 {
     if (clientVersion == 2)
     {
@@ -941,7 +941,7 @@
     }
 }
 
-DXGI_FORMAT GetSRVFormat(GLint internalFormat, GLuint clientVersion)
+DXGI_FORMAT GetSRVFormat(GLenum internalFormat, GLuint clientVersion)
 {
     if (clientVersion == 2)
     {
@@ -976,7 +976,7 @@
     }
 }
 
-DXGI_FORMAT GetRTVFormat(GLint internalFormat, GLuint clientVersion)
+DXGI_FORMAT GetRTVFormat(GLenum internalFormat, GLuint clientVersion)
 {
     if (clientVersion == 2)
     {
@@ -1011,7 +1011,7 @@
     }
 }
 
-DXGI_FORMAT GetDSVFormat(GLint internalFormat, GLuint clientVersion)
+DXGI_FORMAT GetDSVFormat(GLenum internalFormat, GLuint clientVersion)
 {
     if (clientVersion == 2)
     {
@@ -1046,7 +1046,7 @@
 
 // Given a GL internal format, this function returns the DSV format if it is depth- or stencil-renderable,
 // the RTV format if it is color-renderable, and the (nonrenderable) texture format otherwise.
-DXGI_FORMAT GetRenderableFormat(GLint internalFormat, GLuint clientVersion)
+DXGI_FORMAT GetRenderableFormat(GLenum internalFormat, GLuint clientVersion)
 {
     DXGI_FORMAT targetFormat = GetDSVFormat(internalFormat, clientVersion);
     if (targetFormat == DXGI_FORMAT_UNKNOWN)
@@ -1062,7 +1062,7 @@
 namespace d3d11_gl
 {
 
-GLint GetInternalFormat(DXGI_FORMAT format, GLuint clientVersion)
+GLenum GetInternalFormat(DXGI_FORMAT format, GLuint clientVersion)
 {
     DXGIFormatInfo formatInfo;
     if (GetDXGIFormatInfo(format, clientVersion, &formatInfo))
diff --git a/src/libGLESv2/renderer/d3d11/formatutils11.h b/src/libGLESv2/renderer/d3d11/formatutils11.h
index aae8a2d..82de183 100644
--- a/src/libGLESv2/renderer/d3d11/formatutils11.h
+++ b/src/libGLESv2/renderer/d3d11/formatutils11.h
@@ -21,7 +21,7 @@
 typedef std::set<DXGI_FORMAT> DXGIFormatSet;
 
 MipGenerationFunction GetMipGenerationFunction(DXGI_FORMAT format, GLuint clientVersion);
-LoadImageFunction GetImageLoadFunction(GLint internalFormat, GLenum type, GLuint clientVersion);
+LoadImageFunction GetImageLoadFunction(GLenum internalFormat, GLenum type, GLuint clientVersion);
 
 GLuint GetFormatPixelBytes(DXGI_FORMAT format, GLuint clientVersion);
 GLuint GetBlockWidth(DXGI_FORMAT format, GLuint clientVersion);
@@ -44,18 +44,18 @@
 namespace gl_d3d11
 {
 
-DXGI_FORMAT GetTexFormat(GLint internalFormat, GLuint clientVersion);
-DXGI_FORMAT GetSRVFormat(GLint internalFormat, GLuint clientVersion);
-DXGI_FORMAT GetRTVFormat(GLint internalFormat, GLuint clientVersion);
-DXGI_FORMAT GetDSVFormat(GLint internalFormat, GLuint clientVersion);
-DXGI_FORMAT GetRenderableFormat(GLint internalFormat, GLuint clientVersion);
+DXGI_FORMAT GetTexFormat(GLenum internalFormat, GLuint clientVersion);
+DXGI_FORMAT GetSRVFormat(GLenum internalFormat, GLuint clientVersion);
+DXGI_FORMAT GetRTVFormat(GLenum internalFormat, GLuint clientVersion);
+DXGI_FORMAT GetDSVFormat(GLenum internalFormat, GLuint clientVersion);
+DXGI_FORMAT GetRenderableFormat(GLenum internalFormat, GLuint clientVersion);
 
 }
 
 namespace d3d11_gl
 {
 
-GLint GetInternalFormat(DXGI_FORMAT format, GLuint clientVersion);
+GLenum GetInternalFormat(DXGI_FORMAT format, GLuint clientVersion);
 
 }
 
diff --git a/src/libGLESv2/renderer/d3d9/Image9.cpp b/src/libGLESv2/renderer/d3d9/Image9.cpp
index c3b9515..009104e 100644
--- a/src/libGLESv2/renderer/d3d9/Image9.cpp
+++ b/src/libGLESv2/renderer/d3d9/Image9.cpp
@@ -123,7 +123,7 @@
     else UNREACHABLE();
 }
 
-bool Image9::redefine(rx::Renderer *renderer, GLenum target, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, bool forceRelease)
+bool Image9::redefine(rx::Renderer *renderer, GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, bool forceRelease)
 {
     // 3D textures are not supported by the D3D9 backend.
     ASSERT(depth <= 1);
diff --git a/src/libGLESv2/renderer/d3d9/Image9.h b/src/libGLESv2/renderer/d3d9/Image9.h
index 8736725..4e0acad 100644
--- a/src/libGLESv2/renderer/d3d9/Image9.h
+++ b/src/libGLESv2/renderer/d3d9/Image9.h
@@ -37,7 +37,7 @@
     static void generateMip(IDirect3DSurface9 *destSurface, IDirect3DSurface9 *sourceSurface);
     static void copyLockableSurfaces(IDirect3DSurface9 *dest, IDirect3DSurface9 *source);
 
-    virtual bool redefine(Renderer *renderer, GLenum target, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, bool forceRelease);
+    virtual bool redefine(Renderer *renderer, GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, bool forceRelease);
 
     D3DFORMAT getD3DFormat() const;
 
diff --git a/src/libGLESv2/renderer/d3d9/Renderer9.cpp b/src/libGLESv2/renderer/d3d9/Renderer9.cpp
index 4cf78fd..6a9ad1e 100644
--- a/src/libGLESv2/renderer/d3d9/Renderer9.cpp
+++ b/src/libGLESv2/renderer/d3d9/Renderer9.cpp
@@ -723,7 +723,7 @@
     return new Fence9(this);
 }
 
-bool Renderer9::supportsFastCopyBufferToTexture(GLint internalFormat) const
+bool Renderer9::supportsFastCopyBufferToTexture(GLenum internalFormat) const
 {
     // Pixel buffer objects are not supported in D3D9, since D3D9 is ES2-only and PBOs are ES3.
     return false;
@@ -2499,14 +2499,14 @@
     return mMaxSupportedSamples;
 }
 
-GLsizei Renderer9::getMaxSupportedFormatSamples(GLint internalFormat) const
+GLsizei Renderer9::getMaxSupportedFormatSamples(GLenum internalFormat) const
 {
     D3DFORMAT format = gl_d3d9::GetTextureFormat(internalFormat, this);
     MultisampleSupportMap::const_iterator itr = mMultiSampleSupport.find(format);
     return (itr != mMultiSampleSupport.end()) ? mMaxSupportedSamples : 0;
 }
 
-GLsizei Renderer9::getNumSampleCounts(GLint internalFormat) const
+GLsizei Renderer9::getNumSampleCounts(GLenum internalFormat) const
 {
     D3DFORMAT format = gl_d3d9::GetTextureFormat(internalFormat, this);
     MultisampleSupportMap::const_iterator iter = mMultiSampleSupport.find(format);
@@ -2527,7 +2527,7 @@
     return numCounts;
 }
 
-void Renderer9::getSampleCounts(GLint internalFormat, GLsizei bufSize, GLint *params) const
+void Renderer9::getSampleCounts(GLenum internalFormat, GLsizei bufSize, GLint *params) const
 {
     D3DFORMAT format = gl_d3d9::GetTextureFormat(internalFormat, this);
     MultisampleSupportMap::const_iterator iter = mMultiSampleSupport.find(format);
@@ -2578,7 +2578,7 @@
     return 1;
 }
 
-D3DFORMAT Renderer9::ConvertTextureInternalFormat(GLint internalformat)
+D3DFORMAT Renderer9::ConvertTextureInternalFormat(GLenum internalformat)
 {
     switch (internalformat)
     {
@@ -3064,7 +3064,7 @@
 
     GLuint clientVersion = getCurrentClientVersion();
 
-    GLint sourceInternalFormat = d3d9_gl::GetInternalFormat(desc.Format);
+    GLenum sourceInternalFormat = d3d9_gl::GetInternalFormat(desc.Format);
     GLenum sourceFormat = gl::GetFormat(sourceInternalFormat, clientVersion);
     GLenum sourceType = gl::GetType(sourceInternalFormat, clientVersion);
 
@@ -3081,7 +3081,7 @@
     }
     else
     {
-        GLint destInternalFormat = gl::GetSizedInternalFormat(format, type, clientVersion);
+        GLenum destInternalFormat = gl::GetSizedInternalFormat(format, type, clientVersion);
         GLuint destPixelSize = gl::GetPixelBytes(destInternalFormat, clientVersion);
         GLuint sourcePixelSize = gl::GetPixelBytes(sourceInternalFormat, clientVersion);
 
@@ -3329,7 +3329,7 @@
     return false;
 }
 
-GLint Renderer9::getNativeTextureFormat(GLint internalFormat) const
+GLenum Renderer9::getNativeTextureFormat(GLenum internalFormat) const
 {
     return d3d9_gl::GetInternalFormat(gl_d3d9::GetTextureFormat(internalFormat, this));
 }
diff --git a/src/libGLESv2/renderer/d3d9/Renderer9.h b/src/libGLESv2/renderer/d3d9/Renderer9.h
index 344f57a..f16e815 100644
--- a/src/libGLESv2/renderer/d3d9/Renderer9.h
+++ b/src/libGLESv2/renderer/d3d9/Renderer9.h
@@ -161,14 +161,14 @@
     virtual int getMaxSwapInterval() const;
 
     virtual GLsizei getMaxSupportedSamples() const;
-    virtual GLsizei getMaxSupportedFormatSamples(GLint internalFormat) const;
-    virtual GLsizei getNumSampleCounts(GLint internalFormat) const;
-    virtual void getSampleCounts(GLint internalFormat, GLsizei bufSize, GLint *params) const;
+    virtual GLsizei getMaxSupportedFormatSamples(GLenum internalFormat) const;
+    virtual GLsizei getNumSampleCounts(GLenum internalFormat) const;
+    virtual void getSampleCounts(GLenum internalFormat, GLsizei bufSize, GLint *params) const;
     int getNearestSupportedSamples(D3DFORMAT format, int requested) const;
     
     virtual unsigned int getMaxRenderTargets() const;
 
-    D3DFORMAT ConvertTextureInternalFormat(GLint internalformat);
+    D3DFORMAT ConvertTextureInternalFormat(GLenum internalformat);
 
     // Pixel operations
     virtual bool copyToRenderTarget(TextureStorageInterface2D *dest, TextureStorageInterface2D *source);
@@ -217,7 +217,7 @@
     virtual FenceImpl *createFence();
 
     // Buffer-to-texture and Texture-to-buffer copies
-    virtual bool supportsFastCopyBufferToTexture(GLint internalFormat) const;
+    virtual bool supportsFastCopyBufferToTexture(GLenum internalFormat) const;
     virtual bool fastCopyBufferToTexture(const gl::PixelUnpackState &unpack, unsigned int offset, RenderTarget *destRenderTarget,
                                          GLenum destinationFormat, GLenum sourcePixelsType, const gl::Box &destArea);
 
@@ -227,7 +227,7 @@
     D3DPOOL getTexturePool(DWORD usage) const;
 
     virtual bool getLUID(LUID *adapterLuid) const;
-    virtual GLint getNativeTextureFormat(GLint internalFormat) const;
+    virtual GLenum getNativeTextureFormat(GLenum internalFormat) const;
 
   private:
     DISALLOW_COPY_AND_ASSIGN(Renderer9);
diff --git a/src/libGLESv2/renderer/d3d9/formatutils9.cpp b/src/libGLESv2/renderer/d3d9/formatutils9.cpp
index e8b400e..166cd7b 100644
--- a/src/libGLESv2/renderer/d3d9/formatutils9.cpp
+++ b/src/libGLESv2/renderer/d3d9/formatutils9.cpp
@@ -83,8 +83,8 @@
 const D3DFORMAT D3DFMT_INTZ = ((D3DFORMAT)(MAKEFOURCC('I','N','T','Z')));
 const D3DFORMAT D3DFMT_NULL = ((D3DFORMAT)(MAKEFOURCC('N','U','L','L')));
 
-typedef std::pair<GLint, D3D9FormatInfo> D3D9FormatPair;
-typedef std::map<GLint, D3D9FormatInfo> D3D9FormatMap;
+typedef std::pair<GLenum, D3D9FormatInfo> D3D9FormatPair;
+typedef std::map<GLenum, D3D9FormatInfo> D3D9FormatMap;
 
 static D3D9FormatMap BuildD3D9FormatMap()
 {
@@ -135,7 +135,7 @@
     return map;
 }
 
-static bool GetD3D9FormatInfo(GLint internalFormat, D3D9FormatInfo *outFormatInfo)
+static bool GetD3D9FormatInfo(GLenum internalFormat, D3D9FormatInfo *outFormatInfo)
 {
     static const D3D9FormatMap formatMap = BuildD3D9FormatMap();
     D3D9FormatMap::const_iterator iter = formatMap.find(internalFormat);
@@ -159,7 +159,7 @@
     GLuint mPixelBits;
     GLuint mBlockWidth;
     GLuint mBlockHeight;
-    GLint mInternalFormat;
+    GLenum mInternalFormat;
 
     MipGenerationFunction mMipGenerationFunction;
     ColorReadFunction mColorReadFunction;
@@ -169,7 +169,7 @@
           mColorReadFunction(NULL)
     { }
 
-    D3DFormatInfo(GLuint pixelBits, GLuint blockWidth, GLuint blockHeight, GLint internalFormat,
+    D3DFormatInfo(GLuint pixelBits, GLuint blockWidth, GLuint blockHeight, GLenum internalFormat,
                   MipGenerationFunction mipFunc, ColorReadFunction readFunc)
         : mPixelBits(pixelBits), mBlockWidth(blockWidth), mBlockHeight(blockHeight), mInternalFormat(internalFormat),
           mMipGenerationFunction(mipFunc), mColorReadFunction(readFunc)
@@ -293,7 +293,7 @@
     }
 }
 
-LoadImageFunction GetImageLoadFunction(GLint internalFormat, const Renderer9 *renderer)
+LoadImageFunction GetImageLoadFunction(GLenum internalFormat, const Renderer9 *renderer)
 {
     if (!renderer)
     {
@@ -429,7 +429,7 @@
 namespace gl_d3d9
 {
 
-D3DFORMAT GetTextureFormat(GLint internalFormat, const Renderer9 *renderer)
+D3DFORMAT GetTextureFormat(GLenum internalFormat, const Renderer9 *renderer)
 {
     if (!renderer)
     {
@@ -451,7 +451,7 @@
     }
 }
 
-D3DFORMAT GetRenderFormat(GLint internalFormat, const Renderer9 *renderer)
+D3DFORMAT GetRenderFormat(GLenum internalFormat, const Renderer9 *renderer)
 {
     if (!renderer)
     {
@@ -483,7 +483,7 @@
 namespace d3d9_gl
 {
 
-GLint GetInternalFormat(D3DFORMAT format)
+GLenum GetInternalFormat(D3DFORMAT format)
 {
     static const D3D9FormatInfoMap infoMap = BuildD3D9FormatInfoMap();
     D3D9FormatInfoMap::const_iterator iter = infoMap.find(format);
@@ -505,7 +505,7 @@
 
 bool IsFormatChannelEquivalent(D3DFORMAT d3dformat, GLenum format, GLuint clientVersion)
 {
-    GLint internalFormat = d3d9_gl::GetInternalFormat(d3dformat);
+    GLenum internalFormat = d3d9_gl::GetInternalFormat(d3dformat);
     GLenum convertedFormat = gl::GetFormat(internalFormat, clientVersion);
     return convertedFormat == format;
 }
diff --git a/src/libGLESv2/renderer/d3d9/formatutils9.h b/src/libGLESv2/renderer/d3d9/formatutils9.h
index 079403c..1903152 100644
--- a/src/libGLESv2/renderer/d3d9/formatutils9.h
+++ b/src/libGLESv2/renderer/d3d9/formatutils9.h
@@ -23,7 +23,7 @@
 typedef std::set<D3DFORMAT> D3DFormatSet;
 
 MipGenerationFunction GetMipGenerationFunction(D3DFORMAT format);
-LoadImageFunction GetImageLoadFunction(GLint internalFormat, const Renderer9 *renderer);
+LoadImageFunction GetImageLoadFunction(GLenum internalFormat, const Renderer9 *renderer);
 
 GLuint GetFormatPixelBytes(D3DFORMAT format);
 GLuint GetBlockWidth(D3DFORMAT format);
@@ -42,8 +42,8 @@
 namespace gl_d3d9
 {
 
-D3DFORMAT GetTextureFormat(GLint internalFormat, const Renderer9 *renderer);
-D3DFORMAT GetRenderFormat(GLint internalFormat, const Renderer9 *renderer);
+D3DFORMAT GetTextureFormat(GLenum internalFormat, const Renderer9 *renderer);
+D3DFORMAT GetRenderFormat(GLenum internalFormat, const Renderer9 *renderer);
 
 D3DMULTISAMPLE_TYPE GetMultisampleType(GLsizei samples);
 
@@ -52,7 +52,7 @@
 namespace d3d9_gl
 {
 
-GLint GetInternalFormat(D3DFORMAT format);
+GLenum GetInternalFormat(D3DFORMAT format);
 GLsizei GetSamplesCount(D3DMULTISAMPLE_TYPE type);
 bool IsFormatChannelEquivalent(D3DFORMAT d3dformat, GLenum format, GLuint clientVersion);
 
diff --git a/src/libGLESv2/validationES.cpp b/src/libGLESv2/validationES.cpp
index 90fa5d9..b3f8d90 100644
--- a/src/libGLESv2/validationES.cpp
+++ b/src/libGLESv2/validationES.cpp
@@ -75,7 +75,7 @@
     return true;
 }
 
-bool ValidCompressedImageSize(const gl::Context *context, GLint internalFormat, GLsizei width, GLsizei height)
+bool ValidCompressedImageSize(const gl::Context *context, GLenum internalFormat, GLsizei width, GLsizei height)
 {
     GLuint clientVersion = context->getClientVersion();
     if (!IsFormatCompressed(internalFormat, clientVersion))
@@ -273,14 +273,14 @@
 
         if (readColorBuffer && drawColorBuffer)
         {
-            GLint readInternalFormat = readColorBuffer->getActualFormat();
+            GLenum readInternalFormat = readColorBuffer->getActualFormat();
             GLenum readComponentType = gl::GetComponentType(readInternalFormat, clientVersion);
 
             for (unsigned int i = 0; i < gl::IMPLEMENTATION_MAX_DRAW_BUFFERS; i++)
             {
                 if (drawFramebuffer->isEnabledColorAttachment(i))
                 {
-                    GLint drawInternalFormat = drawFramebuffer->getColorbuffer(i)->getActualFormat();
+                    GLenum drawInternalFormat = drawFramebuffer->getColorbuffer(i)->getActualFormat();
                     GLenum drawComponentType = gl::GetComponentType(drawInternalFormat, clientVersion);
 
                     // The GL ES 3.0.2 spec (pg 193) states that:
diff --git a/src/libGLESv2/validationES.h b/src/libGLESv2/validationES.h
index 4b63379..b3ee6cf 100644
--- a/src/libGLESv2/validationES.h
+++ b/src/libGLESv2/validationES.h
@@ -17,7 +17,7 @@
 bool ValidTextureTarget(gl::Context *context, GLenum target);
 bool ValidMipLevel(const gl::Context *context, GLenum target, GLint level);
 bool ValidImageSize(const gl::Context *context, GLenum target, GLint level, GLsizei width, GLsizei height, GLsizei depth);
-bool ValidCompressedImageSize(const gl::Context *context, GLint internalFormat, GLsizei width, GLsizei height);
+bool ValidCompressedImageSize(const gl::Context *context, GLenum internalFormat, GLsizei width, GLsizei height);
 
 bool ValidateRenderbufferStorageParameters(const gl::Context *context, GLenum target, GLsizei samples,
                                            GLenum internalformat, GLsizei width, GLsizei height,
diff --git a/src/libGLESv2/validationES2.cpp b/src/libGLESv2/validationES2.cpp
index a9a11e2..5bd3002 100644
--- a/src/libGLESv2/validationES2.cpp
+++ b/src/libGLESv2/validationES2.cpp
@@ -104,7 +104,7 @@
     return true;
 }
 
-bool ValidateES2TexImageParameters(gl::Context *context, GLenum target, GLint level, GLint internalformat, bool isCompressed, bool isSubImage,
+bool ValidateES2TexImageParameters(gl::Context *context, GLenum target, GLint level, GLenum internalformat, bool isCompressed, bool isSubImage,
                                    GLint xoffset, GLint yoffset, GLsizei width, GLsizei height,
                                    GLint border, GLenum format, GLenum type, const GLvoid *pixels)
 {
@@ -120,7 +120,7 @@
         return gl::error(GL_INVALID_VALUE, false);
     }
 
-    if (!isSubImage && !isCompressed && internalformat != GLint(format))
+    if (!isSubImage && !isCompressed && internalformat != format)
     {
         return gl::error(GL_INVALID_OPERATION, false);
     }
diff --git a/src/libGLESv2/validationES2.h b/src/libGLESv2/validationES2.h
index e18ab52..d98b3b7 100644
--- a/src/libGLESv2/validationES2.h
+++ b/src/libGLESv2/validationES2.h
@@ -14,7 +14,7 @@
 
 class Context;
 
-bool ValidateES2TexImageParameters(gl::Context *context, GLenum target, GLint level, GLint internalformat, bool isCompressed, bool isSubImage,
+bool ValidateES2TexImageParameters(gl::Context *context, GLenum target, GLint level, GLenum internalformat, bool isCompressed, bool isSubImage,
                                    GLint xoffset, GLint yoffset, GLsizei width, GLsizei height,
                                    GLint border, GLenum format, GLenum type, const GLvoid *pixels);
 
diff --git a/src/libGLESv2/validationES3.cpp b/src/libGLESv2/validationES3.cpp
index baf3f2c..2aac77d 100644
--- a/src/libGLESv2/validationES3.cpp
+++ b/src/libGLESv2/validationES3.cpp
@@ -21,7 +21,7 @@
 namespace gl
 {
 
-bool ValidateES3TexImageParameters(gl::Context *context, GLenum target, GLint level, GLint internalformat, bool isCompressed, bool isSubImage,
+bool ValidateES3TexImageParameters(gl::Context *context, GLenum target, GLint level, GLenum internalformat, bool isCompressed, bool isSubImage,
                                    GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth,
                                    GLint border, GLenum format, GLenum type, const GLvoid *pixels)
 {
diff --git a/src/libGLESv2/validationES3.h b/src/libGLESv2/validationES3.h
index e45cc6b..eecfbfc 100644
--- a/src/libGLESv2/validationES3.h
+++ b/src/libGLESv2/validationES3.h
@@ -14,7 +14,7 @@
 
 class Context;
 
-bool ValidateES3TexImageParameters(gl::Context *context, GLenum target, GLint level, GLint internalformat, bool isCompressed, bool isSubImage,
+bool ValidateES3TexImageParameters(gl::Context *context, GLenum target, GLint level, GLenum internalformat, bool isCompressed, bool isSubImage,
                                    GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth,
                                    GLint border, GLenum format, GLenum type, const GLvoid *pixels);