OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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_COMMON_COMMAND_BUFFER_H_ | 5 #ifndef GPU_COMMAND_BUFFER_COMMON_COMMAND_BUFFER_H_ |
6 #define GPU_COMMAND_BUFFER_COMMON_COMMAND_BUFFER_H_ | 6 #define GPU_COMMAND_BUFFER_COMMON_COMMAND_BUFFER_H_ |
7 | 7 |
8 #include "../common/buffer.h" | 8 #include "../common/buffer.h" |
9 #include "../common/constants.h" | 9 #include "../common/constants.h" |
10 | 10 |
| 11 namespace base { |
| 12 class SharedMemory; |
| 13 } |
| 14 |
11 namespace gpu { | 15 namespace gpu { |
12 | 16 |
13 // Common interface for CommandBuffer implementations. | 17 // Common interface for CommandBuffer implementations. |
14 class CommandBuffer { | 18 class CommandBuffer { |
15 public: | 19 public: |
16 enum { | 20 enum { |
17 kMaxCommandBufferSize = 4 * 1024 * 1024 | 21 kMaxCommandBufferSize = 4 * 1024 * 1024 |
18 }; | 22 }; |
19 | 23 |
20 struct State { | 24 struct State { |
(...skipping 27 matching lines...) Expand all Loading... |
48 | 52 |
49 CommandBuffer() { | 53 CommandBuffer() { |
50 } | 54 } |
51 | 55 |
52 virtual ~CommandBuffer() { | 56 virtual ~CommandBuffer() { |
53 } | 57 } |
54 | 58 |
55 // Initialize the command buffer with the given size. | 59 // Initialize the command buffer with the given size. |
56 virtual bool Initialize(int32 size) = 0; | 60 virtual bool Initialize(int32 size) = 0; |
57 | 61 |
| 62 // Initialize the command buffer using the given preallocated buffer. |
| 63 virtual bool Initialize(base::SharedMemory* buffer, int32 size) = 0; |
| 64 |
58 // Gets the ring buffer for the command buffer. | 65 // Gets the ring buffer for the command buffer. |
59 virtual Buffer GetRingBuffer() = 0; | 66 virtual Buffer GetRingBuffer() = 0; |
60 | 67 |
61 // Returns the current status. | 68 // Returns the current status. |
62 virtual State GetState() = 0; | 69 virtual State GetState() = 0; |
63 | 70 |
64 // The writer calls this to update its put offset. This ensures the reader | 71 // The writer calls this to update its put offset. This ensures the reader |
65 // sees the latest added commands, and will eventually process them. | 72 // sees the latest added commands, and will eventually process them. |
66 virtual void Flush(int32 put_offset) = 0; | 73 virtual void Flush(int32 put_offset) = 0; |
67 | 74 |
(...skipping 30 matching lines...) Expand all Loading... |
98 // Allows the reader to set the current parse error. | 105 // Allows the reader to set the current parse error. |
99 virtual void SetParseError(error::Error) = 0; | 106 virtual void SetParseError(error::Error) = 0; |
100 | 107 |
101 private: | 108 private: |
102 DISALLOW_COPY_AND_ASSIGN(CommandBuffer); | 109 DISALLOW_COPY_AND_ASSIGN(CommandBuffer); |
103 }; | 110 }; |
104 | 111 |
105 } // namespace gpu | 112 } // namespace gpu |
106 | 113 |
107 #endif // GPU_COMMAND_BUFFER_COMMON_COMMAND_BUFFER_H_ | 114 #endif // GPU_COMMAND_BUFFER_COMMON_COMMAND_BUFFER_H_ |
OLD | NEW |