OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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_H_ | 5 #ifndef GPU_COMMAND_BUFFER_CLIENT_GPU_MEMORY_BUFFER_H_ |
6 #define GPU_COMMAND_BUFFER_CLIENT_GPU_MEMORY_BUFFER_H_ | 6 #define GPU_COMMAND_BUFFER_CLIENT_GPU_MEMORY_BUFFER_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "gles2_impl_export.h" |
11 | 12 |
12 namespace gpu { | 13 namespace gpu { |
13 | 14 |
14 // Interface for creating and accessing a zero-copy GPU memory buffer. | 15 // Interface for creating and accessing a zero-copy GPU memory buffer. |
15 // This design evolved from the generalization of GraphicBuffer API | 16 // This design evolved from the generalization of GraphicBuffer API |
16 // of Android framework. | 17 // of Android framework. |
17 // | 18 // |
18 // THREADING CONSIDERATIONS: | 19 // THREADING CONSIDERATIONS: |
19 // | 20 // |
20 // This interface is thread-safe. However, multiple threads mapping | 21 // This interface is thread-safe. However, multiple threads mapping |
21 // a buffer for Write or ReadOrWrite simultaneously may result in undefined | 22 // a buffer for Write or ReadOrWrite simultaneously may result in undefined |
22 // behavior and is not allowed. | 23 // behavior and is not allowed. |
23 class GpuMemoryBuffer { | 24 class GLES2_IMPL_EXPORT GpuMemoryBuffer { |
24 public: | 25 public: |
25 typedef base::Callback<scoped_ptr<GpuMemoryBuffer>(int, int)> Creator; | 26 typedef base::Callback<scoped_ptr<GpuMemoryBuffer>(int, int)> Creator; |
26 enum AccessMode { | 27 enum AccessMode { |
27 READ_ONLY, | 28 READ_ONLY, |
28 WRITE_ONLY, | 29 WRITE_ONLY, |
29 READ_OR_WRITE, | 30 READ_OR_WRITE, |
30 }; | 31 }; |
31 | 32 |
32 // Frees a previously allocated buffer. Freeing a buffer that is still | 33 // Frees a previously allocated buffer. Freeing a buffer that is still |
33 // mapped in any process is undefined behavior. | 34 // mapped in any process is undefined behavior. |
(...skipping 11 matching lines...) Expand all Loading... |
45 // Returns the native pointer for the buffer. | 46 // Returns the native pointer for the buffer. |
46 virtual void* GetNativeBuffer() = 0; | 47 virtual void* GetNativeBuffer() = 0; |
47 | 48 |
48 // Returns the stride in pixels for the buffer. | 49 // Returns the stride in pixels for the buffer. |
49 virtual uint32 GetStride() = 0; | 50 virtual uint32 GetStride() = 0; |
50 }; | 51 }; |
51 | 52 |
52 } // namespace gpu | 53 } // namespace gpu |
53 | 54 |
54 #endif // GPU_COMMAND_BUFFER_CLIENT_GPU_MEMORY_BUFFER_H_ | 55 #endif // GPU_COMMAND_BUFFER_CLIENT_GPU_MEMORY_BUFFER_H_ |
OLD | NEW |