OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <set> | 5 #include <set> |
6 #include <string> | 6 #include <string> |
7 #include "gpu/command_buffer/service/feature_info.h" | 7 #include "gpu/command_buffer/service/feature_info.h" |
8 #include "gpu/command_buffer/service/gl_utils.h" | 8 #include "gpu/command_buffer/service/gl_utils.h" |
9 #include "gpu/GLES2/gles2_command_buffer.h" | 9 #include "gpu/GLES2/gles2_command_buffer.h" |
10 #include "ui/gfx/gl/gl_implementation.h" | 10 #include "ui/gfx/gl/gl_implementation.h" |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 AddExtensionString("GL_CHROMIUM_webglsl"); | 114 AddExtensionString("GL_CHROMIUM_webglsl"); |
115 feature_flags_.chromium_webglsl = true; | 115 feature_flags_.chromium_webglsl = true; |
116 } | 116 } |
117 | 117 |
118 // Check if we should allow GL_EXT_texture_compression_dxt1 and | 118 // Check if we should allow GL_EXT_texture_compression_dxt1 and |
119 // GL_EXT_texture_compression_s3tc. | 119 // GL_EXT_texture_compression_s3tc. |
120 bool enable_dxt1 = false; | 120 bool enable_dxt1 = false; |
121 bool enable_dxt3 = false; | 121 bool enable_dxt3 = false; |
122 bool enable_dxt5 = false; | 122 bool enable_dxt5 = false; |
123 bool have_s3tc = ext.Have("GL_EXT_texture_compression_s3tc"); | 123 bool have_s3tc = ext.Have("GL_EXT_texture_compression_s3tc"); |
| 124 bool have_dxt3 = have_s3tc || ext.Have("GL_ANGLE_texture_compression_dxt3"); |
| 125 bool have_dxt5 = have_s3tc || ext.Have("GL_ANGLE_texture_compression_dxt5"); |
124 | 126 |
125 if (ext.Desire("GL_EXT_texture_compression_dxt1") && | 127 if (ext.Desire("GL_EXT_texture_compression_dxt1") && |
126 (ext.Have("GL_EXT_texture_compression_dxt1") || have_s3tc)) { | 128 (ext.Have("GL_EXT_texture_compression_dxt1") || have_s3tc)) { |
127 enable_dxt1 = true; | 129 enable_dxt1 = true; |
128 } | 130 } |
129 if (have_s3tc && ext.Desire("GL_CHROMIUM_texture_compression_dxt3")) { | 131 if (have_dxt3 && ext.Desire("GL_CHROMIUM_texture_compression_dxt3")) { |
130 enable_dxt3 = true; | 132 enable_dxt3 = true; |
131 } | 133 } |
132 if (have_s3tc && ext.Desire("GL_CHROMIUM_texture_compression_dxt5")) { | 134 if (have_dxt5 && ext.Desire("GL_CHROMIUM_texture_compression_dxt5")) { |
133 enable_dxt5 = true; | 135 enable_dxt5 = true; |
134 } | 136 } |
135 | 137 |
136 if (enable_dxt1) { | 138 if (enable_dxt1) { |
137 AddExtensionString("GL_EXT_texture_compression_dxt1"); | 139 AddExtensionString("GL_EXT_texture_compression_dxt1"); |
138 validators_.compressed_texture_format.AddValue( | 140 validators_.compressed_texture_format.AddValue( |
139 GL_COMPRESSED_RGB_S3TC_DXT1_EXT); | 141 GL_COMPRESSED_RGB_S3TC_DXT1_EXT); |
140 validators_.compressed_texture_format.AddValue( | 142 validators_.compressed_texture_format.AddValue( |
141 GL_COMPRESSED_RGBA_S3TC_DXT1_EXT); | 143 GL_COMPRESSED_RGBA_S3TC_DXT1_EXT); |
142 } | 144 } |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
351 } | 353 } |
352 | 354 |
353 void FeatureInfo::AddExtensionString(const std::string& str) { | 355 void FeatureInfo::AddExtensionString(const std::string& str) { |
354 if (extensions_.find(str) == std::string::npos) { | 356 if (extensions_.find(str) == std::string::npos) { |
355 extensions_ += (extensions_.empty() ? "" : " ") + str; | 357 extensions_ += (extensions_.empty() ? "" : " ") + str; |
356 } | 358 } |
357 } | 359 } |
358 | 360 |
359 } // namespace gles2 | 361 } // namespace gles2 |
360 } // namespace gpu | 362 } // namespace gpu |
OLD | NEW |