OLD | NEW |
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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 enable_texture_float_linear(false), | 125 enable_texture_float_linear(false), |
126 enable_texture_half_float_linear(false), | 126 enable_texture_half_float_linear(false), |
127 angle_translated_shader_source(false), | 127 angle_translated_shader_source(false), |
128 angle_pack_reverse_row_order(false), | 128 angle_pack_reverse_row_order(false), |
129 arb_texture_rectangle(false), | 129 arb_texture_rectangle(false), |
130 angle_instanced_arrays(false), | 130 angle_instanced_arrays(false), |
131 occlusion_query_boolean(false), | 131 occlusion_query_boolean(false), |
132 use_arb_occlusion_query2_for_occlusion_query_boolean(false), | 132 use_arb_occlusion_query2_for_occlusion_query_boolean(false), |
133 use_arb_occlusion_query_for_occlusion_query_boolean(false), | 133 use_arb_occlusion_query_for_occlusion_query_boolean(false), |
134 native_vertex_array_object(false), | 134 native_vertex_array_object(false), |
| 135 ext_texture_format_atc(false), |
135 ext_texture_format_bgra8888(false), | 136 ext_texture_format_bgra8888(false), |
| 137 ext_texture_format_dxt1(false), |
| 138 ext_texture_format_dxt5(false), |
136 enable_shader_name_hashing(false), | 139 enable_shader_name_hashing(false), |
137 enable_samplers(false), | 140 enable_samplers(false), |
138 ext_draw_buffers(false), | 141 ext_draw_buffers(false), |
139 nv_draw_buffers(false), | 142 nv_draw_buffers(false), |
140 ext_frag_depth(false), | 143 ext_frag_depth(false), |
141 ext_shader_texture_lod(false), | 144 ext_shader_texture_lod(false), |
142 use_async_readpixels(false), | 145 use_async_readpixels(false), |
143 map_buffer_range(false), | 146 map_buffer_range(false), |
144 ext_discard_framebuffer(false), | 147 ext_discard_framebuffer(false), |
145 angle_depth_texture(false), | 148 angle_depth_texture(false), |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
326 enable_dxt1 = true; | 329 enable_dxt1 = true; |
327 } | 330 } |
328 if (have_dxt3) { | 331 if (have_dxt3) { |
329 enable_dxt3 = true; | 332 enable_dxt3 = true; |
330 } | 333 } |
331 if (have_dxt5) { | 334 if (have_dxt5) { |
332 enable_dxt5 = true; | 335 enable_dxt5 = true; |
333 } | 336 } |
334 | 337 |
335 if (enable_dxt1) { | 338 if (enable_dxt1) { |
| 339 feature_flags_.ext_texture_format_dxt1 = true; |
| 340 |
336 AddExtensionString("GL_EXT_texture_compression_dxt1"); | 341 AddExtensionString("GL_EXT_texture_compression_dxt1"); |
337 validators_.compressed_texture_format.AddValue( | 342 validators_.compressed_texture_format.AddValue( |
338 GL_COMPRESSED_RGB_S3TC_DXT1_EXT); | 343 GL_COMPRESSED_RGB_S3TC_DXT1_EXT); |
339 validators_.compressed_texture_format.AddValue( | 344 validators_.compressed_texture_format.AddValue( |
340 GL_COMPRESSED_RGBA_S3TC_DXT1_EXT); | 345 GL_COMPRESSED_RGBA_S3TC_DXT1_EXT); |
341 } | 346 } |
342 | 347 |
343 if (enable_dxt3) { | 348 if (enable_dxt3) { |
344 // The difference between GL_EXT_texture_compression_s3tc and | 349 // The difference between GL_EXT_texture_compression_s3tc and |
345 // GL_CHROMIUM_texture_compression_dxt3 is that the former | 350 // GL_CHROMIUM_texture_compression_dxt3 is that the former |
346 // requires on the fly compression. The latter does not. | 351 // requires on the fly compression. The latter does not. |
347 AddExtensionString("GL_CHROMIUM_texture_compression_dxt3"); | 352 AddExtensionString("GL_CHROMIUM_texture_compression_dxt3"); |
348 validators_.compressed_texture_format.AddValue( | 353 validators_.compressed_texture_format.AddValue( |
349 GL_COMPRESSED_RGBA_S3TC_DXT3_EXT); | 354 GL_COMPRESSED_RGBA_S3TC_DXT3_EXT); |
350 } | 355 } |
351 | 356 |
352 if (enable_dxt5) { | 357 if (enable_dxt5) { |
| 358 feature_flags_.ext_texture_format_dxt5 = true; |
| 359 |
353 // The difference between GL_EXT_texture_compression_s3tc and | 360 // The difference between GL_EXT_texture_compression_s3tc and |
354 // GL_CHROMIUM_texture_compression_dxt5 is that the former | 361 // GL_CHROMIUM_texture_compression_dxt5 is that the former |
355 // requires on the fly compression. The latter does not. | 362 // requires on the fly compression. The latter does not. |
356 AddExtensionString("GL_CHROMIUM_texture_compression_dxt5"); | 363 AddExtensionString("GL_CHROMIUM_texture_compression_dxt5"); |
357 validators_.compressed_texture_format.AddValue( | 364 validators_.compressed_texture_format.AddValue( |
358 GL_COMPRESSED_RGBA_S3TC_DXT5_EXT); | 365 GL_COMPRESSED_RGBA_S3TC_DXT5_EXT); |
359 } | 366 } |
360 | 367 |
| 368 bool have_atc = extensions.Contains("GL_AMD_compressed_ATC_texture") || |
| 369 extensions.Contains("GL_ATI_texture_compression_atitc"); |
| 370 if (have_atc) { |
| 371 feature_flags_.ext_texture_format_atc = true; |
| 372 |
| 373 AddExtensionString("GL_AMD_compressed_ATC_texture"); |
| 374 validators_.compressed_texture_format.AddValue(GL_ATC_RGB_AMD); |
| 375 validators_.compressed_texture_format.AddValue( |
| 376 GL_ATC_RGBA_INTERPOLATED_ALPHA_AMD); |
| 377 } |
| 378 |
361 // Check if we should enable GL_EXT_texture_filter_anisotropic. | 379 // Check if we should enable GL_EXT_texture_filter_anisotropic. |
362 if (extensions.Contains("GL_EXT_texture_filter_anisotropic")) { | 380 if (extensions.Contains("GL_EXT_texture_filter_anisotropic")) { |
363 AddExtensionString("GL_EXT_texture_filter_anisotropic"); | 381 AddExtensionString("GL_EXT_texture_filter_anisotropic"); |
364 validators_.texture_parameter.AddValue( | 382 validators_.texture_parameter.AddValue( |
365 GL_TEXTURE_MAX_ANISOTROPY_EXT); | 383 GL_TEXTURE_MAX_ANISOTROPY_EXT); |
366 validators_.g_l_state.AddValue( | 384 validators_.g_l_state.AddValue( |
367 GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT); | 385 GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT); |
368 } | 386 } |
369 | 387 |
370 // Check if we should support GL_OES_packed_depth_stencil and/or | 388 // Check if we should support GL_OES_packed_depth_stencil and/or |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
464 bool enable_immutable_texture_format_bgra_on_es3 = | 482 bool enable_immutable_texture_format_bgra_on_es3 = |
465 extensions.Contains("GL_APPLE_texture_format_BGRA8888"); | 483 extensions.Contains("GL_APPLE_texture_format_BGRA8888"); |
466 | 484 |
467 // Check if we should allow GL_EXT_texture_format_BGRA8888 | 485 // Check if we should allow GL_EXT_texture_format_BGRA8888 |
468 if (extensions.Contains("GL_EXT_texture_format_BGRA8888") || | 486 if (extensions.Contains("GL_EXT_texture_format_BGRA8888") || |
469 enable_immutable_texture_format_bgra_on_es3 || | 487 enable_immutable_texture_format_bgra_on_es3 || |
470 extensions.Contains("GL_EXT_bgra")) { | 488 extensions.Contains("GL_EXT_bgra")) { |
471 enable_texture_format_bgra8888 = true; | 489 enable_texture_format_bgra8888 = true; |
472 } | 490 } |
473 | 491 |
474 if (extensions.Contains("GL_EXT_bgra")) { | 492 // Only desktop GL extension GL_EXT_bgra or ANGLE guarantee that we can |
| 493 // allocate a renderbuffer with this format. |
| 494 if (extensions.Contains("GL_EXT_bgra") || gl_version_info_->is_angle) { |
475 enable_render_buffer_bgra = true; | 495 enable_render_buffer_bgra = true; |
476 } | 496 } |
477 | 497 |
478 if (extensions.Contains("GL_EXT_read_format_bgra") || | 498 if (extensions.Contains("GL_EXT_read_format_bgra") || |
479 extensions.Contains("GL_EXT_bgra")) { | 499 extensions.Contains("GL_EXT_bgra")) { |
480 enable_read_format_bgra = true; | 500 enable_read_format_bgra = true; |
481 } | 501 } |
482 | 502 |
483 if (enable_texture_format_bgra8888) { | 503 if (enable_texture_format_bgra8888) { |
484 feature_flags_.ext_texture_format_bgra8888 = true; | 504 feature_flags_.ext_texture_format_bgra8888 = true; |
(...skipping 559 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1044 if (pos == std::string::npos) { | 1064 if (pos == std::string::npos) { |
1045 extensions_ += (extensions_.empty() ? "" : " ") + str; | 1065 extensions_ += (extensions_.empty() ? "" : " ") + str; |
1046 } | 1066 } |
1047 } | 1067 } |
1048 | 1068 |
1049 FeatureInfo::~FeatureInfo() { | 1069 FeatureInfo::~FeatureInfo() { |
1050 } | 1070 } |
1051 | 1071 |
1052 } // namespace gles2 | 1072 } // namespace gles2 |
1053 } // namespace gpu | 1073 } // namespace gpu |
OLD | NEW |