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

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

Issue 11613021: Removing the JumpRelative, Call, CallRelative and Return commands. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Use Noops instead of Jump; Remove Jump command. Created 7 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | gpu/command_buffer/client/cmd_buffer_helper.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 } 142 }
143 } 143 }
144 144
145 void SetToken(uint32 token) { 145 void SetToken(uint32 token) {
146 cmd::SetToken* cmd = GetCmdSpace<cmd::SetToken>(); 146 cmd::SetToken* cmd = GetCmdSpace<cmd::SetToken>();
147 if (cmd) { 147 if (cmd) {
148 cmd->Init(token); 148 cmd->Init(token);
149 } 149 }
150 } 150 }
151 151
152 void Jump(uint32 offset) {
153 cmd::Jump* cmd = GetCmdSpace<cmd::Jump>();
154 if (cmd) {
155 cmd->Init(offset);
156 }
157 }
158
159 void JumpRelative(int32 offset) {
160 cmd::JumpRelative* cmd = GetCmdSpace<cmd::JumpRelative>();
161 if (cmd) {
162 cmd->Init(offset);
163 }
164 }
165
166 void Call(uint32 offset) {
167 cmd::Call* cmd = GetCmdSpace<cmd::Call>();
168 if (cmd) {
169 cmd->Init(offset);
170 }
171 }
172
173 void CallRelative(int32 offset) {
174 cmd::CallRelative* cmd = GetCmdSpace<cmd::CallRelative>();
175 if (cmd) {
176 cmd->Init(offset);
177 }
178 }
179
180 void Return() {
181 cmd::Return* cmd = GetCmdSpace<cmd::Return>();
182 if (cmd) {
183 cmd->Init();
184 }
185 }
186
187 void SetBucketSize(uint32 bucket_id, uint32 size) { 152 void SetBucketSize(uint32 bucket_id, uint32 size) {
188 cmd::SetBucketSize* cmd = GetCmdSpace<cmd::SetBucketSize>(); 153 cmd::SetBucketSize* cmd = GetCmdSpace<cmd::SetBucketSize>();
189 if (cmd) { 154 if (cmd) {
190 cmd->Init(bucket_id, size); 155 cmd->Init(bucket_id, size);
191 } 156 }
192 } 157 }
193 158
194 void SetBucketData(uint32 bucket_id, 159 void SetBucketData(uint32 bucket_id,
195 uint32 offset, 160 uint32 offset,
196 uint32 size, 161 uint32 size,
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 void ClearUsable() { 234 void ClearUsable() {
270 usable_ = false; 235 usable_ = false;
271 } 236 }
272 237
273 private: 238 private:
274 // Waits until get changes, updating the value of get_. 239 // Waits until get changes, updating the value of get_.
275 void WaitForGetChange(); 240 void WaitForGetChange();
276 241
277 // Returns the number of available entries (they may not be contiguous). 242 // Returns the number of available entries (they may not be contiguous).
278 int32 AvailableEntries() { 243 int32 AvailableEntries() {
279 return (get_offset() - put_ - 1 + usable_entry_count_) % 244 return (get_offset() - put_ - 1 + total_entry_count_) % total_entry_count_;
280 usable_entry_count_;
281 } 245 }
282 246
283 bool AllocateRingBuffer(); 247 bool AllocateRingBuffer();
284 void FreeResources(); 248 void FreeResources();
285 249
286 CommandBuffer* command_buffer_; 250 CommandBuffer* command_buffer_;
287 int32 ring_buffer_id_; 251 int32 ring_buffer_id_;
288 int32 ring_buffer_size_; 252 int32 ring_buffer_size_;
289 Buffer ring_buffer_; 253 Buffer ring_buffer_;
290 CommandBufferEntry* entries_; 254 CommandBufferEntry* entries_;
291 int32 total_entry_count_; // the total number of entries 255 int32 total_entry_count_; // the total number of entries
292 int32 usable_entry_count_; // the usable number (ie, minus space for jump)
293 int32 token_; 256 int32 token_;
294 int32 put_; 257 int32 put_;
295 int32 last_put_sent_; 258 int32 last_put_sent_;
296 int commands_issued_; 259 int commands_issued_;
297 bool usable_; 260 bool usable_;
298 bool context_lost_; 261 bool context_lost_;
299 bool flush_automatically_; 262 bool flush_automatically_;
300 263
301 // Using C runtime instead of base because this file cannot depend on base. 264 // Using C runtime instead of base because this file cannot depend on base.
302 clock_t last_flush_time_; 265 clock_t last_flush_time_;
303 266
304 friend class CommandBufferHelperTest; 267 friend class CommandBufferHelperTest;
305 DISALLOW_COPY_AND_ASSIGN(CommandBufferHelper); 268 DISALLOW_COPY_AND_ASSIGN(CommandBufferHelper);
306 }; 269 };
307 270
308 } // namespace gpu 271 } // namespace gpu
309 272
310 #endif // GPU_COMMAND_BUFFER_CLIENT_CMD_BUFFER_HELPER_H_ 273 #endif // GPU_COMMAND_BUFFER_CLIENT_CMD_BUFFER_HELPER_H_
OLDNEW
« no previous file with comments | « no previous file | gpu/command_buffer/client/cmd_buffer_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698