Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(53)

Side by Side Diff: gpu/command_buffer/client/query_tracker.h

Issue 10577037: Add GL_CHROMIUM_get_error_query (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 <queue> 10 #include <queue>
11 #include "../../gpu_export.h"
12 #include "../client/hash_tables.h" 11 #include "../client/hash_tables.h"
13 #include "../common/gles2_cmd_format.h" 12 #include "../common/gles2_cmd_format.h"
13 #include "gles2_impl_export.h"
14 14
15 namespace gpu { 15 namespace gpu {
16 16
17 class CommandBufferHelper; 17 class CommandBufferHelper;
18 class MappedMemoryManager; 18 class MappedMemoryManager;
19 19
20 namespace gles2 { 20 namespace gles2 {
21 21
22 class GLES2Implementation;
23
22 // Manages buckets of QuerySync instances in mapped memory. 24 // Manages buckets of QuerySync instances in mapped memory.
23 class GPU_EXPORT QuerySyncManager { 25 class GLES2_IMPL_EXPORT QuerySyncManager {
24 public: 26 public:
25 static const size_t kSyncsPerBucket = 4096; 27 static const size_t kSyncsPerBucket = 4096;
26 28
27 struct QueryInfo { 29 struct QueryInfo {
28 QueryInfo(int32 id, uint32 offset, QuerySync* sync_mem) 30 QueryInfo(int32 id, uint32 offset, QuerySync* sync_mem)
29 : shm_id(id), 31 : shm_id(id),
30 shm_offset(offset), 32 shm_offset(offset),
31 sync(sync_mem) { 33 sync(sync_mem) {
32 } 34 }
33 35
(...skipping 16 matching lines...) Expand all
50 52
51 private: 53 private:
52 MappedMemoryManager* mapped_memory_; 54 MappedMemoryManager* mapped_memory_;
53 std::queue<QuerySync*> buckets_; 55 std::queue<QuerySync*> buckets_;
54 std::queue<QueryInfo> free_queries_; 56 std::queue<QueryInfo> free_queries_;
55 57
56 DISALLOW_COPY_AND_ASSIGN(QuerySyncManager); 58 DISALLOW_COPY_AND_ASSIGN(QuerySyncManager);
57 }; 59 };
58 60
59 // Tracks queries for client side of command buffer. 61 // Tracks queries for client side of command buffer.
60 class GPU_EXPORT QueryTracker { 62 class GLES2_IMPL_EXPORT QueryTracker {
61 public: 63 public:
62 class GPU_EXPORT Query { 64 class GLES2_IMPL_EXPORT Query {
63 public: 65 public:
64 enum State { 66 enum State {
65 kUninitialized, // never used 67 kUninitialized, // never used
66 kActive, // between begin - end 68 kActive, // between begin - end
67 kPending, // not yet complete 69 kPending, // not yet complete
68 kComplete // completed 70 kComplete // completed
69 }; 71 };
70 72
71 Query(GLuint id, GLenum target, const QuerySyncManager::QueryInfo& info) 73 Query(GLuint id, GLenum target, const QuerySyncManager::QueryInfo& info)
72 : id_(id), 74 : id_(id),
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 } 121 }
120 122
121 bool Pending() const { 123 bool Pending() const {
122 return state_ == kPending; 124 return state_ == kPending;
123 } 125 }
124 126
125 bool CheckResultsAvailable(CommandBufferHelper* helper); 127 bool CheckResultsAvailable(CommandBufferHelper* helper);
126 128
127 uint32 GetResult() const; 129 uint32 GetResult() const;
128 130
131 void Begin(GLES2Implementation* gl);
132 void End(GLES2Implementation* gl);
133
129 private: 134 private:
130 friend class QueryTracker; 135 friend class QueryTracker;
131 friend class QueryTrackerTest; 136 friend class QueryTrackerTest;
132 137
133 GLuint id_; 138 GLuint id_;
134 GLenum target_; 139 GLenum target_;
135 QuerySyncManager::QueryInfo info_; 140 QuerySyncManager::QueryInfo info_;
136 State state_; 141 State state_;
137 uint32 submit_count_; 142 uint32 submit_count_;
138 int32 token_; 143 int32 token_;
(...skipping 14 matching lines...) Expand all
153 QueryMap queries_; 158 QueryMap queries_;
154 QuerySyncManager query_sync_manager_; 159 QuerySyncManager query_sync_manager_;
155 160
156 DISALLOW_COPY_AND_ASSIGN(QueryTracker); 161 DISALLOW_COPY_AND_ASSIGN(QueryTracker);
157 }; 162 };
158 163
159 } // namespace gles2 164 } // namespace gles2
160 } // namespace gpu 165 } // namespace gpu
161 166
162 #endif // GPU_COMMAND_BUFFER_CLIENT_QUERY_TRACKER_H_ 167 #endif // GPU_COMMAND_BUFFER_CLIENT_QUERY_TRACKER_H_
OLDNEW
« no previous file with comments | « gpu/command_buffer/client/gles2_implementation_unittest.cc ('k') | gpu/command_buffer/client/query_tracker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698