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

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

Issue 2337833002: Implement WEBGL_compressed_texture_s3tc_srgb (Closed)
Patch Set: replace NV_sRGB_formats with (draft) EXT_texture_compression_s3tc_srgb Created 4 years, 3 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 <stddef.h> 7 #include <stddef.h>
8 8
9 #include <set> 9 #include <set>
10 #include <vector> 10 #include <vector>
(...skipping 573 matching lines...) Expand 10 before | Expand all | Expand 10 after
584 (extensions.Contains("GL_EXT_framebuffer_sRGB") || 584 (extensions.Contains("GL_EXT_framebuffer_sRGB") ||
585 extensions.Contains("GL_ARB_framebuffer_sRGB")))) { 585 extensions.Contains("GL_ARB_framebuffer_sRGB")))) {
586 feature_flags_.desktop_srgb_support = true; 586 feature_flags_.desktop_srgb_support = true;
587 } 587 }
588 // With EXT_sRGB, unsized SRGB_EXT and SRGB_ALPHA_EXT are accepted by the 588 // With EXT_sRGB, unsized SRGB_EXT and SRGB_ALPHA_EXT are accepted by the
589 // <format> and <internalformat> parameter of TexImage2D. GLES3 adds support 589 // <format> and <internalformat> parameter of TexImage2D. GLES3 adds support
590 // for SRGB Textures but the accepted internal formats for TexImage2D are only 590 // for SRGB Textures but the accepted internal formats for TexImage2D are only
591 // sized formats GL_SRGB8 and GL_SRGB8_ALPHA8. Also, SRGB_EXT isn't a valid 591 // sized formats GL_SRGB8 and GL_SRGB8_ALPHA8. Also, SRGB_EXT isn't a valid
592 // <format> in this case. So, even with GLES3 explicitly check for 592 // <format> in this case. So, even with GLES3 explicitly check for
593 // GL_EXT_sRGB. 593 // GL_EXT_sRGB.
594 bool have_srgb = false;
594 if ((((gl_version_info_->is_es3 || 595 if ((((gl_version_info_->is_es3 ||
595 extensions.Contains("GL_OES_rgb8_rgba8")) && 596 extensions.Contains("GL_OES_rgb8_rgba8")) &&
596 extensions.Contains("GL_EXT_sRGB")) || 597 extensions.Contains("GL_EXT_sRGB")) ||
597 feature_flags_.desktop_srgb_support) && 598 feature_flags_.desktop_srgb_support) &&
598 IsWebGL1OrES2Context()) { 599 IsWebGL1OrES2Context()) {
600 have_srgb = true;
599 AddExtensionString("GL_EXT_sRGB"); 601 AddExtensionString("GL_EXT_sRGB");
600 validators_.texture_internal_format.AddValue(GL_SRGB_EXT); 602 validators_.texture_internal_format.AddValue(GL_SRGB_EXT);
601 validators_.texture_internal_format.AddValue(GL_SRGB_ALPHA_EXT); 603 validators_.texture_internal_format.AddValue(GL_SRGB_ALPHA_EXT);
602 validators_.texture_format.AddValue(GL_SRGB_EXT); 604 validators_.texture_format.AddValue(GL_SRGB_EXT);
603 validators_.texture_format.AddValue(GL_SRGB_ALPHA_EXT); 605 validators_.texture_format.AddValue(GL_SRGB_ALPHA_EXT);
604 validators_.render_buffer_format.AddValue(GL_SRGB8_ALPHA8_EXT); 606 validators_.render_buffer_format.AddValue(GL_SRGB8_ALPHA8_EXT);
605 validators_.framebuffer_parameter.AddValue( 607 validators_.framebuffer_parameter.AddValue(
606 GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT); 608 GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT);
607 validators_.texture_unsized_internal_format.AddValue(GL_SRGB_EXT); 609 validators_.texture_unsized_internal_format.AddValue(GL_SRGB_EXT);
608 validators_.texture_unsized_internal_format.AddValue(GL_SRGB_ALPHA_EXT); 610 validators_.texture_unsized_internal_format.AddValue(GL_SRGB_ALPHA_EXT);
609 } 611 }
610 612
613 if ((have_s3tc || (enable_dxt1 && enable_dxt3 && enable_dxt5)) && have_srgb) {
614 AddExtensionString("GL_EXT_texture_compression_s3tc_srgb");
615
616 validators_.compressed_texture_format.AddValue(
617 GL_COMPRESSED_SRGB_S3TC_DXT1_EXT);
618 validators_.compressed_texture_format.AddValue(
619 GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT);
620 validators_.compressed_texture_format.AddValue(
621 GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT);
622 validators_.compressed_texture_format.AddValue(
623 GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT);
624
625 validators_.texture_internal_format_storage.AddValue(
626 GL_COMPRESSED_SRGB_S3TC_DXT1_EXT);
627 validators_.texture_internal_format_storage.AddValue(
628 GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT);
629 validators_.texture_internal_format_storage.AddValue(
630 GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT);
631 validators_.texture_internal_format_storage.AddValue(
632 GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT);
633 }
634
611 // Note: Only APPLE_texture_format_BGRA8888 extension allows BGRA8_EXT in 635 // Note: Only APPLE_texture_format_BGRA8888 extension allows BGRA8_EXT in
612 // ES3's glTexStorage2D, whereas EXT_texture_format_BGRA8888 doesn't provide 636 // ES3's glTexStorage2D, whereas EXT_texture_format_BGRA8888 doesn't provide
613 // that compatibility. So if EXT_texture_format_BGRA8888 (but not 637 // that compatibility. So if EXT_texture_format_BGRA8888 (but not
614 // APPLE_texture_format_BGRA8888) is present on an underlying ES3 context, we 638 // 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. 639 // 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 640 // 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. 641 // we disable texture storage if only EXT_texture_format_BGRA8888 is present.
618 // If neither is present, we expose texture storage. 642 // If neither is present, we expose texture storage.
619 // When creating ES3 contexts, we do need to expose texture storage, so we 643 // When creating ES3 contexts, we do need to expose texture storage, so we
620 // disable BGRA if we have to. 644 // disable BGRA if we have to.
(...skipping 882 matching lines...) Expand 10 before | Expand all | Expand 10 after
1503 if (pos == std::string::npos) { 1527 if (pos == std::string::npos) {
1504 extensions_ += (extensions_.empty() ? "" : " ") + str; 1528 extensions_ += (extensions_.empty() ? "" : " ") + str;
1505 } 1529 }
1506 } 1530 }
1507 1531
1508 FeatureInfo::~FeatureInfo() { 1532 FeatureInfo::~FeatureInfo() {
1509 } 1533 }
1510 1534
1511 } // namespace gles2 1535 } // namespace gles2
1512 } // namespace gpu 1536 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698