OLD | NEW |
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 implementation of the command buffer helper class. | 5 // This file contains the implementation of the command buffer helper class. |
6 | 6 |
7 #include "gpu/command_buffer/client/cmd_buffer_helper.h" | 7 #include "gpu/command_buffer/client/cmd_buffer_helper.h" |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 } | 143 } |
144 command_buffer_->WaitForGetOffsetInRange(start, end); | 144 command_buffer_->WaitForGetOffsetInRange(start, end); |
145 return command_buffer_->GetLastError() == gpu::error::kNoError; | 145 return command_buffer_->GetLastError() == gpu::error::kNoError; |
146 } | 146 } |
147 | 147 |
148 void CommandBufferHelper::Flush() { | 148 void CommandBufferHelper::Flush() { |
149 // Wrap put_ before flush. | 149 // Wrap put_ before flush. |
150 if (put_ == total_entry_count_) | 150 if (put_ == total_entry_count_) |
151 put_ = 0; | 151 put_ = 0; |
152 | 152 |
153 if (usable() && last_put_sent_ != put_) { | 153 if (usable()) { |
154 last_flush_time_ = base::TimeTicks::Now(); | 154 last_flush_time_ = base::TimeTicks::Now(); |
155 last_put_sent_ = put_; | 155 last_put_sent_ = put_; |
156 command_buffer_->Flush(put_); | 156 command_buffer_->Flush(put_); |
157 ++flush_generation_; | 157 ++flush_generation_; |
158 CalcImmediateEntries(0); | 158 CalcImmediateEntries(0); |
159 } | 159 } |
160 } | 160 } |
161 | 161 |
| 162 void CommandBufferHelper::OrderingBarrier() { |
| 163 // Wrap put_ before setting the barrier. |
| 164 if (put_ == total_entry_count_) |
| 165 put_ = 0; |
| 166 |
| 167 if (usable()) { |
| 168 command_buffer_->OrderingBarrier(put_); |
| 169 ++flush_generation_; |
| 170 CalcImmediateEntries(0); |
| 171 } |
| 172 } |
| 173 |
162 #if defined(CMD_HELPER_PERIODIC_FLUSH_CHECK) | 174 #if defined(CMD_HELPER_PERIODIC_FLUSH_CHECK) |
163 void CommandBufferHelper::PeriodicFlushCheck() { | 175 void CommandBufferHelper::PeriodicFlushCheck() { |
164 base::TimeTicks current_time = base::TimeTicks::Now(); | 176 base::TimeTicks current_time = base::TimeTicks::Now(); |
165 if (current_time - last_flush_time_ > | 177 if (current_time - last_flush_time_ > |
166 base::TimeDelta::FromMicroseconds(kPeriodicFlushDelayInMicroseconds)) { | 178 base::TimeDelta::FromMicroseconds(kPeriodicFlushDelayInMicroseconds)) { |
167 Flush(); | 179 Flush(); |
168 } | 180 } |
169 } | 181 } |
170 #endif | 182 #endif |
171 | 183 |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
284 if (!WaitForGetOffsetInRange(put_ + count + 1, put_)) | 296 if (!WaitForGetOffsetInRange(put_ + count + 1, put_)) |
285 return; | 297 return; |
286 CalcImmediateEntries(count); | 298 CalcImmediateEntries(count); |
287 DCHECK_GE(immediate_entry_count_, count); | 299 DCHECK_GE(immediate_entry_count_, count); |
288 } | 300 } |
289 } | 301 } |
290 } | 302 } |
291 | 303 |
292 | 304 |
293 } // namespace gpu | 305 } // namespace gpu |
OLD | NEW |