| 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 #ifndef GPU_COMMAND_BUFFER_CLIENT_QUERY_TRACKER_H_ | 5 #ifndef GPU_COMMAND_BUFFER_CLIENT_QUERY_TRACKER_H_ |
| 6 #define GPU_COMMAND_BUFFER_CLIENT_QUERY_TRACKER_H_ | 6 #define GPU_COMMAND_BUFFER_CLIENT_QUERY_TRACKER_H_ |
| 7 | 7 |
| 8 #include <GLES2/gl2.h> | 8 #include <GLES2/gl2.h> |
| 9 | 9 |
| 10 #include <bitset> | 10 #include <bitset> |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 bool CheckResultsAvailable(CommandBufferHelper* helper); | 136 bool CheckResultsAvailable(CommandBufferHelper* helper); |
| 137 | 137 |
| 138 uint64 GetResult() const; | 138 uint64 GetResult() const; |
| 139 | 139 |
| 140 private: | 140 private: |
| 141 friend class QueryTracker; | 141 friend class QueryTracker; |
| 142 friend class QueryTrackerTest; | 142 friend class QueryTrackerTest; |
| 143 | 143 |
| 144 void Begin(GLES2Implementation* gl); | 144 void Begin(GLES2Implementation* gl); |
| 145 void End(GLES2Implementation* gl); | 145 void End(GLES2Implementation* gl); |
| 146 void QueryCounter(GLES2Implementation* gl); |
| 146 | 147 |
| 147 GLuint id_; | 148 GLuint id_; |
| 148 GLenum target_; | 149 GLenum target_; |
| 149 QuerySyncManager::QueryInfo info_; | 150 QuerySyncManager::QueryInfo info_; |
| 150 State state_; | 151 State state_; |
| 151 base::subtle::Atomic32 submit_count_; | 152 base::subtle::Atomic32 submit_count_; |
| 152 int32 token_; | 153 int32 token_; |
| 153 uint32 flush_count_; | 154 uint32 flush_count_; |
| 154 uint64 client_begin_time_us_; // Only used for latency query target. | 155 uint64 client_begin_time_us_; // Only used for latency query target. |
| 155 uint64 result_; | 156 uint64 result_; |
| 156 }; | 157 }; |
| 157 | 158 |
| 158 QueryTracker(MappedMemoryManager* manager); | 159 QueryTracker(MappedMemoryManager* manager); |
| 159 ~QueryTracker(); | 160 ~QueryTracker(); |
| 160 | 161 |
| 161 Query* CreateQuery(GLuint id, GLenum target); | 162 Query* CreateQuery(GLuint id, GLenum target); |
| 162 Query* GetQuery(GLuint id); | 163 Query* GetQuery(GLuint id); |
| 163 Query* GetCurrentQuery(GLenum target); | 164 Query* GetCurrentQuery(GLenum target); |
| 164 void RemoveQuery(GLuint id); | 165 void RemoveQuery(GLuint id); |
| 165 void Shrink(); | 166 void Shrink(); |
| 166 void FreeCompletedQueries(); | 167 void FreeCompletedQueries(); |
| 167 | 168 |
| 168 bool BeginQuery(GLuint id, GLenum target, GLES2Implementation* gl); | 169 bool BeginQuery(GLuint id, GLenum target, GLES2Implementation* gl); |
| 169 bool EndQuery(GLenum target, GLES2Implementation* gl); | 170 bool EndQuery(GLenum target, GLES2Implementation* gl); |
| 171 bool QueryCounter(GLuint id, GLenum target, GLES2Implementation* gl); |
| 170 | 172 |
| 171 private: | 173 private: |
| 172 typedef base::hash_map<GLuint, Query*> QueryIdMap; | 174 typedef base::hash_map<GLuint, Query*> QueryIdMap; |
| 173 typedef base::hash_map<GLenum, Query*> QueryTargetMap; | 175 typedef base::hash_map<GLenum, Query*> QueryTargetMap; |
| 174 typedef std::list<Query*> QueryList; | 176 typedef std::list<Query*> QueryList; |
| 175 | 177 |
| 176 QueryIdMap queries_; | 178 QueryIdMap queries_; |
| 177 QueryTargetMap current_queries_; | 179 QueryTargetMap current_queries_; |
| 178 QueryList removed_queries_; | 180 QueryList removed_queries_; |
| 179 QuerySyncManager query_sync_manager_; | 181 QuerySyncManager query_sync_manager_; |
| 180 | 182 |
| 181 DISALLOW_COPY_AND_ASSIGN(QueryTracker); | 183 DISALLOW_COPY_AND_ASSIGN(QueryTracker); |
| 182 }; | 184 }; |
| 183 | 185 |
| 184 } // namespace gles2 | 186 } // namespace gles2 |
| 185 } // namespace gpu | 187 } // namespace gpu |
| 186 | 188 |
| 187 #endif // GPU_COMMAND_BUFFER_CLIENT_QUERY_TRACKER_H_ | 189 #endif // GPU_COMMAND_BUFFER_CLIENT_QUERY_TRACKER_H_ |
| OLD | NEW |