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

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

Issue 1417263002: Revert of Dependencies are now added between the drawTargets in GrPipeline (Closed) Base URL: https://skia.googlesource.com/skia.git@mdb-adddeps
Patch Set: Created 5 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/GrPipeline.cpp ('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 /* 2 /*
3 * Copyright 2011 Google Inc. 3 * Copyright 2011 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 9
10 #include "GrRenderTarget.h" 10 #include "GrRenderTarget.h"
11 11
12 #include "GrContext.h" 12 #include "GrContext.h"
13 #include "GrDrawContext.h" 13 #include "GrDrawContext.h"
14 #include "GrDrawTarget.h" 14 #include "GrDrawTarget.h"
15 #include "GrGpu.h" 15 #include "GrGpu.h"
16 #include "GrRenderTargetPriv.h" 16 #include "GrRenderTargetPriv.h"
17 #include "GrStencilAttachment.h" 17 #include "GrStencilAttachment.h"
18 18
19 GrRenderTarget::~GrRenderTarget() {
20 if (fLastDrawTarget) {
21 fLastDrawTarget->clearRT();
22 }
23 SkSafeUnref(fLastDrawTarget);
24 }
25
26 void GrRenderTarget::discard() { 19 void GrRenderTarget::discard() {
27 // go through context so that all necessary flushing occurs 20 // go through context so that all necessary flushing occurs
28 GrContext* context = this->getContext(); 21 GrContext* context = this->getContext();
29 if (!context) { 22 if (!context) {
30 return; 23 return;
31 } 24 }
32 25
33 SkAutoTUnref<GrDrawContext> drawContext(context->drawContext(this)); 26 SkAutoTUnref<GrDrawContext> drawContext(context->drawContext(this));
34 if (!drawContext) { 27 if (!drawContext) {
35 return; 28 return;
(...skipping 21 matching lines...) Expand all
57 fResolveRect.setLargestInverted(); 50 fResolveRect.setLargestInverted();
58 } else { 51 } else {
59 if (!fResolveRect.intersect(0, 0, this->width(), this->height())) { 52 if (!fResolveRect.intersect(0, 0, this->width(), this->height())) {
60 fResolveRect.setLargestInverted(); 53 fResolveRect.setLargestInverted();
61 } 54 }
62 } 55 }
63 } 56 }
64 57
65 void GrRenderTarget::onRelease() { 58 void GrRenderTarget::onRelease() {
66 SkSafeSetNull(fStencilAttachment); 59 SkSafeSetNull(fStencilAttachment);
60 fLastDrawTarget = nullptr;
67 61
68 INHERITED::onRelease(); 62 INHERITED::onRelease();
69 } 63 }
70 64
71 void GrRenderTarget::onAbandon() { 65 void GrRenderTarget::onAbandon() {
72 SkSafeSetNull(fStencilAttachment); 66 SkSafeSetNull(fStencilAttachment);
67 fLastDrawTarget = nullptr;
73 68
74 INHERITED::onAbandon(); 69 INHERITED::onAbandon();
75 } 70 }
76 71
77 void GrRenderTarget::setLastDrawTarget(GrDrawTarget* dt) { 72 void GrRenderTarget::setLastDrawTarget(GrDrawTarget* dt) {
78 if (fLastDrawTarget) { 73 if (fLastDrawTarget) {
79 // The non-MDB world never closes so we can't check this condition
80 #ifdef ENABLE_MDB
81 SkASSERT(fLastDrawTarget->isClosed()); 74 SkASSERT(fLastDrawTarget->isClosed());
82 #endif
83 fLastDrawTarget->clearRT();
84 } 75 }
85 76
86 SkRefCnt_SafeAssign(fLastDrawTarget, dt); 77 fLastDrawTarget = dt;
87 } 78 }
88 79
89 /////////////////////////////////////////////////////////////////////////////// 80 ///////////////////////////////////////////////////////////////////////////////
90 81
91 bool GrRenderTargetPriv::attachStencilAttachment(GrStencilAttachment* stencil) { 82 bool GrRenderTargetPriv::attachStencilAttachment(GrStencilAttachment* stencil) {
92 if (!stencil && !fRenderTarget->fStencilAttachment) { 83 if (!stencil && !fRenderTarget->fStencilAttachment) {
93 // No need to do any work since we currently don't have a stencil attach ment and 84 // No need to do any work since we currently don't have a stencil attach ment and
94 // we're not acctually adding one. 85 // we're not acctually adding one.
95 return true; 86 return true;
96 } 87 }
97 fRenderTarget->fStencilAttachment = stencil; 88 fRenderTarget->fStencilAttachment = stencil;
98 if (!fRenderTarget->completeStencilAttachment()) { 89 if (!fRenderTarget->completeStencilAttachment()) {
99 SkSafeSetNull(fRenderTarget->fStencilAttachment); 90 SkSafeSetNull(fRenderTarget->fStencilAttachment);
100 return false; 91 return false;
101 } 92 }
102 return true; 93 return true;
103 } 94 }
OLDNEW
« no previous file with comments | « src/gpu/GrPipeline.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698