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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <set> | 9 #include <set> |
10 #include <vector> | 10 #include <vector> |
(...skipping 590 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
601 validators_.texture_internal_format.AddValue(GL_SRGB_ALPHA_EXT); | 601 validators_.texture_internal_format.AddValue(GL_SRGB_ALPHA_EXT); |
602 validators_.texture_format.AddValue(GL_SRGB_EXT); | 602 validators_.texture_format.AddValue(GL_SRGB_EXT); |
603 validators_.texture_format.AddValue(GL_SRGB_ALPHA_EXT); | 603 validators_.texture_format.AddValue(GL_SRGB_ALPHA_EXT); |
604 validators_.render_buffer_format.AddValue(GL_SRGB8_ALPHA8_EXT); | 604 validators_.render_buffer_format.AddValue(GL_SRGB8_ALPHA8_EXT); |
605 validators_.framebuffer_parameter.AddValue( | 605 validators_.framebuffer_parameter.AddValue( |
606 GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT); | 606 GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT); |
607 validators_.texture_unsized_internal_format.AddValue(GL_SRGB_EXT); | 607 validators_.texture_unsized_internal_format.AddValue(GL_SRGB_EXT); |
608 validators_.texture_unsized_internal_format.AddValue(GL_SRGB_ALPHA_EXT); | 608 validators_.texture_unsized_internal_format.AddValue(GL_SRGB_ALPHA_EXT); |
609 } | 609 } |
610 | 610 |
| 611 // On desktop, GL_EXT_texture_sRGB is required regardless of GL version, |
| 612 // since the sRGB formats in OpenGL 3.0 Core do not support S3TC. |
| 613 // TODO(kainino): Support GL_EXT_texture_compression_s3tc_srgb once ratified. |
| 614 if ((gl_version_info_->is_es && extensions.Contains("GL_NV_sRGB_formats")) || |
| 615 (!gl_version_info_->is_es && |
| 616 extensions.Contains("GL_EXT_texture_sRGB") && |
| 617 extensions.Contains("GL_EXT_texture_compression_s3tc"))) { |
| 618 AddExtensionString("GL_EXT_texture_compression_s3tc_srgb"); |
| 619 |
| 620 validators_.compressed_texture_format.AddValue( |
| 621 GL_COMPRESSED_SRGB_S3TC_DXT1_EXT); |
| 622 validators_.compressed_texture_format.AddValue( |
| 623 GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT); |
| 624 validators_.compressed_texture_format.AddValue( |
| 625 GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT); |
| 626 validators_.compressed_texture_format.AddValue( |
| 627 GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT); |
| 628 |
| 629 validators_.texture_internal_format_storage.AddValue( |
| 630 GL_COMPRESSED_SRGB_S3TC_DXT1_EXT); |
| 631 validators_.texture_internal_format_storage.AddValue( |
| 632 GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT); |
| 633 validators_.texture_internal_format_storage.AddValue( |
| 634 GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT); |
| 635 validators_.texture_internal_format_storage.AddValue( |
| 636 GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT); |
| 637 } |
| 638 |
611 // Note: Only APPLE_texture_format_BGRA8888 extension allows BGRA8_EXT in | 639 // Note: Only APPLE_texture_format_BGRA8888 extension allows BGRA8_EXT in |
612 // ES3's glTexStorage2D, whereas EXT_texture_format_BGRA8888 doesn't provide | 640 // ES3's glTexStorage2D, whereas EXT_texture_format_BGRA8888 doesn't provide |
613 // that compatibility. So if EXT_texture_format_BGRA8888 (but not | 641 // that compatibility. So if EXT_texture_format_BGRA8888 (but not |
614 // APPLE_texture_format_BGRA8888) is present on an underlying ES3 context, we | 642 // APPLE_texture_format_BGRA8888) is present on an underlying ES3 context, we |
615 // have to choose which one of BGRA vs texture storage we expose. | 643 // have to choose which one of BGRA vs texture storage we expose. |
616 // When creating ES2 contexts, we prefer support BGRA to texture storage, so | 644 // When creating ES2 contexts, we prefer support BGRA to texture storage, so |
617 // we disable texture storage if only EXT_texture_format_BGRA8888 is present. | 645 // we disable texture storage if only EXT_texture_format_BGRA8888 is present. |
618 // If neither is present, we expose texture storage. | 646 // If neither is present, we expose texture storage. |
619 // When creating ES3 contexts, we do need to expose texture storage, so we | 647 // When creating ES3 contexts, we do need to expose texture storage, so we |
620 // disable BGRA if we have to. | 648 // disable BGRA if we have to. |
(...skipping 882 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1503 if (pos == std::string::npos) { | 1531 if (pos == std::string::npos) { |
1504 extensions_ += (extensions_.empty() ? "" : " ") + str; | 1532 extensions_ += (extensions_.empty() ? "" : " ") + str; |
1505 } | 1533 } |
1506 } | 1534 } |
1507 | 1535 |
1508 FeatureInfo::~FeatureInfo() { | 1536 FeatureInfo::~FeatureInfo() { |
1509 } | 1537 } |
1510 | 1538 |
1511 } // namespace gles2 | 1539 } // namespace gles2 |
1512 } // namespace gpu | 1540 } // namespace gpu |
OLD | NEW |