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

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

Issue 1131553002: Isolate GrBufferAllocPools inside GrBatchTarget (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: update to ToT Created 5 years, 7 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/GrDrawTarget.h ('k') | src/gpu/GrGpu.h » ('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 /* 2 /*
3 * Copyright 2010 Google Inc. 3 * Copyright 2010 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 #include "GrDrawTarget.h" 9 #include "GrDrawTarget.h"
10 10
11 #include "GrBatch.h" 11 #include "GrBatch.h"
12 #include "GrBufferAllocPool.h"
13 #include "GrContext.h" 12 #include "GrContext.h"
14 #include "GrDrawTargetCaps.h" 13 #include "GrDrawTargetCaps.h"
15 #include "GrPath.h" 14 #include "GrPath.h"
16 #include "GrPipeline.h" 15 #include "GrPipeline.h"
17 #include "GrMemoryPool.h" 16 #include "GrMemoryPool.h"
18 #include "GrRectBatch.h" 17 #include "GrRectBatch.h"
19 #include "GrRenderTarget.h" 18 #include "GrRenderTarget.h"
20 #include "GrRenderTargetPriv.h" 19 #include "GrRenderTargetPriv.h"
21 #include "GrSurfacePriv.h" 20 #include "GrSurfacePriv.h"
22 #include "GrTemplates.h" 21 #include "GrTemplates.h"
23 #include "GrTexture.h" 22 #include "GrTexture.h"
24 #include "GrVertexBuffer.h" 23 #include "GrVertexBuffer.h"
25 24
26 #include "SkStrokeRec.h" 25 #include "SkStrokeRec.h"
27 26
28 //////////////////////////////////////////////////////////////////////////////// 27 ////////////////////////////////////////////////////////////////////////////////
29 28
30 #define DEBUG_INVAL_BUFFER 0xdeadcafe 29 #define DEBUG_INVAL_BUFFER 0xdeadcafe
31 #define DEBUG_INVAL_START_IDX -1 30 #define DEBUG_INVAL_START_IDX -1
32 31
33 GrDrawTarget::GrDrawTarget(GrContext* context, 32 GrDrawTarget::GrDrawTarget(GrContext* context)
34 GrVertexBufferAllocPool* vpool,
35 GrIndexBufferAllocPool* ipool)
36 : fContext(context) 33 : fContext(context)
37 , fCaps(SkRef(context->getGpu()->caps())) 34 , fCaps(SkRef(context->getGpu()->caps()))
38 , fGpuTraceMarkerCount(0) 35 , fGpuTraceMarkerCount(0)
39 , fVertexPool(vpool)
40 , fIndexPool(ipool)
41 , fFlushing(false) { 36 , fFlushing(false) {
42 SkASSERT(context); 37 SkASSERT(context);
43 } 38 }
44 39
45 //////////////////////////////////////////////////////////////////////////////// 40 ////////////////////////////////////////////////////////////////////////////////
46 41
47 bool GrDrawTarget::setupDstReadIfNecessary(const GrPipelineBuilder& pipelineBuil der, 42 bool GrDrawTarget::setupDstReadIfNecessary(const GrPipelineBuilder& pipelineBuil der,
48 const GrProcOptInfo& colorPOI, 43 const GrProcOptInfo& colorPOI,
49 const GrProcOptInfo& coveragePOI, 44 const GrProcOptInfo& coveragePOI,
50 GrDeviceCoordTexture* dstCopy, 45 GrDeviceCoordTexture* dstCopy,
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 SkIPoint dstPoint = {0, 0}; 101 SkIPoint dstPoint = {0, 0};
107 if (this->copySurface(copy, rt, copyRect, dstPoint)) { 102 if (this->copySurface(copy, rt, copyRect, dstPoint)) {
108 dstCopy->setTexture(copy); 103 dstCopy->setTexture(copy);
109 dstCopy->setOffset(copyRect.fLeft, copyRect.fTop); 104 dstCopy->setOffset(copyRect.fLeft, copyRect.fTop);
110 return true; 105 return true;
111 } else { 106 } else {
112 return false; 107 return false;
113 } 108 }
114 } 109 }
115 110
116 void GrDrawTarget::reset() {
117 fVertexPool->reset();
118 fIndexPool->reset();
119
120 this->onReset();
121 }
122
123 void GrDrawTarget::flush() { 111 void GrDrawTarget::flush() {
124 if (fFlushing) { 112 if (fFlushing) {
125 return; 113 return;
126 } 114 }
127 fFlushing = true; 115 fFlushing = true;
128 116
129 this->getGpu()->saveActiveTraceMarkers(); 117 this->getGpu()->saveActiveTraceMarkers();
130 118
131 this->onFlush(); 119 this->onFlush();
132 120
(...skipping 656 matching lines...) Expand 10 before | Expand all | Expand 10 after
789 GrPipelineBuilder::AutoRestoreFragmentProcessors* a rfp, 777 GrPipelineBuilder::AutoRestoreFragmentProcessors* a rfp,
790 GrPipelineBuilder::AutoRestoreStencil* ars, 778 GrPipelineBuilder::AutoRestoreStencil* ars,
791 GrScissorState* scissorState, 779 GrScissorState* scissorState,
792 const SkRect* devBounds) { 780 const SkRect* devBounds) {
793 return fClipMaskManager.setupClipping(pipelineBuilder, 781 return fClipMaskManager.setupClipping(pipelineBuilder,
794 arfp, 782 arfp,
795 ars, 783 ars,
796 scissorState, 784 scissorState,
797 devBounds); 785 devBounds);
798 } 786 }
OLDNEW
« no previous file with comments | « src/gpu/GrDrawTarget.h ('k') | src/gpu/GrGpu.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698