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

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

Issue 2312123003: Revert of Restructure flushing relationship between GrContext, GrDrawingManager, and GrResourceCache (Closed)
Patch Set: Created 4 years, 3 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/GrDrawingManager.h ('k') | src/gpu/GrResourceCache.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 "GrDrawContext.h"
8 #include "GrDrawingManager.h" 9 #include "GrDrawingManager.h"
9
10 #include "GrContext.h"
11 #include "GrDrawContext.h"
12 #include "GrDrawTarget.h" 10 #include "GrDrawTarget.h"
13 #include "GrPathRenderingDrawContext.h" 11 #include "GrPathRenderingDrawContext.h"
14 #include "GrResourceProvider.h" 12 #include "GrResourceProvider.h"
15 #include "GrSoftwarePathRenderer.h" 13 #include "GrSoftwarePathRenderer.h"
16 #include "SkSurface_Gpu.h" 14 #include "SkSurface_Gpu.h"
17 #include "SkTTopoSort.h" 15 #include "SkTTopoSort.h"
18 16
19 #include "instanced/InstancedRendering.h" 17 #include "instanced/InstancedRendering.h"
20 18
21 #include "text/GrAtlasTextContext.h" 19 #include "text/GrAtlasTextContext.h"
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 } 67 }
70 } 68 }
71 69
72 void GrDrawingManager::reset() { 70 void GrDrawingManager::reset() {
73 for (int i = 0; i < fDrawTargets.count(); ++i) { 71 for (int i = 0; i < fDrawTargets.count(); ++i) {
74 fDrawTargets[i]->reset(); 72 fDrawTargets[i]->reset();
75 } 73 }
76 fFlushState.reset(); 74 fFlushState.reset();
77 } 75 }
78 76
79 void GrDrawingManager::internalFlush(GrResourceCache::FlushType type) { 77 bool GrDrawingManager::flush() {
80 if (fFlushing || this->wasAbandoned()) { 78 if (fFlushing || this->wasAbandoned()) {
81 return; 79 return false;
82 } 80 }
83 fFlushing = true; 81 fFlushing = true;
84 bool flushed = false; 82 bool flushed = false;
85 SkDEBUGCODE(bool result =) 83 SkDEBUGCODE(bool result =)
86 SkTTopoSort<GrDrawTarget, GrDrawTarget::TopoSortTraits>( &fDrawTargets); 84 SkTTopoSort<GrDrawTarget, GrDrawTarget::TopoSortTraits>( &fDrawTargets);
87 SkASSERT(result); 85 SkASSERT(result);
88 86
89 for (int i = 0; i < fDrawTargets.count(); ++i) { 87 for (int i = 0; i < fDrawTargets.count(); ++i) {
90 fDrawTargets[i]->prepareBatches(&fFlushState); 88 fDrawTargets[i]->prepareBatches(&fFlushState);
91 } 89 }
(...skipping 29 matching lines...) Expand all
121 SkASSERT(fDrawTargets.count() == 1); 119 SkASSERT(fDrawTargets.count() == 1);
122 // Clear out this flag so the topological sort's SkTTopoSort_CheckAllUnm arked check 120 // Clear out this flag so the topological sort's SkTTopoSort_CheckAllUnm arked check
123 // won't bark 121 // won't bark
124 fDrawTargets[0]->resetFlag(GrDrawTarget::kWasOutput_Flag); 122 fDrawTargets[0]->resetFlag(GrDrawTarget::kWasOutput_Flag);
125 } 123 }
126 #else 124 #else
127 fDrawTargets.reset(); 125 fDrawTargets.reset();
128 #endif 126 #endif
129 127
130 fFlushState.reset(); 128 fFlushState.reset();
131 // We always have to notify the cache when it requested a flush so it can re set its state.
132 if (flushed || type == GrResourceCache::FlushType::kCacheRequested) {
133 fContext->getResourceCache()->notifyFlushOccurred(type);
134 }
135 fFlushing = false; 129 fFlushing = false;
130 return flushed;
136 } 131 }
137 132
138 GrDrawTarget* GrDrawingManager::newDrawTarget(GrRenderTarget* rt) { 133 GrDrawTarget* GrDrawingManager::newDrawTarget(GrRenderTarget* rt) {
139 SkASSERT(fContext); 134 SkASSERT(fContext);
140 135
141 #ifndef ENABLE_MDB 136 #ifndef ENABLE_MDB
142 // When MDB is disabled we always just return the single drawTarget 137 // When MDB is disabled we always just return the single drawTarget
143 if (fDrawTargets.count()) { 138 if (fDrawTargets.count()) {
144 SkASSERT(fDrawTargets.count() == 1); 139 SkASSERT(fDrawTargets.count() == 1);
145 // In the non-MDB-world the same drawTarget gets reused for multiple ren der targets. 140 // In the non-MDB-world the same drawTarget gets reused for multiple ren der targets.
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 std::move(colorSpace), s urfaceProps, 216 std::move(colorSpace), s urfaceProps,
222 fContext->getAuditTrail( ), fSingleOwner)); 217 fContext->getAuditTrail( ), fSingleOwner));
223 } 218 }
224 } 219 }
225 220
226 return sk_sp<GrDrawContext>(new GrDrawContext(fContext, this, std::move(rt), 221 return sk_sp<GrDrawContext>(new GrDrawContext(fContext, this, std::move(rt),
227 std::move(colorSpace), surface Props, 222 std::move(colorSpace), surface Props,
228 fContext->getAuditTrail(), 223 fContext->getAuditTrail(),
229 fSingleOwner)); 224 fSingleOwner));
230 } 225 }
OLDNEW
« no previous file with comments | « src/gpu/GrDrawingManager.h ('k') | src/gpu/GrResourceCache.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698