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

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

Issue 2479513002: Reland of Extend CopyTextureCHROMIUM to more ES 3.0 texture formats. (Closed)
Patch Set: rebase and minor fix for premultiply and un-premultiply alpha Created 4 years, 1 month 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 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 // The flag here is for testing only. 204 // The flag here is for testing only.
205 disable_shader_translator_ = 205 disable_shader_translator_ =
206 command_line->HasSwitch(switches::kDisableGLSLTranslator); 206 command_line->HasSwitch(switches::kDisableGLSLTranslator);
207 207
208 // Default context_type_ to a GLES2 Context. 208 // Default context_type_ to a GLES2 Context.
209 context_type_ = CONTEXT_TYPE_OPENGLES2; 209 context_type_ = CONTEXT_TYPE_OPENGLES2;
210 210
211 ext_color_buffer_float_available_ = false; 211 ext_color_buffer_float_available_ = false;
212 oes_texture_float_linear_available_ = false; 212 oes_texture_float_linear_available_ = false;
213 oes_texture_half_float_linear_available_ = false; 213 oes_texture_half_float_linear_available_ = false;
214 texture_format_bgra8888_available_ = false;
215 ext_srgb_available_ = false;
214 } 216 }
215 217
216 bool FeatureInfo::Initialize(ContextType context_type, 218 bool FeatureInfo::Initialize(ContextType context_type,
217 const DisallowedFeatures& disallowed_features) { 219 const DisallowedFeatures& disallowed_features) {
218 disallowed_features_ = disallowed_features; 220 disallowed_features_ = disallowed_features;
219 context_type_ = context_type; 221 context_type_ = context_type;
220 InitializeFeatures(); 222 InitializeFeatures();
221 return true; 223 return true;
222 } 224 }
223 225
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after
582 // <format> and <internalformat> parameter of TexImage2D. GLES3 adds support 584 // <format> and <internalformat> parameter of TexImage2D. GLES3 adds support
583 // for SRGB Textures but the accepted internal formats for TexImage2D are only 585 // for SRGB Textures but the accepted internal formats for TexImage2D are only
584 // sized formats GL_SRGB8 and GL_SRGB8_ALPHA8. Also, SRGB_EXT isn't a valid 586 // sized formats GL_SRGB8 and GL_SRGB8_ALPHA8. Also, SRGB_EXT isn't a valid
585 // <format> in this case. So, even with GLES3 explicitly check for 587 // <format> in this case. So, even with GLES3 explicitly check for
586 // GL_EXT_sRGB. 588 // GL_EXT_sRGB.
587 if ((((gl_version_info_->is_es3 || 589 if ((((gl_version_info_->is_es3 ||
588 extensions.Contains("GL_OES_rgb8_rgba8")) && 590 extensions.Contains("GL_OES_rgb8_rgba8")) &&
589 extensions.Contains("GL_EXT_sRGB")) || 591 extensions.Contains("GL_EXT_sRGB")) ||
590 feature_flags_.desktop_srgb_support) && 592 feature_flags_.desktop_srgb_support) &&
591 IsWebGL1OrES2Context()) { 593 IsWebGL1OrES2Context()) {
594 ext_srgb_available_ = true;
592 AddExtensionString("GL_EXT_sRGB"); 595 AddExtensionString("GL_EXT_sRGB");
593 validators_.texture_internal_format.AddValue(GL_SRGB_EXT); 596 validators_.texture_internal_format.AddValue(GL_SRGB_EXT);
594 validators_.texture_internal_format.AddValue(GL_SRGB_ALPHA_EXT); 597 validators_.texture_internal_format.AddValue(GL_SRGB_ALPHA_EXT);
595 validators_.texture_format.AddValue(GL_SRGB_EXT); 598 validators_.texture_format.AddValue(GL_SRGB_EXT);
596 validators_.texture_format.AddValue(GL_SRGB_ALPHA_EXT); 599 validators_.texture_format.AddValue(GL_SRGB_ALPHA_EXT);
597 validators_.render_buffer_format.AddValue(GL_SRGB8_ALPHA8_EXT); 600 validators_.render_buffer_format.AddValue(GL_SRGB8_ALPHA8_EXT);
598 validators_.framebuffer_parameter.AddValue( 601 validators_.framebuffer_parameter.AddValue(
599 GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT); 602 GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT);
600 validators_.texture_unsized_internal_format.AddValue(GL_SRGB_EXT); 603 validators_.texture_unsized_internal_format.AddValue(GL_SRGB_EXT);
601 validators_.texture_unsized_internal_format.AddValue(GL_SRGB_ALPHA_EXT); 604 validators_.texture_unsized_internal_format.AddValue(GL_SRGB_ALPHA_EXT);
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
666 case CONTEXT_TYPE_OPENGLES3: 669 case CONTEXT_TYPE_OPENGLES3:
667 case CONTEXT_TYPE_WEBGL1: 670 case CONTEXT_TYPE_WEBGL1:
668 case CONTEXT_TYPE_WEBGL2: 671 case CONTEXT_TYPE_WEBGL2:
669 enable_texture_format_bgra8888 = false; 672 enable_texture_format_bgra8888 = false;
670 break; 673 break;
671 } 674 }
672 } 675 }
673 676
674 if (enable_texture_format_bgra8888) { 677 if (enable_texture_format_bgra8888) {
675 feature_flags_.ext_texture_format_bgra8888 = true; 678 feature_flags_.ext_texture_format_bgra8888 = true;
679 texture_format_bgra8888_available_ = true;
676 AddExtensionString("GL_EXT_texture_format_BGRA8888"); 680 AddExtensionString("GL_EXT_texture_format_BGRA8888");
677 validators_.texture_internal_format.AddValue(GL_BGRA_EXT); 681 validators_.texture_internal_format.AddValue(GL_BGRA_EXT);
678 validators_.texture_format.AddValue(GL_BGRA_EXT); 682 validators_.texture_format.AddValue(GL_BGRA_EXT);
679 validators_.texture_unsized_internal_format.AddValue(GL_BGRA_EXT); 683 validators_.texture_unsized_internal_format.AddValue(GL_BGRA_EXT);
680 } 684 }
681 685
682 // On desktop, all devices support BGRA render buffers (note that on desktop 686 // On desktop, all devices support BGRA render buffers (note that on desktop
683 // BGRA internal formats are converted to RGBA in the API implementation). 687 // BGRA internal formats are converted to RGBA in the API implementation).
684 // For ES, there is no extension that exposes BGRA renderbuffers, however 688 // For ES, there is no extension that exposes BGRA renderbuffers, however
685 // Angle does support these. 689 // Angle does support these.
(...skipping 853 matching lines...) Expand 10 before | Expand all | Expand 10 after
1539 if (pos == std::string::npos) { 1543 if (pos == std::string::npos) {
1540 extensions_ += (extensions_.empty() ? "" : " ") + str; 1544 extensions_ += (extensions_.empty() ? "" : " ") + str;
1541 } 1545 }
1542 } 1546 }
1543 1547
1544 FeatureInfo::~FeatureInfo() { 1548 FeatureInfo::~FeatureInfo() {
1545 } 1549 }
1546 1550
1547 } // namespace gles2 1551 } // namespace gles2
1548 } // namespace gpu 1552 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698