Bug 765137 - 2/3 - WebGL: clean up IsExtensionSupported - r=jgilbert
authorBenoit Jacob <bjacob@mozilla.com>
Sat, 16 Jun 2012 01:12:08 -0400
changeset 96879 b4155b0db5682dd74740275b33c23895ef081cdc
parent 96878 e3c16c67029142e78d497bbf8b6121b6abbfad2b
child 96880 45fc4aa0941e6547869d179eeb05fef1cbb072fe
push id22938
push userryanvm@gmail.com
push dateSat, 16 Jun 2012 13:39:00 +0000
treeherdermozilla-central@9602a9e99045 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjgilbert
bugs765137
milestone16.0a1
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 765137 - 2/3 - WebGL: clean up IsExtensionSupported - r=jgilbert
content/canvas/src/WebGLContext.cpp
--- a/content/canvas/src/WebGLContext.cpp
+++ b/content/canvas/src/WebGLContext.cpp
@@ -837,45 +837,43 @@ WebGLContext::MozGetUnderlyingParamStrin
         return NS_ERROR_INVALID_ARG;
     }
 
     return NS_OK;
 }
 
 bool WebGLContext::IsExtensionSupported(WebGLExtensionID ei)
 {
-    bool isSupported;
+    bool isSupported = false;
 
     switch (ei) {
+        case WebGL_OES_standard_derivatives:
+        case WebGL_WEBGL_lose_context:
+            // We always support these extensions.
+            isSupported = true;
+            break;
         case WebGL_OES_texture_float:
             isSupported = gl->IsExtensionSupported(gl->IsGLES2() ? GLContext::OES_texture_float 
                                                                  : GLContext::ARB_texture_float);
-	    break;
-        case WebGL_OES_standard_derivatives:
-            // We always support this extension.
-            isSupported = true;
             break;
         case WebGL_EXT_texture_filter_anisotropic:
             isSupported = gl->IsExtensionSupported(GLContext::EXT_texture_filter_anisotropic);
             break;
-        case WebGL_WEBGL_lose_context:
-            // We always support this extension.
-            isSupported = true;
-            break;
         case WebGL_WEBGL_compressed_texture_s3tc:
             if (gl->IsExtensionSupported(GLContext::EXT_texture_compression_s3tc)) {
                 isSupported = true;
-            } else {
-                isSupported = gl->IsExtensionSupported(GLContext::EXT_texture_compression_dxt1) &&
-                              gl->IsExtensionSupported(GLContext::ANGLE_texture_compression_dxt3) &&
-                              gl->IsExtensionSupported(GLContext::ANGLE_texture_compression_dxt5);
+            } else if (gl->IsExtensionSupported(GLContext::EXT_texture_compression_dxt1) &&
+                       gl->IsExtensionSupported(GLContext::ANGLE_texture_compression_dxt3) &&
+                       gl->IsExtensionSupported(GLContext::ANGLE_texture_compression_dxt5))
+            {
+                isSupported = true;
             }
             break;
         default:
-            isSupported = false;
+            MOZ_ASSERT(false, "should not get there.");
     }
 
     return isSupported;
 }
 
 NS_IMETHODIMP
 WebGLContext::GetExtension(const nsAString& aName, nsIWebGLExtension **retval)
 {