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

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

Issue 2480373002: Refactor context creation parameters into a struct. (Closed)
Patch Set: address piman's comments Created 4 years, 1 month 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 1387 matching lines...) Expand 10 before | Expand all | Expand 10 after
1398 // but we emulate ES 3.0 on top of Desktop GL 4.2+. 1398 // but we emulate ES 3.0 on top of Desktop GL 4.2+.
1399 feature_flags_.emulate_primitive_restart_fixed_index = true; 1399 feature_flags_.emulate_primitive_restart_fixed_index = true;
1400 } 1400 }
1401 1401
1402 feature_flags_.angle_robust_client_memory = 1402 feature_flags_.angle_robust_client_memory =
1403 extensions.Contains("GL_ANGLE_robust_client_memory"); 1403 extensions.Contains("GL_ANGLE_robust_client_memory");
1404 1404
1405 feature_flags_.khr_debug = gl_version_info_->IsAtLeastGL(4, 3) || 1405 feature_flags_.khr_debug = gl_version_info_->IsAtLeastGL(4, 3) ||
1406 gl_version_info_->IsAtLeastGLES(3, 2) || 1406 gl_version_info_->IsAtLeastGLES(3, 2) ||
1407 extensions.Contains("GL_KHR_debug"); 1407 extensions.Contains("GL_KHR_debug");
1408
1409 feature_flags_.chromium_bind_generates_resource =
1410 extensions.Contains("GL_CHROMIUM_bind_generates_resource");
1411 feature_flags_.angle_webgl_compatibility =
1412 extensions.Contains("GL_ANGLE_webgl_compatibility");
1408 } 1413 }
1409 1414
1410 bool FeatureInfo::IsES3Capable() const { 1415 bool FeatureInfo::IsES3Capable() const {
1411 if (workarounds_.disable_texture_storage) 1416 if (workarounds_.disable_texture_storage)
1412 return false; 1417 return false;
1413 if (gl_version_info_) 1418 if (gl_version_info_)
1414 return gl_version_info_->is_es3_capable; 1419 return gl_version_info_->is_es3_capable;
1415 return false; 1420 return false;
1416 } 1421 }
1417 1422
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
1482 if (feature_flags_.ext_texture_format_bgra8888) { 1487 if (feature_flags_.ext_texture_format_bgra8888) {
1483 validators_.texture_internal_format.AddValue(GL_BGRA8_EXT); 1488 validators_.texture_internal_format.AddValue(GL_BGRA8_EXT);
1484 validators_.texture_sized_color_renderable_internal_format.AddValue( 1489 validators_.texture_sized_color_renderable_internal_format.AddValue(
1485 GL_BGRA8_EXT); 1490 GL_BGRA8_EXT);
1486 validators_.texture_sized_texture_filterable_internal_format.AddValue( 1491 validators_.texture_sized_texture_filterable_internal_format.AddValue(
1487 GL_BGRA8_EXT); 1492 GL_BGRA8_EXT);
1488 } 1493 }
1489 } 1494 }
1490 1495
1491 bool FeatureInfo::IsWebGLContext() const { 1496 bool FeatureInfo::IsWebGLContext() const {
1492 // Switch statement to cause a compile-time error if we miss a case. 1497 return IsWebGLContextType(context_type_);
1493 switch (context_type_) {
1494 case CONTEXT_TYPE_WEBGL1:
1495 case CONTEXT_TYPE_WEBGL2:
1496 return true;
1497 case CONTEXT_TYPE_OPENGLES2:
1498 case CONTEXT_TYPE_OPENGLES3:
1499 return false;
1500 }
1501
1502 NOTREACHED();
1503 return false;
1504 } 1498 }
1505 1499
1506 bool FeatureInfo::IsWebGL1OrES2Context() const { 1500 bool FeatureInfo::IsWebGL1OrES2Context() const {
1507 // Switch statement to cause a compile-time error if we miss a case. 1501 // Switch statement to cause a compile-time error if we miss a case.
1508 switch (context_type_) { 1502 switch (context_type_) {
1509 case CONTEXT_TYPE_WEBGL1: 1503 case CONTEXT_TYPE_WEBGL1:
1510 case CONTEXT_TYPE_OPENGLES2: 1504 case CONTEXT_TYPE_OPENGLES2:
1511 return true; 1505 return true;
1512 case CONTEXT_TYPE_WEBGL2: 1506 case CONTEXT_TYPE_WEBGL2:
1513 case CONTEXT_TYPE_OPENGLES3: 1507 case CONTEXT_TYPE_OPENGLES3:
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
1545 if (pos == std::string::npos) { 1539 if (pos == std::string::npos) {
1546 extensions_ += (extensions_.empty() ? "" : " ") + str; 1540 extensions_ += (extensions_.empty() ? "" : " ") + str;
1547 } 1541 }
1548 } 1542 }
1549 1543
1550 FeatureInfo::~FeatureInfo() { 1544 FeatureInfo::~FeatureInfo() {
1551 } 1545 }
1552 1546
1553 } // namespace gles2 1547 } // namespace gles2
1554 } // namespace gpu 1548 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698