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

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

Issue 555020: Redesigned CommandBuffer and NPDevice3D interfaces (Closed) Base URL: svn://chrome-svn/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 37414)
+++ gpu/command_buffer/client/cmd_buffer_helper.cc (working copy)
@@ -24,12 +24,11 @@
if (!ring_buffer_.ptr)
return false;
+ CommandBuffer::State state = command_buffer_->GetState();
entries_ = static_cast<CommandBufferEntry*>(ring_buffer_.ptr);
- entry_count_ = command_buffer_->GetSize();
- get_ = command_buffer_->GetGetOffset();
- put_ = command_buffer_->GetPutOffset();
- last_token_read_ = command_buffer_->GetToken();
-
+ entry_count_ = state.size;
+ put_ = state.put_offset;
+ SynchronizeState(state);
return true;
}
@@ -37,8 +36,9 @@
}
bool CommandBufferHelper::Flush() {
- get_ = command_buffer_->SyncOffsets(put_);
- return !command_buffer_->GetErrorStatus();
+ CommandBuffer::State state = command_buffer_->Flush(put_);
+ SynchronizeState(state);
+ return state.error == parse_error::kParseNoError;
}
// Calls Flush() and then waits until the buffer is empty. Break early if the
@@ -46,7 +46,7 @@
bool CommandBufferHelper::Finish() {
do {
// Do not loop forever if the flush fails, meaning the command buffer reader
- // has shutdown).
+ // has shutdown.
if (!Flush())
return false;
} while (put_ != get_);
@@ -69,7 +69,6 @@
if (token_ == 0) {
// we wrapped
Finish();
- last_token_read_ = command_buffer_->GetToken();
DCHECK_EQ(token_, last_token_read_);
}
return token_;
@@ -84,7 +83,6 @@
if (last_token_read_ >= token) return; // fast path.
if (token > token_) return; // we wrapped
Flush();
- last_token_read_ = command_buffer_->GetToken();
while (last_token_read_ < token) {
if (get_ == put_) {
LOG(FATAL) << "Empty command buffer while waiting on a token.";
@@ -94,7 +92,6 @@
// has shutdown.
if (!Flush())
return;
- last_token_read_ = command_buffer_->GetToken();
}
}
@@ -149,9 +146,15 @@
return space;
}
-parse_error::ParseError CommandBufferHelper::GetParseError() {
- int32 parse_error = command_buffer_->ResetParseError();
- return static_cast<parse_error::ParseError>(parse_error);
+parse_error::ParseError CommandBufferHelper::GetError() {
+ CommandBuffer::State state = command_buffer_->GetState();
+ SynchronizeState(state);
+ return static_cast<parse_error::ParseError>(state.error);
}
+void CommandBufferHelper::SynchronizeState(CommandBuffer::State state) {
+ get_ = state.get_offset;
+ last_token_read_ = state.token;
+}
+
} // namespace gpu
« 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