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

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

Issue 1204773003: Revert of Refactor GrBufferAllocPools to use resource cache (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 6 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/GrBatchTarget.h ('k') | src/gpu/GrBufferAllocPool.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 "GrBatchTarget.h" 8 #include "GrBatchTarget.h"
9 9
10 #include "GrBatchAtlas.h" 10 #include "GrBatchAtlas.h"
11 #include "GrPipeline.h" 11 #include "GrPipeline.h"
12 12
13 static const size_t DRAW_BUFFER_VBPOOL_BUFFER_SIZE = 1 << 15;
14 static const int DRAW_BUFFER_VBPOOL_PREALLOC_BUFFERS = 4;
15
16 static const size_t DRAW_BUFFER_IBPOOL_BUFFER_SIZE = 1 << 11;
17 static const int DRAW_BUFFER_IBPOOL_PREALLOC_BUFFERS = 4;
18
13 GrBatchTarget::GrBatchTarget(GrGpu* gpu) 19 GrBatchTarget::GrBatchTarget(GrGpu* gpu)
14 : fGpu(gpu) 20 : fGpu(gpu)
15 , fVertexPool(gpu)
16 , fIndexPool(gpu)
17 , fFlushBuffer(kFlushBufferInitialSizeInBytes) 21 , fFlushBuffer(kFlushBufferInitialSizeInBytes)
18 , fIter(fFlushBuffer) 22 , fIter(fFlushBuffer)
19 , fNumberOfDraws(0) 23 , fNumberOfDraws(0)
20 , fCurrentToken(0) 24 , fCurrentToken(0)
21 , fLastFlushedToken(0) 25 , fLastFlushedToken(0)
22 , fInlineUpdatesIndex(0) { 26 , fInlineUpdatesIndex(0) {
27
28 fVertexPool.reset(SkNEW_ARGS(GrVertexBufferAllocPool, (fGpu,
29 DRAW_BUFFER_VBPOOL_BUFFER_SIZE,
30 DRAW_BUFFER_VBPOOL_PREALLOC_BUFFERS )));
31 fIndexPool.reset(SkNEW_ARGS(GrIndexBufferAllocPool, (fGpu,
32 DRAW_BUFFER_IBPOOL_BUFFER_SIZE,
33 DRAW_BUFFER_IBPOOL_PREALLOC_BUFFERS) ));
23 } 34 }
24 35
25 void GrBatchTarget::flushNext(int n) { 36 void GrBatchTarget::flushNext(int n) {
26 for (; n > 0; n--) { 37 for (; n > 0; n--) {
27 fLastFlushedToken++; 38 fLastFlushedToken++;
28 SkDEBUGCODE(bool verify =) fIter.next(); 39 SkDEBUGCODE(bool verify =) fIter.next();
29 SkASSERT(verify); 40 SkASSERT(verify);
30 41
31 BufferedFlush* bf = fIter.get(); 42 BufferedFlush* bf = fIter.get();
32 43
(...skipping 14 matching lines...) Expand all
47 int drawCount = bf->fVertexDraws.count(); 58 int drawCount = bf->fVertexDraws.count();
48 const SkSTArray<1, GrVertices, true>& vertexDraws = bf->fVertexDraws; 59 const SkSTArray<1, GrVertices, true>& vertexDraws = bf->fVertexDraws;
49 for (int i = 0; i < drawCount; i++) { 60 for (int i = 0; i < drawCount; i++) {
50 fGpu->draw(args, vertexDraws[i]); 61 fGpu->draw(args, vertexDraws[i]);
51 } 62 }
52 } 63 }
53 } 64 }
54 65
55 void* GrBatchTarget::makeVertSpace(size_t vertexSize, int vertexCount, 66 void* GrBatchTarget::makeVertSpace(size_t vertexSize, int vertexCount,
56 const GrVertexBuffer** buffer, int* startVertex) { 67 const GrVertexBuffer** buffer, int* startVertex) {
57 return fVertexPool.makeSpace(vertexSize, vertexCount, buffer, startVertex); 68 return fVertexPool->makeSpace(vertexSize, vertexCount, buffer, startVertex);
58 } 69 }
59 70
60 uint16_t* GrBatchTarget::makeIndexSpace(int indexCount, 71 uint16_t* GrBatchTarget::makeIndexSpace(int indexCount,
61 const GrIndexBuffer** buffer, int* start Index) { 72 const GrIndexBuffer** buffer, int* start Index) {
62 return reinterpret_cast<uint16_t*>(fIndexPool.makeSpace(indexCount, buffer, startIndex)); 73 return reinterpret_cast<uint16_t*>(fIndexPool->makeSpace(indexCount, buffer, startIndex));
63 } 74 }
64 75
OLDNEW
« no previous file with comments | « src/gpu/GrBatchTarget.h ('k') | src/gpu/GrBufferAllocPool.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698