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 <set> | 7 #include <set> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 arb_texture_rectangle(false), | 125 arb_texture_rectangle(false), |
126 angle_instanced_arrays(false), | 126 angle_instanced_arrays(false), |
127 occlusion_query_boolean(false), | 127 occlusion_query_boolean(false), |
128 use_arb_occlusion_query2_for_occlusion_query_boolean(false), | 128 use_arb_occlusion_query2_for_occlusion_query_boolean(false), |
129 use_arb_occlusion_query_for_occlusion_query_boolean(false), | 129 use_arb_occlusion_query_for_occlusion_query_boolean(false), |
130 native_vertex_array_object(false), | 130 native_vertex_array_object(false), |
131 ext_texture_format_bgra8888(false), | 131 ext_texture_format_bgra8888(false), |
132 enable_shader_name_hashing(false), | 132 enable_shader_name_hashing(false), |
133 enable_samplers(false), | 133 enable_samplers(false), |
134 ext_draw_buffers(false), | 134 ext_draw_buffers(false), |
| 135 nv_draw_buffers(false), |
135 ext_frag_depth(false), | 136 ext_frag_depth(false), |
136 ext_shader_texture_lod(false), | 137 ext_shader_texture_lod(false), |
137 use_async_readpixels(false), | 138 use_async_readpixels(false), |
138 map_buffer_range(false), | 139 map_buffer_range(false), |
139 ext_discard_framebuffer(false), | 140 ext_discard_framebuffer(false), |
140 angle_depth_texture(false), | 141 angle_depth_texture(false), |
141 is_angle(false), | 142 is_angle(false), |
142 is_swiftshader(false), | 143 is_swiftshader(false), |
143 angle_texture_usage(false), | 144 angle_texture_usage(false), |
144 ext_texture_storage(false), | 145 ext_texture_storage(false), |
(...skipping 608 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
753 if (!workarounds_.disable_angle_instanced_arrays && | 754 if (!workarounds_.disable_angle_instanced_arrays && |
754 (extensions.Contains("GL_ANGLE_instanced_arrays") || | 755 (extensions.Contains("GL_ANGLE_instanced_arrays") || |
755 (extensions.Contains("GL_ARB_instanced_arrays") && | 756 (extensions.Contains("GL_ARB_instanced_arrays") && |
756 extensions.Contains("GL_ARB_draw_instanced")) || | 757 extensions.Contains("GL_ARB_draw_instanced")) || |
757 is_es3)) { | 758 is_es3)) { |
758 AddExtensionString("GL_ANGLE_instanced_arrays"); | 759 AddExtensionString("GL_ANGLE_instanced_arrays"); |
759 feature_flags_.angle_instanced_arrays = true; | 760 feature_flags_.angle_instanced_arrays = true; |
760 validators_.vertex_attribute.AddValue(GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE); | 761 validators_.vertex_attribute.AddValue(GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE); |
761 } | 762 } |
762 | 763 |
| 764 bool vendor_agnostic_draw_buffers = |
| 765 extensions.Contains("GL_ARB_draw_buffers") || |
| 766 extensions.Contains("GL_EXT_draw_buffers"); |
763 if (!workarounds_.disable_ext_draw_buffers && | 767 if (!workarounds_.disable_ext_draw_buffers && |
764 (extensions.Contains("GL_ARB_draw_buffers") || | 768 (vendor_agnostic_draw_buffers || |
765 extensions.Contains("GL_EXT_draw_buffers"))) { | 769 (extensions.Contains("GL_NV_draw_buffers") && is_es3))) { |
766 AddExtensionString("GL_EXT_draw_buffers"); | 770 AddExtensionString("GL_EXT_draw_buffers"); |
767 feature_flags_.ext_draw_buffers = true; | 771 feature_flags_.ext_draw_buffers = true; |
768 | 772 |
| 773 // This flag is set to enable emulation of EXT_draw_buffers when we're |
| 774 // running on GLES 3.0+, NV_draw_buffers extension is supported and |
| 775 // glDrawBuffers from GLES 3.0 core has been bound. It toggles using the |
| 776 // NV_draw_buffers extension directive instead of EXT_draw_buffers extension |
| 777 // directive in ESSL 100 shaders translated by ANGLE, enabling them to write |
| 778 // into multiple gl_FragData values, which is not by default possible in |
| 779 // ESSL 100 with core GLES 3.0. For more information, see the |
| 780 // NV_draw_buffers specification. |
| 781 feature_flags_.nv_draw_buffers = !vendor_agnostic_draw_buffers; |
| 782 |
769 GLint max_color_attachments = 0; | 783 GLint max_color_attachments = 0; |
770 glGetIntegerv(GL_MAX_COLOR_ATTACHMENTS_EXT, &max_color_attachments); | 784 glGetIntegerv(GL_MAX_COLOR_ATTACHMENTS_EXT, &max_color_attachments); |
771 for (GLenum i = GL_COLOR_ATTACHMENT1_EXT; | 785 for (GLenum i = GL_COLOR_ATTACHMENT1_EXT; |
772 i < static_cast<GLenum>(GL_COLOR_ATTACHMENT0 + max_color_attachments); | 786 i < static_cast<GLenum>(GL_COLOR_ATTACHMENT0 + max_color_attachments); |
773 ++i) { | 787 ++i) { |
774 validators_.attachment.AddValue(i); | 788 validators_.attachment.AddValue(i); |
775 } | 789 } |
776 COMPILE_ASSERT(GL_COLOR_ATTACHMENT0_EXT == GL_COLOR_ATTACHMENT0, | 790 COMPILE_ASSERT(GL_COLOR_ATTACHMENT0_EXT == GL_COLOR_ATTACHMENT0, |
777 color_attachment0_variation_must_match); | 791 color_attachment0_variation_must_match); |
778 | 792 |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
872 if (pos == std::string::npos) { | 886 if (pos == std::string::npos) { |
873 extensions_ += (extensions_.empty() ? "" : " ") + str; | 887 extensions_ += (extensions_.empty() ? "" : " ") + str; |
874 } | 888 } |
875 } | 889 } |
876 | 890 |
877 FeatureInfo::~FeatureInfo() { | 891 FeatureInfo::~FeatureInfo() { |
878 } | 892 } |
879 | 893 |
880 } // namespace gles2 | 894 } // namespace gles2 |
881 } // namespace gpu | 895 } // namespace gpu |
OLD | NEW |