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

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

Issue 2674493003: Add compositor support for half-float RGBA buffers and textures (Closed)
Patch Set: Created 3 years, 10 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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 glBindBuffer(GL_PIXEL_UNPACK_BUFFER, static_cast<GLuint>(orig_binding_)); 101 glBindBuffer(GL_PIXEL_UNPACK_BUFFER, static_cast<GLuint>(orig_binding_));
102 } 102 }
103 } 103 }
104 104
105 private: 105 private:
106 GLint orig_binding_; 106 GLint orig_binding_;
107 }; 107 };
108 108
109 } // anonymous namespace. 109 } // anonymous namespace.
110 110
111 FeatureInfo::FeatureFlags::FeatureFlags() 111 FeatureInfo::FeatureFlags::FeatureFlags() {}
112 : chromium_framebuffer_multisample(false),
113 chromium_sync_query(false),
114 use_core_framebuffer_multisample(false),
115 multisampled_render_to_texture(false),
116 use_img_for_multisampled_render_to_texture(false),
117 chromium_screen_space_antialiasing(false),
118 use_chromium_screen_space_antialiasing_via_shaders(false),
119 oes_standard_derivatives(false),
120 oes_egl_image_external(false),
121 nv_egl_stream_consumer_external(false),
122 oes_depth24(false),
123 oes_compressed_etc1_rgb8_texture(false),
124 packed_depth24_stencil8(false),
125 npot_ok(false),
126 enable_texture_float_linear(false),
127 enable_texture_half_float_linear(false),
128 angle_translated_shader_source(false),
129 angle_pack_reverse_row_order(false),
130 arb_texture_rectangle(false),
131 angle_instanced_arrays(false),
132 occlusion_query(false),
133 occlusion_query_boolean(false),
134 use_arb_occlusion_query2_for_occlusion_query_boolean(false),
135 use_arb_occlusion_query_for_occlusion_query_boolean(false),
136 native_vertex_array_object(false),
137 ext_texture_format_astc(false),
138 ext_texture_format_atc(false),
139 ext_texture_format_bgra8888(false),
140 ext_texture_format_dxt1(false),
141 ext_texture_format_dxt5(false),
142 enable_shader_name_hashing(false),
143 enable_samplers(false),
144 ext_draw_buffers(false),
145 nv_draw_buffers(false),
146 ext_frag_depth(false),
147 ext_shader_texture_lod(false),
148 use_async_readpixels(false),
149 map_buffer_range(false),
150 ext_discard_framebuffer(false),
151 angle_depth_texture(false),
152 is_swiftshader(false),
153 angle_texture_usage(false),
154 ext_texture_storage(false),
155 chromium_path_rendering(false),
156 chromium_framebuffer_mixed_samples(false),
157 blend_equation_advanced(false),
158 blend_equation_advanced_coherent(false),
159 ext_texture_rg(false),
160 chromium_image_ycbcr_420v(false),
161 chromium_image_ycbcr_422(false),
162 emulate_primitive_restart_fixed_index(false),
163 ext_render_buffer_format_bgra8888(false),
164 ext_multisample_compatibility(false),
165 ext_blend_func_extended(false),
166 ext_read_format_bgra(false),
167 desktop_srgb_support(false),
168 arb_es3_compatibility(false) {}
169 112
170 FeatureInfo::FeatureInfo() { 113 FeatureInfo::FeatureInfo() {
171 InitializeBasicState(base::CommandLine::InitializedForCurrentProcess() 114 InitializeBasicState(base::CommandLine::InitializedForCurrentProcess()
172 ? base::CommandLine::ForCurrentProcess() 115 ? base::CommandLine::ForCurrentProcess()
173 : nullptr); 116 : nullptr);
174 } 117 }
175 118
176 FeatureInfo::FeatureInfo( 119 FeatureInfo::FeatureInfo(
177 const GpuDriverBugWorkarounds& gpu_driver_bug_workarounds) 120 const GpuDriverBugWorkarounds& gpu_driver_bug_workarounds)
178 : workarounds_(gpu_driver_bug_workarounds) { 121 : workarounds_(gpu_driver_bug_workarounds) {
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 validators_.texture_sized_color_renderable_internal_format.AddValue(GL_R16F); 225 validators_.texture_sized_color_renderable_internal_format.AddValue(GL_R16F);
283 validators_.texture_sized_color_renderable_internal_format.AddValue(GL_RG16F); 226 validators_.texture_sized_color_renderable_internal_format.AddValue(GL_RG16F);
284 validators_.texture_sized_color_renderable_internal_format.AddValue( 227 validators_.texture_sized_color_renderable_internal_format.AddValue(
285 GL_RGBA16F); 228 GL_RGBA16F);
286 validators_.texture_sized_color_renderable_internal_format.AddValue(GL_R32F); 229 validators_.texture_sized_color_renderable_internal_format.AddValue(GL_R32F);
287 validators_.texture_sized_color_renderable_internal_format.AddValue(GL_RG32F); 230 validators_.texture_sized_color_renderable_internal_format.AddValue(GL_RG32F);
288 validators_.texture_sized_color_renderable_internal_format.AddValue( 231 validators_.texture_sized_color_renderable_internal_format.AddValue(
289 GL_RGBA32F); 232 GL_RGBA32F);
290 validators_.texture_sized_color_renderable_internal_format.AddValue( 233 validators_.texture_sized_color_renderable_internal_format.AddValue(
291 GL_R11F_G11F_B10F); 234 GL_R11F_G11F_B10F);
235 feature_flags_.enable_color_buffer_float = true;
292 } 236 }
293 237
294 void FeatureInfo::EnableCHROMIUMColorBufferFloatRGBA() { 238 void FeatureInfo::EnableCHROMIUMColorBufferFloatRGBA() {
295 if (!feature_flags_.chromium_color_buffer_float_rgba) 239 if (!feature_flags_.chromium_color_buffer_float_rgba)
296 return; 240 return;
297 validators_.texture_internal_format.AddValue(GL_RGBA32F); 241 validators_.texture_internal_format.AddValue(GL_RGBA32F);
298 validators_.texture_sized_color_renderable_internal_format.AddValue( 242 validators_.texture_sized_color_renderable_internal_format.AddValue(
299 GL_RGBA32F); 243 GL_RGBA32F);
300 AddExtensionString("GL_CHROMIUM_color_buffer_float_rgba"); 244 AddExtensionString("GL_CHROMIUM_color_buffer_float_rgba");
301 } 245 }
(...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after
779 } 723 }
780 724
781 // Check if we should allow GL_OES_texture_float, GL_OES_texture_half_float, 725 // Check if we should allow GL_OES_texture_float, GL_OES_texture_half_float,
782 // GL_OES_texture_float_linear, GL_OES_texture_half_float_linear 726 // GL_OES_texture_float_linear, GL_OES_texture_half_float_linear
783 bool enable_texture_float = false; 727 bool enable_texture_float = false;
784 bool enable_texture_float_linear = false; 728 bool enable_texture_float_linear = false;
785 bool enable_texture_half_float = false; 729 bool enable_texture_half_float = false;
786 bool enable_texture_half_float_linear = false; 730 bool enable_texture_half_float_linear = false;
787 bool enable_ext_color_buffer_float = false; 731 bool enable_ext_color_buffer_float = false;
788 732
733 // Do not expose EXT_color_buffer_float to WebGL 1.
734 const bool allow_ext_color_buffer_float =
735 context_type_ != CONTEXT_TYPE_WEBGL1;
789 bool may_enable_chromium_color_buffer_float = false; 736 bool may_enable_chromium_color_buffer_float = false;
790 737
791 // This extension allows a variety of floating point formats to be 738 // This extension allows a variety of floating point formats to be
792 // rendered to via framebuffer objects. 739 // rendered to via framebuffer objects.
793 if (extensions.Contains("GL_EXT_color_buffer_float")) { 740 if (extensions.Contains("GL_EXT_color_buffer_float")) {
794 enable_ext_color_buffer_float = true; 741 enable_ext_color_buffer_float = true;
795 } 742 }
796 743
797 if (extensions.Contains("GL_ARB_texture_float") || 744 if (extensions.Contains("GL_ARB_texture_float") ||
798 gl_version_info_->is_desktop_core_profile) { 745 gl_version_info_->is_desktop_core_profile) {
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
879 glBindFramebufferEXT(GL_FRAMEBUFFER, fb_id); 826 glBindFramebufferEXT(GL_FRAMEBUFFER, fb_id);
880 glFramebufferTexture2DEXT(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, 827 glFramebufferTexture2DEXT(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
881 GL_TEXTURE_2D, tex_id, 0); 828 GL_TEXTURE_2D, tex_id, 0);
882 GLenum status_rgba = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER); 829 GLenum status_rgba = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER);
883 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB32F, width, width, 0, GL_RGB, 830 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB32F, width, width, 0, GL_RGB,
884 GL_FLOAT, NULL); 831 GL_FLOAT, NULL);
885 GLenum status_rgb = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER); 832 GLenum status_rgb = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER);
886 833
887 // For desktop systems, check to see if we support rendering to the full 834 // For desktop systems, check to see if we support rendering to the full
888 // range of formats supported by EXT_color_buffer_float 835 // range of formats supported by EXT_color_buffer_float
889 if (status_rgba == GL_FRAMEBUFFER_COMPLETE && enable_es3) { 836 if (status_rgba == GL_FRAMEBUFFER_COMPLETE &&
837 allow_ext_color_buffer_float) {
890 bool full_float_support = true; 838 bool full_float_support = true;
891 839
892 glTexImage2D(GL_TEXTURE_2D, 0, GL_R16F, width, width, 0, GL_RED, 840 glTexImage2D(GL_TEXTURE_2D, 0, GL_R16F, width, width, 0, GL_RED,
893 GL_FLOAT, NULL); 841 GL_FLOAT, NULL);
894 full_float_support &= glCheckFramebufferStatusEXT(GL_FRAMEBUFFER) == 842 full_float_support &= glCheckFramebufferStatusEXT(GL_FRAMEBUFFER) ==
895 GL_FRAMEBUFFER_COMPLETE; 843 GL_FRAMEBUFFER_COMPLETE;
896 glTexImage2D(GL_TEXTURE_2D, 0, GL_RG16F, width, width, 0, GL_RG, 844 glTexImage2D(GL_TEXTURE_2D, 0, GL_RG16F, width, width, 0, GL_RG,
897 GL_FLOAT, NULL); 845 GL_FLOAT, NULL);
898 full_float_support &= glCheckFramebufferStatusEXT(GL_FRAMEBUFFER) == 846 full_float_support &= glCheckFramebufferStatusEXT(GL_FRAMEBUFFER) ==
899 GL_FRAMEBUFFER_COMPLETE; 847 GL_FRAMEBUFFER_COMPLETE;
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
931 EnableCHROMIUMColorBufferFloatRGBA(); 879 EnableCHROMIUMColorBufferFloatRGBA();
932 } 880 }
933 if (status_rgb == GL_FRAMEBUFFER_COMPLETE) { 881 if (status_rgb == GL_FRAMEBUFFER_COMPLETE) {
934 feature_flags_.chromium_color_buffer_float_rgb = true; 882 feature_flags_.chromium_color_buffer_float_rgb = true;
935 if (!disallowed_features_.chromium_color_buffer_float_rgb) 883 if (!disallowed_features_.chromium_color_buffer_float_rgb)
936 EnableCHROMIUMColorBufferFloatRGB(); 884 EnableCHROMIUMColorBufferFloatRGB();
937 } 885 }
938 } 886 }
939 887
940 // Enable the GL_EXT_color_buffer_float extension for WebGL 2.0 888 // Enable the GL_EXT_color_buffer_float extension for WebGL 2.0
941 if (enable_ext_color_buffer_float && enable_es3) { 889 if (enable_ext_color_buffer_float && allow_ext_color_buffer_float) {
942 ext_color_buffer_float_available_ = true; 890 ext_color_buffer_float_available_ = true;
943 if (!disallowed_features_.ext_color_buffer_float) 891 if (!disallowed_features_.ext_color_buffer_float)
944 EnableEXTColorBufferFloat(); 892 EnableEXTColorBufferFloat();
945 } 893 }
946 894
947 // Check for multisample support 895 // Check for multisample support
948 if (!workarounds_.disable_chromium_framebuffer_multisample) { 896 if (!workarounds_.disable_chromium_framebuffer_multisample) {
949 bool ext_has_multisample = 897 bool ext_has_multisample =
950 extensions.Contains("GL_EXT_framebuffer_multisample") || 898 extensions.Contains("GL_EXT_framebuffer_multisample") ||
951 gl_version_info_->is_es3 || 899 gl_version_info_->is_es3 ||
(...skipping 640 matching lines...) Expand 10 before | Expand all | Expand 10 after
1592 if (pos == std::string::npos) { 1540 if (pos == std::string::npos) {
1593 extensions_ += (extensions_.empty() ? "" : " ") + str; 1541 extensions_ += (extensions_.empty() ? "" : " ") + str;
1594 } 1542 }
1595 } 1543 }
1596 1544
1597 FeatureInfo::~FeatureInfo() { 1545 FeatureInfo::~FeatureInfo() {
1598 } 1546 }
1599 1547
1600 } // namespace gles2 1548 } // namespace gles2
1601 } // namespace gpu 1549 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698