OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 } | 211 } |
212 | 212 |
213 CommandBuffer* command_buffer() const { | 213 CommandBuffer* command_buffer() const { |
214 return command_buffer_; | 214 return command_buffer_; |
215 } | 215 } |
216 | 216 |
217 Buffer get_ring_buffer() const { | 217 Buffer get_ring_buffer() const { |
218 return ring_buffer_; | 218 return ring_buffer_; |
219 } | 219 } |
220 | 220 |
| 221 void FreeRingBuffer(); |
| 222 |
| 223 bool HaveRingBuffer() const { |
| 224 return ring_buffer_id_ != -1; |
| 225 } |
| 226 |
221 private: | 227 private: |
222 // Waits until get changes, updating the value of get_. | 228 // Waits until get changes, updating the value of get_. |
223 void WaitForGetChange(); | 229 void WaitForGetChange(); |
224 | 230 |
225 // Returns the number of available entries (they may not be contiguous). | 231 // Returns the number of available entries (they may not be contiguous). |
226 int32 AvailableEntries() { | 232 int32 AvailableEntries() { |
227 return (get_offset() - put_ - 1 + usable_entry_count_) % | 233 return (get_offset() - put_ - 1 + usable_entry_count_) % |
228 usable_entry_count_; | 234 usable_entry_count_; |
229 } | 235 } |
230 | 236 |
(...skipping 14 matching lines...) Expand all Loading... |
245 // Using C runtime instead of base because this file cannot depend on base. | 251 // Using C runtime instead of base because this file cannot depend on base. |
246 clock_t last_flush_time_; | 252 clock_t last_flush_time_; |
247 | 253 |
248 friend class CommandBufferHelperTest; | 254 friend class CommandBufferHelperTest; |
249 DISALLOW_COPY_AND_ASSIGN(CommandBufferHelper); | 255 DISALLOW_COPY_AND_ASSIGN(CommandBufferHelper); |
250 }; | 256 }; |
251 | 257 |
252 } // namespace gpu | 258 } // namespace gpu |
253 | 259 |
254 #endif // GPU_COMMAND_BUFFER_CLIENT_CMD_BUFFER_HELPER_H_ | 260 #endif // GPU_COMMAND_BUFFER_CLIENT_CMD_BUFFER_HELPER_H_ |
OLD | NEW |