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 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
466 SkString traceString; | 466 SkString traceString; |
467 if (cmd_has_trace_marker(iter->fType)) { | 467 if (cmd_has_trace_marker(iter->fType)) { |
468 traceString = fGpuCmdMarkers[currCmdMarker].toString(); | 468 traceString = fGpuCmdMarkers[currCmdMarker].toString(); |
469 newMarker.fMarker = traceString.c_str(); | 469 newMarker.fMarker = traceString.c_str(); |
470 this->getGpu()->addGpuTraceMarker(&newMarker); | 470 this->getGpu()->addGpuTraceMarker(&newMarker); |
471 ++currCmdMarker; | 471 ++currCmdMarker; |
472 } | 472 } |
473 | 473 |
474 // TODO temporary hack | 474 // TODO temporary hack |
475 if (kDrawBatch_Cmd == strip_trace_bit(iter->fType)) { | 475 if (kDrawBatch_Cmd == strip_trace_bit(iter->fType)) { |
476 DrawBatch* db = reinterpret_cast<DrawBatch*>(iter.get()); | 476 fBatchTarget.flushNext(); |
477 fBatchTarget.flushNext(db->fBatch->numberOfDraws()); | |
478 continue; | 477 continue; |
479 } | 478 } |
480 | 479 |
481 bool isSetState = kSetState_Cmd == strip_trace_bit(iter->fType); | 480 bool isSetState = kSetState_Cmd == strip_trace_bit(iter->fType); |
482 if (isSetState) { | 481 if (isSetState) { |
483 SetState* ss = reinterpret_cast<SetState*>(iter.get()); | 482 SetState* ss = reinterpret_cast<SetState*>(iter.get()); |
484 | 483 |
485 // TODO sometimes we have a prim proc, othertimes we have a GrBatch.
Eventually we will | 484 // TODO sometimes we have a prim proc, othertimes we have a GrBatch.
Eventually we will |
486 // only have GrBatch and we can delete this | 485 // only have GrBatch and we can delete this |
487 if (ss->fPrimitiveProcessor) { | 486 if (ss->fPrimitiveProcessor) { |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
640 SkASSERT(!cmd_has_trace_marker(fCmdBuffer.back().fType)); | 639 SkASSERT(!cmd_has_trace_marker(fCmdBuffer.back().fType)); |
641 const GrTraceMarkerSet& activeTraceMarkers = this->getActiveTraceMarkers(); | 640 const GrTraceMarkerSet& activeTraceMarkers = this->getActiveTraceMarkers(); |
642 if (activeTraceMarkers.count() > 0) { | 641 if (activeTraceMarkers.count() > 0) { |
643 fCmdBuffer.back().fType = add_trace_bit(fCmdBuffer.back().fType); | 642 fCmdBuffer.back().fType = add_trace_bit(fCmdBuffer.back().fType); |
644 fGpuCmdMarkers.push_back(activeTraceMarkers); | 643 fGpuCmdMarkers.push_back(activeTraceMarkers); |
645 } | 644 } |
646 } | 645 } |
647 | 646 |
648 void GrInOrderDrawBuffer::closeBatch() { | 647 void GrInOrderDrawBuffer::closeBatch() { |
649 if (fDrawBatch) { | 648 if (fDrawBatch) { |
650 fBatchTarget.resetNumberOfDraws(); | |
651 fDrawBatch->execute(this, fPrevState); | 649 fDrawBatch->execute(this, fPrevState); |
652 fDrawBatch->fBatch->setNumberOfDraws(fBatchTarget.numberOfDraws()); | |
653 fDrawBatch = NULL; | 650 fDrawBatch = NULL; |
654 } | 651 } |
655 } | 652 } |
656 | 653 |
657 void GrInOrderDrawBuffer::willReserveVertexAndIndexSpace(int vertexCount, | 654 void GrInOrderDrawBuffer::willReserveVertexAndIndexSpace(int vertexCount, |
658 size_t vertexStride, | 655 size_t vertexStride, |
659 int indexCount) { | 656 int indexCount) { |
660 this->closeBatch(); | 657 this->closeBatch(); |
661 | 658 |
662 // We use geometryHints() to know whether to flush the draw buffer. We | 659 // We use geometryHints() to know whether to flush the draw buffer. We |
(...skipping 15 matching lines...) Expand all Loading... |
678 int vcount = vertexCount; | 675 int vcount = vertexCount; |
679 int icount = indexCount; | 676 int icount = indexCount; |
680 | 677 |
681 if (!insideGeoPush && | 678 if (!insideGeoPush && |
682 !unreleasedVertexSpace && | 679 !unreleasedVertexSpace && |
683 !unreleasedIndexSpace && | 680 !unreleasedIndexSpace && |
684 this->geometryHints(vertexStride, &vcount, &icount)) { | 681 this->geometryHints(vertexStride, &vcount, &icount)) { |
685 this->flush(); | 682 this->flush(); |
686 } | 683 } |
687 } | 684 } |
OLD | NEW |