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

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

Issue 1225923010: Refugee from Dead Machine 4: MDB Monster Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Last update from dead machine Created 4 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.cpp ('k') | src/gpu/GrFontAtlasSizes.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 #define ENABLE_MDB 1
9
8 #include "GrAtlasTextContext.h" 10 #include "GrAtlasTextContext.h"
9 #include "GrDrawContext.h" 11 #include "GrDrawContext.h"
10 #include "GrDrawingManager.h" 12 #include "GrDrawingManager.h"
11 #include "GrDrawTarget.h" 13 #include "GrDrawTarget.h"
12 #include "GrResourceProvider.h" 14 #include "GrResourceProvider.h"
13 #include "GrSoftwarePathRenderer.h" 15 #include "GrSoftwarePathRenderer.h"
14 #include "GrStencilAndCoverTextContext.h" 16 #include "GrStencilAndCoverTextContext.h"
15 #include "SkTTopoSort.h" 17 #include "SkTTopoSort.h"
16 18
17 //#define ENABLE_MDB 1
18
19 void GrDrawingManager::cleanup() { 19 void GrDrawingManager::cleanup() {
20 for (int i = 0; i < fDrawTargets.count(); ++i) { 20 for (int i = 0; i < fDrawTargets.count(); ++i) {
21 fDrawTargets[i]->makeClosed(); // no drawTarget should receive a new co mmand after this
22 fDrawTargets[i]->clearRT();
21 fDrawTargets[i]->unref(); 23 fDrawTargets[i]->unref();
22 } 24 }
23 25
24 fDrawTargets.reset(); 26 fDrawTargets.reset();
25 27
26 delete fNVPRTextContext; 28 delete fNVPRTextContext;
27 fNVPRTextContext = nullptr; 29 fNVPRTextContext = nullptr;
28 30
29 for (int i = 0; i < kNumPixelGeometries; ++i) { 31 for (int i = 0; i < kNumPixelGeometries; ++i) {
30 delete fTextContexts[i][0]; 32 delete fTextContexts[i][0];
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 SkASSERT(result); 69 SkASSERT(result);
68 70
69 #if 0 71 #if 0
70 for (int i = 0; i < fDrawTargets.count(); ++i) { 72 for (int i = 0; i < fDrawTargets.count(); ++i) {
71 SkDEBUGCODE(fDrawTargets[i]->dump();) 73 SkDEBUGCODE(fDrawTargets[i]->dump();)
72 } 74 }
73 #endif 75 #endif
74 76
75 for (int i = 0; i < fDrawTargets.count(); ++i) { 77 for (int i = 0; i < fDrawTargets.count(); ++i) {
76 fDrawTargets[i]->prepareBatches(&fFlushState); 78 fDrawTargets[i]->prepareBatches(&fFlushState);
79 // this causes an assert to fire
80 // fDrawTargets[i]->unref();
77 } 81 }
78 82
79 // Upload all data to the GPU 83 // Upload all data to the GPU
80 fFlushState.preIssueDraws(); 84 fFlushState.preIssueDraws();
81 85
82 for (int i = 0; i < fDrawTargets.count(); ++i) { 86 for (int i = 0; i < fDrawTargets.count(); ++i) {
83 fDrawTargets[i]->drawBatches(&fFlushState); 87 fDrawTargets[i]->drawBatches(&fFlushState);
84 } 88 }
85 89
86 SkASSERT(fFlushState.lastFlushedToken() == fFlushState.currentToken()); 90 SkASSERT(fFlushState.lastFlushedToken() == fFlushState.currentToken2());
87 91
88 #ifndef ENABLE_MDB 92 #ifndef ENABLE_MDB
89 // When MDB is disabled we keep reusing the same drawTarget 93 // When MDB is disabled we keep reusing the same drawTarget
90 if (fDrawTargets.count()) { 94 if (fDrawTargets.count()) {
91 SkASSERT(fDrawTargets.count() == 1); 95 SkASSERT(fDrawTargets.count() == 1);
92 fDrawTargets[0]->resetFlag(GrDrawTarget::kWasOutput_Flag); 96 fDrawTargets[0]->resetFlag(GrDrawTarget::kWasOutput_Flag);
93 } 97 }
94 #endif 98 #endif
95 99
96 for (int i = 0; i < fDrawTargets.count(); ++i) { 100 for (int i = 0; i < fDrawTargets.count(); ++i) {
97 fDrawTargets[i]->reset(); 101 fDrawTargets[i]->reset();
98 } 102 }
99 fFlushState.reset(); 103 fFlushState.reset();
104 fDrawTargets.reset();
100 } 105 }
101 106
102 GrTextContext* GrDrawingManager::textContext(const SkSurfaceProps& props, 107 GrTextContext* GrDrawingManager::textContext(const SkSurfaceProps& props,
103 GrRenderTarget* rt) { 108 GrRenderTarget* rt) {
104 if (this->abandoned()) { 109 if (this->abandoned()) {
105 return nullptr; 110 return nullptr;
106 } 111 }
107 112
108 SkASSERT(props.pixelGeometry() < kNumPixelGeometries); 113 SkASSERT(props.pixelGeometry() < kNumPixelGeometries);
109 bool useDIF = props.isUseDeviceIndependentFonts(); 114 bool useDIF = props.isUseDeviceIndependentFonts();
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 } 179 }
175 180
176 GrDrawContext* GrDrawingManager::drawContext(GrRenderTarget* rt, 181 GrDrawContext* GrDrawingManager::drawContext(GrRenderTarget* rt,
177 const SkSurfaceProps* surfaceProps) { 182 const SkSurfaceProps* surfaceProps) {
178 if (this->abandoned()) { 183 if (this->abandoned()) {
179 return nullptr; 184 return nullptr;
180 } 185 }
181 186
182 return new GrDrawContext(this, rt, surfaceProps); 187 return new GrDrawContext(this, rt, surfaceProps);
183 } 188 }
OLDNEW
« no previous file with comments | « src/gpu/GrDrawTarget.cpp ('k') | src/gpu/GrFontAtlasSizes.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698