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

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

Issue 2123693002: Revert of Begin instanced rendering for simple shapes (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 5 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/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 * 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 "GrDrawContext.h"
9 #include "GrDrawingManager.h" 9 #include "GrDrawingManager.h"
10 #include "GrDrawTarget.h" 10 #include "GrDrawTarget.h"
11 #include "GrPathRenderingDrawContext.h" 11 #include "GrPathRenderingDrawContext.h"
12 #include "GrResourceProvider.h" 12 #include "GrResourceProvider.h"
13 #include "GrSoftwarePathRenderer.h" 13 #include "GrSoftwarePathRenderer.h"
14 #include "SkTTopoSort.h" 14 #include "SkTTopoSort.h"
15 15
16 #include "instanced/InstancedRendering.h"
17
18 #include "text/GrAtlasTextContext.h" 16 #include "text/GrAtlasTextContext.h"
19 #include "text/GrStencilAndCoverTextContext.h" 17 #include "text/GrStencilAndCoverTextContext.h"
20 18
21 using gr_instanced::InstancedRendering;
22
23 void GrDrawingManager::cleanup() { 19 void GrDrawingManager::cleanup() {
24 for (int i = 0; i < fDrawTargets.count(); ++i) { 20 for (int i = 0; i < fDrawTargets.count(); ++i) {
25 fDrawTargets[i]->makeClosed(); // no drawTarget should receive a new co mmand after this 21 fDrawTargets[i]->makeClosed(); // no drawTarget should receive a new co mmand after this
26 fDrawTargets[i]->clearRT(); 22 fDrawTargets[i]->clearRT();
27 23
28 // We shouldn't need to do this, but it turns out some clients still hol d onto drawtargets 24 // We shouldn't need to do this, but it turns out some clients still hol d onto drawtargets
29 // after a cleanup 25 // after a cleanup
30 fDrawTargets[i]->reset(); 26 fDrawTargets[i]->reset();
31 fDrawTargets[i]->unref(); 27 fDrawTargets[i]->unref();
32 } 28 }
33 29
34 fDrawTargets.reset(); 30 fDrawTargets.reset();
35 31
36 delete fPathRendererChain; 32 delete fPathRendererChain;
37 fPathRendererChain = nullptr; 33 fPathRendererChain = nullptr;
38 SkSafeSetNull(fSoftwarePathRenderer); 34 SkSafeSetNull(fSoftwarePathRenderer);
39 } 35 }
40 36
41 GrDrawingManager::~GrDrawingManager() { 37 GrDrawingManager::~GrDrawingManager() {
42 this->cleanup(); 38 this->cleanup();
43 } 39 }
44 40
45 void GrDrawingManager::abandon() { 41 void GrDrawingManager::abandon() {
46 fAbandoned = true; 42 fAbandoned = true;
47 for (int i = 0; i < fDrawTargets.count(); ++i) {
48 if (InstancedRendering* ir = fDrawTargets[i]->instancedRendering()) {
49 ir->resetGpuResources(InstancedRendering::ResetType::kAbandon);
50 }
51 }
52 this->cleanup(); 43 this->cleanup();
53 } 44 }
54 45
55 void GrDrawingManager::freeGpuResources() { 46 void GrDrawingManager::freeGpuResources() {
56 // a path renderer may be holding onto resources 47 // a path renderer may be holding onto resources
57 delete fPathRendererChain; 48 delete fPathRendererChain;
58 fPathRendererChain = nullptr; 49 fPathRendererChain = nullptr;
59 SkSafeSetNull(fSoftwarePathRenderer); 50 SkSafeSetNull(fSoftwarePathRenderer);
60 for (int i = 0; i < fDrawTargets.count(); ++i) {
61 if (InstancedRendering* ir = fDrawTargets[i]->instancedRendering()) {
62 ir->resetGpuResources(InstancedRendering::ResetType::kDestroy);
63 }
64 }
65 } 51 }
66 52
67 void GrDrawingManager::reset() { 53 void GrDrawingManager::reset() {
68 for (int i = 0; i < fDrawTargets.count(); ++i) { 54 for (int i = 0; i < fDrawTargets.count(); ++i) {
69 fDrawTargets[i]->reset(); 55 fDrawTargets[i]->reset();
70 } 56 }
71 fFlushState.reset(); 57 fFlushState.reset();
72 } 58 }
73 59
74 void GrDrawingManager::flush() { 60 void GrDrawingManager::flush() {
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 fContext, this, std::mov e(rt), 180 fContext, this, std::mov e(rt),
195 surfaceProps, 181 surfaceProps,
196 fContext->getAuditTrail( ), fSingleOwner)); 182 fContext->getAuditTrail( ), fSingleOwner));
197 } 183 }
198 } 184 }
199 185
200 return sk_sp<GrDrawContext>(new GrDrawContext(fContext, this, std::move(rt), surfaceProps, 186 return sk_sp<GrDrawContext>(new GrDrawContext(fContext, this, std::move(rt), surfaceProps,
201 fContext->getAuditTrail(), 187 fContext->getAuditTrail(),
202 fSingleOwner)); 188 fSingleOwner));
203 } 189 }
OLDNEW
« no previous file with comments | « src/gpu/GrDrawTarget.cpp ('k') | src/gpu/GrGpu.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698