OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef GPU_COMMAND_BUFFER_CLIENT_GPU_MEMORY_BUFFER_TRACKER_H_ |
| 6 #define GPU_COMMAND_BUFFER_CLIENT_GPU_MEMORY_BUFFER_TRACKER_H_ |
| 7 |
| 8 #include <GLES2/gl2.h> |
| 9 |
| 10 #include "../client/hash_tables.h" |
| 11 #include "../common/gles2_cmd_format.h" |
| 12 #include "base/basictypes.h" |
| 13 #include "gles2_impl_export.h" |
| 14 |
| 15 namespace gpu { |
| 16 class GpuMemoryBuffer; |
| 17 |
| 18 namespace gles2 { |
| 19 class GpuMemoryBufferFactory; |
| 20 |
| 21 // Tracks GPU memory buffer objects for client side of command buffer. |
| 22 class GLES2_IMPL_EXPORT GpuMemoryBufferTracker { |
| 23 public: |
| 24 // Ownership of |factory| remains with caller. |
| 25 explicit GpuMemoryBufferTracker(GpuMemoryBufferFactory* factory); |
| 26 ~GpuMemoryBufferTracker(); |
| 27 |
| 28 GpuMemoryBuffer* CreateBuffer(GLuint image_id, GLsizei width, GLsizei height); |
| 29 GpuMemoryBuffer* GetBuffer(GLuint image_id); |
| 30 void RemoveBuffer(GLuint image_id); |
| 31 |
| 32 private: |
| 33 typedef gpu::hash_map<GLuint, GpuMemoryBuffer*> BufferMap; |
| 34 BufferMap buffers_; |
| 35 GpuMemoryBufferFactory* factory_; // weak |
| 36 |
| 37 DISALLOW_COPY_AND_ASSIGN(GpuMemoryBufferTracker); |
| 38 }; |
| 39 |
| 40 } // namespace gles2 |
| 41 } // namespace gpu |
| 42 |
| 43 #endif // GPU_COMMAND_BUFFER_CLIENT_GPU_MEMORY_BUFFER_TRACKER_H_ |
OLD | NEW |