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" |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/containers/hash_tables.h" | 12 #include "base/containers/hash_tables.h" |
13 #include "base/logging.h" | 13 #include "base/logging.h" |
14 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
15 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
16 #include "gpu/command_buffer/service/feature_info.h" | 16 #include "gpu/command_buffer/service/feature_info.h" |
17 #include "gpu/gpu_export.h" | 17 #include "gpu/gpu_export.h" |
18 | 18 |
| 19 namespace gfx { |
| 20 class GPUTimer; |
| 21 class GPUTimingClient; |
| 22 } |
| 23 |
19 namespace gpu { | 24 namespace gpu { |
20 | 25 |
21 class GLES2Decoder; | 26 class GLES2Decoder; |
22 | 27 |
23 namespace gles2 { | 28 namespace gles2 { |
24 | 29 |
25 class FeatureInfo; | 30 class FeatureInfo; |
26 | 31 |
27 // This class keeps track of the queries and their state | 32 // This class keeps track of the queries and their state |
28 // As Queries are not shared there is one QueryManager per context. | 33 // As Queries are not shared there is one QueryManager per context. |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 // pointing to invalid shared memory. | 186 // pointing to invalid shared memory. |
182 bool ProcessPendingTransferQueries(); | 187 bool ProcessPendingTransferQueries(); |
183 | 188 |
184 // True if there are pending transfer queries. | 189 // True if there are pending transfer queries. |
185 bool HavePendingTransferQueries(); | 190 bool HavePendingTransferQueries(); |
186 | 191 |
187 GLES2Decoder* decoder() const { | 192 GLES2Decoder* decoder() const { |
188 return decoder_; | 193 return decoder_; |
189 } | 194 } |
190 | 195 |
| 196 scoped_ptr<gfx::GPUTimer> CreateGPUTimer(bool elapsed_time); |
| 197 bool GPUTimingAvailable(); |
| 198 |
191 void GenQueries(GLsizei n, const GLuint* queries); | 199 void GenQueries(GLsizei n, const GLuint* queries); |
192 bool IsValidQuery(GLuint id); | 200 bool IsValidQuery(GLuint id); |
193 | 201 |
194 private: | 202 private: |
195 void StartTracking(Query* query); | 203 void StartTracking(Query* query); |
196 void StopTracking(Query* query); | 204 void StopTracking(Query* query); |
197 | 205 |
198 // Wrappers for BeginQueryARB and EndQueryARB to hide differences between | 206 // Wrappers for BeginQueryARB and EndQueryARB to hide differences between |
199 // ARB_occlusion_query2 and EXT_occlusion_query_boolean. | 207 // ARB_occlusion_query2 and EXT_occlusion_query_boolean. |
200 void BeginQueryHelper(GLenum target, GLuint id); | 208 void BeginQueryHelper(GLenum target, GLuint id); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 typedef base::hash_set<GLuint> GeneratedQueryIds; | 242 typedef base::hash_set<GLuint> GeneratedQueryIds; |
235 GeneratedQueryIds generated_query_ids_; | 243 GeneratedQueryIds generated_query_ids_; |
236 | 244 |
237 // Queries waiting for completion. | 245 // Queries waiting for completion. |
238 typedef std::deque<scoped_refptr<Query> > QueryQueue; | 246 typedef std::deque<scoped_refptr<Query> > QueryQueue; |
239 QueryQueue pending_queries_; | 247 QueryQueue pending_queries_; |
240 | 248 |
241 // Async pixel transfer queries waiting for completion. | 249 // Async pixel transfer queries waiting for completion. |
242 QueryQueue pending_transfer_queries_; | 250 QueryQueue pending_transfer_queries_; |
243 | 251 |
| 252 // Used for timer queries. |
| 253 scoped_refptr<gfx::GPUTimingClient> gpu_timing_client_; |
| 254 |
244 DISALLOW_COPY_AND_ASSIGN(QueryManager); | 255 DISALLOW_COPY_AND_ASSIGN(QueryManager); |
245 }; | 256 }; |
246 | 257 |
247 } // namespace gles2 | 258 } // namespace gles2 |
248 } // namespace gpu | 259 } // namespace gpu |
249 | 260 |
250 #endif // GPU_COMMAND_BUFFER_SERVICE_QUERY_MANAGER_H_ | 261 #endif // GPU_COMMAND_BUFFER_SERVICE_QUERY_MANAGER_H_ |
OLD | NEW |