summaryrefslogtreecommitdiffstats
path: root/gpu/command_buffer/client/cmd_buffer_helper.cc
diff options
context:
space:
mode:
authorgman@chromium.org <gman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-28 21:50:24 +0000
committergman@chromium.org <gman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-28 21:50:24 +0000
commit67e5077346cde830210611c2f00fb550d563fcd3 (patch)
tree2b44cd8f1774858d627ae7d43c36cc4a176afcd4 /gpu/command_buffer/client/cmd_buffer_helper.cc
parenta359ecc79d700a0d40701a29d9f1ca226136cc21 (diff)
downloadchromium_src-67e5077346cde830210611c2f00fb550d563fcd3.zip
chromium_src-67e5077346cde830210611c2f00fb550d563fcd3.tar.gz
chromium_src-67e5077346cde830210611c2f00fb550d563fcd3.tar.bz2
Add commands Jump, Call and Return
This is the minimal change version. There were 3 possible solution: #1) Remove these commands #2) Change the command buffers so the client side can not see the "get" pointer and therefore force the client side to use tokens to say in sync. It's the cleaner solution. It lets you put commands in any shared memory thereby getting rid of the ring buffer commands. But, it required major changes. After going down that path for an entire day I punted for... #3) Implement the commands assuming there is only one buffer the commands can be in (what is currently called the ring_buffer). With the jump commands available it no longer has to be used as a ring buffer. A Pepper or NaCl app can use it however they want but, unlike solution #2 they only get the one buffer. TEST=none BUG=none Review URL: http://codereview.chromium.org/555129 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@37446 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'gpu/command_buffer/client/cmd_buffer_helper.cc')
-rw-r--r--gpu/command_buffer/client/cmd_buffer_helper.cc22
1 files changed, 9 insertions, 13 deletions
diff --git a/gpu/command_buffer/client/cmd_buffer_helper.cc b/gpu/command_buffer/client/cmd_buffer_helper.cc
index 45c0866..0651ee6 100644
--- a/gpu/command_buffer/client/cmd_buffer_helper.cc
+++ b/gpu/command_buffer/client/cmd_buffer_helper.cc
@@ -62,10 +62,8 @@ int32 CommandBufferHelper::InsertToken() {
// 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 @@ void CommandBufferHelper::WaitForAvailableEntries(int32 count) {
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;
}