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

Unified Diff: gpu/command_buffer/client/cmd_buffer_helper.cc

Issue 555129: Add commands Jump, Call and Return... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gpu/command_buffer/client/cmd_buffer_helper.h ('k') | gpu/command_buffer/client/cmd_buffer_helper_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gpu/command_buffer/client/cmd_buffer_helper.cc
===================================================================
--- gpu/command_buffer/client/cmd_buffer_helper.cc (revision 37239)
+++ gpu/command_buffer/client/cmd_buffer_helper.cc (working copy)
@@ -62,10 +62,8 @@
// Increment token as 31-bit integer. Negative values are used to signal an
// error.
token_ = (token_ + 1) & 0x7FFFFFFF;
- CommandBufferEntry args;
- args.value_uint32 = token_;
- const uint32 kSetToken = 1; // TODO(gman): add a common set of commands.
- AddCommand(kSetToken, 1, &args);
+ cmd::SetToken& cmd = GetCmdSpace<cmd::SetToken>();
+ cmd.Init(token_);
if (token_ == 0) {
// we wrapped
Finish();
@@ -118,15 +116,13 @@
if (!Flush())
return;
}
- // Add the noops. By convention, a noop is a command 0 with no args.
- // TODO(apatrick): A noop can have a size. It would be better to add a
- // single noop with a variable size. Watch out for size limit on
- // individual commands.
- CommandHeader header;
- header.size = 1;
- header.command = 0;
- while (put_ < entry_count_) {
- entries_[put_++].value_header = header;
+ // Insert Noops to fill out buffer.
+ int32 num_entries = entry_count_ - put_;
+ while (num_entries > 0) {
+ int32 num_to_skip = std::min(CommandHeader::kMaxSize, num_entries);
+ cmd::Noop::Set(&entries_[put_], num_to_skip);
+ put_ += num_to_skip;
+ num_entries -= num_to_skip;
}
put_ = 0;
}
« no previous file with comments | « gpu/command_buffer/client/cmd_buffer_helper.h ('k') | gpu/command_buffer/client/cmd_buffer_helper_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698