r?jrmuizel - WGL without DXGLInterop2 is perf caveat. draft
authorJeff Gilbert <jdashg@gmail.com>
Mon, 23 May 2016 16:51:06 -0700
changeset 371854 a5586158a73ef749ee3d4e269bd6ec1aeacde163
parent 371853 8d8ac8e93c02c6c98414cd66d840552cb8d7e200
child 371855 28ed1eb2dca97a8c3450921466f1d4f0ae89cccc
push id19369
push userjgilbert@mozilla.com
push dateThu, 26 May 2016 23:11:09 +0000
reviewersjrmuizel
milestone49.0a1
r?jrmuizel - WGL without DXGLInterop2 is perf caveat. From c424ae6779afcd8c3a57fc58a704d9050188feec Mon Sep 17 00:00:00 2001 --- dom/canvas/WebGLContext.cpp | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) MozReview-Commit-ID: BpPyu8rDbEM
dom/canvas/WebGLContext.cpp
--- a/dom/canvas/WebGLContext.cpp
+++ b/dom/canvas/WebGLContext.cpp
@@ -70,16 +70,20 @@
 #include "WebGLTransformFeedback.h"
 #include "WebGLVertexArray.h"
 #include "WebGLVertexAttribData.h"
 
 #ifdef MOZ_WIDGET_COCOA
 #include "nsCocoaFeatures.h"
 #endif
 
+#ifdef XP_WIN
+#include "WGLLibrary.h"
+#endif
+
 // Generated
 #include "mozilla/dom/WebGLRenderingContextBinding.h"
 
 
 namespace mozilla {
 
 using namespace mozilla::dom;
 using namespace mozilla::gfx;
@@ -947,18 +951,30 @@ WebGLContext::SetDimensions(int32_t sign
 
             text.AppendASCII("\n* ");
             text.Append(cur.info);
         }
         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);
+#ifdef XP_WIN
+    if (failIfPerfCaveat &&
+        gl->GetContextType() == gl::GLContextType::WGL &&
+        !gl::sWGLLib.HasDXInterop2())
+    {
+        gl = nullptr;
+
+        const nsLiteralCString text("Caveat: WGL without DXGLInterop2.");
+        ThrowEvent_WebGLContextCreationError(text);
+        return NS_ERROR_FAILURE;
+    }
+#endif
 
     if (!ResizeBackbuffer(width, height)) {
         Telemetry::Accumulate(Telemetry::CANVAS_WEBGL_FAILURE_ID,
                               NS_LITERAL_CSTRING("FEATURE_FAILURE_WEBGL_RESIZE"));
         const nsLiteralCString text("Initializing WebGL backbuffer failed.");
         ThrowEvent_WebGLContextCreationError(text);
         return NS_ERROR_FAILURE;
     }