| 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 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 283 | 283 |
| 284 bool usable () const { | 284 bool usable () const { |
| 285 return usable_; | 285 return usable_; |
| 286 } | 286 } |
| 287 | 287 |
| 288 void ClearUsable() { | 288 void ClearUsable() { |
| 289 usable_ = false; | 289 usable_ = false; |
| 290 CalcImmediateEntries(0); | 290 CalcImmediateEntries(0); |
| 291 } | 291 } |
| 292 | 292 |
| 293 void WillWaitOnSyncPoint(int sync_point) { |
| 294 sync_points_to_wait_on_.push_back(sync_point); |
| 295 } |
| 296 |
| 293 private: | 297 private: |
| 294 // Returns the number of available entries (they may not be contiguous). | 298 // Returns the number of available entries (they may not be contiguous). |
| 295 int32 AvailableEntries() { | 299 int32 AvailableEntries() { |
| 296 return (get_offset() - put_ - 1 + total_entry_count_) % total_entry_count_; | 300 return (get_offset() - put_ - 1 + total_entry_count_) % total_entry_count_; |
| 297 } | 301 } |
| 298 | 302 |
| 299 void CalcImmediateEntries(int waiting_count); | 303 void CalcImmediateEntries(int waiting_count); |
| 300 bool AllocateRingBuffer(); | 304 bool AllocateRingBuffer(); |
| 301 void FreeResources(); | 305 void FreeResources(); |
| 302 | 306 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 313 int32 ring_buffer_id_; | 317 int32 ring_buffer_id_; |
| 314 int32 ring_buffer_size_; | 318 int32 ring_buffer_size_; |
| 315 scoped_refptr<gpu::Buffer> ring_buffer_; | 319 scoped_refptr<gpu::Buffer> ring_buffer_; |
| 316 CommandBufferEntry* entries_; | 320 CommandBufferEntry* entries_; |
| 317 int32 total_entry_count_; // the total number of entries | 321 int32 total_entry_count_; // the total number of entries |
| 318 int32 immediate_entry_count_; | 322 int32 immediate_entry_count_; |
| 319 int32 token_; | 323 int32 token_; |
| 320 int32 put_; | 324 int32 put_; |
| 321 int32 last_put_sent_; | 325 int32 last_put_sent_; |
| 322 | 326 |
| 327 std::vector<uint32> sync_points_to_wait_on_; |
| 328 |
| 323 #if defined(CMD_HELPER_PERIODIC_FLUSH_CHECK) | 329 #if defined(CMD_HELPER_PERIODIC_FLUSH_CHECK) |
| 324 int commands_issued_; | 330 int commands_issued_; |
| 325 #endif | 331 #endif |
| 326 | 332 |
| 327 bool usable_; | 333 bool usable_; |
| 328 bool context_lost_; | 334 bool context_lost_; |
| 329 bool flush_automatically_; | 335 bool flush_automatically_; |
| 330 | 336 |
| 331 base::TimeTicks last_flush_time_; | 337 base::TimeTicks last_flush_time_; |
| 332 | 338 |
| 333 // Incremented every time the helper flushes the command buffer. | 339 // Incremented every time the helper flushes the command buffer. |
| 334 // Can be used to track when prior commands have been flushed. | 340 // Can be used to track when prior commands have been flushed. |
| 335 uint32 flush_generation_; | 341 uint32 flush_generation_; |
| 336 | 342 |
| 337 friend class CommandBufferHelperTest; | 343 friend class CommandBufferHelperTest; |
| 338 DISALLOW_COPY_AND_ASSIGN(CommandBufferHelper); | 344 DISALLOW_COPY_AND_ASSIGN(CommandBufferHelper); |
| 339 }; | 345 }; |
| 340 | 346 |
| 341 } // namespace gpu | 347 } // namespace gpu |
| 342 | 348 |
| 343 #endif // GPU_COMMAND_BUFFER_CLIENT_CMD_BUFFER_HELPER_H_ | 349 #endif // GPU_COMMAND_BUFFER_CLIENT_CMD_BUFFER_HELPER_H_ |
| OLD | NEW |