From 77f8db0759552d202e3ea14e2b13ba5eab969c6e Mon Sep 17 00:00:00 2001 From: "gman@chromium.org" Date: Mon, 21 Mar 2011 21:48:59 +0000 Subject: Change GL_EXT_texture_compression_s3tc to GL_CHROMIUM_texture_compression_dxt3 and GL_CHROMIUM_texture_compression_dxt5 because we don't support all the features of GL_EXT_texture_compression_s3tc. TEST=unit tests BUG=none Review URL: http://codereview.chromium.org/6715005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@78926 0039d316-1c4b-4281-b951-d872f2087c98 --- gpu/command_buffer/service/feature_info.cc | 31 ++++++++++++++++------ gpu/command_buffer/service/feature_info.h | 2 +- .../service/feature_info_unittest.cc | 10 +++++-- 3 files changed, 32 insertions(+), 11 deletions(-) (limited to 'gpu') diff --git a/gpu/command_buffer/service/feature_info.cc b/gpu/command_buffer/service/feature_info.cc index bc58f11..19e71fc 100644 --- a/gpu/command_buffer/service/feature_info.cc +++ b/gpu/command_buffer/service/feature_info.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -117,14 +117,19 @@ void FeatureInfo::AddFeatures(const char* desired_features) { // Check if we should allow GL_EXT_texture_compression_dxt1 and // GL_EXT_texture_compression_s3tc. bool enable_dxt1 = false; - bool enable_s3tc = false; + bool enable_dxt3 = false; + bool enable_dxt5 = false; + bool have_s3tc = ext.Have("GL_EXT_texture_compression_s3tc"); - if (ext.HaveAndDesire("GL_EXT_texture_compression_dxt1")) { + if (ext.Desire("GL_EXT_texture_compression_dxt1") && + (ext.Have("GL_EXT_texture_compression_dxt1") || have_s3tc)) { enable_dxt1 = true; } - if (ext.HaveAndDesire("GL_EXT_texture_compression_s3tc")) { - enable_dxt1 = true; - enable_s3tc = true; + if (have_s3tc && ext.Desire("GL_CHROMIUM_texture_compression_dxt3")) { + enable_dxt3 = true; + } + if (have_s3tc && ext.Desire("GL_CHROMIUM_texture_compression_dxt5")) { + enable_dxt5 = true; } if (enable_dxt1) { @@ -135,10 +140,20 @@ void FeatureInfo::AddFeatures(const char* desired_features) { GL_COMPRESSED_RGBA_S3TC_DXT1_EXT); } - if (enable_s3tc) { - AddExtensionString("GL_EXT_texture_compression_s3tc"); + if (enable_dxt3) { + // The difference between GL_EXT_texture_compression_s3tc and + // GL_CHROMIUM_texture_compression_dxt3 is that the former + // requires on the fly compression. The latter does not. + AddExtensionString("GL_CHROMIUM_texture_compression_dxt3"); validators_.compressed_texture_format.AddValue( GL_COMPRESSED_RGBA_S3TC_DXT3_EXT); + } + + if (enable_dxt5) { + // The difference between GL_EXT_texture_compression_s3tc and + // GL_CHROMIUM_texture_compression_dxt5 is that the former + // requires on the fly compression. The latter does not. + AddExtensionString("GL_CHROMIUM_texture_compression_dxt5"); validators_.compressed_texture_format.AddValue( GL_COMPRESSED_RGBA_S3TC_DXT5_EXT); } diff --git a/gpu/command_buffer/service/feature_info.h b/gpu/command_buffer/service/feature_info.h index 44f1008..37f7397 100644 --- a/gpu/command_buffer/service/feature_info.h +++ b/gpu/command_buffer/service/feature_info.h @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/gpu/command_buffer/service/feature_info_unittest.cc b/gpu/command_buffer/service/feature_info_unittest.cc index 4db4229..cc96bc8 100644 --- a/gpu/command_buffer/service/feature_info_unittest.cc +++ b/gpu/command_buffer/service/feature_info_unittest.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -77,6 +77,10 @@ TEST_F(FeatureInfoTest, InitializeNoExtensions) { EXPECT_THAT(info_.extensions(), Not(HasSubstr("GL_OES_texture_npot"))); EXPECT_THAT(info_.extensions(), Not(HasSubstr("GL_EXT_texture_compression_dxt1"))); + EXPECT_THAT(info_.extensions(), + Not(HasSubstr("GL_CHROMIUM_texture_compression_dxt3"))); + EXPECT_THAT(info_.extensions(), + Not(HasSubstr("GL_CHROMIUM_texture_compression_dxt5"))); EXPECT_FALSE(info_.feature_flags().npot_ok); EXPECT_FALSE(info_.feature_flags().chromium_webglsl); EXPECT_FALSE(info_.validators()->compressed_texture_format.IsValid( @@ -153,7 +157,9 @@ TEST_F(FeatureInfoTest, InitializeDXTExtensionGL) { EXPECT_THAT(info_.extensions(), HasSubstr("GL_EXT_texture_compression_dxt1")); EXPECT_THAT(info_.extensions(), - HasSubstr("GL_EXT_texture_compression_s3tc")); + HasSubstr("GL_CHROMIUM_texture_compression_dxt3")); + EXPECT_THAT(info_.extensions(), + HasSubstr("GL_CHROMIUM_texture_compression_dxt5")); EXPECT_TRUE(info_.validators()->compressed_texture_format.IsValid( GL_COMPRESSED_RGB_S3TC_DXT1_EXT)); EXPECT_TRUE(info_.validators()->compressed_texture_format.IsValid( -- cgit v1.1