Bug 1273252 - r?jrmuizel - WARP should hit draft
authorJeff Gilbert <jdashg@gmail.com>
Fri, 20 May 2016 14:21:19 -0700
changeset 369229 8352520a54332357a621b167d49363e29c6deaa2
parent 368911 1806d405c8715949b39fa3a4fc142d14a60df590
child 521518 2c5b64b4129e1c51cfd25ff1d44184fe1961d1ec
push id18801
push userjgilbert@mozilla.com
push dateFri, 20 May 2016 21:23:20 +0000
reviewersjrmuizel
bugs1273252
milestone49.0a1
Bug 1273252 - r?jrmuizel - WARP should hit From 1aea1bd168d6a61165a1038c7debfa1d940c9896 Mon Sep 17 00:00:00 2001 failIfMajorPerformanceCaveat. --- dom/canvas/WebGLContext.cpp | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) MozReview-Commit-ID: FDiXSWldsBB
dom/canvas/WebGLContext.cpp
--- a/dom/canvas/WebGLContext.cpp
+++ b/dom/canvas/WebGLContext.cpp
@@ -880,21 +880,21 @@ WebGLContext::SetDimensions(int32_t sign
     disabled |= gfxPlatform::InSafeMode();
 
     if (disabled) {
         const nsLiteralCString text("WebGL is currently disabled.");
         ThrowEvent_WebGLContextCreationError(text);
         return NS_ERROR_FAILURE;
     }
 
-    bool failIfPerfCaveat = mOptions.failIfMajorPerformanceCaveat;
-    if (gfxPrefs::WebGLDisableFailIfMajorPerformanceCaveat())
-        failIfPerfCaveat = false;
+    if (gfxPrefs::WebGLDisableFailIfMajorPerformanceCaveat()) {
+        mOptions.failIfMajorPerformanceCaveat = false;
+    }
 
-    if (failIfPerfCaveat) {
+    if (mOptions.failIfMajorPerformanceCaveat) {
         nsCOMPtr<nsIGfxInfo> gfxInfo = services::GetGfxInfo();
         if (!HasAcceleratedLayers(gfxInfo)) {
             const nsLiteralCString text("failIfMajorPerformanceCaveat: Compositor is not"
                                         " hardware-accelerated.");
             ThrowEvent_WebGLContextCreationError(text);
             return NS_ERROR_FAILURE;
         }
     }
@@ -907,18 +907,26 @@ WebGLContext::SetDimensions(int32_t sign
     nsCString failReason;
     if (!CreateAndInitGL(forceEnabled, &failReason)) {
         const nsPrintfCString text("WebGL creation failed: %s",
                                    failReason.BeginReading());
         ThrowEvent_WebGLContextCreationError(text);
         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()) {
+            const nsLiteralCString text("failIfMajorPerformanceCaveat: Driver is not"
+                                        " hardware-accelerated.");
+            ThrowEvent_WebGLContextCreationError(text);
+            return NS_ERROR_FAILURE;
+        }
+    }
 
     if (!ResizeBackbuffer(width, height)) {
         const nsLiteralCString text("Initializing WebGL backbuffer failed.");
         ThrowEvent_WebGLContextCreationError(text);
         return NS_ERROR_FAILURE;
     }
 
 #ifdef DEBUG