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

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

Issue 2689203002: Check for some extensions before calling potentially NULL GL entry points. (Closed)
Patch Set: Revert discard_framebuffer functional change 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 683 matching lines...) Expand 10 before | Expand all | Expand 10 after
694 feature_flags_.arb_es3_compatibility = 694 feature_flags_.arb_es3_compatibility =
695 extensions.Contains("GL_ARB_ES3_compatibility") && 695 extensions.Contains("GL_ARB_ES3_compatibility") &&
696 !gl_version_info_->is_es; 696 !gl_version_info_->is_es;
697 697
698 // glGetInteger64v for timestamps is implemented on the client side in a way 698 // glGetInteger64v for timestamps is implemented on the client side in a way
699 // that it does not depend on a driver-level implementation of 699 // that it does not depend on a driver-level implementation of
700 // glGetInteger64v. The GPUTimer class which implements timer queries can also 700 // glGetInteger64v. The GPUTimer class which implements timer queries can also
701 // fallback to an implementation that does not depend on glGetInteger64v on 701 // fallback to an implementation that does not depend on glGetInteger64v on
702 // ES2. Thus we can enable GL_EXT_disjoint_timer_query on ES2 contexts even 702 // ES2. Thus we can enable GL_EXT_disjoint_timer_query on ES2 contexts even
703 // though it does not support glGetInteger64v due to a specification bug. 703 // though it does not support glGetInteger64v due to a specification bug.
704 if (extensions.Contains("GL_EXT_disjoint_timer_query") || 704 feature_flags_.ext_disjoint_timer_query =
705 extensions.Contains("GL_EXT_disjoint_timer_query");
706 if (feature_flags_.ext_disjoint_timer_query ||
705 extensions.Contains("GL_ARB_timer_query") || 707 extensions.Contains("GL_ARB_timer_query") ||
706 extensions.Contains("GL_EXT_timer_query")) { 708 extensions.Contains("GL_EXT_timer_query")) {
707 AddExtensionString("GL_EXT_disjoint_timer_query"); 709 AddExtensionString("GL_EXT_disjoint_timer_query");
708 } 710 }
709 711
710 if (extensions.Contains("GL_OES_rgb8_rgba8") || gl::HasDesktopGLFeatures()) { 712 if (extensions.Contains("GL_OES_rgb8_rgba8") || gl::HasDesktopGLFeatures()) {
711 AddExtensionString("GL_OES_rgb8_rgba8"); 713 AddExtensionString("GL_OES_rgb8_rgba8");
712 validators_.render_buffer_format.AddValue(GL_RGB8_OES); 714 validators_.render_buffer_format.AddValue(GL_RGB8_OES);
713 validators_.render_buffer_format.AddValue(GL_RGBA8_OES); 715 validators_.render_buffer_format.AddValue(GL_RGBA8_OES);
714 } 716 }
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
889 EnableEXTColorBufferFloat(); 891 EnableEXTColorBufferFloat();
890 } 892 }
891 893
892 // Check for multisample support 894 // Check for multisample support
893 if (!workarounds_.disable_chromium_framebuffer_multisample) { 895 if (!workarounds_.disable_chromium_framebuffer_multisample) {
894 bool ext_has_multisample = 896 bool ext_has_multisample =
895 extensions.Contains("GL_EXT_framebuffer_multisample") || 897 extensions.Contains("GL_EXT_framebuffer_multisample") ||
896 gl_version_info_->is_es3 || 898 gl_version_info_->is_es3 ||
897 gl_version_info_->is_desktop_core_profile; 899 gl_version_info_->is_desktop_core_profile;
898 if (gl_version_info_->is_angle) { 900 if (gl_version_info_->is_angle) {
899 ext_has_multisample |= 901 feature_flags_.angle_framebuffer_multisample =
900 extensions.Contains("GL_ANGLE_framebuffer_multisample"); 902 extensions.Contains("GL_ANGLE_framebuffer_multisample");
903 ext_has_multisample |= feature_flags_.angle_framebuffer_multisample;
901 } 904 }
902 feature_flags_.use_core_framebuffer_multisample = 905 feature_flags_.use_core_framebuffer_multisample =
903 gl_version_info_->is_es3 || gl_version_info_->is_desktop_core_profile; 906 gl_version_info_->is_es3 || gl_version_info_->is_desktop_core_profile;
904 if (ext_has_multisample) { 907 if (ext_has_multisample) {
905 feature_flags_.chromium_framebuffer_multisample = true; 908 feature_flags_.chromium_framebuffer_multisample = true;
906 validators_.framebuffer_target.AddValue(GL_READ_FRAMEBUFFER_EXT); 909 validators_.framebuffer_target.AddValue(GL_READ_FRAMEBUFFER_EXT);
907 validators_.framebuffer_target.AddValue(GL_DRAW_FRAMEBUFFER_EXT); 910 validators_.framebuffer_target.AddValue(GL_DRAW_FRAMEBUFFER_EXT);
908 validators_.g_l_state.AddValue(GL_READ_FRAMEBUFFER_BINDING_EXT); 911 validators_.g_l_state.AddValue(GL_READ_FRAMEBUFFER_BINDING_EXT);
909 validators_.g_l_state.AddValue(GL_MAX_SAMPLES_EXT); 912 validators_.g_l_state.AddValue(GL_MAX_SAMPLES_EXT);
910 validators_.render_buffer_parameter.AddValue(GL_RENDERBUFFER_SAMPLES_EXT); 913 validators_.render_buffer_parameter.AddValue(GL_RENDERBUFFER_SAMPLES_EXT);
(...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after
1394 extensions.Contains("GL_ANGLE_robust_client_memory"); 1397 extensions.Contains("GL_ANGLE_robust_client_memory");
1395 1398
1396 feature_flags_.khr_debug = gl_version_info_->IsAtLeastGL(4, 3) || 1399 feature_flags_.khr_debug = gl_version_info_->IsAtLeastGL(4, 3) ||
1397 gl_version_info_->IsAtLeastGLES(3, 2) || 1400 gl_version_info_->IsAtLeastGLES(3, 2) ||
1398 extensions.Contains("GL_KHR_debug"); 1401 extensions.Contains("GL_KHR_debug");
1399 1402
1400 feature_flags_.chromium_bind_generates_resource = 1403 feature_flags_.chromium_bind_generates_resource =
1401 extensions.Contains("GL_CHROMIUM_bind_generates_resource"); 1404 extensions.Contains("GL_CHROMIUM_bind_generates_resource");
1402 feature_flags_.angle_webgl_compatibility = 1405 feature_flags_.angle_webgl_compatibility =
1403 extensions.Contains("GL_ANGLE_webgl_compatibility"); 1406 extensions.Contains("GL_ANGLE_webgl_compatibility");
1407 feature_flags_.chromium_copy_texture =
1408 extensions.Contains("GL_CHROMIUM_copy_texture");
1409 feature_flags_.chromium_copy_compressed_texture =
1410 extensions.Contains("GL_CHROMIUM_copy_compressed_texture");
1404 } 1411 }
1405 1412
1406 bool FeatureInfo::IsES3Capable() const { 1413 bool FeatureInfo::IsES3Capable() const {
1407 if (workarounds_.disable_texture_storage) 1414 if (workarounds_.disable_texture_storage)
1408 return false; 1415 return false;
1409 if (gl_version_info_) 1416 if (gl_version_info_)
1410 return gl_version_info_->is_es3_capable; 1417 return gl_version_info_->is_es3_capable;
1411 return false; 1418 return false;
1412 } 1419 }
1413 1420
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
1537 if (pos == std::string::npos) { 1544 if (pos == std::string::npos) {
1538 extensions_ += (extensions_.empty() ? "" : " ") + str; 1545 extensions_ += (extensions_.empty() ? "" : " ") + str;
1539 } 1546 }
1540 } 1547 }
1541 1548
1542 FeatureInfo::~FeatureInfo() { 1549 FeatureInfo::~FeatureInfo() {
1543 } 1550 }
1544 1551
1545 } // namespace gles2 1552 } // namespace gles2
1546 } // namespace gpu 1553 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/feature_info.h ('k') | gpu/command_buffer/service/gles2_cmd_decoder_passthrough.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698