| 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 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 // Waits until get changes, updating the value of get_. | 267 // Waits until get changes, updating the value of get_. |
| 268 void WaitForGetChange(); | 268 void WaitForGetChange(); |
| 269 | 269 |
| 270 // Returns the number of available entries (they may not be contiguous). | 270 // Returns the number of available entries (they may not be contiguous). |
| 271 int32 AvailableEntries() { | 271 int32 AvailableEntries() { |
| 272 return (get_offset() - put_ - 1 + usable_entry_count_) % | 272 return (get_offset() - put_ - 1 + usable_entry_count_) % |
| 273 usable_entry_count_; | 273 usable_entry_count_; |
| 274 } | 274 } |
| 275 | 275 |
| 276 bool AllocateRingBuffer(); | 276 bool AllocateRingBuffer(); |
| 277 void FreeResources(); |
| 277 | 278 |
| 278 CommandBuffer* command_buffer_; | 279 CommandBuffer* command_buffer_; |
| 279 int32 ring_buffer_id_; | 280 int32 ring_buffer_id_; |
| 280 int32 ring_buffer_size_; | 281 int32 ring_buffer_size_; |
| 281 Buffer ring_buffer_; | 282 Buffer ring_buffer_; |
| 282 CommandBufferEntry* entries_; | 283 CommandBufferEntry* entries_; |
| 283 int32 total_entry_count_; // the total number of entries | 284 int32 total_entry_count_; // the total number of entries |
| 284 int32 usable_entry_count_; // the usable number (ie, minus space for jump) | 285 int32 usable_entry_count_; // the usable number (ie, minus space for jump) |
| 285 int32 token_; | 286 int32 token_; |
| 286 int32 put_; | 287 int32 put_; |
| 287 int32 last_put_sent_; | 288 int32 last_put_sent_; |
| 288 int commands_issued_; | 289 int commands_issued_; |
| 289 bool usable_; | 290 bool usable_; |
| 290 | 291 |
| 291 // Using C runtime instead of base because this file cannot depend on base. | 292 // Using C runtime instead of base because this file cannot depend on base. |
| 292 clock_t last_flush_time_; | 293 clock_t last_flush_time_; |
| 293 | 294 |
| 294 friend class CommandBufferHelperTest; | 295 friend class CommandBufferHelperTest; |
| 295 DISALLOW_COPY_AND_ASSIGN(CommandBufferHelper); | 296 DISALLOW_COPY_AND_ASSIGN(CommandBufferHelper); |
| 296 }; | 297 }; |
| 297 | 298 |
| 298 } // namespace gpu | 299 } // namespace gpu |
| 299 | 300 |
| 300 #endif // GPU_COMMAND_BUFFER_CLIENT_CMD_BUFFER_HELPER_H_ | 301 #endif // GPU_COMMAND_BUFFER_CLIENT_CMD_BUFFER_HELPER_H_ |
| OLD | NEW |