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

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

Issue 707953004: cleaning up geometry handling in gpu (Closed) Base URL: https://skia.googlesource.com/skia.git@solo_gpu
Patch Set: rebase try 2 Created 6 years, 1 month 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/GrGpu.cpp ('k') | src/gpu/gl/GrGpuGL.cpp » ('j') | 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 541 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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 }
OLDNEW
« no previous file with comments | « src/gpu/GrGpu.cpp ('k') | src/gpu/gl/GrGpuGL.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698