OLD | NEW |
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 #ifndef gr_instanced_InstancedRendering_DEFINED | 8 #ifndef gr_instanced_InstancedRendering_DEFINED |
9 #define gr_instanced_InstancedRendering_DEFINED | 9 #define gr_instanced_InstancedRendering_DEFINED |
10 | 10 |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 Draw* fHeadDraw; | 136 Draw* fHeadDraw; |
137 Draw* fTailDraw; | 137 Draw* fTailDraw; |
138 | 138 |
139 typedef GrDrawBatch INHERITED; | 139 typedef GrDrawBatch INHERITED; |
140 | 140 |
141 friend class InstancedRendering; | 141 friend class InstancedRendering; |
142 }; | 142 }; |
143 | 143 |
144 typedef SkTInternalLList<Batch> BatchList; | 144 typedef SkTInternalLList<Batch> BatchList; |
145 | 145 |
146 InstancedRendering(GrGpu* gpu, AntialiasMode lastSupportedAAMode, bool canRe
nderToFloat); | 146 InstancedRendering(GrGpu* gpu); |
147 | 147 |
148 const BatchList& trackedBatches() const { return fTrackedBatches; } | 148 const BatchList& trackedBatches() const { return fTrackedBatches; } |
149 const GrBuffer* vertexBuffer() const { SkASSERT(fVertexBuffer); return fVert
exBuffer; } | 149 const GrBuffer* vertexBuffer() const { SkASSERT(fVertexBuffer); return fVert
exBuffer; } |
150 const GrBuffer* indexBuffer() const { SkASSERT(fIndexBuffer); return fIndexB
uffer; } | 150 const GrBuffer* indexBuffer() const { SkASSERT(fIndexBuffer); return fIndexB
uffer; } |
151 | 151 |
152 virtual void onBeginFlush(GrResourceProvider*) = 0; | 152 virtual void onBeginFlush(GrResourceProvider*) = 0; |
153 virtual void onDraw(const GrPipeline&, const InstanceProcessor&, const Batch
*) = 0; | 153 virtual void onDraw(const GrPipeline&, const InstanceProcessor&, const Batch
*) = 0; |
154 virtual void onEndFlush() = 0; | 154 virtual void onEndFlush() = 0; |
155 virtual void onResetGpuResources(ResetType) = 0; | 155 virtual void onResetGpuResources(ResetType) = 0; |
156 | 156 |
157 private: | 157 private: |
158 enum class State : bool { | 158 enum class State : bool { |
159 kRecordingDraws, | 159 kRecordingDraws, |
160 kFlushing | 160 kFlushing |
161 }; | 161 }; |
162 | 162 |
163 Batch* SK_WARN_UNUSED_RESULT recordShape(ShapeType, const SkRect& bounds, | 163 Batch* SK_WARN_UNUSED_RESULT recordShape(ShapeType, const SkRect& bounds, |
164 const SkMatrix& viewMatrix, GrColor
, | 164 const SkMatrix& viewMatrix, GrColor
, |
165 const SkRect& localRect, bool antia
lias, | 165 const SkRect& localRect, bool antia
lias, |
166 const GrInstancedPipelineInfo&, boo
l* requireHWAA); | 166 const GrInstancedPipelineInfo&, boo
l* requireHWAA); |
167 | 167 |
168 bool selectAntialiasMode(const SkMatrix& viewMatrix, bool antialias, | 168 bool selectAntialiasMode(const SkMatrix& viewMatrix, bool antialias, |
169 const GrInstancedPipelineInfo&, bool* useHWAA, Anti
aliasMode*); | 169 const GrInstancedPipelineInfo&, bool* useHWAA, Anti
aliasMode*); |
170 | 170 |
171 virtual Batch* createBatch() = 0; | 171 virtual Batch* createBatch() = 0; |
172 | 172 |
173 const SkAutoTUnref<GrGpu> fGpu; | 173 const SkAutoTUnref<GrGpu> fGpu; |
174 const AntialiasMode fLastSupportedAAMode; | |
175 const bool fCanRenderToFloat; | |
176 State fState; | 174 State fState; |
177 GrMemoryPool fDrawPool; | 175 GrMemoryPool fDrawPool; |
178 SkSTArray<1024, ParamsTexel, true> fParams; | 176 SkSTArray<1024, ParamsTexel, true> fParams; |
179 BatchList fTrackedBatches; | 177 BatchList fTrackedBatches; |
180 SkAutoTUnref<const GrBuffer> fVertexBuffer; | 178 SkAutoTUnref<const GrBuffer> fVertexBuffer; |
181 SkAutoTUnref<const GrBuffer> fIndexBuffer; | 179 SkAutoTUnref<const GrBuffer> fIndexBuffer; |
182 SkAutoTUnref<GrBuffer> fParamsBuffer; | 180 SkAutoTUnref<GrBuffer> fParamsBuffer; |
183 }; | 181 }; |
184 | 182 |
185 } | 183 } |
186 | 184 |
187 #endif | 185 #endif |
OLD | NEW |