| 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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 void SetAutomaticFlushes(bool enabled); | 59 void SetAutomaticFlushes(bool enabled); |
| 60 | 60 |
| 61 // True if the context is lost. | 61 // True if the context is lost. |
| 62 bool IsContextLost(); | 62 bool IsContextLost(); |
| 63 | 63 |
| 64 // Asynchronously flushes the commands, setting the put pointer to let the | 64 // Asynchronously flushes the commands, setting the put pointer to let the |
| 65 // buffer interface know that new commands have been added. After a flush | 65 // buffer interface know that new commands have been added. After a flush |
| 66 // returns, the command buffer service is aware of all pending commands. | 66 // returns, the command buffer service is aware of all pending commands. |
| 67 void Flush(); | 67 void Flush(); |
| 68 | 68 |
| 69 // Ensures that commands up to the put pointer will be processed in the |
| 70 // command buffer service before any future commands on other command buffers |
| 71 // sharing a channel. |
| 72 void OrderingBarrier(); |
| 73 |
| 69 // Waits until all the commands have been executed. Returns whether it | 74 // Waits until all the commands have been executed. Returns whether it |
| 70 // was successful. The function will fail if the command buffer service has | 75 // was successful. The function will fail if the command buffer service has |
| 71 // disconnected. | 76 // disconnected. |
| 72 bool Finish(); | 77 bool Finish(); |
| 73 | 78 |
| 74 // Waits until a given number of available entries are available. | 79 // Waits until a given number of available entries are available. |
| 75 // Parameters: | 80 // Parameters: |
| 76 // count: number of entries needed. This value must be at most | 81 // count: number of entries needed. This value must be at most |
| 77 // the size of the buffer minus one. | 82 // the size of the buffer minus one. |
| 78 void WaitForAvailableEntries(int32 count); | 83 void WaitForAvailableEntries(int32 count); |
| (...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 315 CommandBuffer* command_buffer_; | 320 CommandBuffer* command_buffer_; |
| 316 int32 ring_buffer_id_; | 321 int32 ring_buffer_id_; |
| 317 int32 ring_buffer_size_; | 322 int32 ring_buffer_size_; |
| 318 scoped_refptr<gpu::Buffer> ring_buffer_; | 323 scoped_refptr<gpu::Buffer> ring_buffer_; |
| 319 CommandBufferEntry* entries_; | 324 CommandBufferEntry* entries_; |
| 320 int32 total_entry_count_; // the total number of entries | 325 int32 total_entry_count_; // the total number of entries |
| 321 int32 immediate_entry_count_; | 326 int32 immediate_entry_count_; |
| 322 int32 token_; | 327 int32 token_; |
| 323 int32 put_; | 328 int32 put_; |
| 324 int32 last_put_sent_; | 329 int32 last_put_sent_; |
| 330 int32 last_barrier_put_sent_; |
| 325 | 331 |
| 326 #if defined(CMD_HELPER_PERIODIC_FLUSH_CHECK) | 332 #if defined(CMD_HELPER_PERIODIC_FLUSH_CHECK) |
| 327 int commands_issued_; | 333 int commands_issued_; |
| 328 #endif | 334 #endif |
| 329 | 335 |
| 330 bool usable_; | 336 bool usable_; |
| 331 bool context_lost_; | 337 bool context_lost_; |
| 332 bool flush_automatically_; | 338 bool flush_automatically_; |
| 333 | 339 |
| 334 base::TimeTicks last_flush_time_; | 340 base::TimeTicks last_flush_time_; |
| 335 | 341 |
| 336 // Incremented every time the helper flushes the command buffer. | 342 // Incremented every time the helper flushes the command buffer. |
| 337 // Can be used to track when prior commands have been flushed. | 343 // Can be used to track when prior commands have been flushed. |
| 338 uint32 flush_generation_; | 344 uint32 flush_generation_; |
| 339 | 345 |
| 340 friend class CommandBufferHelperTest; | 346 friend class CommandBufferHelperTest; |
| 341 DISALLOW_COPY_AND_ASSIGN(CommandBufferHelper); | 347 DISALLOW_COPY_AND_ASSIGN(CommandBufferHelper); |
| 342 }; | 348 }; |
| 343 | 349 |
| 344 } // namespace gpu | 350 } // namespace gpu |
| 345 | 351 |
| 346 #endif // GPU_COMMAND_BUFFER_CLIENT_CMD_BUFFER_HELPER_H_ | 352 #endif // GPU_COMMAND_BUFFER_CLIENT_CMD_BUFFER_HELPER_H_ |
| OLD | NEW |