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

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

Issue 1781093002: Add CONTEXT_TYPE_OPENGLES2_PEPPER (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: move kContextType to header Created 4 years, 9 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 838 matching lines...) Expand 10 before | Expand all | Expand 10 after
849 // Enable the GL_EXT_color_buffer_float extension for WebGL 2.0 849 // Enable the GL_EXT_color_buffer_float extension for WebGL 2.0
850 if (enable_ext_color_buffer_float && IsES3Capable()) { 850 if (enable_ext_color_buffer_float && IsES3Capable()) {
851 ext_color_buffer_float_available_ = true; 851 ext_color_buffer_float_available_ = true;
852 if (!disallowed_features_.ext_color_buffer_float) 852 if (!disallowed_features_.ext_color_buffer_float)
853 EnableEXTColorBufferFloat(); 853 EnableEXTColorBufferFloat();
854 } 854 }
855 855
856 // Check for multisample support 856 // Check for multisample support
857 857
858 // crbug.com/527565 - On some GPUs, MSAA does not perform acceptably for 858 // crbug.com/527565 - On some GPUs, MSAA does not perform acceptably for
859 // rasterization. We disable it on non-WebGL contexts. For WebGL contexts 859 // rasterization. For externally exposed (WebGL or Pepper) contexts we leave
860 // we leave it up to the site to decide whether to enable MSAA. 860 // it up to the site to decide whether to enable MSAA.
861 bool disable_all_multisample = 861 bool disable_all_multisample =
862 workarounds_.disable_msaa_on_non_webgl_contexts && !IsWebGLContext(); 862 workarounds_.disable_msaa_on_internal_contexts && !IsWebGLContext() &&
863 !IsPepperContext();
863 864
864 if (!disable_all_multisample && 865 if (!disable_all_multisample &&
865 !workarounds_.disable_chromium_framebuffer_multisample) { 866 !workarounds_.disable_chromium_framebuffer_multisample) {
866 bool ext_has_multisample = 867 bool ext_has_multisample =
867 extensions.Contains("GL_EXT_framebuffer_multisample") || 868 extensions.Contains("GL_EXT_framebuffer_multisample") ||
868 gl_version_info_->is_es3 || 869 gl_version_info_->is_es3 ||
869 gl_version_info_->is_desktop_core_profile; 870 gl_version_info_->is_desktop_core_profile;
870 if (gl_version_info_->is_angle) { 871 if (gl_version_info_->is_angle) {
871 ext_has_multisample |= 872 ext_has_multisample |=
872 extensions.Contains("GL_ANGLE_framebuffer_multisample"); 873 extensions.Contains("GL_ANGLE_framebuffer_multisample");
(...skipping 536 matching lines...) Expand 10 before | Expand all | Expand 10 after
1409 } 1410 }
1410 1411
1411 bool FeatureInfo::IsWebGLContext() const { 1412 bool FeatureInfo::IsWebGLContext() const {
1412 // Switch statement to cause a compile-time error if we miss a case. 1413 // Switch statement to cause a compile-time error if we miss a case.
1413 switch (context_type_) { 1414 switch (context_type_) {
1414 case CONTEXT_TYPE_WEBGL1: 1415 case CONTEXT_TYPE_WEBGL1:
1415 case CONTEXT_TYPE_WEBGL2: 1416 case CONTEXT_TYPE_WEBGL2:
1416 return true; 1417 return true;
1417 case CONTEXT_TYPE_OPENGLES2: 1418 case CONTEXT_TYPE_OPENGLES2:
1418 case CONTEXT_TYPE_OPENGLES3: 1419 case CONTEXT_TYPE_OPENGLES3:
1420 case CONTEXT_TYPE_OPENGLES2_PEPPER:
1419 return false; 1421 return false;
1420 } 1422 }
1421 1423
1422 NOTREACHED(); 1424 NOTREACHED();
1423 return false; 1425 return false;
1424 } 1426 }
1425 1427
1428 bool FeatureInfo::IsPepperContext() const {
1429 // Switch statement to cause a compile-time error if we miss a case.
1430 switch (context_type_) {
1431 case CONTEXT_TYPE_WEBGL1:
1432 case CONTEXT_TYPE_WEBGL2:
1433 case CONTEXT_TYPE_OPENGLES2:
1434 case CONTEXT_TYPE_OPENGLES3:
1435 return false;
1436 case CONTEXT_TYPE_OPENGLES2_PEPPER:
1437 return true;
1438 }
1439
1440 NOTREACHED();
1441 return false;
1442 }
1443
1426 void FeatureInfo::AddExtensionString(const char* s) { 1444 void FeatureInfo::AddExtensionString(const char* s) {
1427 std::string str(s); 1445 std::string str(s);
1428 size_t pos = extensions_.find(str); 1446 size_t pos = extensions_.find(str);
1429 while (pos != std::string::npos && 1447 while (pos != std::string::npos &&
1430 pos + str.length() < extensions_.length() && 1448 pos + str.length() < extensions_.length() &&
1431 extensions_.substr(pos + str.length(), 1) != " ") { 1449 extensions_.substr(pos + str.length(), 1) != " ") {
1432 // This extension name is a substring of another. 1450 // This extension name is a substring of another.
1433 pos = extensions_.find(str, pos + str.length()); 1451 pos = extensions_.find(str, pos + str.length());
1434 } 1452 }
1435 if (pos == std::string::npos) { 1453 if (pos == std::string::npos) {
1436 extensions_ += (extensions_.empty() ? "" : " ") + str; 1454 extensions_ += (extensions_.empty() ? "" : " ") + str;
1437 } 1455 }
1438 } 1456 }
1439 1457
1440 FeatureInfo::~FeatureInfo() { 1458 FeatureInfo::~FeatureInfo() {
1441 } 1459 }
1442 1460
1443 } // namespace gles2 1461 } // namespace gles2
1444 } // namespace gpu 1462 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698