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

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

Issue 1129253006: std::bitset solution for GL Query cache. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Cleaned up. Created 5 years, 7 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
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 <bitset>
10 #include <deque> 11 #include <deque>
11 #include <list> 12 #include <list>
12 #include <vector>
13 13
14 #include "base/atomicops.h" 14 #include "base/atomicops.h"
15 #include "base/containers/hash_tables.h" 15 #include "base/containers/hash_tables.h"
16 #include "gles2_impl_export.h" 16 #include "gles2_impl_export.h"
17 #include "gpu/command_buffer/common/gles2_cmd_format.h" 17 #include "gpu/command_buffer/common/gles2_cmd_format.h"
18 18
19 namespace gpu { 19 namespace gpu {
20 20
21 class CommandBufferHelper; 21 class CommandBufferHelper;
22 class MappedMemoryManager; 22 class MappedMemoryManager;
23 23
24 namespace gles2 { 24 namespace gles2 {
25 25
26 class GLES2Implementation; 26 class GLES2Implementation;
27 27
28 // Manages buckets of QuerySync instances in mapped memory. 28 // Manages buckets of QuerySync instances in mapped memory.
29 class GLES2_IMPL_EXPORT QuerySyncManager { 29 class GLES2_IMPL_EXPORT QuerySyncManager {
30 public: 30 public:
31 static const size_t kSyncsPerBucket = 1024; 31 static const size_t kSyncsPerBucket = 1024;
32 32
33 struct Bucket { 33 struct Bucket {
34 Bucket(QuerySync* sync_mem, int32 shm_id, uint32 shm_offset); 34 Bucket(QuerySync* sync_mem, int32 shm_id, uint32 shm_offset);
35 ~Bucket(); 35 ~Bucket();
36 QuerySync* syncs; 36 QuerySync* syncs;
37 int32 shm_id; 37 int32 shm_id;
38 uint32 base_shm_offset; 38 uint32 base_shm_offset;
39 std::vector<unsigned short> free_queries; 39 std::bitset<kSyncsPerBucket> in_use_queries;
40 uint32 in_use_query_count;
reveman 2015/05/18 19:58:42 Can we use in_use_queries.count() instead?
41 uint32 next_query_scan_pos;
40 }; 42 };
41 struct QueryInfo { 43 struct QueryInfo {
42 QueryInfo(Bucket* bucket, int32 id, uint32 offset, QuerySync* sync_mem) 44 QueryInfo(Bucket* bucket, int32 id, uint32 offset, QuerySync* sync_mem)
43 : bucket(bucket), 45 : bucket(bucket),
44 shm_id(id), 46 shm_id(id),
45 shm_offset(offset), 47 shm_offset(offset),
46 sync(sync_mem) { 48 sync(sync_mem) {
47 } 49 }
48 50
49 QueryInfo() 51 QueryInfo()
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 QueryList removed_queries_; 170 QueryList removed_queries_;
169 QuerySyncManager query_sync_manager_; 171 QuerySyncManager query_sync_manager_;
170 172
171 DISALLOW_COPY_AND_ASSIGN(QueryTracker); 173 DISALLOW_COPY_AND_ASSIGN(QueryTracker);
172 }; 174 };
173 175
174 } // namespace gles2 176 } // namespace gles2
175 } // namespace gpu 177 } // namespace gpu
176 178
177 #endif // GPU_COMMAND_BUFFER_CLIENT_QUERY_TRACKER_H_ 179 #endif // GPU_COMMAND_BUFFER_CLIENT_QUERY_TRACKER_H_
OLDNEW
« no previous file with comments | « no previous file | gpu/command_buffer/client/query_tracker.cc » ('j') | gpu/command_buffer/client/query_tracker.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698