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

Side by Side Diff: gpu/command_buffer/service/buffer_manager.h

Issue 12649002: Refactor GPU code. Buffer* info to Buffer* buffer (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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
« no previous file with comments | « no previous file | gpu/command_buffer/service/buffer_manager.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_SERVICE_BUFFER_MANAGER_H_ 5 #ifndef GPU_COMMAND_BUFFER_SERVICE_BUFFER_MANAGER_H_
6 #define GPU_COMMAND_BUFFER_SERVICE_BUFFER_MANAGER_H_ 6 #define GPU_COMMAND_BUFFER_SERVICE_BUFFER_MANAGER_H_
7 7
8 #include <map> 8 #include <map>
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/hash_tables.h" 10 #include "base/hash_tables.h"
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 202
203 // Does a glBufferSubData and updates the approrate accounting. 203 // Does a glBufferSubData and updates the approrate accounting.
204 void DoBufferSubData( 204 void DoBufferSubData(
205 GLES2Decoder* decoder, 205 GLES2Decoder* decoder,
206 Buffer* buffer, 206 Buffer* buffer,
207 GLintptr offset, 207 GLintptr offset,
208 GLsizeiptr size, 208 GLsizeiptr size,
209 const GLvoid* data); 209 const GLvoid* data);
210 210
211 // Sets the target of a buffer. Returns false if the target can not be set. 211 // Sets the target of a buffer. Returns false if the target can not be set.
212 bool SetTarget(Buffer* info, GLenum target); 212 bool SetTarget(Buffer* buffer, GLenum target);
213 213
214 void set_allow_buffers_on_multiple_targets(bool allow) { 214 void set_allow_buffers_on_multiple_targets(bool allow) {
215 allow_buffers_on_multiple_targets_ = allow; 215 allow_buffers_on_multiple_targets_ = allow;
216 } 216 }
217 217
218 size_t mem_represented() const { 218 size_t mem_represented() const {
219 return memory_tracker_->GetMemRepresented(); 219 return memory_tracker_->GetMemRepresented();
220 } 220 }
221 221
222 // Tell's for a given usage if this would be a client side array. 222 // Tell's for a given usage if this would be a client side array.
223 bool IsUsageClientSideArray(GLenum usage); 223 bool IsUsageClientSideArray(GLenum usage);
224 224
225 private: 225 private:
226 friend class Buffer; 226 friend class Buffer;
227 void StartTracking(Buffer* info); 227 void StartTracking(Buffer* buffer);
228 void StopTracking(Buffer* info); 228 void StopTracking(Buffer* buffer);
229 229
230 // Sets the size, usage and initial data of a buffer. 230 // Sets the size, usage and initial data of a buffer.
231 // If data is NULL buffer will be initialized to 0 if shadowed. 231 // If data is NULL buffer will be initialized to 0 if shadowed.
232 void SetInfo(Buffer* info, GLsizeiptr size, GLenum usage, const GLvoid* data); 232 void SetInfo(
233 Buffer* buffer, GLsizeiptr size, GLenum usage, const GLvoid* data);
233 234
234 scoped_ptr<MemoryTypeTracker> memory_tracker_; 235 scoped_ptr<MemoryTypeTracker> memory_tracker_;
235 scoped_refptr<FeatureInfo> feature_info_; 236 scoped_refptr<FeatureInfo> feature_info_;
236 237
237 // Info for each buffer in the system. 238 // Info for each buffer in the system.
238 typedef base::hash_map<GLuint, scoped_refptr<Buffer> > BufferInfoMap; 239 typedef base::hash_map<GLuint, scoped_refptr<Buffer> > BufferMap;
239 BufferInfoMap buffer_infos_; 240 BufferMap buffers_;
240 241
241 // Whether or not buffers can be bound to multiple targets. 242 // Whether or not buffers can be bound to multiple targets.
242 bool allow_buffers_on_multiple_targets_; 243 bool allow_buffers_on_multiple_targets_;
243 244
244 // Counts the number of Buffer allocated with 'this' as its manager. 245 // Counts the number of Buffer allocated with 'this' as its manager.
245 // Allows to check no Buffer will outlive this. 246 // Allows to check no Buffer will outlive this.
246 unsigned int buffer_info_count_; 247 unsigned int buffer_count_;
247 248
248 bool have_context_; 249 bool have_context_;
249 bool use_client_side_arrays_for_stream_buffers_; 250 bool use_client_side_arrays_for_stream_buffers_;
250 251
251 DISALLOW_COPY_AND_ASSIGN(BufferManager); 252 DISALLOW_COPY_AND_ASSIGN(BufferManager);
252 }; 253 };
253 254
254 } // namespace gles2 255 } // namespace gles2
255 } // namespace gpu 256 } // namespace gpu
256 257
257 #endif // GPU_COMMAND_BUFFER_SERVICE_BUFFER_MANAGER_H_ 258 #endif // GPU_COMMAND_BUFFER_SERVICE_BUFFER_MANAGER_H_
OLDNEW
« no previous file with comments | « no previous file | gpu/command_buffer/service/buffer_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698