| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 implementation of the command buffer helper class. | 5 // This file contains the implementation of the command buffer helper class. |
| 6 | 6 |
| 7 #include "../client/cmd_buffer_helper.h" | 7 #include "../client/cmd_buffer_helper.h" |
| 8 #include "../common/command_buffer.h" | 8 #include "../common/command_buffer.h" |
| 9 #include "gpu/common/gpu_trace_event.h" | 9 #include "gpu/common/gpu_trace_event.h" |
| 10 | 10 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 put_ = state.put_offset; | 42 put_ = state.put_offset; |
| 43 SynchronizeState(state); | 43 SynchronizeState(state); |
| 44 return true; | 44 return true; |
| 45 } | 45 } |
| 46 | 46 |
| 47 CommandBufferHelper::~CommandBufferHelper() { | 47 CommandBufferHelper::~CommandBufferHelper() { |
| 48 } | 48 } |
| 49 | 49 |
| 50 bool CommandBufferHelper::FlushSync() { | 50 bool CommandBufferHelper::FlushSync() { |
| 51 last_put_sent_ = put_; | 51 last_put_sent_ = put_; |
| 52 CommandBuffer::State state = command_buffer_->FlushSync(put_); | 52 CommandBuffer::State state = command_buffer_->FlushSync(put_, get_); |
| 53 SynchronizeState(state); | 53 SynchronizeState(state); |
| 54 return state.error == error::kNoError; | 54 return state.error == error::kNoError; |
| 55 } | 55 } |
| 56 | 56 |
| 57 void CommandBufferHelper::Flush() { | 57 void CommandBufferHelper::Flush() { |
| 58 last_put_sent_ = put_; | 58 last_put_sent_ = put_; |
| 59 command_buffer_->Flush(put_); | 59 command_buffer_->Flush(put_); |
| 60 } | 60 } |
| 61 | 61 |
| 62 // Calls Flush() and then waits until the buffer is empty. Break early if the | 62 // Calls Flush() and then waits until the buffer is empty. Break early if the |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 SynchronizeState(state); | 179 SynchronizeState(state); |
| 180 return static_cast<error::Error>(state.error); | 180 return static_cast<error::Error>(state.error); |
| 181 } | 181 } |
| 182 | 182 |
| 183 void CommandBufferHelper::SynchronizeState(CommandBuffer::State state) { | 183 void CommandBufferHelper::SynchronizeState(CommandBuffer::State state) { |
| 184 get_ = state.get_offset; | 184 get_ = state.get_offset; |
| 185 last_token_read_ = state.token; | 185 last_token_read_ = state.token; |
| 186 } | 186 } |
| 187 | 187 |
| 188 } // namespace gpu | 188 } // namespace gpu |
| OLD | NEW |