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 1134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1145 (extensions.Contains("GL_ANGLE_instanced_arrays") || | 1145 (extensions.Contains("GL_ANGLE_instanced_arrays") || |
1146 (extensions.Contains("GL_ARB_instanced_arrays") && | 1146 (extensions.Contains("GL_ARB_instanced_arrays") && |
1147 extensions.Contains("GL_ARB_draw_instanced")) || | 1147 extensions.Contains("GL_ARB_draw_instanced")) || |
1148 gl_version_info_->is_es3 || | 1148 gl_version_info_->is_es3 || |
1149 gl_version_info_->is_desktop_core_profile)) { | 1149 gl_version_info_->is_desktop_core_profile)) { |
1150 AddExtensionString("GL_ANGLE_instanced_arrays"); | 1150 AddExtensionString("GL_ANGLE_instanced_arrays"); |
1151 feature_flags_.angle_instanced_arrays = true; | 1151 feature_flags_.angle_instanced_arrays = true; |
1152 validators_.vertex_attribute.AddValue(GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE); | 1152 validators_.vertex_attribute.AddValue(GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE); |
1153 } | 1153 } |
1154 | 1154 |
1155 bool support_draw_buffers = gl_version_info_->is_es3 || | 1155 bool vendor_agnostic_draw_buffers = |
1156 gl_version_info_->is_desktop_core_profile || | 1156 extensions.Contains("GL_ARB_draw_buffers") || |
1157 extensions.Contains("GL_ARB_draw_buffers") || | 1157 extensions.Contains("GL_EXT_draw_buffers"); |
1158 extensions.Contains("GL_EXT_draw_buffers"); | 1158 if (!workarounds_.disable_ext_draw_buffers && |
1159 bool have_draw_buffers = !workarounds_.disable_ext_draw_buffers && | 1159 (vendor_agnostic_draw_buffers || |
1160 IsWebGL1OrES2Context() && support_draw_buffers; | 1160 (extensions.Contains("GL_NV_draw_buffers") && |
1161 if (have_draw_buffers) { | 1161 gl_version_info_->is_es3) || |
| 1162 gl_version_info_->is_desktop_core_profile)) { |
1162 AddExtensionString("GL_EXT_draw_buffers"); | 1163 AddExtensionString("GL_EXT_draw_buffers"); |
1163 feature_flags_.ext_draw_buffers = true; | 1164 feature_flags_.ext_draw_buffers = true; |
1164 } | |
1165 | 1165 |
1166 if (IsWebGL2OrES3Context() || have_draw_buffers) { | 1166 // This flag is set to enable emulation of EXT_draw_buffers when we're |
| 1167 // running on GLES 3.0+, NV_draw_buffers extension is supported and |
| 1168 // glDrawBuffers from GLES 3.0 core has been bound. It toggles using the |
| 1169 // NV_draw_buffers extension directive instead of EXT_draw_buffers extension |
| 1170 // directive in ESSL 100 shaders translated by ANGLE, enabling them to write |
| 1171 // into multiple gl_FragData values, which is not by default possible in |
| 1172 // ESSL 100 with core GLES 3.0. For more information, see the |
| 1173 // NV_draw_buffers specification. |
| 1174 feature_flags_.nv_draw_buffers = !vendor_agnostic_draw_buffers; |
| 1175 |
1167 GLint max_color_attachments = 0; | 1176 GLint max_color_attachments = 0; |
1168 glGetIntegerv(GL_MAX_COLOR_ATTACHMENTS_EXT, &max_color_attachments); | 1177 glGetIntegerv(GL_MAX_COLOR_ATTACHMENTS_EXT, &max_color_attachments); |
1169 for (GLenum i = GL_COLOR_ATTACHMENT1_EXT; | 1178 for (GLenum i = GL_COLOR_ATTACHMENT1_EXT; |
1170 i < static_cast<GLenum>(GL_COLOR_ATTACHMENT0 + max_color_attachments); | 1179 i < static_cast<GLenum>(GL_COLOR_ATTACHMENT0 + max_color_attachments); |
1171 ++i) { | 1180 ++i) { |
1172 validators_.attachment.AddValue(i); | 1181 validators_.attachment.AddValue(i); |
1173 validators_.attachment_query.AddValue(i); | 1182 validators_.attachment_query.AddValue(i); |
1174 } | 1183 } |
1175 static_assert(GL_COLOR_ATTACHMENT0_EXT == GL_COLOR_ATTACHMENT0, | 1184 static_assert(GL_COLOR_ATTACHMENT0_EXT == GL_COLOR_ATTACHMENT0, |
1176 "GL_COLOR_ATTACHMENT0_EXT should equal GL_COLOR_ATTACHMENT0"); | 1185 "GL_COLOR_ATTACHMENT0_EXT should equal GL_COLOR_ATTACHMENT0"); |
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1528 if (pos == std::string::npos) { | 1537 if (pos == std::string::npos) { |
1529 extensions_ += (extensions_.empty() ? "" : " ") + str; | 1538 extensions_ += (extensions_.empty() ? "" : " ") + str; |
1530 } | 1539 } |
1531 } | 1540 } |
1532 | 1541 |
1533 FeatureInfo::~FeatureInfo() { | 1542 FeatureInfo::~FeatureInfo() { |
1534 } | 1543 } |
1535 | 1544 |
1536 } // namespace gles2 | 1545 } // namespace gles2 |
1537 } // namespace gpu | 1546 } // namespace gpu |
OLD | NEW |