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 GrRODrawState_DEFINED | 8 #ifndef GrRODrawState_DEFINED |
9 #define GrRODrawState_DEFINED | 9 #define GrRODrawState_DEFINED |
10 | 10 |
(...skipping 19 matching lines...) Expand all Loading... |
30 /// @name Vertex Attributes | 30 /// @name Vertex Attributes |
31 //// | 31 //// |
32 | 32 |
33 enum { | 33 enum { |
34 kMaxVertexAttribCnt = kLast_GrVertexAttribBinding + 4, | 34 kMaxVertexAttribCnt = kLast_GrVertexAttribBinding + 4, |
35 }; | 35 }; |
36 | 36 |
37 const GrVertexAttrib* getVertexAttribs() const { return fVAPtr; } | 37 const GrVertexAttrib* getVertexAttribs() const { return fVAPtr; } |
38 int getVertexAttribCount() const { return fVACount; } | 38 int getVertexAttribCount() const { return fVACount; } |
39 | 39 |
40 size_t getVertexSize() const { return fVertexSize; } | 40 size_t getVertexStride() const { return fVAStride; } |
41 | 41 |
42 /** | 42 /** |
43 * Getters for index into getVertexAttribs() for particular bindings. -1 is
returned if the | 43 * Getters for index into getVertexAttribs() for particular bindings. -1 is
returned if the |
44 * binding does not appear in the current attribs. These bindings should app
ear only once in | 44 * binding does not appear in the current attribs. These bindings should app
ear only once in |
45 * the attrib array. | 45 * the attrib array. |
46 */ | 46 */ |
47 | 47 |
48 int positionAttributeIndex() const { | 48 int positionAttributeIndex() const { |
49 return fFixedFunctionVertexAttribIndices[kPosition_GrVertexAttribBinding
]; | 49 return fFixedFunctionVertexAttribIndices[kPosition_GrVertexAttribBinding
]; |
50 } | 50 } |
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
333 /** The GrDrawStates cannot be combined. */ | 333 /** The GrDrawStates cannot be combined. */ |
334 kIncompatible_CombinedState, | 334 kIncompatible_CombinedState, |
335 /** Either draw state can be used in place of the other. */ | 335 /** Either draw state can be used in place of the other. */ |
336 kAOrB_CombinedState, | 336 kAOrB_CombinedState, |
337 /** Use the first draw state. */ | 337 /** Use the first draw state. */ |
338 kA_CombinedState, | 338 kA_CombinedState, |
339 /** Use the second draw state. */ | 339 /** Use the second draw state. */ |
340 kB_CombinedState, | 340 kB_CombinedState, |
341 }; | 341 }; |
342 | 342 |
343 GrRODrawState& operator= (const GrRODrawState& that); | |
344 | |
345 protected: | 343 protected: |
346 bool isEqual(const GrRODrawState& that) const; | 344 bool isEqual(const GrRODrawState& that) const; |
347 | 345 |
348 // These fields are roughly sorted by decreasing likelihood of being differe
nt in op== | 346 // These fields are roughly sorted by decreasing likelihood of being differe
nt in op== |
349 SkAutoTUnref<GrRenderTarget> fRenderTarget; | 347 SkAutoTUnref<GrRenderTarget> fRenderTarget; |
350 GrColor fColor; | 348 GrColor fColor; |
351 SkMatrix fViewMatrix; | 349 SkMatrix fViewMatrix; |
352 GrColor fBlendConstant; | 350 GrColor fBlendConstant; |
353 uint32_t fFlagBits; | 351 uint32_t fFlagBits; |
354 const GrVertexAttrib* fVAPtr; | 352 const GrVertexAttrib* fVAPtr; |
355 int fVACount; | 353 int fVACount; |
356 size_t fVertexSize; | 354 size_t fVAStride; |
357 GrStencilSettings fStencilSettings; | 355 GrStencilSettings fStencilSettings; |
358 uint8_t fCoverage; | 356 uint8_t fCoverage; |
359 DrawFace fDrawFace; | 357 DrawFace fDrawFace; |
360 GrBlendCoeff fSrcBlend; | 358 GrBlendCoeff fSrcBlend; |
361 GrBlendCoeff fDstBlend; | 359 GrBlendCoeff fDstBlend; |
362 | 360 |
363 typedef SkSTArray<4, GrEffectStage> EffectStageArray; | 361 typedef SkSTArray<4, GrEffectStage> EffectStageArray; |
364 EffectStageArray fColorStages; | 362 EffectStageArray fColorStages; |
365 EffectStageArray fCoverageStages; | 363 EffectStageArray fCoverageStages; |
366 | 364 |
367 mutable GrBlendCoeff fOptSrcBlend; | 365 mutable GrBlendCoeff fOptSrcBlend; |
368 mutable GrBlendCoeff fOptDstBlend; | 366 mutable GrBlendCoeff fOptDstBlend; |
369 mutable BlendOptFlags fBlendOptFlags; | 367 mutable BlendOptFlags fBlendOptFlags; |
370 | 368 |
371 // This is simply a different representation of info in fVertexAttribs and t
hus does | 369 // This is simply a different representation of info in fVertexAttribs and t
hus does |
372 // not need to be compared in op==. | 370 // not need to be compared in op==. |
373 int fFixedFunctionVertexAttribIndices[kGrFixedFunctionVertexAttribBindingCnt
]; | 371 int fFixedFunctionVertexAttribIndices[kGrFixedFunctionVertexAttribBindingCnt
]; |
374 | 372 |
375 private: | 373 private: |
376 typedef SkRefCnt INHERITED; | 374 typedef SkRefCnt INHERITED; |
377 }; | 375 }; |
378 | 376 |
379 GR_MAKE_BITFIELD_OPS(GrRODrawState::BlendOptFlags); | 377 GR_MAKE_BITFIELD_OPS(GrRODrawState::BlendOptFlags); |
380 | 378 |
381 #endif | 379 #endif |
OLD | NEW |