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 // As Flush, but may be deferred in a CommandBufferProxy implementation. |
| 70 void ShallowFlush(); |
| 71 |
69 // Waits until all the commands have been executed. Returns whether it | 72 // Waits until all the commands have been executed. Returns whether it |
70 // was successful. The function will fail if the command buffer service has | 73 // was successful. The function will fail if the command buffer service has |
71 // disconnected. | 74 // disconnected. |
72 bool Finish(); | 75 bool Finish(); |
73 | 76 |
74 // Waits until a given number of available entries are available. | 77 // Waits until a given number of available entries are available. |
75 // Parameters: | 78 // Parameters: |
76 // count: number of entries needed. This value must be at most | 79 // count: number of entries needed. This value must be at most |
77 // the size of the buffer minus one. | 80 // the size of the buffer minus one. |
78 void WaitForAvailableEntries(int32 count); | 81 void WaitForAvailableEntries(int32 count); |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
315 CommandBuffer* command_buffer_; | 318 CommandBuffer* command_buffer_; |
316 int32 ring_buffer_id_; | 319 int32 ring_buffer_id_; |
317 int32 ring_buffer_size_; | 320 int32 ring_buffer_size_; |
318 scoped_refptr<gpu::Buffer> ring_buffer_; | 321 scoped_refptr<gpu::Buffer> ring_buffer_; |
319 CommandBufferEntry* entries_; | 322 CommandBufferEntry* entries_; |
320 int32 total_entry_count_; // the total number of entries | 323 int32 total_entry_count_; // the total number of entries |
321 int32 immediate_entry_count_; | 324 int32 immediate_entry_count_; |
322 int32 token_; | 325 int32 token_; |
323 int32 put_; | 326 int32 put_; |
324 int32 last_put_sent_; | 327 int32 last_put_sent_; |
| 328 int32 last_shallow_put_sent_; |
325 | 329 |
326 #if defined(CMD_HELPER_PERIODIC_FLUSH_CHECK) | 330 #if defined(CMD_HELPER_PERIODIC_FLUSH_CHECK) |
327 int commands_issued_; | 331 int commands_issued_; |
328 #endif | 332 #endif |
329 | 333 |
330 bool usable_; | 334 bool usable_; |
331 bool context_lost_; | 335 bool context_lost_; |
332 bool flush_automatically_; | 336 bool flush_automatically_; |
333 | 337 |
334 base::TimeTicks last_flush_time_; | 338 base::TimeTicks last_flush_time_; |
335 | 339 |
336 // Incremented every time the helper flushes the command buffer. | 340 // Incremented every time the helper flushes the command buffer. |
337 // Can be used to track when prior commands have been flushed. | 341 // Can be used to track when prior commands have been flushed. |
338 uint32 flush_generation_; | 342 uint32 flush_generation_; |
339 | 343 |
340 friend class CommandBufferHelperTest; | 344 friend class CommandBufferHelperTest; |
341 DISALLOW_COPY_AND_ASSIGN(CommandBufferHelper); | 345 DISALLOW_COPY_AND_ASSIGN(CommandBufferHelper); |
342 }; | 346 }; |
343 | 347 |
344 } // namespace gpu | 348 } // namespace gpu |
345 | 349 |
346 #endif // GPU_COMMAND_BUFFER_CLIENT_CMD_BUFFER_HELPER_H_ | 350 #endif // GPU_COMMAND_BUFFER_CLIENT_CMD_BUFFER_HELPER_H_ |
OLD | NEW |