Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(42)

Side by Side Diff: src/gpu/GrInOrderDrawBuffer.cpp

Issue 930953003: Minor refactoring (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/gpu/GrInOrderDrawBuffer.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 623 matching lines...) Expand 10 before | Expand all | Expand 10 after
634 fCmdBuffer.back().fType = add_trace_bit(fCmdBuffer.back().fType); 634 fCmdBuffer.back().fType = add_trace_bit(fCmdBuffer.back().fType);
635 fGpuCmdMarkers.push_back(activeTraceMarkers); 635 fGpuCmdMarkers.push_back(activeTraceMarkers);
636 } 636 }
637 } 637 }
638 638
639 void GrInOrderDrawBuffer::willReserveVertexAndIndexSpace(int vertexCount, 639 void GrInOrderDrawBuffer::willReserveVertexAndIndexSpace(int vertexCount,
640 size_t vertexStride, 640 size_t vertexStride,
641 int indexCount) { 641 int indexCount) {
642 this->closeBatch(); 642 this->closeBatch();
643 643
644 // We use geometryHints() to know whether to flush the draw buffer. We 644 this->INHERITED::willReserveVertexAndIndexSpace(vertexCount, vertexStride, i ndexCount);
645 // can't flush if we are inside an unbalanced pushGeometrySource.
646 // Moreover, flushing blows away vertex and index data that was
647 // previously reserved. So if the vertex or index data is pulled from
648 // reserved space and won't be released by this request then we can't
649 // flush.
650 bool insideGeoPush = this->getGeoPoolStateStack().count() > 1;
651
652 bool unreleasedVertexSpace =
653 !vertexCount &&
654 kReserved_GeometrySrcType == this->getGeomSrc().fVertexSrc;
655
656 bool unreleasedIndexSpace =
657 !indexCount &&
658 kReserved_GeometrySrcType == this->getGeomSrc().fIndexSrc;
659
660 int vcount = vertexCount;
661 int icount = indexCount;
662
663 if (!insideGeoPush &&
664 !unreleasedVertexSpace &&
665 !unreleasedIndexSpace &&
666 this->geometryHints(vertexStride, &vcount, &icount)) {
667 this->flush();
668 }
669 } 645 }
OLDNEW
« no previous file with comments | « src/gpu/GrInOrderDrawBuffer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698