Bug 1273252 - WARP should hit. r=jmuizelaar, a=ritu
--- 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())