Bug 1273252 - WARP should hit. r=jmuizelaar, a=ritu
authorJeff Gilbert <jdashg@gmail.com>
Fri, 20 May 2016 14:21:19 -0700
changeset 324473 c4cf7fcd62d3cb5f1e2f5f7f0227459415017771
parent 324472 46eb9f7807f371cf7205fbdee59fef6da41157cb
child 324474 7abf386fee3f6aa34f9d3058dd033af8c495a5ef
push id6025
push usercbook@mozilla.com
push dateWed, 25 May 2016 14:23:38 +0000
treeherdermozilla-beta@c4cf7fcd62d3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjmuizelaar, ritu
bugs1273252
milestone47.0
Bug 1273252 - WARP should hit. r=jmuizelaar, a=ritu
dom/canvas/WebGLContext.cpp
--- a/dom/canvas/WebGLContext.cpp
+++ b/dom/canvas/WebGLContext.cpp
@@ -843,40 +843,42 @@ WebGLContext::SetDimensions(int32_t sign
     // TODO: When we have software webgl support we should use that instead.
     disabled |= gfxPlatform::InSafeMode();
 
     if (disabled) {
         GenerateWarning("WebGL creation is disabled, and so disallowed here.");
         return NS_ERROR_FAILURE;
     }
 
-    nsCOMPtr<nsIGfxInfo> gfxInfo = services::GetGfxInfo();
-    bool failIfMajorPerformanceCaveat =
-                    !gfxPrefs::WebGLDisableFailIfMajorPerformanceCaveat() &&
-                    !HasAcceleratedLayers(gfxInfo);
-    if (failIfMajorPerformanceCaveat) {
-        dom::Nullable<dom::WebGLContextAttributes> contextAttributes;
-        this->GetContextAttributes(contextAttributes);
-        if (contextAttributes.Value().mFailIfMajorPerformanceCaveat) {
+    if (gfxPrefs::WebGLDisableFailIfMajorPerformanceCaveat()) {
+        mOptions.failIfMajorPerformanceCaveat = false;
+    }
+
+    if (mOptions.failIfMajorPerformanceCaveat) {
+        nsCOMPtr<nsIGfxInfo> gfxInfo = services::GetGfxInfo();
+        if (!HasAcceleratedLayers(gfxInfo))
             return NS_ERROR_FAILURE;
-        }
     }
 
     // Alright, now let's start trying.
     bool forceEnabled = gfxPrefs::WebGLForceEnabled();
     ScopedGfxFeatureReporter reporter("WebGL", forceEnabled);
 
     MOZ_ASSERT(!gl);
     if (!CreateAndInitGL(forceEnabled)) {
         GenerateWarning("WebGL creation failed.");
         return NS_ERROR_FAILURE;
     }
     MOZ_ASSERT(gl);
+    MOZ_ASSERT_IF(mOptions.alpha, gl->Caps().alpha);
 
-    MOZ_ASSERT_IF(mOptions.alpha, gl->Caps().alpha);
+    if (mOptions.failIfMajorPerformanceCaveat) {
+        if (gl->IsWARP())
+            return NS_ERROR_FAILURE;
+    }
 
     if (!ResizeBackbuffer(width, height)) {
         GenerateWarning("Initializing WebGL backbuffer failed.");
         return NS_ERROR_FAILURE;
     }
 
 #ifdef DEBUG
     if (gl->DebugMode())