Refactor FeatureInfo so you can't request features.
With this change all contexts should share the same features.
Another CL can try to make it so there is only one global
instance of a FeatureInfo.
BUG=168628
Review URL: https://chromiumcodereview.appspot.com/11791032
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@175473 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.cc b/gpu/command_buffer/service/gles2_cmd_decoder.cc
index 13ccc15..710de787 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder.cc
+++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc
@@ -2118,13 +2118,9 @@
// The shader translator is used for WebGL even when running on EGL
// because additional restrictions are needed (like only enabling
// GL_OES_standard_derivatives on demand). It is used for the unit
- // tests because
- // GLES2DecoderWithShaderTest.GetShaderInfoLogValidArgs passes the
- // empty string to CompileShader and this is not a valid shader.
- // TODO(apatrick): fix this test.
- if ((gfx::GetGLImplementation() == gfx::kGLImplementationEGLGLES2 &&
- !features().chromium_webglsl && !force_webgl_glsl_validation_) ||
- gfx::GetGLImplementation() == gfx::kGLImplementationMockGL ||
+ // tests because GLES2DecoderWithShaderTest.GetShaderInfoLogValidArgs passes
+ // the empty string to CompileShader and this is not a valid shader.
+ if (gfx::GetGLImplementation() == gfx::kGLImplementationMockGL ||
CommandLine::ForCurrentProcess()->HasSwitch(
switches::kDisableGLSLTranslator)) {
use_shader_translator_ = false;
@@ -2453,12 +2449,6 @@
bool GLES2DecoderImpl::InitializeShaderTranslator() {
TRACE_EVENT0("gpu", "GLES2DecoderImpl::InitializeShaderTranslator");
- // Re-check the state of use_shader_translator_ each time this is called.
- if (gfx::GetGLImplementation() == gfx::kGLImplementationEGLGLES2 &&
- (features().chromium_webglsl || force_webgl_glsl_validation_) &&
- !use_shader_translator_) {
- use_shader_translator_ = true;
- }
if (!use_shader_translator_) {
return true;
}
@@ -2491,7 +2481,7 @@
resources.HashFunction = &CityHashForAngle;
ShShaderSpec shader_spec = force_webgl_glsl_validation_ ||
- features().chromium_webglsl ? SH_WEBGL_SPEC : SH_GLES2_SPEC;
+ force_webgl_glsl_validation_ ? SH_WEBGL_SPEC : SH_GLES2_SPEC;
ShaderTranslatorInterface::GlslImplementationType implementation_type =
gfx::GetGLImplementation() == gfx::kGLImplementationEGLGLES2 ?
ShaderTranslatorInterface::kGlslES : ShaderTranslatorInterface::kGlsl;
@@ -8753,25 +8743,18 @@
return error::kInvalidArguments;
}
- bool std_derivatives_enabled = features().oes_standard_derivatives;
- bool webglsl_enabled = features().chromium_webglsl;
-
- feature_info_->AddFeatures(feature_str.c_str());
-
- bool initialization_required = false;
- if (force_webgl_glsl_validation_ && !derivatives_explicitly_enabled_) {
- size_t derivatives_offset = feature_str.find(kOESDerivativeExtension);
- if (std::string::npos != derivatives_offset) {
- derivatives_explicitly_enabled_ = true;
- initialization_required = true;
- }
+ bool desire_webgl_glsl_validation =
+ feature_str.find("GL_CHROMIUM_webglsl") != std::string::npos;
+ bool desire_standard_derivatives = false;
+ if (force_webgl_glsl_validation_) {
+ desire_standard_derivatives =
+ feature_str.find("GL_OES_standard_derivatives") != std::string::npos;
}
- // If we just enabled a feature which affects the shader translator,
- // we may need to re-initialize it.
- if (std_derivatives_enabled != features().oes_standard_derivatives ||
- webglsl_enabled != features().chromium_webglsl ||
- initialization_required) {
+ if (desire_webgl_glsl_validation != force_webgl_glsl_validation_ ||
+ desire_standard_derivatives != derivatives_explicitly_enabled_) {
+ force_webgl_glsl_validation_ = desire_webgl_glsl_validation;
+ derivatives_explicitly_enabled_ = desire_standard_derivatives;
InitializeShaderTranslator();
}