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

Side by Side Diff: trunk/src/gpu/command_buffer/client/buffer_tracker.h

Issue 216673006: Revert 260177 "By keeping track of transfer buffer usage (both s..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 6 years, 9 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_BUFFER_TRACKER_H_ 5 #ifndef GPU_COMMAND_BUFFER_CLIENT_BUFFER_TRACKER_H_
6 #define GPU_COMMAND_BUFFER_CLIENT_BUFFER_TRACKER_H_ 6 #define GPU_COMMAND_BUFFER_CLIENT_BUFFER_TRACKER_H_
7 7
8 #include <GLES2/gl2.h> 8 #include <GLES2/gl2.h>
9 9
10 #include <queue> 10 #include <queue>
(...skipping 17 matching lines...) Expand all
28 unsigned int size, 28 unsigned int size,
29 int32 shm_id, 29 int32 shm_id,
30 uint32 shm_offset, 30 uint32 shm_offset,
31 void* address) 31 void* address)
32 : id_(id), 32 : id_(id),
33 size_(size), 33 size_(size),
34 shm_id_(shm_id), 34 shm_id_(shm_id),
35 shm_offset_(shm_offset), 35 shm_offset_(shm_offset),
36 address_(address), 36 address_(address),
37 mapped_(false), 37 mapped_(false),
38 last_usage_token_(0), 38 transfer_ready_token_(0) {
39 last_async_upload_token_(0) {
40 } 39 }
41 40
42 GLenum id() const { 41 GLenum id() const {
43 return id_; 42 return id_;
44 } 43 }
45 44
46 unsigned int size() const { 45 unsigned int size() const {
47 return size_; 46 return size_;
48 } 47 }
49 48
(...skipping 10 matching lines...) Expand all
60 } 59 }
61 60
62 void set_mapped(bool mapped) { 61 void set_mapped(bool mapped) {
63 mapped_ = mapped; 62 mapped_ = mapped;
64 } 63 }
65 64
66 bool mapped() const { 65 bool mapped() const {
67 return mapped_; 66 return mapped_;
68 } 67 }
69 68
70 void set_last_usage_token(int token) { 69 void set_transfer_ready_token(int token) {
71 last_usage_token_ = token; 70 transfer_ready_token_ = token;
72 } 71 }
73 72
74 int last_usage_token() const { 73 uint32 transfer_ready_token() const {
75 return last_usage_token_; 74 return transfer_ready_token_;
76 }
77
78 void set_last_async_upload_token(uint32 async_token) {
79 last_async_upload_token_ = async_token;
80 }
81
82 GLuint last_async_upload_token() const {
83 return last_async_upload_token_;
84 } 75 }
85 76
86 private: 77 private:
87 friend class BufferTracker; 78 friend class BufferTracker;
88 friend class BufferTrackerTest; 79 friend class BufferTrackerTest;
89 80
90 GLuint id_; 81 GLuint id_;
91 unsigned int size_; 82 unsigned int size_;
92 int32 shm_id_; 83 int32 shm_id_;
93 uint32 shm_offset_; 84 uint32 shm_offset_;
94 void* address_; 85 void* address_;
95 bool mapped_; 86 bool mapped_;
96 int32 last_usage_token_; 87 int32 transfer_ready_token_;
97 GLuint last_async_upload_token_;
98 }; 88 };
99 89
100 BufferTracker(MappedMemoryManager* manager); 90 BufferTracker(MappedMemoryManager* manager);
101 ~BufferTracker(); 91 ~BufferTracker();
102 92
103 Buffer* CreateBuffer(GLuint id, GLsizeiptr size); 93 Buffer* CreateBuffer(GLuint id, GLsizeiptr size);
104 Buffer* GetBuffer(GLuint id); 94 Buffer* GetBuffer(GLuint id);
105 void RemoveBuffer(GLuint id); 95 void RemoveBuffer(GLuint id);
106 96
107 // Frees the block of memory associated with buffer, pending the passage 97 // Frees the block of memory associated with buffer, pending the passage
108 // of a token. 98 // of a token.
109 void FreePendingToken(Buffer* buffer, int32 token); 99 void FreePendingToken(Buffer*, int32 token);
110 void Unmanage(Buffer* buffer);
111 void Free(Buffer* buffer);
112 100
113 private: 101 private:
114 typedef base::hash_map<GLuint, Buffer*> BufferMap; 102 typedef base::hash_map<GLuint, Buffer*> BufferMap;
115 103
116 MappedMemoryManager* mapped_memory_; 104 MappedMemoryManager* mapped_memory_;
117 BufferMap buffers_; 105 BufferMap buffers_;
118 106
119 DISALLOW_COPY_AND_ASSIGN(BufferTracker); 107 DISALLOW_COPY_AND_ASSIGN(BufferTracker);
120 }; 108 };
121 109
122 } // namespace gles2 110 } // namespace gles2
123 } // namespace gpu 111 } // namespace gpu
124 112
125 #endif // GPU_COMMAND_BUFFER_CLIENT_BUFFER_TRACKER_H_ 113 #endif // GPU_COMMAND_BUFFER_CLIENT_BUFFER_TRACKER_H_
OLDNEW
« no previous file with comments | « trunk/src/gpu/command_buffer/build_gles2_cmd_buffer.py ('k') | trunk/src/gpu/command_buffer/client/buffer_tracker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698