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

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

Issue 2182783004: Add test configs for instanced rendering (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Add test configs for instanced rendering Created 4 years, 4 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"
(...skipping 27 matching lines...) Expand all
38 SkSafeSetNull(fSoftwarePathRenderer); 38 SkSafeSetNull(fSoftwarePathRenderer);
39 } 39 }
40 40
41 GrDrawingManager::~GrDrawingManager() { 41 GrDrawingManager::~GrDrawingManager() {
42 this->cleanup(); 42 this->cleanup();
43 } 43 }
44 44
45 void GrDrawingManager::abandon() { 45 void GrDrawingManager::abandon() {
46 fAbandoned = true; 46 fAbandoned = true;
47 for (int i = 0; i < fDrawTargets.count(); ++i) { 47 for (int i = 0; i < fDrawTargets.count(); ++i) {
48 if (InstancedRendering* ir = fDrawTargets[i]->instancedRendering()) { 48 if (GrCaps::InstancedSupport::kNone != fContext->caps()->instancedSuppor t()) {
49 InstancedRendering* ir = fDrawTargets[i]->instancedRendering();
49 ir->resetGpuResources(InstancedRendering::ResetType::kAbandon); 50 ir->resetGpuResources(InstancedRendering::ResetType::kAbandon);
50 } 51 }
51 } 52 }
52 this->cleanup(); 53 this->cleanup();
53 } 54 }
54 55
55 void GrDrawingManager::freeGpuResources() { 56 void GrDrawingManager::freeGpuResources() {
56 // a path renderer may be holding onto resources 57 // a path renderer may be holding onto resources
57 delete fPathRendererChain; 58 delete fPathRendererChain;
58 fPathRendererChain = nullptr; 59 fPathRendererChain = nullptr;
59 SkSafeSetNull(fSoftwarePathRenderer); 60 SkSafeSetNull(fSoftwarePathRenderer);
60 for (int i = 0; i < fDrawTargets.count(); ++i) { 61 for (int i = 0; i < fDrawTargets.count(); ++i) {
61 if (InstancedRendering* ir = fDrawTargets[i]->instancedRendering()) { 62 if (GrCaps::InstancedSupport::kNone != fContext->caps()->instancedSuppor t()) {
63 InstancedRendering* ir = fDrawTargets[i]->instancedRendering();
62 ir->resetGpuResources(InstancedRendering::ResetType::kDestroy); 64 ir->resetGpuResources(InstancedRendering::ResetType::kDestroy);
63 } 65 }
64 } 66 }
65 } 67 }
66 68
67 void GrDrawingManager::reset() { 69 void GrDrawingManager::reset() {
68 for (int i = 0; i < fDrawTargets.count(); ++i) { 70 for (int i = 0; i < fDrawTargets.count(); ++i) {
69 fDrawTargets[i]->reset(); 71 fDrawTargets[i]->reset();
70 } 72 }
71 fFlushState.reset(); 73 fFlushState.reset();
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 std::move(colorSpace), s urfaceProps, 198 std::move(colorSpace), s urfaceProps,
197 fContext->getAuditTrail( ), fSingleOwner)); 199 fContext->getAuditTrail( ), fSingleOwner));
198 } 200 }
199 } 201 }
200 202
201 return sk_sp<GrDrawContext>(new GrDrawContext(fContext, this, std::move(rt), 203 return sk_sp<GrDrawContext>(new GrDrawContext(fContext, this, std::move(rt),
202 std::move(colorSpace), surface Props, 204 std::move(colorSpace), surface Props,
203 fContext->getAuditTrail(), 205 fContext->getAuditTrail(),
204 fSingleOwner)); 206 fSingleOwner));
205 } 207 }
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