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 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
138 * @return The currently set render target. | 138 * @return The currently set render target. |
139 */ | 139 */ |
140 GrRenderTarget* getRenderTarget() const { return fRenderTarget.get(); } | 140 GrRenderTarget* getRenderTarget() const { return fRenderTarget.get(); } |
141 | 141 |
142 const GrStencilSettings& getStencil() const { return fStencilSettings; } | 142 const GrStencilSettings& getStencil() const { return fStencilSettings; } |
143 | 143 |
144 const GrScissorState& getScissorState() const { return fScissorState; } | 144 const GrScissorState& getScissorState() const { return fScissorState; } |
145 | 145 |
146 bool isHWAntialiasState() const { return SkToBool(fFlags & kHWAA_Flag); } | 146 bool isHWAntialiasState() const { return SkToBool(fFlags & kHWAA_Flag); } |
147 bool snapVerticesToPixelCenters() const { return SkToBool(fFlags & kSnapVert ices_Flag); } | 147 bool snapVerticesToPixelCenters() const { return SkToBool(fFlags & kSnapVert ices_Flag); } |
148 bool hasSampleLocations() const { return SkToBool(fFlags & kSampleLocations_ Flag); } | |
148 | 149 |
149 GrXferBarrierType xferBarrierType(const GrCaps& caps) const { | 150 GrXferBarrierType xferBarrierType(const GrCaps& caps) const { |
150 return this->getXferProcessor().xferBarrierType(fRenderTarget.get(), cap s); | 151 return this->getXferProcessor().xferBarrierType(fRenderTarget.get(), cap s); |
151 } | 152 } |
152 | 153 |
153 /** | 154 /** |
154 * Gets whether the target is drawing clockwise, counterclockwise, | 155 * Gets whether the target is drawing clockwise, counterclockwise, |
155 * or both faces. | 156 * or both faces. |
156 * @return the current draw face(s). | 157 * @return the current draw face(s). |
157 */ | 158 */ |
158 GrPipelineBuilder::DrawFace getDrawFace() const { return fDrawFace; } | 159 GrPipelineBuilder::DrawFace getDrawFace() const { return fDrawFace; } |
159 | 160 |
160 | 161 |
161 /////////////////////////////////////////////////////////////////////////// | 162 /////////////////////////////////////////////////////////////////////////// |
162 | 163 |
163 bool readsFragPosition() const { return fReadsFragPosition; } | 164 bool readsFragPosition() const { return fReadsFragPosition; } |
164 bool ignoresCoverage() const { return fIgnoresCoverage; } | 165 bool ignoresCoverage() const { return fIgnoresCoverage; } |
165 | 166 |
167 /////////////////////////////////////////////////////////////////////////// | |
168 | |
169 /** | |
170 * Returns the actual number of samples the hardware will run when using thi s pipeline. | |
171 * NOTE: this can be greater than the sample count in the render target's su rface descriptor. | |
172 */ | |
173 int effectiveSampleCount() const { return this->getMultisampleSpecs().fEffec tiveSampleCnt; } | |
174 | |
175 /** | |
176 * Returns a unique ID that identifies this pipeline's sample pattern, or 0 if sample locations | |
177 * are not supported. | |
178 */ | |
179 uint16_t getSamplePatternID() const { return this->getMultisampleSpecs().fSa mplePatternID; } | |
180 | |
181 /** | |
182 * Returns this pipeline's sample locations, or nullptr if sample locations are not supported. | |
183 * The locations are stored as offsets in device space from the center of th e pixel. | |
184 */ | |
185 const SkPoint* getSampleLocations() const { | |
186 return this->getMultisampleSpecs().fSampleLocations; | |
187 } | |
188 | |
166 private: | 189 private: |
167 GrPipeline() { /** Initialized in factory function*/ } | 190 GrPipeline() { /** Initialized in factory function*/ } |
168 | 191 |
169 /** | 192 /** |
170 * Alter the program desc and inputs (attribs and processors) based on the b lend optimization. | 193 * Alter the program desc and inputs (attribs and processors) based on the b lend optimization. |
171 */ | 194 */ |
172 void adjustProgramFromOptimizations(const GrPipelineBuilder& ds, | 195 void adjustProgramFromOptimizations(const GrPipelineBuilder& ds, |
173 GrXferProcessor::OptFlags, | 196 GrXferProcessor::OptFlags, |
174 const GrProcOptInfo& colorPOI, | 197 const GrProcOptInfo& colorPOI, |
175 const GrProcOptInfo& coveragePOI, | 198 const GrProcOptInfo& coveragePOI, |
176 int* firstColorProcessorIdx, | 199 int* firstColorProcessorIdx, |
177 int* firstCoverageProcessorIdx); | 200 int* firstCoverageProcessorIdx); |
178 | 201 |
179 /** | 202 /** |
180 * Calculates the primary and secondary output types of the shader. For cert ain output types | 203 * Calculates the primary and secondary output types of the shader. For cert ain output types |
181 * the function may adjust the blend coefficients. After this function is ca lled the src and dst | 204 * the function may adjust the blend coefficients. After this function is ca lled the src and dst |
182 * blend coeffs will represent those used by backend API. | 205 * blend coeffs will represent those used by backend API. |
183 */ | 206 */ |
184 void setOutputStateInfo(const GrPipelineBuilder& ds, GrXferProcessor::OptFla gs, | 207 void setOutputStateInfo(const GrPipelineBuilder& ds, GrXferProcessor::OptFla gs, |
185 const GrCaps&); | 208 const GrCaps&); |
186 | 209 |
210 const GrRenderTargetPriv::MultisampleSpecs& getMultisampleSpecs() const { | |
bsalomon
2016/02/22 20:28:25
We anticipate render target being removed from pip
Chris Dalton
2016/02/22 21:19:11
I imagine it would be straightforward, but I can o
| |
211 SkASSERT(this->isHWAntialiasState()); | |
212 return this->getRenderTarget()->renderTargetPriv().getMultisampleSpecs(f StencilSettings); | |
213 } | |
214 | |
187 enum Flags { | 215 enum Flags { |
188 kHWAA_Flag = 0x1, | 216 kHWAA_Flag = 0x1, |
189 kSnapVertices_Flag = 0x2, | 217 kSnapVertices_Flag = 0x2, |
218 kSampleLocations_Flag = 0x4, | |
190 }; | 219 }; |
191 | 220 |
192 typedef GrPendingIOResource<GrRenderTarget, kWrite_GrIOType> RenderTarget; | 221 typedef GrPendingIOResource<GrRenderTarget, kWrite_GrIOType> RenderTarget; |
193 typedef GrPendingProgramElement<const GrFragmentProcessor> PendingFragmentPr ocessor; | 222 typedef GrPendingProgramElement<const GrFragmentProcessor> PendingFragmentPr ocessor; |
194 typedef SkAutoSTArray<8, PendingFragmentProcessor> FragmentProcessorArray; | 223 typedef SkAutoSTArray<8, PendingFragmentProcessor> FragmentProcessorArray; |
195 typedef GrPendingProgramElement<const GrXferProcessor> ProgramXferProcessor; | 224 typedef GrPendingProgramElement<const GrXferProcessor> ProgramXferProcessor; |
196 RenderTarget fRenderTarget; | 225 RenderTarget fRenderTarget; |
197 GrScissorState fScissorState; | 226 GrScissorState fScissorState; |
198 GrStencilSettings fStencilSettings; | 227 GrStencilSettings fStencilSettings; |
199 GrPipelineBuilder::DrawFace fDrawFace; | 228 GrPipelineBuilder::DrawFace fDrawFace; |
200 uint32_t fFlags; | 229 uint32_t fFlags; |
201 ProgramXferProcessor fXferProcessor; | 230 ProgramXferProcessor fXferProcessor; |
202 FragmentProcessorArray fFragmentProcessors; | 231 FragmentProcessorArray fFragmentProcessors; |
203 bool fReadsFragPosition; | 232 bool fReadsFragPosition; |
204 bool fIgnoresCoverage; | 233 bool fIgnoresCoverage; |
205 | 234 |
206 // This value is also the index in fFragmentProcessors where coverage proces sors begin. | 235 // This value is also the index in fFragmentProcessors where coverage proces sors begin. |
207 int fNumColorProcessors; | 236 int fNumColorProcessors; |
208 | 237 |
209 typedef SkRefCnt INHERITED; | 238 typedef SkRefCnt INHERITED; |
210 }; | 239 }; |
211 | 240 |
212 #endif | 241 #endif |
OLD | NEW |