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

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

Issue 2569763003: improve feature detection for S3TC+sRGB textures (Closed)
Patch Set: fix typo Created 4 years 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <stddef.h> 7 #include <stddef.h>
8 8
9 #include <set> 9 #include <set>
10 #include <vector> 10 #include <vector>
(...skipping 607 matching lines...) Expand 10 before | Expand all | Expand 10 after
618 validators_.capability.AddValue(GL_FRAMEBUFFER_SRGB_EXT); 618 validators_.capability.AddValue(GL_FRAMEBUFFER_SRGB_EXT);
619 } 619 }
620 } 620 }
621 621
622 // The extension GL_EXT_texture_sRGB_decode is the same on desktop and GLES. 622 // The extension GL_EXT_texture_sRGB_decode is the same on desktop and GLES.
623 if (extensions.Contains("GL_EXT_texture_sRGB_decode") && !IsWebGLContext()) { 623 if (extensions.Contains("GL_EXT_texture_sRGB_decode") && !IsWebGLContext()) {
624 AddExtensionString("GL_EXT_texture_sRGB_decode"); 624 AddExtensionString("GL_EXT_texture_sRGB_decode");
625 validators_.texture_parameter.AddValue(GL_TEXTURE_SRGB_DECODE_EXT); 625 validators_.texture_parameter.AddValue(GL_TEXTURE_SRGB_DECODE_EXT);
626 } 626 }
627 627
628 // On desktop, GL_EXT_texture_sRGB is required regardless of GL version, 628 bool have_s3tc_srgb = false;
629 // since the sRGB formats in OpenGL 3.0 Core do not support S3TC. 629 if (gl_version_info_->is_es) {
630 // TODO(kainino): Support GL_EXT_texture_compression_s3tc_srgb once ratified. 630 // On mobile, the only extension that supports S3TC+sRGB is NV_sRGB_formats.
631 if ((gl_version_info_->is_es && extensions.Contains("GL_NV_sRGB_formats")) || 631 // The draft extension EXT_texture_compression_s3tc_srgb also supports it
632 (!gl_version_info_->is_es && 632 // and is used if available (e.g. if ANGLE exposes it).
633 extensions.Contains("GL_EXT_texture_sRGB") && 633 have_s3tc_srgb = extensions.Contains("GL_NV_sRGB_formats") ||
634 extensions.Contains("GL_EXT_texture_compression_s3tc"))) { 634 extensions.Contains("GL_EXT_texture_compression_s3tc_srgb");
635 } else {
636 // On desktop, strictly-speaking, S3TC+sRGB is only available if both
637 // EXT_texture_sRGB and EXT_texture_compression_s3tc_srgb are available.
638 //
639 // However, on macOS, S3TC+sRGB is supported on OpenGL 4.1 with only
640 // EXT_texture_compression_s3tc_srgb, so we allow that as well.
641 if (extensions.Contains("GL_EXT_texture_sRGB") ||
642 gl_version_info_->IsAtLeastGL(4, 1)) {
643 have_s3tc_srgb = extensions.Contains("GL_EXT_texture_compression_s3tc");
644 }
645 }
646
647 if (have_s3tc_srgb) {
635 AddExtensionString("GL_EXT_texture_compression_s3tc_srgb"); 648 AddExtensionString("GL_EXT_texture_compression_s3tc_srgb");
636 649
637 validators_.compressed_texture_format.AddValue( 650 validators_.compressed_texture_format.AddValue(
638 GL_COMPRESSED_SRGB_S3TC_DXT1_EXT); 651 GL_COMPRESSED_SRGB_S3TC_DXT1_EXT);
639 validators_.compressed_texture_format.AddValue( 652 validators_.compressed_texture_format.AddValue(
640 GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT); 653 GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT);
641 validators_.compressed_texture_format.AddValue( 654 validators_.compressed_texture_format.AddValue(
642 GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT); 655 GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT);
643 validators_.compressed_texture_format.AddValue( 656 validators_.compressed_texture_format.AddValue(
644 GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT); 657 GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT);
(...skipping 925 matching lines...) Expand 10 before | Expand all | Expand 10 after
1570 if (pos == std::string::npos) { 1583 if (pos == std::string::npos) {
1571 extensions_ += (extensions_.empty() ? "" : " ") + str; 1584 extensions_ += (extensions_.empty() ? "" : " ") + str;
1572 } 1585 }
1573 } 1586 }
1574 1587
1575 FeatureInfo::~FeatureInfo() { 1588 FeatureInfo::~FeatureInfo() {
1576 } 1589 }
1577 1590
1578 } // namespace gles2 1591 } // namespace gles2
1579 } // namespace gpu 1592 } // namespace gpu
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698