r?jrmuizel - Disable native GL for webgl1, but allow in webgl2.
draft
r?jrmuizel - Disable native GL for webgl1, but allow in webgl2.
From f8c8ab1c5c86621facbb57a471abd58b5003ba79 Mon Sep 17 00:00:00 2001
---
dom/canvas/WebGLContext.cpp | 17 +++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)
MozReview-Commit-ID: BW3HO5zTFnK
--- a/dom/canvas/WebGLContext.cpp
+++ b/dom/canvas/WebGLContext.cpp
@@ -685,48 +685,49 @@ WebGLContext::CreateAndInitGLWith(FnCrea
return true;
}
bool
WebGLContext::CreateAndInitGL(bool forceEnabled,
std::vector<FailureReason>* const out_failReasons)
{
- bool blacklistOpenGL = false;
- if (!forceEnabled) {
+ bool disableNativeGL = true;
+ if (forceEnabled) {
+ disableNativeGL = false;
+ } else if (IsWebGL2()) {
const nsCOMPtr<nsIGfxInfo> gfxInfo = services::GetGfxInfo();
+ const auto feature = nsIGfxInfo::FEATURE_WEBGL_OPENGL;
FailureReason reason;
- if (IsFeatureInBlacklist(gfxInfo, nsIGfxInfo::FEATURE_WEBGL_OPENGL,
- &reason.key))
- {
- blacklistOpenGL = true;
-
+ if (IsFeatureInBlacklist(gfxInfo, feature, &reason.key)) {
reason.info = "Refused to create native OpenGL context because of blacklist"
" entry: ";
reason.info.Append(reason.key);
out_failReasons->push_back(reason);
GenerateWarning(reason.info.BeginReading());
+ } else {
+ disableNativeGL = false;
}
}
//////
gl::CreateContextFlags flags = gl::CreateContextFlags::NONE;
if (forceEnabled) flags |= gl::CreateContextFlags::FORCE_ENABLE_HARDWARE;
if (!IsWebGL2()) flags |= gl::CreateContextFlags::REQUIRE_COMPAT_PROFILE;
if (IsWebGL2()) flags |= gl::CreateContextFlags::PREFER_ES3;
const gl::SurfaceCaps baseCaps = BaseCaps(mOptions, this);
//////
- if (!blacklistOpenGL) {
+ if (!disableNativeGL) {
const bool useEGL = PR_GetEnv("MOZ_WEBGL_FORCE_EGL");
if (useEGL)
return CreateAndInitGLWith(CreateGLWithEGL, baseCaps, flags, out_failReasons);
bool tryNativeGL = true;
#ifdef XP_WIN
if (gfxPrefs::WebGLDisableWGL()) {