OLD | NEW |
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 #ifndef GrVertexBatch_DEFINED | 8 #ifndef GrVertexBatch_DEFINED |
9 #define GrVertexBatch_DEFINED | 9 #define GrVertexBatch_DEFINED |
10 | 10 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 calling recordDraws(). */ | 56 calling recordDraws(). */ |
57 void* init(Target*, size_t vertexStride, int quadsToDraw); | 57 void* init(Target*, size_t vertexStride, int quadsToDraw); |
58 | 58 |
59 using InstancedHelper::recordDraw; | 59 using InstancedHelper::recordDraw; |
60 private: | 60 private: |
61 typedef InstancedHelper INHERITED; | 61 typedef InstancedHelper INHERITED; |
62 }; | 62 }; |
63 | 63 |
64 private: | 64 private: |
65 void onPrepare(GrBatchFlushState* state) final; | 65 void onPrepare(GrBatchFlushState* state) final; |
66 void onDraw(GrBatchFlushState* state) final; | 66 void onDraw(GrBatchFlushState* state, GrGpuCommandBuffer* buffer) final; |
67 | 67 |
68 virtual void onPrepareDraws(Target*) const = 0; | 68 virtual void onPrepareDraws(Target*) const = 0; |
69 | 69 |
70 // A set of contiguous draws that share a draw token and primitive processor
. The draws all use | 70 // A set of contiguous draws that share a draw token and primitive processor
. The draws all use |
71 // the batch's pipeline. The meshes for the draw are stored in the fMeshes a
rray and each | 71 // the batch's pipeline. The meshes for the draw are stored in the fMeshes a
rray and each |
72 // Queued draw uses fMeshCnt meshes from the fMeshes array. The reason for c
oallescing meshes | 72 // Queued draw uses fMeshCnt meshes from the fMeshes array. The reason for c
oallescing meshes |
73 // that share a primitive processor into a QueuedDraw is that it allows the
Gpu object to setup | 73 // that share a primitive processor into a QueuedDraw is that it allows the
Gpu object to setup |
74 // the shared state once and then issue draws for each mesh. | 74 // the shared state once and then issue draws for each mesh. |
75 struct QueuedDraw { | 75 struct QueuedDraw { |
76 int fMeshCnt = 0; | 76 int fMeshCnt = 0; |
77 GrPendingProgramElement<const GrGeometryProcessor> fGeometryProcessor; | 77 GrPendingProgramElement<const GrGeometryProcessor> fGeometryProcessor; |
78 }; | 78 }; |
79 | 79 |
80 // All draws in all the vertex batches have implicit tokens based on the ord
er they are | 80 // All draws in all the vertex batches have implicit tokens based on the ord
er they are |
81 // enqueued globally across all batches. This is the offset of the first ent
ry in fQueuedDraws. | 81 // enqueued globally across all batches. This is the offset of the first ent
ry in fQueuedDraws. |
82 // fQueuedDraws[i]'s token is fBaseDrawToken + i. | 82 // fQueuedDraws[i]'s token is fBaseDrawToken + i. |
83 GrBatchDrawToken fBaseDrawToken; | 83 GrBatchDrawToken fBaseDrawToken; |
84 | 84 |
85 SkSTArray<4, GrMesh> fMeshes; | 85 SkSTArray<4, GrMesh> fMeshes; |
86 SkSTArray<4, QueuedDraw, true> fQueuedDraws; | 86 SkSTArray<4, QueuedDraw, true> fQueuedDraws; |
87 | 87 |
88 typedef GrDrawBatch INHERITED; | 88 typedef GrDrawBatch INHERITED; |
89 }; | 89 }; |
90 | 90 |
91 #endif | 91 #endif |
OLD | NEW |