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

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

Issue 1897203002: Implement instanced rendering for simple shapes (Closed) Base URL: https://skia.googlesource.com/skia.git@upload2_requireHWAA
Patch Set: comments 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/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 "GrInstancedRendering.h"
11 #include "GrPathRenderingDrawContext.h" 12 #include "GrPathRenderingDrawContext.h"
12 #include "GrResourceProvider.h" 13 #include "GrResourceProvider.h"
13 #include "GrSoftwarePathRenderer.h" 14 #include "GrSoftwarePathRenderer.h"
14 #include "SkTTopoSort.h" 15 #include "SkTTopoSort.h"
15 16
16 #include "text/GrAtlasTextContext.h" 17 #include "text/GrAtlasTextContext.h"
17 #include "text/GrStencilAndCoverTextContext.h" 18 #include "text/GrStencilAndCoverTextContext.h"
18 19
19 void GrDrawingManager::cleanup() { 20 void GrDrawingManager::cleanup() {
20 for (int i = 0; i < fDrawTargets.count(); ++i) { 21 for (int i = 0; i < fDrawTargets.count(); ++i) {
(...skipping 12 matching lines...) Expand all
33 fPathRendererChain = nullptr; 34 fPathRendererChain = nullptr;
34 SkSafeSetNull(fSoftwarePathRenderer); 35 SkSafeSetNull(fSoftwarePathRenderer);
35 } 36 }
36 37
37 GrDrawingManager::~GrDrawingManager() { 38 GrDrawingManager::~GrDrawingManager() {
38 this->cleanup(); 39 this->cleanup();
39 } 40 }
40 41
41 void GrDrawingManager::abandon() { 42 void GrDrawingManager::abandon() {
42 fAbandoned = true; 43 fAbandoned = true;
44 for (int i = 0; i < fDrawTargets.count(); ++i) {
45 if (GrInstancedRendering* ir = fDrawTargets[i]->instancedRendering()) {
46 ir->resetGpuResources(GrInstancedRendering::ResetType::kAbandon);
47 }
48 }
43 this->cleanup(); 49 this->cleanup();
44 } 50 }
45 51
46 void GrDrawingManager::freeGpuResources() { 52 void GrDrawingManager::freeGpuResources() {
47 // a path renderer may be holding onto resources 53 // a path renderer may be holding onto resources
48 delete fPathRendererChain; 54 delete fPathRendererChain;
49 fPathRendererChain = nullptr; 55 fPathRendererChain = nullptr;
50 SkSafeSetNull(fSoftwarePathRenderer); 56 SkSafeSetNull(fSoftwarePathRenderer);
57 for (int i = 0; i < fDrawTargets.count(); ++i) {
58 if (GrInstancedRendering* ir = fDrawTargets[i]->instancedRendering()) {
59 ir->resetGpuResources(GrInstancedRendering::ResetType::kDestroy);
60 }
61 }
51 } 62 }
52 63
53 void GrDrawingManager::reset() { 64 void GrDrawingManager::reset() {
54 for (int i = 0; i < fDrawTargets.count(); ++i) { 65 for (int i = 0; i < fDrawTargets.count(); ++i) {
55 fDrawTargets[i]->reset(); 66 fDrawTargets[i]->reset();
56 } 67 }
57 fFlushState.reset(); 68 fFlushState.reset();
58 } 69 }
59 70
60 void GrDrawingManager::flush() { 71 void GrDrawingManager::flush() {
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 GrStencilAttachment* sb = fContext->resourceProvider()->attachStencilAtt achment(rt); 187 GrStencilAttachment* sb = fContext->resourceProvider()->attachStencilAtt achment(rt);
177 if (sb) { 188 if (sb) {
178 return new GrPathRenderingDrawContext(fContext, this, rt, surfacePro ps, 189 return new GrPathRenderingDrawContext(fContext, this, rt, surfacePro ps,
179 fContext->getAuditTrail(), fSi ngleOwner); 190 fContext->getAuditTrail(), fSi ngleOwner);
180 } 191 }
181 } 192 }
182 193
183 return new GrDrawContext(fContext, this, rt, surfaceProps, fContext->getAudi tTrail(), 194 return new GrDrawContext(fContext, this, rt, surfaceProps, fContext->getAudi tTrail(),
184 fSingleOwner); 195 fSingleOwner);
185 } 196 }
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