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_SERVICE_QUERY_MANAGER_H_ | 5 #ifndef GPU_COMMAND_BUFFER_SERVICE_QUERY_MANAGER_H_ |
6 #define GPU_COMMAND_BUFFER_SERVICE_QUERY_MANAGER_H_ | 6 #define GPU_COMMAND_BUFFER_SERVICE_QUERY_MANAGER_H_ |
7 | 7 |
8 #include <deque> | 8 #include <deque> |
9 #include <vector> | 9 #include <vector> |
10 #include "base/atomicops.h" | 10 #include "base/atomicops.h" |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 // pointing to invalid shared memory. | 181 // pointing to invalid shared memory. |
182 bool ProcessPendingTransferQueries(); | 182 bool ProcessPendingTransferQueries(); |
183 | 183 |
184 // True if there are pending transfer queries. | 184 // True if there are pending transfer queries. |
185 bool HavePendingTransferQueries(); | 185 bool HavePendingTransferQueries(); |
186 | 186 |
187 GLES2Decoder* decoder() const { | 187 GLES2Decoder* decoder() const { |
188 return decoder_; | 188 return decoder_; |
189 } | 189 } |
190 | 190 |
| 191 void GenQueries(GLsizei n, const GLuint* queries); |
| 192 bool IsValidQuery(GLuint id); |
| 193 |
191 private: | 194 private: |
192 void StartTracking(Query* query); | 195 void StartTracking(Query* query); |
193 void StopTracking(Query* query); | 196 void StopTracking(Query* query); |
194 | 197 |
195 // Wrappers for BeginQueryARB and EndQueryARB to hide differences between | 198 // Wrappers for BeginQueryARB and EndQueryARB to hide differences between |
196 // ARB_occlusion_query2 and EXT_occlusion_query_boolean. | 199 // ARB_occlusion_query2 and EXT_occlusion_query_boolean. |
197 void BeginQueryHelper(GLenum target, GLuint id); | 200 void BeginQueryHelper(GLenum target, GLuint id); |
198 void EndQueryHelper(GLenum target); | 201 void EndQueryHelper(GLenum target); |
199 | 202 |
200 // Adds to queue of queries waiting for completion. | 203 // Adds to queue of queries waiting for completion. |
(...skipping 20 matching lines...) Expand all Loading... |
221 bool use_arb_occlusion_query_for_occlusion_query_boolean_; | 224 bool use_arb_occlusion_query_for_occlusion_query_boolean_; |
222 | 225 |
223 // Counts the number of Queries allocated with 'this' as their manager. | 226 // Counts the number of Queries allocated with 'this' as their manager. |
224 // Allows checking no Query will outlive this. | 227 // Allows checking no Query will outlive this. |
225 unsigned query_count_; | 228 unsigned query_count_; |
226 | 229 |
227 // Info for each query in the system. | 230 // Info for each query in the system. |
228 typedef base::hash_map<GLuint, scoped_refptr<Query> > QueryMap; | 231 typedef base::hash_map<GLuint, scoped_refptr<Query> > QueryMap; |
229 QueryMap queries_; | 232 QueryMap queries_; |
230 | 233 |
| 234 typedef base::hash_set<GLuint> GeneratedQueryIds; |
| 235 GeneratedQueryIds generated_query_ids_; |
| 236 |
231 // Queries waiting for completion. | 237 // Queries waiting for completion. |
232 typedef std::deque<scoped_refptr<Query> > QueryQueue; | 238 typedef std::deque<scoped_refptr<Query> > QueryQueue; |
233 QueryQueue pending_queries_; | 239 QueryQueue pending_queries_; |
234 | 240 |
235 // Async pixel transfer queries waiting for completion. | 241 // Async pixel transfer queries waiting for completion. |
236 QueryQueue pending_transfer_queries_; | 242 QueryQueue pending_transfer_queries_; |
237 | 243 |
238 DISALLOW_COPY_AND_ASSIGN(QueryManager); | 244 DISALLOW_COPY_AND_ASSIGN(QueryManager); |
239 }; | 245 }; |
240 | 246 |
241 } // namespace gles2 | 247 } // namespace gles2 |
242 } // namespace gpu | 248 } // namespace gpu |
243 | 249 |
244 #endif // GPU_COMMAND_BUFFER_SERVICE_QUERY_MANAGER_H_ | 250 #endif // GPU_COMMAND_BUFFER_SERVICE_QUERY_MANAGER_H_ |
OLD | NEW |