OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 GrInOrderDrawBuffer_DEFINED | 8 #ifndef GrInOrderDrawBuffer_DEFINED |
9 #define GrInOrderDrawBuffer_DEFINED | 9 #define GrInOrderDrawBuffer_DEFINED |
10 | 10 |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
181 SkIPoint fDstPoint; | 181 SkIPoint fDstPoint; |
182 SkIRect fSrcRect; | 182 SkIRect fSrcRect; |
183 | 183 |
184 private: | 184 private: |
185 GrPendingIOResource<GrSurface, kWrite_GrIOType> fDst; | 185 GrPendingIOResource<GrSurface, kWrite_GrIOType> fDst; |
186 GrPendingIOResource<GrSurface, kRead_GrIOType> fSrc; | 186 GrPendingIOResource<GrSurface, kRead_GrIOType> fSrc; |
187 }; | 187 }; |
188 | 188 |
189 // TODO: rename to SetPipeline once pp, batch tracker, and desc are removed | 189 // TODO: rename to SetPipeline once pp, batch tracker, and desc are removed |
190 struct SetState : public Cmd { | 190 struct SetState : public Cmd { |
191 // TODO get rid of the prim proc version of this when we use batch every where | 191 // TODO get rid of the prim proc parameter when we use batch everywhere |
192 SetState(const GrPipelineBuilder& pipelineBuilder, const GrPrimitiveProc essor* primProc, | 192 SetState(const GrPipelineBuilder& pipelineBuilder, const GrProcOptInfo& colorPOI, |
193 const GrDrawTargetCaps& caps, | 193 const GrProcOptInfo& coveragePOI, const GrDrawTargetCaps& caps, |
194 const GrScissorState& scissor, const GrDeviceCoordTexture* dstC opy) | 194 const GrScissorState& scissor, const GrDeviceCoordTexture* dstC opy, |
195 const GrPrimitiveProcessor* primProc = NULL) | |
195 : Cmd(kSetState_Cmd) | 196 : Cmd(kSetState_Cmd) |
196 , fPrimitiveProcessor(primProc) | 197 , fPrimitiveProcessor(primProc) |
197 , fPipeline(pipelineBuilder, primProc, caps, scissor, dstCopy) {} | 198 , fPipeline(pipelineBuilder, colorPOI, coveragePOI, caps, scissor, dstCo py) {} |
198 | |
199 SetState(GrBatch* batch, | |
200 const GrPipelineBuilder& pipelineBuilder, | |
201 const GrDrawTargetCaps& caps, | |
202 const GrScissorState& scissor, const GrDeviceCoordTexture* dstC opy) | |
203 : Cmd(kSetState_Cmd) | |
204 , fPipeline(batch, pipelineBuilder, caps, scissor, dstCopy) {} | |
205 | 199 |
206 void execute(GrInOrderDrawBuffer*, const SetState*) SK_OVERRIDE; | 200 void execute(GrInOrderDrawBuffer*, const SetState*) SK_OVERRIDE; |
207 | 201 |
208 typedef GrPendingProgramElement<const GrPrimitiveProcessor> ProgramPrimi tiveProcessor; | 202 typedef GrPendingProgramElement<const GrPrimitiveProcessor> ProgramPrimi tiveProcessor; |
209 ProgramPrimitiveProcessor fPrimitiveProcessor; | 203 ProgramPrimitiveProcessor fPrimitiveProcessor; |
210 const GrPipeline fPipeline; | 204 const GrPipeline fPipeline; |
211 GrProgramDesc fDesc; | 205 GrProgramDesc fDesc; |
212 GrBatchTracker fBatchTracker; | 206 GrBatchTracker fBatchTracker; |
213 }; | 207 }; |
214 | 208 |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
277 const SkIPoint& dstPoint) SK_OVERRIDE; | 271 const SkIPoint& dstPoint) SK_OVERRIDE; |
278 | 272 |
279 // Attempts to concat instances from info onto the previous draw. info must represent an | 273 // Attempts to concat instances from info onto the previous draw. info must represent an |
280 // instanced draw. The caller must have already recorded a new draw state an d clip if necessary. | 274 // instanced draw. The caller must have already recorded a new draw state an d clip if necessary. |
281 int concatInstancedDraw(const GrPipelineBuilder&, const DrawInfo&); | 275 int concatInstancedDraw(const GrPipelineBuilder&, const DrawInfo&); |
282 | 276 |
283 // Determines whether the current draw operation requires a new GrPipeline a nd if so | 277 // Determines whether the current draw operation requires a new GrPipeline a nd if so |
284 // records it. If the draw can be skipped false is returned and no new GrPip eline is | 278 // records it. If the draw can be skipped false is returned and no new GrPip eline is |
285 // recorded. | 279 // recorded. |
286 // TODO delete the primproc variant when we have batches everywhere | 280 // TODO delete the primproc variant when we have batches everywhere |
287 bool SK_WARN_UNUSED_RESULT recordStateAndShouldDraw(const GrPipelineBuilder& , | 281 bool SK_WARN_UNUSED_RESULT recordStateAndSetupPipeline(const GrPrimitiveProc essor*, |
bsalomon
2015/02/11 15:38:03
savePipelineAndShouldDraw?
| |
288 const GrPrimitiveProcess or*, | 282 const GrPipelineBuild er&, |
289 const GrScissorState&, | 283 const GrScissorState& , |
290 const SkRect*); | 284 const SkRect*); |
291 bool SK_WARN_UNUSED_RESULT recordStateAndShouldDraw(GrBatch*, | 285 bool SK_WARN_UNUSED_RESULT recordStateAndSetupPipeline(GrBatch*, |
292 const GrPipelineBuilder& , | 286 const GrPipelineBuild er&, |
293 const GrScissorState&, | 287 const GrScissorState& , |
294 const SkRect*); | 288 const SkRect*); |
295 | 289 |
296 // We lazily record clip changes in order to skip clips that have no effect. | 290 // We lazily record clip changes in order to skip clips that have no effect. |
297 void recordClipIfNecessary(); | 291 void recordClipIfNecessary(); |
298 // Records any trace markers for a command after adding it to the buffer. | 292 // Records any trace markers for a command after adding it to the buffer. |
299 void recordTraceMarkersIfNecessary(); | 293 void recordTraceMarkersIfNecessary(); |
300 | 294 |
301 bool isIssued(uint32_t drawID) SK_OVERRIDE { return drawID != fDrawID; } | 295 bool isIssued(uint32_t drawID) SK_OVERRIDE { return drawID != fDrawID; } |
302 | 296 |
303 GrBatchTarget* getBatchTarget() { return &fBatchTarget; } | 297 GrBatchTarget* getBatchTarget() { return &fBatchTarget; } |
304 | 298 |
(...skipping 22 matching lines...) Expand all Loading... | |
327 fDrawBatch->execute(this, fPrevState); | 321 fDrawBatch->execute(this, fPrevState); |
328 fDrawBatch->fBatch->setNumberOfDraws(fBatchTarget.numberOfDraws()); | 322 fDrawBatch->fBatch->setNumberOfDraws(fBatchTarget.numberOfDraws()); |
329 fDrawBatch = NULL; | 323 fDrawBatch = NULL; |
330 } | 324 } |
331 } | 325 } |
332 | 326 |
333 typedef GrFlushToGpuDrawTarget INHERITED; | 327 typedef GrFlushToGpuDrawTarget INHERITED; |
334 }; | 328 }; |
335 | 329 |
336 #endif | 330 #endif |
OLD | NEW |