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 <algorithm> | 9 #include <algorithm> |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 // error is set. | 191 // error is set. |
192 bool CommandBufferHelper::Finish() { | 192 bool CommandBufferHelper::Finish() { |
193 TRACE_EVENT0("gpu", "CommandBufferHelper::Finish"); | 193 TRACE_EVENT0("gpu", "CommandBufferHelper::Finish"); |
194 if (!usable()) { | 194 if (!usable()) { |
195 return false; | 195 return false; |
196 } | 196 } |
197 // If there is no work just exit. | 197 // If there is no work just exit. |
198 if (put_ == get_offset()) { | 198 if (put_ == get_offset()) { |
199 return true; | 199 return true; |
200 } | 200 } |
201 DCHECK(HaveRingBuffer()); | 201 DCHECK(HaveRingBuffer() || |
| 202 error::IsError(command_buffer_->GetLastState().error)); |
202 Flush(); | 203 Flush(); |
203 if (!WaitForGetOffsetInRange(put_, put_)) | 204 if (!WaitForGetOffsetInRange(put_, put_)) |
204 return false; | 205 return false; |
205 DCHECK_EQ(get_offset(), put_); | 206 DCHECK_EQ(get_offset(), put_); |
206 | 207 |
207 CalcImmediateEntries(0); | 208 CalcImmediateEntries(0); |
208 | 209 |
209 return true; | 210 return true; |
210 } | 211 } |
211 | 212 |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
302 if (!WaitForGetOffsetInRange(put_ + count + 1, put_)) | 303 if (!WaitForGetOffsetInRange(put_ + count + 1, put_)) |
303 return; | 304 return; |
304 CalcImmediateEntries(count); | 305 CalcImmediateEntries(count); |
305 DCHECK_GE(immediate_entry_count_, count); | 306 DCHECK_GE(immediate_entry_count_, count); |
306 } | 307 } |
307 } | 308 } |
308 } | 309 } |
309 | 310 |
310 | 311 |
311 } // namespace gpu | 312 } // namespace gpu |
OLD | NEW |