OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "GrInOrderDrawBuffer.h" | 8 #include "GrInOrderDrawBuffer.h" |
9 | 9 |
10 #include "GrBufferAllocPool.h" | 10 #include "GrBufferAllocPool.h" |
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
392 this->recordTraceMarkersIfNecessary(draw); | 392 this->recordTraceMarkersIfNecessary(draw); |
393 } | 393 } |
394 | 394 |
395 void GrInOrderDrawBuffer::onDrawBatch(GrBatch* batch, | 395 void GrInOrderDrawBuffer::onDrawBatch(GrBatch* batch, |
396 const PipelineInfo& pipelineInfo) { | 396 const PipelineInfo& pipelineInfo) { |
397 if (!this->setupPipelineAndShouldDraw(batch, pipelineInfo)) { | 397 if (!this->setupPipelineAndShouldDraw(batch, pipelineInfo)) { |
398 return; | 398 return; |
399 } | 399 } |
400 | 400 |
401 // Check if there is a Batch Draw we can batch with | 401 // Check if there is a Batch Draw we can batch with |
402 if (Cmd::kDrawBatch_Cmd != fCmdBuffer.back().type()) { | 402 if (Cmd::kDrawBatch_Cmd != fCmdBuffer.back().type() || !fDrawBatch) { |
403 fDrawBatch = GrNEW_APPEND_TO_RECORDER(fCmdBuffer, DrawBatch, (batch, &fB
atchTarget)); | 403 fDrawBatch = GrNEW_APPEND_TO_RECORDER(fCmdBuffer, DrawBatch, (batch, &fB
atchTarget)); |
404 this->recordTraceMarkersIfNecessary(fDrawBatch); | 404 this->recordTraceMarkersIfNecessary(fDrawBatch); |
405 return; | 405 return; |
406 } | 406 } |
407 | 407 |
408 SkASSERT(&fCmdBuffer.back() == fDrawBatch); | 408 SkASSERT(&fCmdBuffer.back() == fDrawBatch); |
409 if (!fDrawBatch->fBatch->combineIfPossible(batch)) { | 409 if (!fDrawBatch->fBatch->combineIfPossible(batch)) { |
410 this->closeBatch(); | 410 this->closeBatch(); |
411 fDrawBatch = GrNEW_APPEND_TO_RECORDER(fCmdBuffer, DrawBatch, (batch, &fB
atchTarget)); | 411 fDrawBatch = GrNEW_APPEND_TO_RECORDER(fCmdBuffer, DrawBatch, (batch, &fB
atchTarget)); |
412 } | 412 } |
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
772 } | 772 } |
773 } | 773 } |
774 | 774 |
775 void GrInOrderDrawBuffer::willReserveVertexAndIndexSpace(int vertexCount, | 775 void GrInOrderDrawBuffer::willReserveVertexAndIndexSpace(int vertexCount, |
776 size_t vertexStride, | 776 size_t vertexStride, |
777 int indexCount) { | 777 int indexCount) { |
778 this->closeBatch(); | 778 this->closeBatch(); |
779 | 779 |
780 this->INHERITED::willReserveVertexAndIndexSpace(vertexCount, vertexStride, i
ndexCount); | 780 this->INHERITED::willReserveVertexAndIndexSpace(vertexCount, vertexStride, i
ndexCount); |
781 } | 781 } |
OLD | NEW |