Backout cc37cd8dac59 (bug 744303) for M1 orange
authorEd Morley <emorley@mozilla.com>
Wed, 25 Apr 2012 16:15:11 +0100
changeset 92435 049d28694d2680fdd12c92b59345ddee1f53faa7
parent 92434 d2bececb50a1a20a49ce11d99e0e78ffdab900c5
child 92436 949cb1977ef999ee708d2dcdc3636c44b244b5a7
push id22531
push userkhuey@mozilla.com
push dateThu, 26 Apr 2012 03:23:06 +0000
treeherdermozilla-central@b893f852fe7b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs744303
milestone15.0a1
backs outcc37cd8dac5965c6465a6a9d775a75a988679028
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
Backout cc37cd8dac59 (bug 744303) for M1 orange
content/canvas/src/WebGLContextGL.cpp
gfx/gl/GLContext.h
--- a/content/canvas/src/WebGLContextGL.cpp
+++ b/content/canvas/src/WebGLContextGL.cpp
@@ -5179,30 +5179,16 @@ WebGLContext::TexImage2D_base(WebGLenum 
 
     GLenum error = LOCAL_GL_NO_ERROR;
 
     if (byteLength) {
         int dstFormat = GetWebGLTexelFormat(format, type);
         int actualSrcFormat = srcFormat == WebGLTexelFormat::Auto ? dstFormat : srcFormat;
         size_t srcStride = srcStrideOrZero ? srcStrideOrZero : checked_alignedRowSize.value();
 
-        if (gl->CanUploadBGRA() &&
-            actualSrcFormat == WebGLTexelFormat::BGRA8 &&
-            dstFormat == WebGLTexelFormat::RGBA8)
-        {
-            dstFormat = WebGLTexelFormat::BGRA8;
-            format = LOCAL_GL_BGRA;
-            if (gl->IsGLES2()) {
-                internalformat = LOCAL_GL_BGRA;
-            } else {
-                internalformat = LOCAL_GL_RGBA;
-                type = LOCAL_GL_UNSIGNED_INT_8_8_8_8_REV;
-            }
-        }
-
         size_t dstPlainRowSize = texelSize * width;
         size_t unpackAlignment = mPixelStoreUnpackAlignment;
         size_t dstStride = ((dstPlainRowSize + unpackAlignment-1) / unpackAlignment) * unpackAlignment;
 
         if (actualSrcFormat == dstFormat &&
             srcPremultiplied == mPixelStorePremultiplyAlpha &&
             srcStride == dstStride &&
             !mPixelStoreFlipY)
@@ -5403,27 +5389,16 @@ WebGLContext::TexSubImage2D_base(WebGLen
     int dstFormat = GetWebGLTexelFormat(format, type);
     int actualSrcFormat = srcFormat == WebGLTexelFormat::Auto ? dstFormat : srcFormat;
     size_t srcStride = srcStrideOrZero ? srcStrideOrZero : checked_alignedRowSize.value();
 
     size_t dstPlainRowSize = texelSize * width;
     // There are checks above to ensure that this won't overflow.
     size_t dstStride = RoundedToNextMultipleOf(dstPlainRowSize, mPixelStoreUnpackAlignment).value();
 
-    if (gl->CanUploadBGRA() &&
-        actualSrcFormat == WebGLTexelFormat::BGRA8 &&
-        dstFormat == WebGLTexelFormat::RGBA8)
-    {
-        dstFormat = WebGLTexelFormat::BGRA8;
-        format = LOCAL_GL_BGRA;
-        if (!gl->IsGLES2()) {
-            type = LOCAL_GL_UNSIGNED_INT_8_8_8_8_REV;
-        }
-    }
-
     if (actualSrcFormat == dstFormat &&
         srcPremultiplied == mPixelStorePremultiplyAlpha &&
         srcStride == dstStride &&
         !mPixelStoreFlipY)
     {
         // no conversion, no flipping, so we avoid copying anything and just pass the source pointer
         gl->fTexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels);
     }
--- a/gfx/gl/GLContext.h
+++ b/gfx/gl/GLContext.h
@@ -1512,17 +1512,17 @@ public:
         ANGLE_framebuffer_multisample,
         OES_rgb8_rgba8,
         ARB_robustness,
         EXT_robustness,
         ARB_sync,
         Extensions_Max
     };
 
-    bool IsExtensionSupported(GLExtensions aKnownExtension) const {
+    bool IsExtensionSupported(GLExtensions aKnownExtension) {
         return mAvailableExtensions[aKnownExtension];
     }
 
     void MarkExtensionUnsupported(GLExtensions aKnownExtension) {
         mAvailableExtensions[aKnownExtension] = 0;
     }
 
     // Shared code for GL extensions and GLX extensions.
@@ -1540,22 +1540,17 @@ public:
     template<size_t setlen>
     struct ExtensionBitset {
         ExtensionBitset() {
             for (size_t i = 0; i < setlen; ++i)
                 values[i] = false;
         }
 
         bool& operator[](size_t index) {
-            NS_ABORT_IF_FALSE(index < setlen, "out of range");
-            return values[index];
-        }
-
-        const bool& operator[](size_t index) const {
-            NS_ABORT_IF_FALSE(index < setlen, "out of range");
+            NS_ASSERTION(index < setlen, "out of range");
             return values[index];
         }
 
         bool values[setlen];
     };
 
     /**
      * Context reset constants.
@@ -1704,26 +1699,16 @@ protected:
     // Clear to transparent black, with 0 depth and stencil,
     // while preserving current ClearColor etc. values.
     // Useful for resizing offscreen buffers.
 public:
     void ClearSafely();
 
     bool WorkAroundDriverBugs() const { return mWorkAroundDriverBugs; }
 
-    bool CanUploadBGRA() const {
-        if (!IsGLES2())
-            return true;
-
-        if (IsExtensionSupported(EXT_texture_format_BGRA8888))
-            return true;
-
-        return false;
-    }
-
 protected:
 
     nsDataHashtable<nsPtrHashKey<void>, void*> mUserData;
 
     void SetIsGLES2(bool aIsGLES2) {
         NS_ASSERTION(!mInitialized, "SetIsGLES2 can only be called before initialization!");
         mIsGLES2 = aIsGLES2;
     }