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