Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(267)

Side by Side Diff: gpu/command_buffer/service/feature_info.cc

Issue 1263043006: Implement the texture uploading of ASTC compression for WebGL (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "gpu/command_buffer/service/feature_info.h" 5 #include "gpu/command_buffer/service/feature_info.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 enable_texture_float_linear(false), 138 enable_texture_float_linear(false),
139 enable_texture_half_float_linear(false), 139 enable_texture_half_float_linear(false),
140 angle_translated_shader_source(false), 140 angle_translated_shader_source(false),
141 angle_pack_reverse_row_order(false), 141 angle_pack_reverse_row_order(false),
142 arb_texture_rectangle(false), 142 arb_texture_rectangle(false),
143 angle_instanced_arrays(false), 143 angle_instanced_arrays(false),
144 occlusion_query_boolean(false), 144 occlusion_query_boolean(false),
145 use_arb_occlusion_query2_for_occlusion_query_boolean(false), 145 use_arb_occlusion_query2_for_occlusion_query_boolean(false),
146 use_arb_occlusion_query_for_occlusion_query_boolean(false), 146 use_arb_occlusion_query_for_occlusion_query_boolean(false),
147 native_vertex_array_object(false), 147 native_vertex_array_object(false),
148 ext_texture_format_astc(false),
148 ext_texture_format_atc(false), 149 ext_texture_format_atc(false),
149 ext_texture_format_bgra8888(false), 150 ext_texture_format_bgra8888(false),
150 ext_texture_format_dxt1(false), 151 ext_texture_format_dxt1(false),
151 ext_texture_format_dxt5(false), 152 ext_texture_format_dxt5(false),
152 enable_shader_name_hashing(false), 153 enable_shader_name_hashing(false),
153 enable_samplers(false), 154 enable_samplers(false),
154 ext_draw_buffers(false), 155 ext_draw_buffers(false),
155 nv_draw_buffers(false), 156 nv_draw_buffers(false),
156 ext_frag_depth(false), 157 ext_frag_depth(false),
157 ext_shader_texture_lod(false), 158 ext_shader_texture_lod(false),
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
377 // The difference between GL_EXT_texture_compression_s3tc and 378 // The difference between GL_EXT_texture_compression_s3tc and
378 // GL_CHROMIUM_texture_compression_dxt5 is that the former 379 // GL_CHROMIUM_texture_compression_dxt5 is that the former
379 // requires on the fly compression. The latter does not. 380 // requires on the fly compression. The latter does not.
380 AddExtensionString("GL_CHROMIUM_texture_compression_dxt5"); 381 AddExtensionString("GL_CHROMIUM_texture_compression_dxt5");
381 validators_.compressed_texture_format.AddValue( 382 validators_.compressed_texture_format.AddValue(
382 GL_COMPRESSED_RGBA_S3TC_DXT5_EXT); 383 GL_COMPRESSED_RGBA_S3TC_DXT5_EXT);
383 validators_.texture_internal_format_storage.AddValue( 384 validators_.texture_internal_format_storage.AddValue(
384 GL_COMPRESSED_RGBA_S3TC_DXT5_EXT); 385 GL_COMPRESSED_RGBA_S3TC_DXT5_EXT);
385 } 386 }
386 387
388 bool have_astc = extensions.Contains("GL_OES_texture_compression_astc") ||
Ken Russell (switch to Gerrit) 2015/08/07 22:32:33 I don't think we should reference the GL_OES_textu
389 extensions.Contains("GL_KHR_texture_compression_astc_ldr");
390 if (have_astc) {
391 feature_flags_.ext_texture_format_astc = true;
392 AddExtensionString("GL_KHR_texture_compression_astc_ldr");
393
394 GLint astc_rgba_type_max =
395 (GL_COMPRESSED_RGBA_ASTC_12x12_KHR -
396 GL_COMPRESSED_RGBA_ASTC_4x4_KHR);
397 GLint astc_srgba_type_max =
398 (GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR -
399 GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR);
400
401 // GL_COMPRESSED_RGBA_ASTC
402 for (GLint i = 0; i <= astc_rgba_type_max; i++) {
Ken Russell (switch to Gerrit) 2015/08/07 22:32:33 Why not just iterate from COMPRESSED_RGBA_ASTC_4x4
403 GLint format = GL_COMPRESSED_RGBA_ASTC_4x4_KHR + i;
404 validators_.compressed_texture_format.AddValue(format);
405 }
406 // GL_COMPRESSED_SRGB8_ALPHA8_ASTC
407 for (GLint i = 0; i <= astc_srgba_type_max; i++) {
408 GLint format = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR + i;
409 validators_.compressed_texture_format.AddValue(format);
410 }
411 }
412
387 bool have_atc = extensions.Contains("GL_AMD_compressed_ATC_texture") || 413 bool have_atc = extensions.Contains("GL_AMD_compressed_ATC_texture") ||
388 extensions.Contains("GL_ATI_texture_compression_atitc"); 414 extensions.Contains("GL_ATI_texture_compression_atitc");
389 if (have_atc) { 415 if (have_atc) {
390 feature_flags_.ext_texture_format_atc = true; 416 feature_flags_.ext_texture_format_atc = true;
391 417
392 AddExtensionString("GL_AMD_compressed_ATC_texture"); 418 AddExtensionString("GL_AMD_compressed_ATC_texture");
393 validators_.compressed_texture_format.AddValue(GL_ATC_RGB_AMD); 419 validators_.compressed_texture_format.AddValue(GL_ATC_RGB_AMD);
394 validators_.compressed_texture_format.AddValue( 420 validators_.compressed_texture_format.AddValue(
395 GL_ATC_RGBA_INTERPOLATED_ALPHA_AMD); 421 GL_ATC_RGBA_INTERPOLATED_ALPHA_AMD);
396 422
(...skipping 772 matching lines...) Expand 10 before | Expand all | Expand 10 after
1169 if (pos == std::string::npos) { 1195 if (pos == std::string::npos) {
1170 extensions_ += (extensions_.empty() ? "" : " ") + str; 1196 extensions_ += (extensions_.empty() ? "" : " ") + str;
1171 } 1197 }
1172 } 1198 }
1173 1199
1174 FeatureInfo::~FeatureInfo() { 1200 FeatureInfo::~FeatureInfo() {
1175 } 1201 }
1176 1202
1177 } // namespace gles2 1203 } // namespace gles2
1178 } // namespace gpu 1204 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698