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 GrPipeline_DEFINED | 8 #ifndef GrPipeline_DEFINED |
9 #define GrPipeline_DEFINED | 9 #define GrPipeline_DEFINED |
10 | 10 |
(...skipping 11 matching lines...) Expand all Loading... |
22 class GrBatch; | 22 class GrBatch; |
23 class GrDeviceCoordTexture; | 23 class GrDeviceCoordTexture; |
24 class GrPipelineBuilder; | 24 class GrPipelineBuilder; |
25 | 25 |
26 /** | 26 /** |
27 * Class that holds an optimized version of a GrPipelineBuilder. It is meant to
be an immutable | 27 * Class that holds an optimized version of a GrPipelineBuilder. It is meant to
be an immutable |
28 * class, and contains all data needed to set the state for a gpu draw. | 28 * class, and contains all data needed to set the state for a gpu draw. |
29 */ | 29 */ |
30 class GrPipeline : public GrNonAtomicRef { | 30 class GrPipeline : public GrNonAtomicRef { |
31 public: | 31 public: |
| 32 struct CreateArgs { |
| 33 const GrPipelineBuilder* fPipelineBuilder; |
| 34 const GrCaps* fCaps; |
| 35 GrProcOptInfo fColorPOI; |
| 36 GrProcOptInfo fCoveragePOI; |
| 37 const GrScissorState* fScissor; |
| 38 GrXferProcessor::DstTexture fDstTexture; |
| 39 }; |
| 40 |
32 /** Creates a pipeline into a pre-allocated buffer */ | 41 /** Creates a pipeline into a pre-allocated buffer */ |
33 static GrPipeline* CreateAt(void* memory, | 42 static GrPipeline* CreateAt(void* memory, const CreateArgs&, GrPipelineOptim
izations*); |
34 const GrPipelineBuilder&, | |
35 const GrProcOptInfo& colorPOI, | |
36 const GrProcOptInfo& coveragePOI, | |
37 const GrCaps&, | |
38 const GrScissorState&, | |
39 const GrXferProcessor::DstTexture*, | |
40 GrPipelineOptimizations*); | |
41 | 43 |
42 /* | 44 /* |
43 * Returns true if these pipelines are equivalent. Coord transforms may be
applied either on | 45 * Returns true if these pipelines are equivalent. Coord transforms may be
applied either on |
44 * the GPU or the CPU. When we apply them on the CPU then the matrices need
not agree in order | 46 * the GPU or the CPU. When we apply them on the CPU then the matrices need
not agree in order |
45 * to combine draws. Therefore we take a param that indicates whether coord
transforms should be | 47 * to combine draws. Therefore we take a param that indicates whether coord
transforms should be |
46 * compared." | 48 * compared." |
47 */ | 49 */ |
48 bool isEqual(const GrPipeline& that, bool ignoreCoordTransforms = false) con
st; | 50 bool isEqual(const GrPipeline& that, bool ignoreCoordTransforms = false) con
st; |
49 | 51 |
50 /// @} | 52 /// @} |
(...skipping 29 matching lines...) Expand all Loading... |
80 */ | 82 */ |
81 GrRenderTarget* getRenderTarget() const { return fRenderTarget.get(); } | 83 GrRenderTarget* getRenderTarget() const { return fRenderTarget.get(); } |
82 | 84 |
83 const GrStencilSettings& getStencil() const { return fStencilSettings; } | 85 const GrStencilSettings& getStencil() const { return fStencilSettings; } |
84 | 86 |
85 const GrScissorState& getScissorState() const { return fScissorState; } | 87 const GrScissorState& getScissorState() const { return fScissorState; } |
86 | 88 |
87 bool isDitherState() const { return SkToBool(fFlags & kDither_Flag); } | 89 bool isDitherState() const { return SkToBool(fFlags & kDither_Flag); } |
88 bool isHWAntialiasState() const { return SkToBool(fFlags & kHWAA_Flag); } | 90 bool isHWAntialiasState() const { return SkToBool(fFlags & kHWAA_Flag); } |
89 bool snapVerticesToPixelCenters() const { return SkToBool(fFlags & kSnapVert
ices_Flag); } | 91 bool snapVerticesToPixelCenters() const { return SkToBool(fFlags & kSnapVert
ices_Flag); } |
90 // Skip any draws that refer to this pipeline (they should be a no-op). | |
91 bool mustSkip() const { return NULL == this->getRenderTarget(); } | |
92 | 92 |
93 /** | 93 /** |
94 * Gets whether the target is drawing clockwise, counterclockwise, | 94 * Gets whether the target is drawing clockwise, counterclockwise, |
95 * or both faces. | 95 * or both faces. |
96 * @return the current draw face(s). | 96 * @return the current draw face(s). |
97 */ | 97 */ |
98 GrPipelineBuilder::DrawFace getDrawFace() const { return fDrawFace; } | 98 GrPipelineBuilder::DrawFace getDrawFace() const { return fDrawFace; } |
99 | 99 |
100 | 100 |
101 /////////////////////////////////////////////////////////////////////////// | 101 /////////////////////////////////////////////////////////////////////////// |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 // This function is equivalent to the offset into fFragmentStages where cove
rage stages begin. | 148 // This function is equivalent to the offset into fFragmentStages where cove
rage stages begin. |
149 int fNumColorStages; | 149 int fNumColorStages; |
150 | 150 |
151 SkSTArray<8, const GrCoordTransform*, true> fCoordTransforms; | 151 SkSTArray<8, const GrCoordTransform*, true> fCoordTransforms; |
152 GrProgramDesc fDesc; | 152 GrProgramDesc fDesc; |
153 | 153 |
154 typedef SkRefCnt INHERITED; | 154 typedef SkRefCnt INHERITED; |
155 }; | 155 }; |
156 | 156 |
157 #endif | 157 #endif |
OLD | NEW |