From 26a764f8cb5452493c53a5b80f1b2cfa2bae4585 Mon Sep 17 00:00:00 2001 From: "jbates@chromium.org" Date: Thu, 29 Dec 2011 20:50:57 +0000 Subject: Disable GL_EXT_texture_storage support in Linux. Our implementation is not compatible with newer Nvidia driver versions. This should be reenabled when a workaround is found. BUG=107782 TEST=see bug report for manual test (linux only) Review URL: http://codereview.chromium.org/8989064 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@115983 0039d316-1c4b-4281-b951-d872f2087c98 --- gpu/command_buffer/service/feature_info.cc | 35 +++++++++++++++++++++++++++--- gpu/command_buffer/service/test_helper.cc | 5 +++++ 2 files changed, 37 insertions(+), 3 deletions(-) (limited to 'gpu') diff --git a/gpu/command_buffer/service/feature_info.cc b/gpu/command_buffer/service/feature_info.cc index 7bee2a8..0d836d9 100644 --- a/gpu/command_buffer/service/feature_info.cc +++ b/gpu/command_buffer/service/feature_info.cc @@ -2,9 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include -#include #include "gpu/command_buffer/service/feature_info.h" + +#include + +#include "base/string_number_conversions.h" #include "gpu/command_buffer/service/gl_utils.h" #include "ui/gfx/gl/gl_context.h" #include "ui/gfx/gl/gl_implementation.h" @@ -411,7 +413,34 @@ void FeatureInfo::AddFeatures(const char* desired_features) { validators_.texture_parameter.AddValue(GL_TEXTURE_USAGE_ANGLE); } - if (ext.HaveAndDesire("GL_EXT_texture_storage")) { + bool allow_texture_storage = true; +#if defined(OS_LINUX) + if (!disallowed_features_.driver_bug_workarounds) { + // Disable GL_EXT_texture_storage on Linux, newer Nvidia drivers + // don't support our implementation. See crbug.com/107782. The bug is + // present on 285.x.x but not on 280.x.x so we will disable this feature + // on driver versions greater than 280. + const char* vendor_str = + reinterpret_cast(glGetString(GL_VENDOR)); + bool is_nvidia = vendor_str && + (strcmp(vendor_str, "NVIDIA Corporation") == 0); + if (is_nvidia) { + base::StringPiece version = + reinterpret_cast(glGetString(GL_VERSION)); + int version_num = 0; + size_t begin_version = version.find_last_of(' ') + 1; + size_t size_version = version.find_first_of('.', begin_version) - + begin_version; + if (base::StringToInt(version.substr(begin_version, size_version), + &version_num)) + allow_texture_storage = (version_num <= 280); + else + allow_texture_storage = false; + } + } +#endif + + if (allow_texture_storage && ext.HaveAndDesire("GL_EXT_texture_storage")) { AddExtensionString("GL_EXT_texture_storage"); validators_.texture_parameter.AddValue(GL_TEXTURE_IMMUTABLE_FORMAT_EXT); if (enable_texture_format_bgra8888) diff --git a/gpu/command_buffer/service/test_helper.cc b/gpu/command_buffer/service/test_helper.cc index 0290980..d4628a9 100644 --- a/gpu/command_buffer/service/test_helper.cc +++ b/gpu/command_buffer/service/test_helper.cc @@ -221,6 +221,11 @@ void TestHelper::SetupFeatureInfoInitExpectations( EXPECT_CALL(*gl, GetString(GL_EXTENSIONS)) .WillOnce(Return(reinterpret_cast(extensions))) .RetiresOnSaturation(); +#if defined(OS_LINUX) + EXPECT_CALL(*gl, GetString(GL_VENDOR)) + .WillOnce(Return(reinterpret_cast(extensions))) + .RetiresOnSaturation(); +#endif } } // namespace gles2 -- cgit v1.1