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

Side by Side Diff: src/gpu/instanced/InstancedRendering.cpp

Issue 2525773002: Make GrMemoryPool play nice with bucketing allocators. (Closed)
Patch Set: Proper naming; kill friend Created 4 years 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
OLDNEW
1 /* 1 /*
2 * Copyright 2016 Google Inc. 2 * Copyright 2016 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 "InstancedRendering.h" 8 #include "InstancedRendering.h"
9 9
10 #include "GrBatchFlushState.h" 10 #include "GrBatchFlushState.h"
11 #include "GrCaps.h" 11 #include "GrCaps.h"
12 #include "GrPipeline.h" 12 #include "GrPipeline.h"
13 #include "GrResourceProvider.h" 13 #include "GrResourceProvider.h"
14 #include "instanced/InstanceProcessor.h" 14 #include "instanced/InstanceProcessor.h"
15 15
16 namespace gr_instanced { 16 namespace gr_instanced {
17 17
18 InstancedRendering::InstancedRendering(GrGpu* gpu) 18 InstancedRendering::InstancedRendering(GrGpu* gpu)
19 : fGpu(SkRef(gpu)), 19 : fGpu(SkRef(gpu)),
20 fState(State::kRecordingDraws), 20 fState(State::kRecordingDraws),
21 fDrawPool(1024 * sizeof(Batch::Draw), 1024 * sizeof(Batch::Draw)) { 21 fDrawPool(1024, 1024) {
22 } 22 }
23 23
24 GrDrawBatch* InstancedRendering::recordRect(const SkRect& rect, const SkMatrix& viewMatrix, 24 GrDrawBatch* InstancedRendering::recordRect(const SkRect& rect, const SkMatrix& viewMatrix,
25 GrColor color, bool antialias, 25 GrColor color, bool antialias,
26 const GrInstancedPipelineInfo& info, bool* useHWAA) { 26 const GrInstancedPipelineInfo& info, bool* useHWAA) {
27 return this->recordShape(ShapeType::kRect, rect, viewMatrix, color, rect, an tialias, info, 27 return this->recordShape(ShapeType::kRect, rect, viewMatrix, color, rect, an tialias, info,
28 useHWAA); 28 useHWAA);
29 } 29 }
30 30
31 GrDrawBatch* InstancedRendering::recordRect(const SkRect& rect, const SkMatrix& viewMatrix, 31 GrDrawBatch* InstancedRendering::recordRect(const SkRect& rect, const SkMatrix& viewMatrix,
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 234
235 return false; 235 return false;
236 } 236 }
237 237
238 InstancedRendering::Batch::Batch(uint32_t classID, InstancedRendering* ir) 238 InstancedRendering::Batch::Batch(uint32_t classID, InstancedRendering* ir)
239 : INHERITED(classID), 239 : INHERITED(classID),
240 fInstancedRendering(ir), 240 fInstancedRendering(ir),
241 fIsTracked(false), 241 fIsTracked(false),
242 fNumDraws(1), 242 fNumDraws(1),
243 fNumChangesInGeometry(0) { 243 fNumChangesInGeometry(0) {
244 fHeadDraw = fTailDraw = (Draw*)fInstancedRendering->fDrawPool.allocate(sizeo f(Draw)); 244 fHeadDraw = fTailDraw = fInstancedRendering->fDrawPool.allocate();
245 #ifdef SK_DEBUG 245 #ifdef SK_DEBUG
246 fHeadDraw->fGeometry = {-1, 0}; 246 fHeadDraw->fGeometry = {-1, 0};
247 #endif 247 #endif
248 fHeadDraw->fNext = nullptr; 248 fHeadDraw->fNext = nullptr;
249 } 249 }
250 250
251 InstancedRendering::Batch::~Batch() { 251 InstancedRendering::Batch::~Batch() {
252 if (fIsTracked) { 252 if (fIsTracked) {
253 fInstancedRendering->fTrackedBatches.remove(this); 253 fInstancedRendering->fTrackedBatches.remove(this);
254 } 254 }
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
487 } 487 }
488 488
489 void InstancedRendering::resetGpuResources(ResetType resetType) { 489 void InstancedRendering::resetGpuResources(ResetType resetType) {
490 fVertexBuffer.reset(); 490 fVertexBuffer.reset();
491 fIndexBuffer.reset(); 491 fIndexBuffer.reset();
492 fParamsBuffer.reset(); 492 fParamsBuffer.reset();
493 this->onResetGpuResources(resetType); 493 this->onResetGpuResources(resetType);
494 } 494 }
495 495
496 } 496 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698