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)); | |
203 Flush(); | 202 Flush(); |
204 if (!WaitForGetOffsetInRange(put_, put_)) | 203 if (!WaitForGetOffsetInRange(put_, put_)) |
205 return false; | 204 return false; |
206 DCHECK_EQ(get_offset(), put_); | 205 DCHECK_EQ(get_offset(), put_); |
207 | 206 |
208 CalcImmediateEntries(0); | 207 CalcImmediateEntries(0); |
209 | 208 |
210 return true; | 209 return true; |
211 } | 210 } |
212 | 211 |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
303 if (!WaitForGetOffsetInRange(put_ + count + 1, put_)) | 302 if (!WaitForGetOffsetInRange(put_ + count + 1, put_)) |
304 return; | 303 return; |
305 CalcImmediateEntries(count); | 304 CalcImmediateEntries(count); |
306 DCHECK_GE(immediate_entry_count_, count); | 305 DCHECK_GE(immediate_entry_count_, count); |
307 } | 306 } |
308 } | 307 } |
309 } | 308 } |
310 | 309 |
311 | 310 |
312 } // namespace gpu | 311 } // namespace gpu |
OLD | NEW |