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 GrPipelineBuilder_DEFINED | 8 #ifndef GrPipelineBuilder_DEFINED |
9 #define GrPipelineBuilder_DEFINED | 9 #define GrPipelineBuilder_DEFINED |
10 | 10 |
11 #include "GrBlend.h" | 11 #include "GrBlend.h" |
12 #include "GrCaps.h" | 12 #include "GrCaps.h" |
13 #include "GrClip.h" | |
14 #include "GrGpuResourceRef.h" | 13 #include "GrGpuResourceRef.h" |
15 #include "GrProcOptInfo.h" | 14 #include "GrProcOptInfo.h" |
16 #include "GrRenderTarget.h" | 15 #include "GrRenderTarget.h" |
17 #include "GrUserStencilSettings.h" | 16 #include "GrUserStencilSettings.h" |
18 #include "GrXferProcessor.h" | 17 #include "GrXferProcessor.h" |
19 #include "SkMatrix.h" | 18 #include "SkMatrix.h" |
20 #include "effects/GrCoverageSetOpXP.h" | 19 #include "effects/GrCoverageSetOpXP.h" |
21 #include "effects/GrDisableColorXP.h" | 20 #include "effects/GrDisableColorXP.h" |
22 #include "effects/GrPorterDuffXferProcessor.h" | 21 #include "effects/GrPorterDuffXferProcessor.h" |
23 #include "effects/GrSimpleTextureEffect.h" | 22 #include "effects/GrSimpleTextureEffect.h" |
24 | 23 |
25 class GrDrawBatch; | 24 class GrDrawBatch; |
26 class GrCaps; | 25 class GrCaps; |
27 class GrPaint; | 26 class GrPaint; |
28 class GrTexture; | 27 class GrTexture; |
29 | 28 |
30 class GrPipelineBuilder : public SkNoncopyable { | 29 class GrPipelineBuilder : public SkNoncopyable { |
31 public: | 30 public: |
32 GrPipelineBuilder(); | 31 GrPipelineBuilder(); |
33 | 32 |
34 /** | 33 /** |
35 * Initializes the GrPipelineBuilder based on a GrPaint, render target, and
clip. Note | 34 * Initializes the GrPipelineBuilder based on a GrPaint, render target, and
clip. Note |
36 * that GrPipelineBuilder encompasses more than GrPaint. Aspects of GrPipeli
neBuilder that have | 35 * that GrPipelineBuilder encompasses more than GrPaint. Aspects of GrPipeli
neBuilder that have |
37 * no GrPaint equivalents are set to default values with the exception of ve
rtex attribute state | 36 * no GrPaint equivalents are set to default values with the exception of ve
rtex attribute state |
38 * which is unmodified by this function and clipping which will be enabled. | 37 * which is unmodified by this function and clipping which will be enabled. |
39 */ | 38 */ |
40 GrPipelineBuilder(const GrPaint&, GrRenderTarget*, const GrClip&); | 39 GrPipelineBuilder(const GrPaint&, GrRenderTarget*); |
41 | 40 |
42 virtual ~GrPipelineBuilder(); | 41 virtual ~GrPipelineBuilder(); |
43 | 42 |
44 /////////////////////////////////////////////////////////////////////////// | 43 /////////////////////////////////////////////////////////////////////////// |
45 /// @name Fragment Processors | 44 /// @name Fragment Processors |
46 /// | 45 /// |
47 /// GrFragmentProcessors are used to compute per-pixel color and per-pixel f
ractional coverage. | 46 /// GrFragmentProcessors are used to compute per-pixel color and per-pixel f
ractional coverage. |
48 /// There are two chains of FPs, one for color and one for coverage. The fir
st FP in each | 47 /// There are two chains of FPs, one for color and one for coverage. The fir
st FP in each |
49 /// chain gets the initial color/coverage from the GrPrimitiveProcessor. It
computes an output | 48 /// chain gets the initial color/coverage from the GrPrimitiveProcessor. It
computes an output |
50 /// color/coverage which is fed to the next FP in the chain. The last color
and coverage FPs | 49 /// color/coverage which is fed to the next FP in the chain. The last color
and coverage FPs |
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
315 SkASSERT(kInvalid_DrawFace != face); | 314 SkASSERT(kInvalid_DrawFace != face); |
316 fDrawFace = face; | 315 fDrawFace = face; |
317 } | 316 } |
318 | 317 |
319 /// @} | 318 /// @} |
320 | 319 |
321 /////////////////////////////////////////////////////////////////////////// | 320 /////////////////////////////////////////////////////////////////////////// |
322 | 321 |
323 bool usePLSDstRead(const GrDrawBatch* batch) const; | 322 bool usePLSDstRead(const GrDrawBatch* batch) const; |
324 | 323 |
325 void setClip(const GrClip& clip) { fClip = clip; } | |
326 const GrClip& clip() const { return fClip; } | |
327 | |
328 private: | 324 private: |
329 // Some of the auto restore objects assume that no effects are removed durin
g their lifetime. | 325 // Some of the auto restore objects assume that no effects are removed durin
g their lifetime. |
330 // This is used to assert that this condition holds. | 326 // This is used to assert that this condition holds. |
331 SkDEBUGCODE(mutable int fBlockEffectRemovalCnt;) | 327 SkDEBUGCODE(mutable int fBlockEffectRemovalCnt;) |
332 | 328 |
333 typedef SkSTArray<4, const GrFragmentProcessor*, true> FragmentProcessorArra
y; | 329 typedef SkSTArray<4, const GrFragmentProcessor*, true> FragmentProcessorArra
y; |
334 | 330 |
335 SkAutoTUnref<GrRenderTarget> fRenderTarget; | 331 SkAutoTUnref<GrRenderTarget> fRenderTarget; |
336 uint32_t fFlags; | 332 uint32_t fFlags; |
337 const GrUserStencilSettings* fUserStencilSettings; | 333 const GrUserStencilSettings* fUserStencilSettings; |
338 DrawFace fDrawFace; | 334 DrawFace fDrawFace; |
339 mutable SkAutoTUnref<const GrXPFactory> fXPFactory; | 335 mutable SkAutoTUnref<const GrXPFactory> fXPFactory; |
340 FragmentProcessorArray fColorFragmentProcessors; | 336 FragmentProcessorArray fColorFragmentProcessors; |
341 FragmentProcessorArray fCoverageFragmentProcessors; | 337 FragmentProcessorArray fCoverageFragmentProcessors; |
342 GrClip fClip; | |
343 | 338 |
344 friend class GrPipeline; | 339 friend class GrPipeline; |
345 friend class GrDrawTarget; | 340 friend class GrDrawTarget; |
346 }; | 341 }; |
347 | 342 |
348 #endif | 343 #endif |
OLD | NEW |