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

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

Issue 1287973003: Check for xfer barriers in GrBatch, auto-issue barriers in GrGpu (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Address comment Created 5 years, 4 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/GrGpu.cpp ('k') | src/gpu/GrInOrderCommandBuilder.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 * Copyright 2015 Google Inc. 2 * Copyright 2015 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 "GrImmediateDrawTarget.h" 8 #include "GrImmediateDrawTarget.h"
9 9
10 #include "GrGpu.h" 10 #include "GrGpu.h"
11 #include "GrPipeline.h" 11 #include "GrPipeline.h"
12 #include "GrRenderTarget.h" 12 #include "GrRenderTarget.h"
13 #include "SkRect.h" 13 #include "SkRect.h"
14 #include "SkTypes.h" 14 #include "SkTypes.h"
15 15
16 #include "batches/GrBatch.h" 16 #include "batches/GrBatch.h"
17 17
18 GrImmediateDrawTarget::GrImmediateDrawTarget(GrContext* context) 18 GrImmediateDrawTarget::GrImmediateDrawTarget(GrContext* context)
19 : INHERITED(context) 19 : INHERITED(context)
20 , fBatchTarget(this->getGpu()) 20 , fBatchTarget(this->getGpu())
21 , fDrawID(0) { 21 , fDrawID(0) {
22 } 22 }
23 23
24 GrImmediateDrawTarget::~GrImmediateDrawTarget() { 24 GrImmediateDrawTarget::~GrImmediateDrawTarget() {
25 this->reset(); 25 this->reset();
26 } 26 }
27 27
28 void GrImmediateDrawTarget::onDrawBatch(GrBatch* batch) { 28 void GrImmediateDrawTarget::onDrawBatch(GrBatch* batch) {
29 const GrXferProcessor& xp = *batch->pipeline()->getXferProcessor();
30 GrRenderTarget* rt = batch->pipeline()->getRenderTarget();
31
32 GrXferBarrierType barrierType;
33 if (xp.willNeedXferBarrier(rt, *this->caps(), &barrierType)) {
34 this->getGpu()->xferBarrier(rt, barrierType);
35 }
36
37 fBatchTarget.resetNumberOfDraws(); 29 fBatchTarget.resetNumberOfDraws();
38 30
39 batch->generateGeometry(&fBatchTarget); 31 batch->generateGeometry(&fBatchTarget);
40 batch->setNumberOfDraws(fBatchTarget.numberOfDraws()); 32 batch->setNumberOfDraws(fBatchTarget.numberOfDraws());
41 33
42 fBatchTarget.preFlush(); 34 fBatchTarget.preFlush();
43 fBatchTarget.flushNext(batch->numberOfDraws()); 35 fBatchTarget.flushNext(batch->numberOfDraws());
44 fBatchTarget.postFlush(); 36 fBatchTarget.postFlush();
45 } 37 }
46 38
(...skipping 23 matching lines...) Expand all
70 this->getGpu()->discard(renderTarget); 62 this->getGpu()->discard(renderTarget);
71 } 63 }
72 64
73 void GrImmediateDrawTarget::onReset() { 65 void GrImmediateDrawTarget::onReset() {
74 fBatchTarget.reset(); 66 fBatchTarget.reset();
75 } 67 }
76 68
77 void GrImmediateDrawTarget::onFlush() { 69 void GrImmediateDrawTarget::onFlush() {
78 ++fDrawID; 70 ++fDrawID;
79 } 71 }
OLDNEW
« no previous file with comments | « src/gpu/GrGpu.cpp ('k') | src/gpu/GrInOrderCommandBuilder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698