| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2010 Google Inc. | 2 * Copyright 2010 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 GrDrawTarget_DEFINED | 8 #ifndef GrDrawTarget_DEFINED |
| 9 #define GrDrawTarget_DEFINED | 9 #define GrDrawTarget_DEFINED |
| 10 | 10 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 class GrBatch; | 38 class GrBatch; |
| 39 class GrClip; | 39 class GrClip; |
| 40 class GrCaps; | 40 class GrCaps; |
| 41 class GrPath; | 41 class GrPath; |
| 42 class GrDrawPathBatchBase; | 42 class GrDrawPathBatchBase; |
| 43 | 43 |
| 44 class GrDrawTarget final : public SkRefCnt { | 44 class GrDrawTarget final : public SkRefCnt { |
| 45 public: | 45 public: |
| 46 /** Options for GrDrawTarget behavior. */ | 46 /** Options for GrDrawTarget behavior. */ |
| 47 struct Options { | 47 struct Options { |
| 48 Options () : fClipBatchToBounds(false), fDrawBatchBounds(false), fMaxBat
chLookback(-1) {} | 48 Options () |
| 49 : fClipBatchToBounds(false) |
| 50 , fDrawBatchBounds(false) |
| 51 , fMaxBatchLookback(-1) |
| 52 , fMaxBatchLookahead(-1) {} |
| 49 bool fClipBatchToBounds; | 53 bool fClipBatchToBounds; |
| 50 bool fDrawBatchBounds; | 54 bool fDrawBatchBounds; |
| 51 int fMaxBatchLookback; | 55 int fMaxBatchLookback; |
| 56 int fMaxBatchLookahead; |
| 52 }; | 57 }; |
| 53 | 58 |
| 54 GrDrawTarget(GrRenderTarget*, GrGpu*, GrResourceProvider*, GrAuditTrail*, co
nst Options&); | 59 GrDrawTarget(GrRenderTarget*, GrGpu*, GrResourceProvider*, GrAuditTrail*, co
nst Options&); |
| 55 | 60 |
| 56 ~GrDrawTarget() override; | 61 ~GrDrawTarget() override; |
| 57 | 62 |
| 58 void makeClosed() { | 63 void makeClosed() { |
| 59 // We only close drawTargets When MDB is enabled. When MDB is disabled t
here is only | 64 // We only close drawTargets When MDB is enabled. When MDB is disabled t
here is only |
| 60 // ever one drawTarget and all calls will be funnelled into it. | 65 // ever one drawTarget and all calls will be funnelled into it. |
| 61 #ifdef ENABLE_MDB | 66 #ifdef ENABLE_MDB |
| 62 this->setFlag(kClosed_Flag); | 67 this->setFlag(kClosed_Flag); |
| 63 #endif | 68 #endif |
| 69 this->forwardCombine(); |
| 64 } | 70 } |
| 71 |
| 65 bool isClosed() const { return this->isSetFlag(kClosed_Flag); } | 72 bool isClosed() const { return this->isSetFlag(kClosed_Flag); } |
| 66 | 73 |
| 67 // TODO: this entry point is only needed in the non-MDB world. Remove when | 74 // TODO: this entry point is only needed in the non-MDB world. Remove when |
| 68 // we make the switch to MDB | 75 // we make the switch to MDB |
| 69 void clearRT() { fRenderTarget = nullptr; } | 76 void clearRT() { fRenderTarget = nullptr; } |
| 70 | 77 |
| 71 /* | 78 /* |
| 72 * Notify this drawTarget that it relies on the contents of 'dependedOn' | 79 * Notify this drawTarget that it relies on the contents of 'dependedOn' |
| 73 */ | 80 */ |
| 74 void addDependency(GrSurface* dependedOn); | 81 void addDependency(GrSurface* dependedOn); |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 } | 216 } |
| 210 static int NumDependencies(const GrDrawTarget* dt) { | 217 static int NumDependencies(const GrDrawTarget* dt) { |
| 211 return dt->fDependencies.count(); | 218 return dt->fDependencies.count(); |
| 212 } | 219 } |
| 213 static GrDrawTarget* Dependency(GrDrawTarget* dt, int index) { | 220 static GrDrawTarget* Dependency(GrDrawTarget* dt, int index) { |
| 214 return dt->fDependencies[index]; | 221 return dt->fDependencies[index]; |
| 215 } | 222 } |
| 216 }; | 223 }; |
| 217 | 224 |
| 218 void recordBatch(GrBatch*); | 225 void recordBatch(GrBatch*); |
| 226 void forwardCombine(); |
| 219 bool installPipelineInDrawBatch(const GrPipelineBuilder* pipelineBuilder, | 227 bool installPipelineInDrawBatch(const GrPipelineBuilder* pipelineBuilder, |
| 220 const GrScissorState* scissor, | 228 const GrScissorState* scissor, |
| 221 GrDrawBatch* batch); | 229 GrDrawBatch* batch); |
| 222 | 230 |
| 223 // Makes a copy of the dst if it is necessary for the draw. Returns false if
a copy is required | 231 // Makes a copy of the dst if it is necessary for the draw. Returns false if
a copy is required |
| 224 // but couldn't be made. Otherwise, returns true. This method needs to be p
rotected because it | 232 // but couldn't be made. Otherwise, returns true. This method needs to be p
rotected because it |
| 225 // needs to be accessed by GLPrograms to setup a correct drawstate | 233 // needs to be accessed by GLPrograms to setup a correct drawstate |
| 226 bool setupDstReadIfNecessary(const GrPipelineBuilder&, | 234 bool setupDstReadIfNecessary(const GrPipelineBuilder&, |
| 227 const GrPipelineOptimizations& optimizations, | 235 const GrPipelineOptimizations& optimizations, |
| 228 GrXferProcessor::DstTexture*, | 236 GrXferProcessor::DstTexture*, |
| 229 const SkRect& batchBounds); | 237 const SkRect& batchBounds); |
| 230 | 238 |
| 231 // Check to see if this set of draw commands has been sent out | 239 // Check to see if this set of draw commands has been sent out |
| 232 void getPathStencilSettingsForFilltype(GrPathRendering::FillType, | 240 void getPathStencilSettingsForFilltype(GrPathRendering::FillType, |
| 233 const GrStencilAttachment*, | 241 const GrStencilAttachment*, |
| 234 GrStencilSettings*); | 242 GrStencilSettings*); |
| 235 bool setupClip(const GrPipelineBuilder&, | |
| 236 GrPipelineBuilder::AutoRestoreFragmentProcessorState*
, | |
| 237 GrPipelineBuilder::AutoRestoreStencil*, | |
| 238 GrScissorState*, | |
| 239 const SkRect* devBounds); | |
| 240 | 243 |
| 241 void addDependency(GrDrawTarget* dependedOn); | 244 void addDependency(GrDrawTarget* dependedOn); |
| 242 | 245 |
| 243 // Used only by CMM. | 246 // Used only by CMM. |
| 244 void clearStencilClip(const SkIRect&, bool insideClip, GrRenderTarget*); | 247 void clearStencilClip(const SkIRect&, bool insideClip, GrRenderTarget*); |
| 245 | 248 |
| 246 SkSTArray<256, SkAutoTUnref<GrBatch>, true> fBatches; | 249 SkSTArray<256, SkAutoTUnref<GrBatch>, true> fBatches; |
| 247 SkAutoTDelete<GrClipMaskManager> fClipMaskManager; | 250 SkAutoTDelete<GrClipMaskManager> fClipMaskManager; |
| 248 // The context is only in service of the clip mask manager, remove once CMM
doesn't need this. | 251 // The context is only in service of the clip mask manager, remove once CMM
doesn't need this. |
| 249 GrContext* fContext; | 252 GrContext* fContext; |
| 250 GrGpu* fGpu; | 253 GrGpu* fGpu; |
| 251 GrResourceProvider* fResourceProvider; | 254 GrResourceProvider* fResourceProvider; |
| 252 GrAuditTrail* fAuditTrail; | 255 GrAuditTrail* fAuditTrail; |
| 253 | 256 |
| 254 SkDEBUGCODE(int fDebugID;) | 257 SkDEBUGCODE(int fDebugID;) |
| 255 uint32_t fFlags; | 258 uint32_t fFlags; |
| 256 | 259 |
| 257 // 'this' drawTarget relies on the output of the drawTargets in 'fDependenci
es' | 260 // 'this' drawTarget relies on the output of the drawTargets in 'fDependenci
es' |
| 258 SkTDArray<GrDrawTarget*> fDependencies; | 261 SkTDArray<GrDrawTarget*> fDependencies; |
| 259 GrRenderTarget* fRenderTarget; | 262 GrRenderTarget* fRenderTarget; |
| 260 | 263 |
| 261 bool fDrawBatchBounds; | 264 bool fDrawBatchBounds; |
| 262 int fMaxBatchLookback; | 265 int fMaxBatchLookback; |
| 266 int fMaxBatchLookahead; |
| 263 | 267 |
| 264 typedef SkRefCnt INHERITED; | 268 typedef SkRefCnt INHERITED; |
| 265 }; | 269 }; |
| 266 | 270 |
| 267 #endif | 271 #endif |
| OLD | NEW |