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 // This file contains the command buffer helper class. | 5 // This file contains the command buffer helper class. |
6 | 6 |
7 #ifndef GPU_COMMAND_BUFFER_CLIENT_CMD_BUFFER_HELPER_H_ | 7 #ifndef GPU_COMMAND_BUFFER_CLIENT_CMD_BUFFER_HELPER_H_ |
8 #define GPU_COMMAND_BUFFER_CLIENT_CMD_BUFFER_HELPER_H_ | 8 #define GPU_COMMAND_BUFFER_CLIENT_CMD_BUFFER_HELPER_H_ |
9 | 9 |
10 #include <string.h> | 10 #include <string.h> |
(...skipping 24 matching lines...) Expand all Loading... |
35 public: | 35 public: |
36 explicit CommandBufferHelper(CommandBuffer* command_buffer); | 36 explicit CommandBufferHelper(CommandBuffer* command_buffer); |
37 virtual ~CommandBufferHelper(); | 37 virtual ~CommandBufferHelper(); |
38 | 38 |
39 // Initializes the CommandBufferHelper. | 39 // Initializes the CommandBufferHelper. |
40 // Parameters: | 40 // Parameters: |
41 // ring_buffer_size: The size of the ring buffer portion of the command | 41 // ring_buffer_size: The size of the ring buffer portion of the command |
42 // buffer. | 42 // buffer. |
43 bool Initialize(int32 ring_buffer_size); | 43 bool Initialize(int32 ring_buffer_size); |
44 | 44 |
| 45 // Asynchronously flushes the commands, setting the put pointer to let the |
| 46 // buffer interface know that new commands have been added. After a flush |
| 47 // returns, the command buffer service is aware of all pending commands. |
| 48 void Flush(); |
| 49 |
45 // Flushes the commands, setting the put pointer to let the buffer interface | 50 // Flushes the commands, setting the put pointer to let the buffer interface |
46 // know that new commands have been added. After a flush returns, the command | 51 // know that new commands have been added. After a flush returns, the command |
47 // buffer service is aware of all pending commands and it is guaranteed to | 52 // buffer service is aware of all pending commands and it is guaranteed to |
48 // have made some progress in processing them. Returns whether the flush was | 53 // have made some progress in processing them. Returns whether the flush was |
49 // successful. The flush will fail if the command buffer service has | 54 // successful. The flush will fail if the command buffer service has |
50 // disconnected. | 55 // disconnected. |
51 bool Flush(); | 56 bool FlushSync(); |
52 | 57 |
53 // Waits until all the commands have been executed. Returns whether it | 58 // Waits until all the commands have been executed. Returns whether it |
54 // was successful. The function will fail if the command buffer service has | 59 // was successful. The function will fail if the command buffer service has |
55 // disconnected. | 60 // disconnected. |
56 bool Finish(); | 61 bool Finish(); |
57 | 62 |
58 // Waits until a given number of available entries are available. | 63 // Waits until a given number of available entries are available. |
59 // Parameters: | 64 // Parameters: |
60 // count: number of entries needed. This value must be at most | 65 // count: number of entries needed. This value must be at most |
61 // the size of the buffer minus one. | 66 // the size of the buffer minus one. |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 | 223 |
219 CommandBuffer* command_buffer_; | 224 CommandBuffer* command_buffer_; |
220 Buffer ring_buffer_; | 225 Buffer ring_buffer_; |
221 CommandBufferEntry *entries_; | 226 CommandBufferEntry *entries_; |
222 int32 total_entry_count_; // the total number of entries | 227 int32 total_entry_count_; // the total number of entries |
223 int32 usable_entry_count_; // the usable number (ie, minus space for jump) | 228 int32 usable_entry_count_; // the usable number (ie, minus space for jump) |
224 int32 token_; | 229 int32 token_; |
225 int32 last_token_read_; | 230 int32 last_token_read_; |
226 int32 get_; | 231 int32 get_; |
227 int32 put_; | 232 int32 put_; |
| 233 int32 last_put_sent_; |
228 | 234 |
229 friend class CommandBufferHelperTest; | 235 friend class CommandBufferHelperTest; |
230 DISALLOW_COPY_AND_ASSIGN(CommandBufferHelper); | 236 DISALLOW_COPY_AND_ASSIGN(CommandBufferHelper); |
231 }; | 237 }; |
232 | 238 |
233 } // namespace gpu | 239 } // namespace gpu |
234 | 240 |
235 #endif // GPU_COMMAND_BUFFER_CLIENT_CMD_BUFFER_HELPER_H_ | 241 #endif // GPU_COMMAND_BUFFER_CLIENT_CMD_BUFFER_HELPER_H_ |
OLD | NEW |