| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 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 | 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_GPU_MEMORY_BUFFER_TRACKER_H_ | 5 #ifndef GPU_COMMAND_BUFFER_CLIENT_GPU_MEMORY_BUFFER_TRACKER_H_ |
| 6 #define GPU_COMMAND_BUFFER_CLIENT_GPU_MEMORY_BUFFER_TRACKER_H_ | 6 #define GPU_COMMAND_BUFFER_CLIENT_GPU_MEMORY_BUFFER_TRACKER_H_ |
| 7 | 7 |
| 8 #include <GLES2/gl2.h> | |
| 9 | |
| 10 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 11 #include "gles2_impl_export.h" | 9 #include "gles2_impl_export.h" |
| 12 #include "gpu/command_buffer/client/hash_tables.h" | 10 #include "gpu/command_buffer/client/hash_tables.h" |
| 13 | 11 |
| 14 namespace gfx { | 12 namespace gfx { |
| 15 class GpuMemoryBuffer; | 13 class GpuMemoryBuffer; |
| 16 } | 14 } |
| 17 | 15 |
| 18 namespace gpu { | 16 namespace gpu { |
| 17 class GpuControl; |
| 18 |
| 19 namespace gles2 { | 19 namespace gles2 { |
| 20 class ImageFactory; | |
| 21 | 20 |
| 22 // Tracks GPU memory buffer objects on the client side. | 21 // Tracks GPU memory buffer objects on the client side. |
| 23 class GLES2_IMPL_EXPORT GpuMemoryBufferTracker { | 22 class GLES2_IMPL_EXPORT GpuMemoryBufferTracker { |
| 24 public: | 23 public: |
| 25 // Ownership of |factory| remains with caller. | 24 explicit GpuMemoryBufferTracker(GpuControl* gpu_control); |
| 26 explicit GpuMemoryBufferTracker(ImageFactory* factory); | |
| 27 virtual ~GpuMemoryBufferTracker(); | 25 virtual ~GpuMemoryBufferTracker(); |
| 28 | 26 |
| 29 GLuint CreateBuffer( | 27 int32 CreateBuffer(size_t width, size_t height, int32 internalformat); |
| 30 GLsizei width, GLsizei height, GLenum internalformat); | 28 gfx::GpuMemoryBuffer* GetBuffer(int32 image_id); |
| 31 gfx::GpuMemoryBuffer* GetBuffer(GLuint image_id); | 29 void RemoveBuffer(int32 image_id); |
| 32 void RemoveBuffer(GLuint image_id); | |
| 33 | 30 |
| 34 private: | 31 private: |
| 35 typedef gpu::hash_map<GLuint, gfx::GpuMemoryBuffer*> BufferMap; | 32 typedef gpu::hash_map<int32, gfx::GpuMemoryBuffer*> BufferMap; |
| 36 BufferMap buffers_; | 33 BufferMap buffers_; |
| 37 ImageFactory* factory_; | 34 GpuControl* gpu_control_; |
| 38 | 35 |
| 39 DISALLOW_COPY_AND_ASSIGN(GpuMemoryBufferTracker); | 36 DISALLOW_COPY_AND_ASSIGN(GpuMemoryBufferTracker); |
| 40 }; | 37 }; |
| 41 | 38 |
| 42 } // namespace gles2 | 39 } // namespace gles2 |
| 43 } // namespace gpu | 40 } // namespace gpu |
| 44 | 41 |
| 45 #endif // GPU_COMMAND_BUFFER_CLIENT_GPU_MEMORY_BUFFER_TRACKER_H_ | 42 #endif // GPU_COMMAND_BUFFER_CLIENT_GPU_MEMORY_BUFFER_TRACKER_H_ |
| OLD | NEW |