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> |
11 #include <time.h> | 11 #include <time.h> |
12 | 12 |
| 13 #include "../../gpu_export.h" |
13 #include "../common/logging.h" | 14 #include "../common/logging.h" |
14 #include "../common/constants.h" | 15 #include "../common/constants.h" |
15 #include "../common/cmd_buffer_common.h" | 16 #include "../common/cmd_buffer_common.h" |
16 #include "../common/command_buffer.h" | 17 #include "../common/command_buffer.h" |
17 | 18 |
18 namespace gpu { | 19 namespace gpu { |
19 | 20 |
20 // Command buffer helper class. This class simplifies ring buffer management: | 21 // Command buffer helper class. This class simplifies ring buffer management: |
21 // it will allocate the buffer, give it to the buffer interface, and let the | 22 // it will allocate the buffer, give it to the buffer interface, and let the |
22 // user add commands to it, while taking care of the synchronization (put and | 23 // user add commands to it, while taking care of the synchronization (put and |
23 // get). It also provides a way to ensure commands have been executed, through | 24 // get). It also provides a way to ensure commands have been executed, through |
24 // the token mechanism: | 25 // the token mechanism: |
25 // | 26 // |
26 // helper.AddCommand(...); | 27 // helper.AddCommand(...); |
27 // helper.AddCommand(...); | 28 // helper.AddCommand(...); |
28 // int32 token = helper.InsertToken(); | 29 // int32 token = helper.InsertToken(); |
29 // helper.AddCommand(...); | 30 // helper.AddCommand(...); |
30 // helper.AddCommand(...); | 31 // helper.AddCommand(...); |
31 // [...] | 32 // [...] |
32 // | 33 // |
33 // helper.WaitForToken(token); // this doesn't return until the first two | 34 // helper.WaitForToken(token); // this doesn't return until the first two |
34 // // commands have been executed. | 35 // // commands have been executed. |
35 class CommandBufferHelper { | 36 class GPU_EXPORT CommandBufferHelper { |
36 public: | 37 public: |
37 explicit CommandBufferHelper(CommandBuffer* command_buffer); | 38 explicit CommandBufferHelper(CommandBuffer* command_buffer); |
38 virtual ~CommandBufferHelper(); | 39 virtual ~CommandBufferHelper(); |
39 | 40 |
40 // Initializes the CommandBufferHelper. | 41 // Initializes the CommandBufferHelper. |
41 // Parameters: | 42 // Parameters: |
42 // ring_buffer_size: The size of the ring buffer portion of the command | 43 // ring_buffer_size: The size of the ring buffer portion of the command |
43 // buffer. | 44 // buffer. |
44 bool Initialize(int32 ring_buffer_size); | 45 bool Initialize(int32 ring_buffer_size); |
45 | 46 |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
284 // Using C runtime instead of base because this file cannot depend on base. | 285 // Using C runtime instead of base because this file cannot depend on base. |
285 clock_t last_flush_time_; | 286 clock_t last_flush_time_; |
286 | 287 |
287 friend class CommandBufferHelperTest; | 288 friend class CommandBufferHelperTest; |
288 DISALLOW_COPY_AND_ASSIGN(CommandBufferHelper); | 289 DISALLOW_COPY_AND_ASSIGN(CommandBufferHelper); |
289 }; | 290 }; |
290 | 291 |
291 } // namespace gpu | 292 } // namespace gpu |
292 | 293 |
293 #endif // GPU_COMMAND_BUFFER_CLIENT_CMD_BUFFER_HELPER_H_ | 294 #endif // GPU_COMMAND_BUFFER_CLIENT_CMD_BUFFER_HELPER_H_ |
OLD | NEW |