OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 26 matching lines...) Expand all Loading... |
37 public: | 37 public: |
38 explicit CommandBufferHelper(CommandBuffer* command_buffer); | 38 explicit CommandBufferHelper(CommandBuffer* command_buffer); |
39 virtual ~CommandBufferHelper(); | 39 virtual ~CommandBufferHelper(); |
40 | 40 |
41 // Initializes the CommandBufferHelper. | 41 // Initializes the CommandBufferHelper. |
42 // Parameters: | 42 // Parameters: |
43 // ring_buffer_size: The size of the ring buffer portion of the command | 43 // ring_buffer_size: The size of the ring buffer portion of the command |
44 // buffer. | 44 // buffer. |
45 bool Initialize(int32 ring_buffer_size); | 45 bool Initialize(int32 ring_buffer_size); |
46 | 46 |
| 47 // Sets whether the command buffer should automatically flush periodically |
| 48 // to try to increase performance. Defaults to true. |
| 49 void SetAutomaticFlushes(bool enabled); |
| 50 |
47 // True if the context is lost. | 51 // True if the context is lost. |
48 bool IsContextLost(); | 52 bool IsContextLost(); |
49 | 53 |
50 // Asynchronously flushes the commands, setting the put pointer to let the | 54 // Asynchronously flushes the commands, setting the put pointer to let the |
51 // buffer interface know that new commands have been added. After a flush | 55 // buffer interface know that new commands have been added. After a flush |
52 // returns, the command buffer service is aware of all pending commands. | 56 // returns, the command buffer service is aware of all pending commands. |
53 void Flush(); | 57 void Flush(); |
54 | 58 |
55 // Flushes the commands, setting the put pointer to let the buffer interface | 59 // Flushes the commands, setting the put pointer to let the buffer interface |
56 // know that new commands have been added. After a flush returns, the command | 60 // know that new commands have been added. After a flush returns, the command |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 Buffer ring_buffer_; | 289 Buffer ring_buffer_; |
286 CommandBufferEntry* entries_; | 290 CommandBufferEntry* entries_; |
287 int32 total_entry_count_; // the total number of entries | 291 int32 total_entry_count_; // the total number of entries |
288 int32 usable_entry_count_; // the usable number (ie, minus space for jump) | 292 int32 usable_entry_count_; // the usable number (ie, minus space for jump) |
289 int32 token_; | 293 int32 token_; |
290 int32 put_; | 294 int32 put_; |
291 int32 last_put_sent_; | 295 int32 last_put_sent_; |
292 int commands_issued_; | 296 int commands_issued_; |
293 bool usable_; | 297 bool usable_; |
294 bool context_lost_; | 298 bool context_lost_; |
| 299 bool flush_automatically_; |
295 | 300 |
296 // Using C runtime instead of base because this file cannot depend on base. | 301 // Using C runtime instead of base because this file cannot depend on base. |
297 clock_t last_flush_time_; | 302 clock_t last_flush_time_; |
298 | 303 |
299 friend class CommandBufferHelperTest; | 304 friend class CommandBufferHelperTest; |
300 DISALLOW_COPY_AND_ASSIGN(CommandBufferHelper); | 305 DISALLOW_COPY_AND_ASSIGN(CommandBufferHelper); |
301 }; | 306 }; |
302 | 307 |
303 } // namespace gpu | 308 } // namespace gpu |
304 | 309 |
305 #endif // GPU_COMMAND_BUFFER_CLIENT_CMD_BUFFER_HELPER_H_ | 310 #endif // GPU_COMMAND_BUFFER_CLIENT_CMD_BUFFER_HELPER_H_ |
OLD | NEW |