OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 GrDrawState_DEFINED | 8 #ifndef GrDrawState_DEFINED |
9 #define GrDrawState_DEFINED | 9 #define GrDrawState_DEFINED |
10 | 10 |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
73 * GrTypesPriv.h). | 73 * GrTypesPriv.h). |
74 * | 74 * |
75 * The mapping of attributes with kEffect bindings to GrEffect inputs is spe cified when | 75 * The mapping of attributes with kEffect bindings to GrEffect inputs is spe cified when |
76 * setEffect is called. | 76 * setEffect is called. |
77 */ | 77 */ |
78 | 78 |
79 /** | 79 /** |
80 * Sets vertex attributes for next draw. The object driving the templatizat ion | 80 * Sets vertex attributes for next draw. The object driving the templatizat ion |
81 * should be a global GrVertexAttrib array that is never changed. | 81 * should be a global GrVertexAttrib array that is never changed. |
82 */ | 82 */ |
83 template <const GrVertexAttrib A[]> void setVertexAttribs(int count) { | 83 template <const GrVertexAttrib A[]> void setVertexAttribs(int count, size_t stride) { |
84 this->setVertexAttribs(A, count); | 84 this->setVertexAttribs(A, count, stride); |
85 } | 85 } |
86 | 86 |
87 /** | 87 /** |
88 * Sets default vertex attributes for next draw. The default is a single at tribute: | 88 * Sets default vertex attributes for next draw. The default is a single at tribute: |
89 * {kVec2f_GrVertexAttribType, 0, kPosition_GrVertexAttribType} | 89 * {kVec2f_GrVertexAttribType, 0, kPosition_GrVertexAttribType} |
90 */ | 90 */ |
91 void setDefaultVertexAttribs(); | 91 void setDefaultVertexAttribs(); |
92 | 92 |
93 /** | 93 /** |
94 * Helper to save/restore vertex attribs | 94 * Helper to save/restore vertex attribs |
95 */ | 95 */ |
96 class AutoVertexAttribRestore { | 96 class AutoVertexAttribRestore { |
97 public: | 97 public: |
98 AutoVertexAttribRestore(GrDrawState* drawState); | 98 AutoVertexAttribRestore(GrDrawState* drawState); |
99 | 99 |
100 ~AutoVertexAttribRestore() { fDrawState->setVertexAttribs(fVAPtr, fVACo unt); } | 100 ~AutoVertexAttribRestore() { fDrawState->setVertexAttribs(fVAPtr, fVACo unt, fVAStride); } |
101 | 101 |
102 private: | 102 private: |
103 GrDrawState* fDrawState; | 103 GrDrawState* fDrawState; |
104 const GrVertexAttrib* fVAPtr; | 104 const GrVertexAttrib* fVAPtr; |
105 int fVACount; | 105 int fVACount; |
106 size_t fVAStride; | |
106 }; | 107 }; |
107 | 108 |
108 /// @} | 109 /// @} |
109 | 110 |
110 /** | 111 /** |
111 * Depending on features available in the underlying 3D API and the color bl end mode requested | 112 * Depending on features available in the underlying 3D API and the color bl end mode requested |
112 * it may or may not be possible to correctly blend with fractional pixel co verage generated by | 113 * it may or may not be possible to correctly blend with fractional pixel co verage generated by |
113 * the fragment shader. | 114 * the fragment shader. |
114 * | 115 * |
115 * This function considers the current draw state and the draw target's capa bilities to | 116 * This function considers the current draw state and the draw target's capa bilities to |
(...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
556 uint32_t fHints; | 557 uint32_t fHints; |
557 | 558 |
558 // Some of the auto restore objects assume that no effects are removed durin g their lifetime. | 559 // Some of the auto restore objects assume that no effects are removed durin g their lifetime. |
559 // This is used to assert that this condition holds. | 560 // This is used to assert that this condition holds. |
560 SkDEBUGCODE(int fBlockEffectRemovalCnt;) | 561 SkDEBUGCODE(int fBlockEffectRemovalCnt;) |
561 | 562 |
562 /** | 563 /** |
563 * Sets vertex attributes for next draw. | 564 * Sets vertex attributes for next draw. |
564 * | 565 * |
565 * @param attribs the array of vertex attributes to set. | 566 * @param attribs the array of vertex attributes to set. |
566 * @param count the number of attributes being set, limited to kMaxVer texAttribCnt. | 567 * @param count the number of attributes being set, limited to kMaxVer texAttribCnt. |
bsalomon
2014/08/27 17:46:28
update comment? Maybe move the params comments to
egdaniel
2014/08/27 18:33:55
Done.
| |
567 */ | 568 */ |
568 void setVertexAttribs(const GrVertexAttrib attribs[], int count); | 569 void setVertexAttribs(const GrVertexAttrib attribs[], int count, size_t stri de); |
569 | 570 |
570 typedef GrRODrawState INHERITED; | 571 typedef GrRODrawState INHERITED; |
571 }; | 572 }; |
572 | 573 |
573 #endif | 574 #endif |
OLD | NEW |