Index: gpu/command_buffer/service/feature_info.cc |
diff --git a/gpu/command_buffer/service/feature_info.cc b/gpu/command_buffer/service/feature_info.cc |
index c21815c08abcc013b64b1e43cc08fb8f21012986..ea162a6542a69a07619e52734e32580d7c873941 100644 |
--- a/gpu/command_buffer/service/feature_info.cc |
+++ b/gpu/command_buffer/service/feature_info.cc |
@@ -231,20 +231,23 @@ void FeatureInfo::InitializeBasicState(const base::CommandLine* command_line) { |
command_line->HasSwitch(switches::kDisableGLSLTranslator); |
unsafe_es3_apis_enabled_ = false; |
-} |
-bool FeatureInfo::Initialize() { |
- disallowed_features_ = DisallowedFeatures(); |
- InitializeFeatures(); |
- return true; |
+ // Default context_type_ to a GLES2 Context. |
+ context_type_ = CONTEXT_TYPE_OPENGLES2; |
} |
-bool FeatureInfo::Initialize(const DisallowedFeatures& disallowed_features) { |
+bool FeatureInfo::Initialize(ContextType context_type, |
+ const DisallowedFeatures& disallowed_features) { |
disallowed_features_ = disallowed_features; |
+ context_type_ = context_type; |
InitializeFeatures(); |
return true; |
} |
+bool FeatureInfo::InitializeForTesting() { |
+ return Initialize(CONTEXT_TYPE_OPENGLES2, DisallowedFeatures()); |
+} |
+ |
bool IsGL_REDSupportedOnFBOs() { |
// Skia uses GL_RED with frame buffers, unfortunately, Mesa claims to support |
// GL_EXT_texture_rg, but it doesn't support it on frame buffers. To fix |
@@ -698,7 +701,15 @@ void FeatureInfo::InitializeFeatures() { |
} |
// Check for multisample support |
- if (!workarounds_.disable_chromium_framebuffer_multisample) { |
+ |
+ // crbug.com/527565 - On some GPUs, MSAA does not perform acceptably for |
+ // rasterization. We disable it on non-WebGL contexts. For WebGL contexts |
+ // we leave it up to the site to decide whether to enable MSAA. |
+ bool disable_all_multisample = |
+ workarounds_.disable_msaa_on_non_webgl_contexts && !IsWebGLContext(); |
+ |
+ if (!disable_all_multisample && |
+ !workarounds_.disable_chromium_framebuffer_multisample) { |
bool ext_has_multisample = |
extensions.Contains("GL_EXT_framebuffer_multisample") || |
gl_version_info_->is_es3 || |
@@ -720,7 +731,8 @@ void FeatureInfo::InitializeFeatures() { |
} |
} |
- if (!workarounds_.disable_multisampled_render_to_texture) { |
+ if (!disable_all_multisample && |
+ !workarounds_.disable_multisampled_render_to_texture) { |
if (extensions.Contains("GL_EXT_multisampled_render_to_texture")) { |
feature_flags_.multisampled_render_to_texture = true; |
} else if (extensions.Contains("GL_IMG_multisampled_render_to_texture")) { |
@@ -1193,6 +1205,21 @@ void FeatureInfo::EnableES3Validators() { |
unsafe_es3_apis_enabled_ = true; |
} |
+bool FeatureInfo::IsWebGLContext() const { |
+ // Switch statement to cause a compile-time error if we miss a case. |
+ switch (context_type_) { |
+ case CONTEXT_TYPE_WEBGL1: |
+ case CONTEXT_TYPE_WEBGL2: |
+ return true; |
+ case CONTEXT_TYPE_OPENGLES2: |
+ case CONTEXT_TYPE_OPENGLES3: |
+ return false; |
+ } |
+ |
+ NOTREACHED(); |
+ return false; |
+} |
+ |
void FeatureInfo::AddExtensionString(const char* s) { |
std::string str(s); |
size_t pos = extensions_.find(str); |