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 "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/containers/hash_tables.h" | 9 #include "base/containers/hash_tables.h" |
10 #include "gles2_impl_export.h" | 10 #include "gles2_impl_export.h" |
11 | 11 |
12 namespace gfx { | 12 namespace gfx { |
13 class GpuMemoryBuffer; | 13 class GpuMemoryBuffer; |
14 } | 14 } |
15 | 15 |
16 namespace gpu { | 16 namespace gpu { |
17 class GpuControl; | 17 class GpuControl; |
18 | 18 |
19 namespace gles2 { | 19 namespace gles2 { |
20 | 20 |
21 // Tracks GPU memory buffer objects on the client side. | 21 // Tracks GPU memory buffer objects on the client side. |
22 class GLES2_IMPL_EXPORT GpuMemoryBufferTracker { | 22 class GLES2_IMPL_EXPORT GpuMemoryBufferTracker { |
23 public: | 23 public: |
24 explicit GpuMemoryBufferTracker(GpuControl* gpu_control); | 24 explicit GpuMemoryBufferTracker(GpuControl* gpu_control); |
25 virtual ~GpuMemoryBufferTracker(); | 25 virtual ~GpuMemoryBufferTracker(); |
26 | 26 |
27 int32 CreateBuffer(size_t width, size_t height, int32 internalformat); | 27 int32 CreateBuffer(size_t width, |
| 28 size_t height, |
| 29 int32 internalformat, |
| 30 int32 usage); |
28 gfx::GpuMemoryBuffer* GetBuffer(int32 image_id); | 31 gfx::GpuMemoryBuffer* GetBuffer(int32 image_id); |
29 void RemoveBuffer(int32 image_id); | 32 void RemoveBuffer(int32 image_id); |
30 | 33 |
31 private: | 34 private: |
32 typedef base::hash_map<int32, gfx::GpuMemoryBuffer*> BufferMap; | 35 typedef base::hash_map<int32, gfx::GpuMemoryBuffer*> BufferMap; |
33 BufferMap buffers_; | 36 BufferMap buffers_; |
34 GpuControl* gpu_control_; | 37 GpuControl* gpu_control_; |
35 | 38 |
36 DISALLOW_COPY_AND_ASSIGN(GpuMemoryBufferTracker); | 39 DISALLOW_COPY_AND_ASSIGN(GpuMemoryBufferTracker); |
37 }; | 40 }; |
38 | 41 |
39 } // namespace gles2 | 42 } // namespace gles2 |
40 } // namespace gpu | 43 } // namespace gpu |
41 | 44 |
42 #endif // GPU_COMMAND_BUFFER_CLIENT_GPU_MEMORY_BUFFER_TRACKER_H_ | 45 #endif // GPU_COMMAND_BUFFER_CLIENT_GPU_MEMORY_BUFFER_TRACKER_H_ |
OLD | NEW |