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 541 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
552 bool insideGeoPush = fGeoPoolStateStack.count() > 1; | 552 bool insideGeoPush = fGeoPoolStateStack.count() > 1; |
553 | 553 |
554 bool unreleasedVertexSpace = | 554 bool unreleasedVertexSpace = |
555 !vertexCount && | 555 !vertexCount && |
556 kReserved_GeometrySrcType == this->getGeomSrc().fVertexSrc; | 556 kReserved_GeometrySrcType == this->getGeomSrc().fVertexSrc; |
557 | 557 |
558 bool unreleasedIndexSpace = | 558 bool unreleasedIndexSpace = |
559 !indexCount && | 559 !indexCount && |
560 kReserved_GeometrySrcType == this->getGeomSrc().fIndexSrc; | 560 kReserved_GeometrySrcType == this->getGeomSrc().fIndexSrc; |
561 | 561 |
562 // we don't want to finalize any reserved geom on the target since | |
563 // we don't know that the client has finished writing to it. | |
564 bool targetHasReservedGeom = fDstGpu->hasReservedVerticesOrIndices(); | |
565 | |
566 int vcount = vertexCount; | 562 int vcount = vertexCount; |
567 int icount = indexCount; | 563 int icount = indexCount; |
568 | 564 |
569 if (!insideGeoPush && | 565 if (!insideGeoPush && |
570 !unreleasedVertexSpace && | 566 !unreleasedVertexSpace && |
571 !unreleasedIndexSpace && | 567 !unreleasedIndexSpace && |
572 !targetHasReservedGeom && | |
573 this->geometryHints(&vcount, &icount)) { | 568 this->geometryHints(&vcount, &icount)) { |
574 this->flush(); | 569 this->flush(); |
575 } | 570 } |
576 } | 571 } |
577 | 572 |
578 bool GrInOrderDrawBuffer::geometryHints(int* vertexCount, | 573 bool GrInOrderDrawBuffer::geometryHints(int* vertexCount, |
579 int* indexCount) const { | 574 int* indexCount) const { |
580 // we will recommend a flush if the data could fit in a single | 575 // we will recommend a flush if the data could fit in a single |
581 // preallocated buffer but none are left and it can't fit | 576 // preallocated buffer but none are left and it can't fit |
582 // in the current buffer (which may not be prealloced). | 577 // in the current buffer (which may not be prealloced). |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
729 | 724 |
730 void GrInOrderDrawBuffer::recordTraceMarkersIfNecessary() { | 725 void GrInOrderDrawBuffer::recordTraceMarkersIfNecessary() { |
731 SkASSERT(!fCmdBuffer.empty()); | 726 SkASSERT(!fCmdBuffer.empty()); |
732 SkASSERT(!cmd_has_trace_marker(fCmdBuffer.back().fType)); | 727 SkASSERT(!cmd_has_trace_marker(fCmdBuffer.back().fType)); |
733 const GrTraceMarkerSet& activeTraceMarkers = this->getActiveTraceMarkers(); | 728 const GrTraceMarkerSet& activeTraceMarkers = this->getActiveTraceMarkers(); |
734 if (activeTraceMarkers.count() > 0) { | 729 if (activeTraceMarkers.count() > 0) { |
735 fCmdBuffer.back().fType = add_trace_bit(fCmdBuffer.back().fType); | 730 fCmdBuffer.back().fType = add_trace_bit(fCmdBuffer.back().fType); |
736 fGpuCmdMarkers.push_back(activeTraceMarkers); | 731 fGpuCmdMarkers.push_back(activeTraceMarkers); |
737 } | 732 } |
738 } | 733 } |
OLD | NEW |