r?jrmuizel - WGL without DXGLInterop2 is perf caveat.
draft
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
--- 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;
}