Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(89)

Side by Side Diff: src/gpu/GrDrawState.h

Issue 502533004: Revert of Make setVertexAttribs in GrDrawState take a stride parameter. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/gpu/GrDistanceFieldTextContext.cpp ('k') | src/gpu/GrDrawState.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 * the type of the attribute, its offset, and semantic binding (see GrVertex Attrib in 72 * the type of the attribute, its offset, and semantic binding (see GrVertex Attrib in
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 *
83 * @param count the number of attributes being set, limited to kMaxVer texAttribCnt.
84 * @param stride the number of bytes between successive vertex data.
85 */ 82 */
86 template <const GrVertexAttrib A[]> void setVertexAttribs(int count, size_t stride) { 83 template <const GrVertexAttrib A[]> void setVertexAttribs(int count) {
87 this->internalSetVertexAttribs(A, count, stride); 84 this->setVertexAttribs(A, count);
88 } 85 }
89 86
90 /** 87 /**
91 * 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:
92 * {kVec2f_GrVertexAttribType, 0, kPosition_GrVertexAttribType} 89 * {kVec2f_GrVertexAttribType, 0, kPosition_GrVertexAttribType}
93 */ 90 */
94 void setDefaultVertexAttribs(); 91 void setDefaultVertexAttribs();
95 92
96 /** 93 /**
97 * Helper to save/restore vertex attribs 94 * Helper to save/restore vertex attribs
98 */ 95 */
99 class AutoVertexAttribRestore { 96 class AutoVertexAttribRestore {
100 public: 97 public:
101 AutoVertexAttribRestore(GrDrawState* drawState); 98 AutoVertexAttribRestore(GrDrawState* drawState);
102 99
103 ~AutoVertexAttribRestore() { fDrawState->internalSetVertexAttribs(fVAPt r, fVACount, fVAStride); } 100 ~AutoVertexAttribRestore() { fDrawState->setVertexAttribs(fVAPtr, fVACo unt); }
104 101
105 private: 102 private:
106 GrDrawState* fDrawState; 103 GrDrawState* fDrawState;
107 const GrVertexAttrib* fVAPtr; 104 const GrVertexAttrib* fVAPtr;
108 int fVACount; 105 int fVACount;
109 size_t fVAStride;
110 }; 106 };
111 107
112 /// @} 108 /// @}
113 109
114 /** 110 /**
115 * Depending on features available in the underlying 3D API and the color bl end mode requested 111 * Depending on features available in the underlying 3D API and the color bl end mode requested
116 * it may or may not be possible to correctly blend with fractional pixel co verage generated by 112 * it may or may not be possible to correctly blend with fractional pixel co verage generated by
117 * the fragment shader. 113 * the fragment shader.
118 * 114 *
119 * This function considers the current draw state and the draw target's capa bilities to 115 * This function considers the current draw state and the draw target's capa bilities to
(...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after
556 void invalidateBlendOptFlags() { 552 void invalidateBlendOptFlags() {
557 fBlendOptFlags = kInvalid_BlendOptFlag; 553 fBlendOptFlags = kInvalid_BlendOptFlag;
558 } 554 }
559 555
560 uint32_t fHints; 556 uint32_t fHints;
561 557
562 // Some of the auto restore objects assume that no effects are removed durin g their lifetime. 558 // Some of the auto restore objects assume that no effects are removed durin g their lifetime.
563 // This is used to assert that this condition holds. 559 // This is used to assert that this condition holds.
564 SkDEBUGCODE(int fBlockEffectRemovalCnt;) 560 SkDEBUGCODE(int fBlockEffectRemovalCnt;)
565 561
566 void internalSetVertexAttribs(const GrVertexAttrib attribs[], int count, siz e_t stride); 562 /**
563 * Sets vertex attributes for next draw.
564 *
565 * @param attribs the array of vertex attributes to set.
566 * @param count the number of attributes being set, limited to kMaxVer texAttribCnt.
567 */
568 void setVertexAttribs(const GrVertexAttrib attribs[], int count);
567 569
568 typedef GrRODrawState INHERITED; 570 typedef GrRODrawState INHERITED;
569 }; 571 };
570 572
571 #endif 573 #endif
OLDNEW
« no previous file with comments | « src/gpu/GrDistanceFieldTextContext.cpp ('k') | src/gpu/GrDrawState.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698