OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 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 GrOptDrawState_DEFINED | 8 #ifndef GrOptDrawState_DEFINED |
9 #define GrOptDrawState_DEFINED | 9 #define GrOptDrawState_DEFINED |
10 | 10 |
(...skipping 18 matching lines...) Expand all Loading... |
29 SK_DECLARE_INST_COUNT(GrOptDrawState) | 29 SK_DECLARE_INST_COUNT(GrOptDrawState) |
30 | 30 |
31 typedef GrClipMaskManager::ScissorState ScissorState; | 31 typedef GrClipMaskManager::ScissorState ScissorState; |
32 | 32 |
33 GrOptDrawState(const GrDrawState& drawState, GrGpu*, const ScissorState&, | 33 GrOptDrawState(const GrDrawState& drawState, GrGpu*, const ScissorState&, |
34 const GrDeviceCoordTexture* dstCopy, GrGpu::DrawType); | 34 const GrDeviceCoordTexture* dstCopy, GrGpu::DrawType); |
35 | 35 |
36 bool operator== (const GrOptDrawState& that) const; | 36 bool operator== (const GrOptDrawState& that) const; |
37 bool operator!= (const GrOptDrawState& that) const { return !(*this == that)
; } | 37 bool operator!= (const GrOptDrawState& that) const { return !(*this == that)
; } |
38 | 38 |
39 /////////////////////////////////////////////////////////////////////////// | |
40 /// @name Vertex Attributes | |
41 //// | |
42 | |
43 enum { | |
44 kMaxVertexAttribCnt = kLast_GrVertexAttribBinding + 4, | |
45 }; | |
46 | |
47 const GrVertexAttrib* getVertexAttribs() const { return fVAPtr; } | |
48 int getVertexAttribCount() const { return fVACount; } | |
49 | |
50 size_t getVertexStride() const { return fVAStride; } | |
51 | |
52 /// @} | 39 /// @} |
53 | 40 |
54 /////////////////////////////////////////////////////////////////////////// | 41 /////////////////////////////////////////////////////////////////////////// |
55 /// @name Color | 42 /// @name Color |
56 //// | 43 //// |
57 | 44 |
58 GrColor getColor() const { return fColor; } | 45 GrColor getColor() const { return fColor; } |
59 | 46 |
60 /// @} | 47 /// @} |
61 | 48 |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 | 193 |
207 /** | 194 /** |
208 * Loops through all the coverage stage effects to check if the stage will i
gnore color input. | 195 * Loops through all the coverage stage effects to check if the stage will i
gnore color input. |
209 * If a coverage stage will ignore input, then we can ignore all coverage st
ages before it. We | 196 * If a coverage stage will ignore input, then we can ignore all coverage st
ages before it. We |
210 * loop to determine the first effective coverage stage. | 197 * loop to determine the first effective coverage stage. |
211 */ | 198 */ |
212 void computeEffectiveCoverageStages(const GrDrawState& ds, GrProgramDesc::De
scInfo* descInfo, | 199 void computeEffectiveCoverageStages(const GrDrawState& ds, GrProgramDesc::De
scInfo* descInfo, |
213 int* firstCoverageStageIdx); | 200 int* firstCoverageStageIdx); |
214 | 201 |
215 /** | 202 /** |
216 * This function takes in a flag and removes the corresponding fixed functio
n vertex attributes. | |
217 * The flags are in the same order as GrVertexAttribBinding array. If bit i
of removeVAFlags is | |
218 * set, then vertex attributes with binding (GrVertexAttribute)i will be rem
oved. | |
219 */ | |
220 void removeFixedFunctionVertexAttribs(uint8_t removeVAFlags, GrProgramDesc::
DescInfo*); | |
221 | |
222 /** | |
223 * Alter the program desc and inputs (attribs and processors) based on the b
lend optimization. | 203 * Alter the program desc and inputs (attribs and processors) based on the b
lend optimization. |
224 */ | 204 */ |
225 void adjustProgramForBlendOpt(const GrDrawState& ds, GrDrawState::BlendOpt, | 205 void adjustProgramForBlendOpt(const GrDrawState& ds, GrDrawState::BlendOpt, |
226 GrProgramDesc::DescInfo*, | 206 GrProgramDesc::DescInfo*, |
227 int* firstColorStageIdx, int* firstCoverageSta
geIdx, | 207 int* firstColorStageIdx, int* firstCoverageSta
geIdx); |
228 uint8_t* fixedFunctionVAToRemove); | |
229 | 208 |
230 /** | 209 /** |
231 * Loop over the effect stages to determine various info like what data they
will read and what | 210 * Loop over the effect stages to determine various info like what data they
will read and what |
232 * shaders they require. | 211 * shaders they require. |
233 */ | 212 */ |
234 void getStageStats(const GrDrawState& ds, int firstColorStageIdx, int firstC
overageStageIdx, | 213 void getStageStats(const GrDrawState& ds, int firstColorStageIdx, int firstC
overageStageIdx, |
235 GrProgramDesc::DescInfo*); | 214 bool hasLocalCoords, GrProgramDesc::DescInfo*); |
236 | 215 |
237 /** | 216 /** |
238 * Calculates the primary and secondary output types of the shader. For cert
ain output types | 217 * Calculates the primary and secondary output types of the shader. For cert
ain output types |
239 * the function may adjust the blend coefficients. After this function is ca
lled the src and dst | 218 * the function may adjust the blend coefficients. After this function is ca
lled the src and dst |
240 * blend coeffs will represent those used by backend API. | 219 * blend coeffs will represent those used by backend API. |
241 */ | 220 */ |
242 void setOutputStateInfo(const GrDrawState& ds, GrDrawState::BlendOpt, const
GrDrawTargetCaps&, | 221 void setOutputStateInfo(const GrDrawState& ds, GrDrawState::BlendOpt, const
GrDrawTargetCaps&, |
243 GrProgramDesc::DescInfo*); | 222 GrProgramDesc::DescInfo*); |
244 | 223 |
245 enum Flags { | 224 enum Flags { |
246 kDither_Flag = 0x1, | 225 kDither_Flag = 0x1, |
247 kHWAA_Flag = 0x2, | 226 kHWAA_Flag = 0x2, |
248 kDisableColorWrite_Flag = 0x4, | 227 kDisableColorWrite_Flag = 0x4, |
249 }; | 228 }; |
250 | 229 |
251 typedef GrPendingIOResource<GrRenderTarget, kWrite_GrIOType> RenderTarget; | 230 typedef GrPendingIOResource<GrRenderTarget, kWrite_GrIOType> RenderTarget; |
252 typedef SkSTArray<8, GrPendingFragmentStage> FragmentStageArray; | 231 typedef SkSTArray<8, GrPendingFragmentStage> FragmentStageArray; |
253 typedef GrPendingProgramElement<const GrGeometryProcessor> ProgramGeometryPr
ocessor; | 232 typedef GrPendingProgramElement<const GrGeometryProcessor> ProgramGeometryPr
ocessor; |
254 RenderTarget fRenderTarget; | 233 RenderTarget fRenderTarget; |
255 ScissorState fScissorState; | 234 ScissorState fScissorState; |
256 GrColor fColor; | 235 GrColor fColor; |
257 SkMatrix fViewMatrix; | 236 SkMatrix fViewMatrix; |
258 GrColor fBlendConstant; | 237 GrColor fBlendConstant; |
259 const GrVertexAttrib* fVAPtr; | |
260 int fVACount; | |
261 size_t fVAStride; | |
262 GrStencilSettings fStencilSettings; | 238 GrStencilSettings fStencilSettings; |
263 uint8_t fCoverage; | 239 uint8_t fCoverage; |
264 GrDrawState::DrawFace fDrawFace; | 240 GrDrawState::DrawFace fDrawFace; |
265 GrDeviceCoordTexture fDstCopy; | 241 GrDeviceCoordTexture fDstCopy; |
266 GrBlendCoeff fSrcBlend; | 242 GrBlendCoeff fSrcBlend; |
267 GrBlendCoeff fDstBlend; | 243 GrBlendCoeff fDstBlend; |
268 uint32_t fFlags; | 244 uint32_t fFlags; |
269 ProgramGeometryProcessor fGeometryProcessor; | 245 ProgramGeometryProcessor fGeometryProcessor; |
270 FragmentStageArray fFragmentStages; | 246 FragmentStageArray fFragmentStages; |
271 | 247 |
272 // This function is equivalent to the offset into fFragmentStages where cove
rage stages begin. | 248 // This function is equivalent to the offset into fFragmentStages where cove
rage stages begin. |
273 int fNumColorStages; | 249 int fNumColorStages; |
274 | 250 |
275 SkAutoSTArray<4, GrVertexAttrib> fOptVA; | |
276 | |
277 GrProgramDesc fDesc; | 251 GrProgramDesc fDesc; |
278 | 252 |
279 typedef SkRefCnt INHERITED; | 253 typedef SkRefCnt INHERITED; |
280 }; | 254 }; |
281 | 255 |
282 #endif | 256 #endif |
OLD | NEW |