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 GrTInstanceBatch_DEFINED | 8 #ifndef GrTInstanceBatch_DEFINED |
9 #define GrTInstanceBatch_DEFINED | 9 #define GrTInstanceBatch_DEFINED |
10 | 10 |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 GrTInstanceBatch() : INHERITED(ClassID()) {} | 89 GrTInstanceBatch() : INHERITED(ClassID()) {} |
90 | 90 |
91 void onPrepareDraws(Target* target) const override { | 91 void onPrepareDraws(Target* target) const override { |
92 SkAutoTUnref<const GrGeometryProcessor> gp(Impl::CreateGP(this->seedGeom
etry(), | 92 SkAutoTUnref<const GrGeometryProcessor> gp(Impl::CreateGP(this->seedGeom
etry(), |
93 fOverrides)); | 93 fOverrides)); |
94 if (!gp) { | 94 if (!gp) { |
95 SkDebugf("Couldn't create GrGeometryProcessor\n"); | 95 SkDebugf("Couldn't create GrGeometryProcessor\n"); |
96 return; | 96 return; |
97 } | 97 } |
98 | 98 |
99 target->initDraw(gp, this->pipeline()); | 99 target->initDraw(gp); |
100 | 100 |
101 size_t vertexStride = gp->getVertexStride(); | 101 size_t vertexStride = gp->getVertexStride(); |
102 int instanceCount = fGeoData.count(); | 102 int instanceCount = fGeoData.count(); |
103 | 103 |
104 SkAutoTUnref<const GrIndexBuffer> indexBuffer( | 104 SkAutoTUnref<const GrIndexBuffer> indexBuffer( |
105 Impl::GetIndexBuffer(target->resourceProvider())); | 105 Impl::GetIndexBuffer(target->resourceProvider())); |
106 InstancedHelper helper; | 106 InstancedHelper helper; |
107 void* vertices = helper.init(target, kTriangles_GrPrimitiveType, vertexS
tride, | 107 void* vertices = helper.init(target, kTriangles_GrPrimitiveType, vertexS
tride, |
108 indexBuffer, Impl::kVertsPerInstance, | 108 indexBuffer, Impl::kVertsPerInstance, |
109 Impl::kIndicesPerInstance, instanceCount); | 109 Impl::kIndicesPerInstance, instanceCount); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 return true; | 144 return true; |
145 } | 145 } |
146 | 146 |
147 GrXPOverridesForBatch fOverrides; | 147 GrXPOverridesForBatch fOverrides; |
148 SkSTArray<1, Geometry, true> fGeoData; | 148 SkSTArray<1, Geometry, true> fGeoData; |
149 | 149 |
150 typedef GrVertexBatch INHERITED; | 150 typedef GrVertexBatch INHERITED; |
151 }; | 151 }; |
152 | 152 |
153 #endif | 153 #endif |
OLD | NEW |