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 GrPipeline(const GrPipelineBuilder&, | 32 /** Creates a pipeline into a pre-allocated buffer */ |
33 const GrProcOptInfo& colorPOI, | 33 static GrPipeline* CreateAt(void* memory, |
34 const GrProcOptInfo& coveragePOI, | 34 const GrPipelineBuilder& pb, |
35 const GrCaps&, | 35 const GrProcOptInfo& colorPOI, |
36 const GrScissorState&, | 36 const GrProcOptInfo& coveragePOI, |
37 const GrXferProcessor::DstTexture*); | 37 const GrCaps& caps, |
| 38 const GrScissorState& scissor, |
| 39 const GrXferProcessor::DstTexture* dst) { |
| 40 return SkNEW_PLACEMENT_ARGS(memory, GrPipeline, (pb, colorPOI, coverageP
OI, caps, scissor, |
| 41 dst)); |
| 42 } |
38 | 43 |
39 /* | 44 /* |
40 * 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 |
41 * 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 |
42 * 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 |
43 * compared." | 48 * compared." |
44 */ | 49 */ |
45 bool isEqual(const GrPipeline& that, bool ignoreCoordTransforms = false) con
st; | 50 bool isEqual(const GrPipeline& that, bool ignoreCoordTransforms = false) con
st; |
46 | 51 |
47 /// @} | 52 /// @} |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 | 106 |
102 const GrPipelineInfo& infoForPrimitiveProcessor() const { | 107 const GrPipelineInfo& infoForPrimitiveProcessor() const { |
103 return fInfoForPrimitiveProcessor; | 108 return fInfoForPrimitiveProcessor; |
104 } | 109 } |
105 | 110 |
106 const SkTArray<const GrCoordTransform*, true>& coordTransforms() const { | 111 const SkTArray<const GrCoordTransform*, true>& coordTransforms() const { |
107 return fCoordTransforms; | 112 return fCoordTransforms; |
108 } | 113 } |
109 | 114 |
110 private: | 115 private: |
| 116 GrPipeline(const GrPipelineBuilder&, |
| 117 const GrProcOptInfo& colorPOI, |
| 118 const GrProcOptInfo& coveragePOI, |
| 119 const GrCaps&, |
| 120 const GrScissorState&, |
| 121 const GrXferProcessor::DstTexture*); |
| 122 |
111 /** | 123 /** |
112 * Alter the program desc and inputs (attribs and processors) based on the b
lend optimization. | 124 * Alter the program desc and inputs (attribs and processors) based on the b
lend optimization. |
113 */ | 125 */ |
114 void adjustProgramFromOptimizations(const GrPipelineBuilder& ds, | 126 void adjustProgramFromOptimizations(const GrPipelineBuilder& ds, |
115 GrXferProcessor::OptFlags, | 127 GrXferProcessor::OptFlags, |
116 const GrProcOptInfo& colorPOI, | 128 const GrProcOptInfo& colorPOI, |
117 const GrProcOptInfo& coveragePOI, | 129 const GrProcOptInfo& coveragePOI, |
118 int* firstColorStageIdx, | 130 int* firstColorStageIdx, |
119 int* firstCoverageStageIdx); | 131 int* firstCoverageStageIdx); |
120 | 132 |
(...skipping 21 matching lines...) Expand all Loading... |
142 uint32_t fFlags; | 154 uint32_t fFlags; |
143 ProgramXferProcessor fXferProcessor; | 155 ProgramXferProcessor fXferProcessor; |
144 FragmentStageArray fFragmentStages; | 156 FragmentStageArray fFragmentStages; |
145 bool fReadsFragPosition; | 157 bool fReadsFragPosition; |
146 GrPipelineInfo fInfoForPrimitiveProcessor; | 158 GrPipelineInfo fInfoForPrimitiveProcessor; |
147 | 159 |
148 // This function is equivalent to the offset into fFragmentStages where cove
rage stages begin. | 160 // This function is equivalent to the offset into fFragmentStages where cove
rage stages begin. |
149 int fNumColorStages; | 161 int fNumColorStages; |
150 | 162 |
151 SkSTArray<8, const GrCoordTransform*, true> fCoordTransforms; | 163 SkSTArray<8, const GrCoordTransform*, true> fCoordTransforms; |
152 int fNumCoordTransforms; | |
153 GrProgramDesc fDesc; | 164 GrProgramDesc fDesc; |
154 | 165 |
155 typedef SkRefCnt INHERITED; | 166 typedef SkRefCnt INHERITED; |
156 }; | 167 }; |
157 | 168 |
158 #endif | 169 #endif |
OLD | NEW |