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

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

Issue 2678483003: Fix EXT_draw_buffers detection on some GL ES 3 contexts (Closed)
Patch Set: remove nv_draw_buffers entirely 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 1134 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 vendor_agnostic_draw_buffers = 1155 bool support_draw_buffers = extensions.Contains("GL_ARB_draw_buffers") ||
1156 extensions.Contains("GL_ARB_draw_buffers") || 1156 extensions.Contains("GL_EXT_draw_buffers") ||
1157 extensions.Contains("GL_EXT_draw_buffers"); 1157 gl_version_info_->is_es3 ||
Zhenyao Mo 2017/02/15 18:42:37 nit: probably put the last two conditions first as
1158 if (!workarounds_.disable_ext_draw_buffers && 1158 gl_version_info_->is_desktop_core_profile;
1159 (vendor_agnostic_draw_buffers || 1159 bool have_draw_buffers = !workarounds_.disable_ext_draw_buffers &&
1160 (extensions.Contains("GL_NV_draw_buffers") && 1160 IsWebGL1OrES2Context() && support_draw_buffers;
1161 gl_version_info_->is_es3) || 1161 if (have_draw_buffers) {
1162 gl_version_info_->is_desktop_core_profile)) {
1163 AddExtensionString("GL_EXT_draw_buffers"); 1162 AddExtensionString("GL_EXT_draw_buffers");
1164 feature_flags_.ext_draw_buffers = true; 1163 feature_flags_.ext_draw_buffers = true;
1164 }
1165 1165
1166 // This flag is set to enable emulation of EXT_draw_buffers when we're 1166 if (IsWebGL2OrES3Context() || have_draw_buffers) {
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
1176 GLint max_color_attachments = 0; 1167 GLint max_color_attachments = 0;
1177 glGetIntegerv(GL_MAX_COLOR_ATTACHMENTS_EXT, &max_color_attachments); 1168 glGetIntegerv(GL_MAX_COLOR_ATTACHMENTS_EXT, &max_color_attachments);
1178 for (GLenum i = GL_COLOR_ATTACHMENT1_EXT; 1169 for (GLenum i = GL_COLOR_ATTACHMENT1_EXT;
1179 i < static_cast<GLenum>(GL_COLOR_ATTACHMENT0 + max_color_attachments); 1170 i < static_cast<GLenum>(GL_COLOR_ATTACHMENT0 + max_color_attachments);
1180 ++i) { 1171 ++i) {
1181 validators_.attachment.AddValue(i); 1172 validators_.attachment.AddValue(i);
1182 validators_.attachment_query.AddValue(i); 1173 validators_.attachment_query.AddValue(i);
1183 } 1174 }
1184 static_assert(GL_COLOR_ATTACHMENT0_EXT == GL_COLOR_ATTACHMENT0, 1175 static_assert(GL_COLOR_ATTACHMENT0_EXT == GL_COLOR_ATTACHMENT0,
1185 "GL_COLOR_ATTACHMENT0_EXT should equal GL_COLOR_ATTACHMENT0"); 1176 "GL_COLOR_ATTACHMENT0_EXT should equal GL_COLOR_ATTACHMENT0");
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after
1537 if (pos == std::string::npos) { 1528 if (pos == std::string::npos) {
1538 extensions_ += (extensions_.empty() ? "" : " ") + str; 1529 extensions_ += (extensions_.empty() ? "" : " ") + str;
1539 } 1530 }
1540 } 1531 }
1541 1532
1542 FeatureInfo::~FeatureInfo() { 1533 FeatureInfo::~FeatureInfo() {
1543 } 1534 }
1544 1535
1545 } // namespace gles2 1536 } // namespace gles2
1546 } // namespace gpu 1537 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/feature_info.h ('k') | gpu/command_buffer/service/feature_info_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698