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 13 matching lines...) Expand all Loading... |
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 /** Creates a pipeline into a pre-allocated buffer */ | 32 /** Creates a pipeline into a pre-allocated buffer */ |
33 static GrPipeline* CreateAt(void* memory, | 33 static GrPipeline* CreateAt(void* memory, |
34 const GrPipelineBuilder& pb, | 34 const GrPipelineBuilder&, |
35 const GrProcOptInfo& colorPOI, | 35 const GrProcOptInfo& colorPOI, |
36 const GrProcOptInfo& coveragePOI, | 36 const GrProcOptInfo& coveragePOI, |
37 const GrCaps& caps, | 37 const GrCaps&, |
38 const GrScissorState& scissor, | 38 const GrScissorState&, |
39 const GrXferProcessor::DstTexture* dst) { | 39 const GrXferProcessor::DstTexture*, |
40 return SkNEW_PLACEMENT_ARGS(memory, GrPipeline, (pb, colorPOI, coverageP
OI, caps, scissor, | 40 GrPipelineOptimizations*); |
41 dst)); | |
42 } | |
43 | 41 |
44 /* | 42 /* |
45 * Returns true if these pipelines are equivalent. Coord transforms may be
applied either on | 43 * Returns true if these pipelines are equivalent. Coord transforms may be
applied either on |
46 * the GPU or the CPU. When we apply them on the CPU then the matrices need
not agree in order | 44 * the GPU or the CPU. When we apply them on the CPU then the matrices need
not agree in order |
47 * to combine draws. Therefore we take a param that indicates whether coord
transforms should be | 45 * to combine draws. Therefore we take a param that indicates whether coord
transforms should be |
48 * compared." | 46 * compared." |
49 */ | 47 */ |
50 bool isEqual(const GrPipeline& that, bool ignoreCoordTransforms = false) con
st; | 48 bool isEqual(const GrPipeline& that, bool ignoreCoordTransforms = false) con
st; |
51 | 49 |
52 /// @} | 50 /// @} |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 * or both faces. | 95 * or both faces. |
98 * @return the current draw face(s). | 96 * @return the current draw face(s). |
99 */ | 97 */ |
100 GrPipelineBuilder::DrawFace getDrawFace() const { return fDrawFace; } | 98 GrPipelineBuilder::DrawFace getDrawFace() const { return fDrawFace; } |
101 | 99 |
102 | 100 |
103 /////////////////////////////////////////////////////////////////////////// | 101 /////////////////////////////////////////////////////////////////////////// |
104 | 102 |
105 bool readsFragPosition() const { return fReadsFragPosition; } | 103 bool readsFragPosition() const { return fReadsFragPosition; } |
106 | 104 |
107 const GrPipelineOptimizations& infoForPrimitiveProcessor() const { | |
108 return fInfoForPrimitiveProcessor; | |
109 } | |
110 | |
111 const SkTArray<const GrCoordTransform*, true>& coordTransforms() const { | 105 const SkTArray<const GrCoordTransform*, true>& coordTransforms() const { |
112 return fCoordTransforms; | 106 return fCoordTransforms; |
113 } | 107 } |
114 | 108 |
115 private: | 109 private: |
116 GrPipeline(const GrPipelineBuilder&, | 110 GrPipeline() { /** Initialized in factory function*/ } |
117 const GrProcOptInfo& colorPOI, | |
118 const GrProcOptInfo& coveragePOI, | |
119 const GrCaps&, | |
120 const GrScissorState&, | |
121 const GrXferProcessor::DstTexture*); | |
122 | 111 |
123 /** | 112 /** |
124 * Alter the program desc and inputs (attribs and processors) based on the b
lend optimization. | 113 * Alter the program desc and inputs (attribs and processors) based on the b
lend optimization. |
125 */ | 114 */ |
126 void adjustProgramFromOptimizations(const GrPipelineBuilder& ds, | 115 void adjustProgramFromOptimizations(const GrPipelineBuilder& ds, |
127 GrXferProcessor::OptFlags, | 116 GrXferProcessor::OptFlags, |
128 const GrProcOptInfo& colorPOI, | 117 const GrProcOptInfo& colorPOI, |
129 const GrProcOptInfo& coveragePOI, | 118 const GrProcOptInfo& coveragePOI, |
130 int* firstColorStageIdx, | 119 int* firstColorStageIdx, |
131 int* firstCoverageStageIdx); | 120 int* firstCoverageStageIdx); |
(...skipping 16 matching lines...) Expand all Loading... |
148 typedef SkSTArray<8, GrPendingFragmentStage> FragmentStageArray; | 137 typedef SkSTArray<8, GrPendingFragmentStage> FragmentStageArray; |
149 typedef GrPendingProgramElement<const GrXferProcessor> ProgramXferProcessor; | 138 typedef GrPendingProgramElement<const GrXferProcessor> ProgramXferProcessor; |
150 RenderTarget fRenderTarget; | 139 RenderTarget fRenderTarget; |
151 GrScissorState fScissorState; | 140 GrScissorState fScissorState; |
152 GrStencilSettings fStencilSettings; | 141 GrStencilSettings fStencilSettings; |
153 GrPipelineBuilder::DrawFace fDrawFace; | 142 GrPipelineBuilder::DrawFace fDrawFace; |
154 uint32_t fFlags; | 143 uint32_t fFlags; |
155 ProgramXferProcessor fXferProcessor; | 144 ProgramXferProcessor fXferProcessor; |
156 FragmentStageArray fFragmentStages; | 145 FragmentStageArray fFragmentStages; |
157 bool fReadsFragPosition; | 146 bool fReadsFragPosition; |
158 GrPipelineOptimizations fInfoForPrimitiveProcessor; | |
159 | 147 |
160 // 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. |
161 int fNumColorStages; | 149 int fNumColorStages; |
162 | 150 |
163 SkSTArray<8, const GrCoordTransform*, true> fCoordTransforms; | 151 SkSTArray<8, const GrCoordTransform*, true> fCoordTransforms; |
164 GrProgramDesc fDesc; | 152 GrProgramDesc fDesc; |
165 | 153 |
166 typedef SkRefCnt INHERITED; | 154 typedef SkRefCnt INHERITED; |
167 }; | 155 }; |
168 | 156 |
169 #endif | 157 #endif |
OLD | NEW |