| 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_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/containers/hash_tables.h" | 10 #include "base/containers/hash_tables.h" |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 void ValidateAndDoGetBufferParameteriv( | 210 void ValidateAndDoGetBufferParameteriv( |
| 211 ContextState* context_state, GLenum target, GLenum pname, GLint* params); | 211 ContextState* context_state, GLenum target, GLenum pname, GLint* params); |
| 212 | 212 |
| 213 // Sets the target of a buffer. Returns false if the target can not be set. | 213 // Sets the target of a buffer. Returns false if the target can not be set. |
| 214 bool SetTarget(Buffer* buffer, GLenum target); | 214 bool SetTarget(Buffer* buffer, GLenum target); |
| 215 | 215 |
| 216 void set_allow_buffers_on_multiple_targets(bool allow) { | 216 void set_allow_buffers_on_multiple_targets(bool allow) { |
| 217 allow_buffers_on_multiple_targets_ = allow; | 217 allow_buffers_on_multiple_targets_ = allow; |
| 218 } | 218 } |
| 219 | 219 |
| 220 void set_allow_fixed_attribs(bool allow) { |
| 221 allow_fixed_attribs_ = allow; |
| 222 } |
| 223 |
| 220 size_t mem_represented() const { | 224 size_t mem_represented() const { |
| 221 return memory_tracker_->GetMemRepresented(); | 225 return memory_tracker_->GetMemRepresented(); |
| 222 } | 226 } |
| 223 | 227 |
| 224 // Tells for a given usage if this would be a client side array. | 228 // Tells for a given usage if this would be a client side array. |
| 225 bool IsUsageClientSideArray(GLenum usage); | 229 bool IsUsageClientSideArray(GLenum usage); |
| 226 | 230 |
| 227 // Tells whether a buffer that is emulated using client-side arrays should be | 231 // Tells whether a buffer that is emulated using client-side arrays should be |
| 228 // set to a non-zero size. | 232 // set to a non-zero size. |
| 229 bool UseNonZeroSizeForClientSideArrayBuffer(); | 233 bool UseNonZeroSizeForClientSideArrayBuffer(); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 263 scoped_ptr<MemoryTypeTracker> memory_tracker_; | 267 scoped_ptr<MemoryTypeTracker> memory_tracker_; |
| 264 scoped_refptr<FeatureInfo> feature_info_; | 268 scoped_refptr<FeatureInfo> feature_info_; |
| 265 | 269 |
| 266 // Info for each buffer in the system. | 270 // Info for each buffer in the system. |
| 267 typedef base::hash_map<GLuint, scoped_refptr<Buffer> > BufferMap; | 271 typedef base::hash_map<GLuint, scoped_refptr<Buffer> > BufferMap; |
| 268 BufferMap buffers_; | 272 BufferMap buffers_; |
| 269 | 273 |
| 270 // Whether or not buffers can be bound to multiple targets. | 274 // Whether or not buffers can be bound to multiple targets. |
| 271 bool allow_buffers_on_multiple_targets_; | 275 bool allow_buffers_on_multiple_targets_; |
| 272 | 276 |
| 277 // Whether or not allow using GL_FIXED type for vertex attribs. |
| 278 bool allow_fixed_attribs_; |
| 279 |
| 273 // Counts the number of Buffer allocated with 'this' as its manager. | 280 // Counts the number of Buffer allocated with 'this' as its manager. |
| 274 // Allows to check no Buffer will outlive this. | 281 // Allows to check no Buffer will outlive this. |
| 275 unsigned int buffer_count_; | 282 unsigned int buffer_count_; |
| 276 | 283 |
| 277 bool have_context_; | 284 bool have_context_; |
| 278 bool use_client_side_arrays_for_stream_buffers_; | 285 bool use_client_side_arrays_for_stream_buffers_; |
| 279 | 286 |
| 280 DISALLOW_COPY_AND_ASSIGN(BufferManager); | 287 DISALLOW_COPY_AND_ASSIGN(BufferManager); |
| 281 }; | 288 }; |
| 282 | 289 |
| 283 } // namespace gles2 | 290 } // namespace gles2 |
| 284 } // namespace gpu | 291 } // namespace gpu |
| 285 | 292 |
| 286 #endif // GPU_COMMAND_BUFFER_SERVICE_BUFFER_MANAGER_H_ | 293 #endif // GPU_COMMAND_BUFFER_SERVICE_BUFFER_MANAGER_H_ |
| OLD | NEW |