| 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/query_manager.h" | 5 #include "gpu/command_buffer/service/query_manager.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include "base/atomicops.h" | 10 #include "base/atomicops.h" |
| (...skipping 696 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 707 QueryManager::QueryManager( | 707 QueryManager::QueryManager( |
| 708 GLES2Decoder* decoder, | 708 GLES2Decoder* decoder, |
| 709 FeatureInfo* feature_info) | 709 FeatureInfo* feature_info) |
| 710 : decoder_(decoder), | 710 : decoder_(decoder), |
| 711 use_arb_occlusion_query2_for_occlusion_query_boolean_( | 711 use_arb_occlusion_query2_for_occlusion_query_boolean_( |
| 712 feature_info->feature_flags( | 712 feature_info->feature_flags( |
| 713 ).use_arb_occlusion_query2_for_occlusion_query_boolean), | 713 ).use_arb_occlusion_query2_for_occlusion_query_boolean), |
| 714 use_arb_occlusion_query_for_occlusion_query_boolean_( | 714 use_arb_occlusion_query_for_occlusion_query_boolean_( |
| 715 feature_info->feature_flags( | 715 feature_info->feature_flags( |
| 716 ).use_arb_occlusion_query_for_occlusion_query_boolean), | 716 ).use_arb_occlusion_query_for_occlusion_query_boolean), |
| 717 no_covert_any_samples_passed_conservative_target_for_es3_( |
| 718 feature_info->feature_flags( |
| 719 ).no_covert_any_samples_passed_conservative_target_for_es3), |
| 720 covert_any_samples_passed_conservative_target_for_low_gl_( |
| 721 feature_info->feature_flags( |
| 722 ).covert_any_samples_passed_conservative_target_for_low_gl), |
| 717 update_disjoints_continually_(false), | 723 update_disjoints_continually_(false), |
| 718 disjoint_notify_shm_id_(-1), | 724 disjoint_notify_shm_id_(-1), |
| 719 disjoint_notify_shm_offset_(0), | 725 disjoint_notify_shm_offset_(0), |
| 720 disjoints_notified_(0), | 726 disjoints_notified_(0), |
| 721 query_count_(0) { | 727 query_count_(0) { |
| 722 DCHECK(!(use_arb_occlusion_query_for_occlusion_query_boolean_ && | 728 DCHECK(!(use_arb_occlusion_query_for_occlusion_query_boolean_ && |
| 723 use_arb_occlusion_query2_for_occlusion_query_boolean_)); | 729 use_arb_occlusion_query2_for_occlusion_query_boolean_)); |
| 724 DCHECK(decoder); | 730 DCHECK(decoder); |
| 725 gl::GLContext* context = decoder_->GetGLContext(); | 731 gl::GLContext* context = decoder_->GetGLContext(); |
| 726 if (context) { | 732 if (context) { |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 869 } | 875 } |
| 870 | 876 |
| 871 void QueryManager::StopTracking(QueryManager::Query* /* query */) { | 877 void QueryManager::StopTracking(QueryManager::Query* /* query */) { |
| 872 --query_count_; | 878 --query_count_; |
| 873 } | 879 } |
| 874 | 880 |
| 875 GLenum QueryManager::AdjustTargetForEmulation(GLenum target) { | 881 GLenum QueryManager::AdjustTargetForEmulation(GLenum target) { |
| 876 switch (target) { | 882 switch (target) { |
| 877 case GL_ANY_SAMPLES_PASSED_CONSERVATIVE_EXT: | 883 case GL_ANY_SAMPLES_PASSED_CONSERVATIVE_EXT: |
| 878 case GL_ANY_SAMPLES_PASSED_EXT: | 884 case GL_ANY_SAMPLES_PASSED_EXT: |
| 879 if (use_arb_occlusion_query2_for_occlusion_query_boolean_) { | 885 if (!no_covert_any_samples_passed_conservative_target_for_es3_) { |
| 880 // ARB_occlusion_query2 does not have a | 886 if (use_arb_occlusion_query2_for_occlusion_query_boolean_) { |
| 881 // GL_ANY_SAMPLES_PASSED_CONSERVATIVE_EXT | 887 // ARB_occlusion_query2 does not have a |
| 882 // target. | 888 // GL_ANY_SAMPLES_PASSED_CONSERVATIVE_EXT |
| 883 target = GL_ANY_SAMPLES_PASSED_EXT; | 889 // target. |
| 884 } else if (use_arb_occlusion_query_for_occlusion_query_boolean_) { | 890 target = GL_ANY_SAMPLES_PASSED_EXT; |
| 885 // ARB_occlusion_query does not have a | 891 } else if (use_arb_occlusion_query_for_occlusion_query_boolean_) { |
| 886 // GL_ANY_SAMPLES_PASSED_EXT | 892 // ARB_occlusion_query does not have a |
| 887 // target. | 893 // GL_ANY_SAMPLES_PASSED_EXT |
| 888 target = GL_SAMPLES_PASSED_ARB; | 894 // target. |
| 895 target = GL_SAMPLES_PASSED_ARB; |
| 896 } else if (covert_any_samples_passed_conservative_target_for_low_gl_) { |
| 897 // When underlying driver is lower than OpenGL4.3, it does not have a |
| 898 // GL_ANY_SAMPLES_PASSED_CONSERVATIVE |
| 899 // target. |
| 900 target = GL_ANY_SAMPLES_PASSED_EXT; |
| 901 } |
| 889 } | 902 } |
| 890 break; | 903 break; |
| 891 default: | 904 default: |
| 892 break; | 905 break; |
| 893 } | 906 } |
| 894 return target; | 907 return target; |
| 895 } | 908 } |
| 896 | 909 |
| 897 void QueryManager::BeginQueryHelper(GLenum target, GLuint id) { | 910 void QueryManager::BeginQueryHelper(GLenum target, GLuint id) { |
| 898 target = AdjustTargetForEmulation(target); | 911 target = AdjustTargetForEmulation(target); |
| (...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1132 for (std::pair<const GLenum, scoped_refptr<Query> >& it : active_queries_) { | 1145 for (std::pair<const GLenum, scoped_refptr<Query> >& it : active_queries_) { |
| 1133 if (it.second->IsPaused()) { | 1146 if (it.second->IsPaused()) { |
| 1134 it.second->Resume(); | 1147 it.second->Resume(); |
| 1135 DCHECK(it.second->IsActive()); | 1148 DCHECK(it.second->IsActive()); |
| 1136 } | 1149 } |
| 1137 } | 1150 } |
| 1138 } | 1151 } |
| 1139 | 1152 |
| 1140 } // namespace gles2 | 1153 } // namespace gles2 |
| 1141 } // namespace gpu | 1154 } // namespace gpu |
| OLD | NEW |