| 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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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) {} |
| 112 | 169 |
| 113 FeatureInfo::FeatureInfo() { | 170 FeatureInfo::FeatureInfo() { |
| 114 InitializeBasicState(base::CommandLine::InitializedForCurrentProcess() | 171 InitializeBasicState(base::CommandLine::InitializedForCurrentProcess() |
| 115 ? base::CommandLine::ForCurrentProcess() | 172 ? base::CommandLine::ForCurrentProcess() |
| 116 : nullptr); | 173 : nullptr); |
| 117 } | 174 } |
| 118 | 175 |
| 119 FeatureInfo::FeatureInfo( | 176 FeatureInfo::FeatureInfo( |
| 120 const GpuDriverBugWorkarounds& gpu_driver_bug_workarounds) | 177 const GpuDriverBugWorkarounds& gpu_driver_bug_workarounds) |
| 121 : workarounds_(gpu_driver_bug_workarounds) { | 178 : workarounds_(gpu_driver_bug_workarounds) { |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 validators_.texture_sized_color_renderable_internal_format.AddValue(GL_R16F); | 282 validators_.texture_sized_color_renderable_internal_format.AddValue(GL_R16F); |
| 226 validators_.texture_sized_color_renderable_internal_format.AddValue(GL_RG16F); | 283 validators_.texture_sized_color_renderable_internal_format.AddValue(GL_RG16F); |
| 227 validators_.texture_sized_color_renderable_internal_format.AddValue( | 284 validators_.texture_sized_color_renderable_internal_format.AddValue( |
| 228 GL_RGBA16F); | 285 GL_RGBA16F); |
| 229 validators_.texture_sized_color_renderable_internal_format.AddValue(GL_R32F); | 286 validators_.texture_sized_color_renderable_internal_format.AddValue(GL_R32F); |
| 230 validators_.texture_sized_color_renderable_internal_format.AddValue(GL_RG32F); | 287 validators_.texture_sized_color_renderable_internal_format.AddValue(GL_RG32F); |
| 231 validators_.texture_sized_color_renderable_internal_format.AddValue( | 288 validators_.texture_sized_color_renderable_internal_format.AddValue( |
| 232 GL_RGBA32F); | 289 GL_RGBA32F); |
| 233 validators_.texture_sized_color_renderable_internal_format.AddValue( | 290 validators_.texture_sized_color_renderable_internal_format.AddValue( |
| 234 GL_R11F_G11F_B10F); | 291 GL_R11F_G11F_B10F); |
| 235 feature_flags_.enable_color_buffer_float = true; | |
| 236 } | 292 } |
| 237 | 293 |
| 238 void FeatureInfo::EnableCHROMIUMColorBufferFloatRGBA() { | 294 void FeatureInfo::EnableCHROMIUMColorBufferFloatRGBA() { |
| 239 if (!feature_flags_.chromium_color_buffer_float_rgba) | 295 if (!feature_flags_.chromium_color_buffer_float_rgba) |
| 240 return; | 296 return; |
| 241 validators_.texture_internal_format.AddValue(GL_RGBA32F); | 297 validators_.texture_internal_format.AddValue(GL_RGBA32F); |
| 242 validators_.texture_sized_color_renderable_internal_format.AddValue( | 298 validators_.texture_sized_color_renderable_internal_format.AddValue( |
| 243 GL_RGBA32F); | 299 GL_RGBA32F); |
| 244 AddExtensionString("GL_CHROMIUM_color_buffer_float_rgba"); | 300 AddExtensionString("GL_CHROMIUM_color_buffer_float_rgba"); |
| 245 } | 301 } |
| (...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 723 } | 779 } |
| 724 | 780 |
| 725 // Check if we should allow GL_OES_texture_float, GL_OES_texture_half_float, | 781 // Check if we should allow GL_OES_texture_float, GL_OES_texture_half_float, |
| 726 // GL_OES_texture_float_linear, GL_OES_texture_half_float_linear | 782 // GL_OES_texture_float_linear, GL_OES_texture_half_float_linear |
| 727 bool enable_texture_float = false; | 783 bool enable_texture_float = false; |
| 728 bool enable_texture_float_linear = false; | 784 bool enable_texture_float_linear = false; |
| 729 bool enable_texture_half_float = false; | 785 bool enable_texture_half_float = false; |
| 730 bool enable_texture_half_float_linear = false; | 786 bool enable_texture_half_float_linear = false; |
| 731 bool enable_ext_color_buffer_float = false; | 787 bool enable_ext_color_buffer_float = false; |
| 732 | 788 |
| 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; | |
| 736 bool may_enable_chromium_color_buffer_float = false; | 789 bool may_enable_chromium_color_buffer_float = false; |
| 737 | 790 |
| 738 // This extension allows a variety of floating point formats to be | 791 // This extension allows a variety of floating point formats to be |
| 739 // rendered to via framebuffer objects. | 792 // rendered to via framebuffer objects. |
| 740 if (extensions.Contains("GL_EXT_color_buffer_float")) { | 793 if (extensions.Contains("GL_EXT_color_buffer_float")) { |
| 741 enable_ext_color_buffer_float = true; | 794 enable_ext_color_buffer_float = true; |
| 742 } | 795 } |
| 743 | 796 |
| 744 if (extensions.Contains("GL_ARB_texture_float") || | 797 if (extensions.Contains("GL_ARB_texture_float") || |
| 745 gl_version_info_->is_desktop_core_profile) { | 798 gl_version_info_->is_desktop_core_profile) { |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 826 glBindFramebufferEXT(GL_FRAMEBUFFER, fb_id); | 879 glBindFramebufferEXT(GL_FRAMEBUFFER, fb_id); |
| 827 glFramebufferTexture2DEXT(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, | 880 glFramebufferTexture2DEXT(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, |
| 828 GL_TEXTURE_2D, tex_id, 0); | 881 GL_TEXTURE_2D, tex_id, 0); |
| 829 GLenum status_rgba = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER); | 882 GLenum status_rgba = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER); |
| 830 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB32F, width, width, 0, GL_RGB, | 883 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB32F, width, width, 0, GL_RGB, |
| 831 GL_FLOAT, NULL); | 884 GL_FLOAT, NULL); |
| 832 GLenum status_rgb = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER); | 885 GLenum status_rgb = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER); |
| 833 | 886 |
| 834 // For desktop systems, check to see if we support rendering to the full | 887 // For desktop systems, check to see if we support rendering to the full |
| 835 // range of formats supported by EXT_color_buffer_float | 888 // range of formats supported by EXT_color_buffer_float |
| 836 if (status_rgba == GL_FRAMEBUFFER_COMPLETE && | 889 if (status_rgba == GL_FRAMEBUFFER_COMPLETE && enable_es3) { |
| 837 allow_ext_color_buffer_float) { | |
| 838 bool full_float_support = true; | 890 bool full_float_support = true; |
| 839 | 891 |
| 840 glTexImage2D(GL_TEXTURE_2D, 0, GL_R16F, width, width, 0, GL_RED, | 892 glTexImage2D(GL_TEXTURE_2D, 0, GL_R16F, width, width, 0, GL_RED, |
| 841 GL_FLOAT, NULL); | 893 GL_FLOAT, NULL); |
| 842 full_float_support &= glCheckFramebufferStatusEXT(GL_FRAMEBUFFER) == | 894 full_float_support &= glCheckFramebufferStatusEXT(GL_FRAMEBUFFER) == |
| 843 GL_FRAMEBUFFER_COMPLETE; | 895 GL_FRAMEBUFFER_COMPLETE; |
| 844 glTexImage2D(GL_TEXTURE_2D, 0, GL_RG16F, width, width, 0, GL_RG, | 896 glTexImage2D(GL_TEXTURE_2D, 0, GL_RG16F, width, width, 0, GL_RG, |
| 845 GL_FLOAT, NULL); | 897 GL_FLOAT, NULL); |
| 846 full_float_support &= glCheckFramebufferStatusEXT(GL_FRAMEBUFFER) == | 898 full_float_support &= glCheckFramebufferStatusEXT(GL_FRAMEBUFFER) == |
| 847 GL_FRAMEBUFFER_COMPLETE; | 899 GL_FRAMEBUFFER_COMPLETE; |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 879 EnableCHROMIUMColorBufferFloatRGBA(); | 931 EnableCHROMIUMColorBufferFloatRGBA(); |
| 880 } | 932 } |
| 881 if (status_rgb == GL_FRAMEBUFFER_COMPLETE) { | 933 if (status_rgb == GL_FRAMEBUFFER_COMPLETE) { |
| 882 feature_flags_.chromium_color_buffer_float_rgb = true; | 934 feature_flags_.chromium_color_buffer_float_rgb = true; |
| 883 if (!disallowed_features_.chromium_color_buffer_float_rgb) | 935 if (!disallowed_features_.chromium_color_buffer_float_rgb) |
| 884 EnableCHROMIUMColorBufferFloatRGB(); | 936 EnableCHROMIUMColorBufferFloatRGB(); |
| 885 } | 937 } |
| 886 } | 938 } |
| 887 | 939 |
| 888 // Enable the GL_EXT_color_buffer_float extension for WebGL 2.0 | 940 // Enable the GL_EXT_color_buffer_float extension for WebGL 2.0 |
| 889 if (enable_ext_color_buffer_float && allow_ext_color_buffer_float) { | 941 if (enable_ext_color_buffer_float && enable_es3) { |
| 890 ext_color_buffer_float_available_ = true; | 942 ext_color_buffer_float_available_ = true; |
| 891 if (!disallowed_features_.ext_color_buffer_float) | 943 if (!disallowed_features_.ext_color_buffer_float) |
| 892 EnableEXTColorBufferFloat(); | 944 EnableEXTColorBufferFloat(); |
| 893 } | 945 } |
| 894 | 946 |
| 895 // Check for multisample support | 947 // Check for multisample support |
| 896 if (!workarounds_.disable_chromium_framebuffer_multisample) { | 948 if (!workarounds_.disable_chromium_framebuffer_multisample) { |
| 897 bool ext_has_multisample = | 949 bool ext_has_multisample = |
| 898 extensions.Contains("GL_EXT_framebuffer_multisample") || | 950 extensions.Contains("GL_EXT_framebuffer_multisample") || |
| 899 gl_version_info_->is_es3 || | 951 gl_version_info_->is_es3 || |
| (...skipping 640 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1540 if (pos == std::string::npos) { | 1592 if (pos == std::string::npos) { |
| 1541 extensions_ += (extensions_.empty() ? "" : " ") + str; | 1593 extensions_ += (extensions_.empty() ? "" : " ") + str; |
| 1542 } | 1594 } |
| 1543 } | 1595 } |
| 1544 | 1596 |
| 1545 FeatureInfo::~FeatureInfo() { | 1597 FeatureInfo::~FeatureInfo() { |
| 1546 } | 1598 } |
| 1547 | 1599 |
| 1548 } // namespace gles2 | 1600 } // namespace gles2 |
| 1549 } // namespace gpu | 1601 } // namespace gpu |
| OLD | NEW |