Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(883)

Side by Side Diff: gpu/command_buffer/client/cmd_buffer_helper.h

Issue 116863003: gpu: Reuse transfer buffers more aggresively (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Rebased; removed unnecessary barrier; use CheckedNumeric Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 85
86 // Inserts a new token into the command buffer. This token either has a value 86 // Inserts a new token into the command buffer. This token either has a value
87 // different from previously inserted tokens, or ensures that previously 87 // different from previously inserted tokens, or ensures that previously
88 // inserted tokens with that value have already passed through the command 88 // inserted tokens with that value have already passed through the command
89 // stream. 89 // stream.
90 // Returns: 90 // Returns:
91 // the value of the new token or -1 if the command buffer reader has 91 // the value of the new token or -1 if the command buffer reader has
92 // shutdown. 92 // shutdown.
93 int32 InsertToken(); 93 int32 InsertToken();
94 94
95 // Returns true if the token has passed.
96 // Parameters:
97 // the value of the token to check whether it has passed
98 bool HasTokenPassed(int32 token) const {
99 if (token > token_)
100 return true; // we wrapped
101 return last_token_read() >= token;
102 }
103
95 // Waits until the token of a particular value has passed through the command 104 // Waits until the token of a particular value has passed through the command
96 // stream (i.e. commands inserted before that token have been executed). 105 // stream (i.e. commands inserted before that token have been executed).
97 // NOTE: This will call Flush if it needs to block. 106 // NOTE: This will call Flush if it needs to block.
98 // Parameters: 107 // Parameters:
99 // the value of the token to wait for. 108 // the value of the token to wait for.
100 void WaitForToken(int32 token); 109 void WaitForToken(int32 token);
101 110
102 // Called prior to each command being issued. Waits for a certain amount of 111 // Called prior to each command being issued. Waits for a certain amount of
103 // space to be available. Returns address of space. 112 // space to be available. Returns address of space.
104 CommandBufferEntry* GetSpace(int32 entries) { 113 CommandBufferEntry* GetSpace(int32 entries) {
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 // Can be used to track when prior commands have been flushed. 326 // Can be used to track when prior commands have been flushed.
318 uint32 flush_generation_; 327 uint32 flush_generation_;
319 328
320 friend class CommandBufferHelperTest; 329 friend class CommandBufferHelperTest;
321 DISALLOW_COPY_AND_ASSIGN(CommandBufferHelper); 330 DISALLOW_COPY_AND_ASSIGN(CommandBufferHelper);
322 }; 331 };
323 332
324 } // namespace gpu 333 } // namespace gpu
325 334
326 #endif // GPU_COMMAND_BUFFER_CLIENT_CMD_BUFFER_HELPER_H_ 335 #endif // GPU_COMMAND_BUFFER_CLIENT_CMD_BUFFER_HELPER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698