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

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

Issue 543623004: Removing vertex attrib indices (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: warning fixed 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/GrOvalRenderer.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 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 } 173 }
174 174
175 /// @} 175 /// @}
176 176
177 /** 177 /**
178 * The geometry processor is the sole element of the skia pipeline which can use the vertex, 178 * The geometry processor is the sole element of the skia pipeline which can use the vertex,
179 * geometry, and tesselation shaders. The GP may also compute a coverage in its fragment shader 179 * geometry, and tesselation shaders. The GP may also compute a coverage in its fragment shader
180 * but is never put in the color processing pipeline. 180 * but is never put in the color processing pipeline.
181 */ 181 */
182 182
183 const GrEffect* setGeometryProcessor(const GrEffect* effect, int attr0 = -1, int attr1 = -1) { 183 const GrEffect* setGeometryProcessor(const GrEffect* effect) {
184 SkASSERT(effect); 184 SkASSERT(effect);
185 SkASSERT(effect->requiresVertexShader());
185 SkASSERT(!this->hasGeometryProcessor()); 186 SkASSERT(!this->hasGeometryProcessor());
186 fGeometryProcessor.reset(new GrEffectStage(effect, attr0, attr1)); 187 fGeometryProcessor.reset(new GrEffectStage(effect));
187 this->invalidateOptState(); 188 this->invalidateOptState();
188 return effect; 189 return effect;
189 } 190 }
190 191
191 /////////////////////////////////////////////////////////////////////////// 192 ///////////////////////////////////////////////////////////////////////////
192 /// @name Effect Stages 193 /// @name Effect Stages
193 /// Each stage hosts a GrEffect. The effect produces an output color or cove rage in the fragment 194 /// Each stage hosts a GrEffect. The effect produces an output color or cove rage in the fragment
194 /// shader. Its inputs are the output from the previous stage as well as som e variables 195 /// shader. Its inputs are the output from the previous stage as well as som e variables
195 /// available to it in the fragment and vertex shader (e.g. the vertex posit ion, the dst color, 196 /// available to it in the fragment and vertex shader (e.g. the vertex posit ion, the dst color,
196 /// the fragment position, local coordinates). 197 /// the fragment position, local coordinates).
197 /// 198 ///
198 /// The stages are divided into two sets, color-computing and coverage-compu ting. The final 199 /// The stages are divided into two sets, color-computing and coverage-compu ting. The final
199 /// color stage produces the final pixel color. The coverage-computing stage s function exactly 200 /// color stage produces the final pixel color. The coverage-computing stage s function exactly
200 /// as the color-computing but the output of the final coverage stage is tre ated as a fractional 201 /// as the color-computing but the output of the final coverage stage is tre ated as a fractional
201 /// pixel coverage rather than as input to the src/dst color blend step. 202 /// pixel coverage rather than as input to the src/dst color blend step.
202 /// 203 ///
203 /// The input color to the first color-stage is either the constant color or interpolated 204 /// The input color to the first color-stage is either the constant color or interpolated
204 /// per-vertex colors. The input to the first coverage stage is either a con stant coverage 205 /// per-vertex colors. The input to the first coverage stage is either a con stant coverage
205 /// (usually full-coverage) or interpolated per-vertex coverage. 206 /// (usually full-coverage) or interpolated per-vertex coverage.
206 /// 207 ///
207 /// See the documentation of kCoverageDrawing_StateBit for information about disabling the 208 /// See the documentation of kCoverageDrawing_StateBit for information about disabling the
208 /// the color / coverage distinction. 209 /// the color / coverage distinction.
209 //// 210 ////
210 211
211 const GrEffect* addColorEffect(const GrEffect* effect, int attr0 = -1, int a ttr1 = -1) { 212 const GrEffect* addColorEffect(const GrEffect* effect) {
212 SkASSERT(effect); 213 SkASSERT(effect);
213 SkNEW_APPEND_TO_TARRAY(&fColorStages, GrEffectStage, (effect, attr0, att r1)); 214 SkASSERT(!effect->requiresVertexShader());
215 SkNEW_APPEND_TO_TARRAY(&fColorStages, GrEffectStage, (effect));
214 this->invalidateOptState(); 216 this->invalidateOptState();
215 return effect; 217 return effect;
216 } 218 }
217 219
218 const GrEffect* addCoverageEffect(const GrEffect* effect, int attr0 = -1, in t attr1 = -1) { 220 const GrEffect* addCoverageEffect(const GrEffect* effect) {
219 SkASSERT(effect); 221 SkASSERT(effect);
220 SkNEW_APPEND_TO_TARRAY(&fCoverageStages, GrEffectStage, (effect, attr0, attr1)); 222 SkASSERT(!effect->requiresVertexShader());
223 SkNEW_APPEND_TO_TARRAY(&fCoverageStages, GrEffectStage, (effect));
221 this->invalidateOptState(); 224 this->invalidateOptState();
222 return effect; 225 return effect;
223 } 226 }
224 227
225 /** 228 /**
226 * Creates a GrSimpleTextureEffect that uses local coords as texture coordin ates. 229 * Creates a GrSimpleTextureEffect that uses local coords as texture coordin ates.
227 */ 230 */
228 void addColorTextureEffect(GrTexture* texture, const SkMatrix& matrix) { 231 void addColorTextureEffect(GrTexture* texture, const SkMatrix& matrix) {
229 this->addColorEffect(GrSimpleTextureEffect::Create(texture, matrix))->un ref(); 232 this->addColorEffect(GrSimpleTextureEffect::Create(texture, matrix))->un ref();
230 } 233 }
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after
565 SkDEBUGCODE(int fBlockEffectRemovalCnt;) 568 SkDEBUGCODE(int fBlockEffectRemovalCnt;)
566 569
567 void internalSetVertexAttribs(const GrVertexAttrib attribs[], int count, siz e_t stride); 570 void internalSetVertexAttribs(const GrVertexAttrib attribs[], int count, siz e_t stride);
568 571
569 mutable GrOptDrawState* fCachedOptState; 572 mutable GrOptDrawState* fCachedOptState;
570 573
571 typedef GrRODrawState INHERITED; 574 typedef GrRODrawState INHERITED;
572 }; 575 };
573 576
574 #endif 577 #endif
OLDNEW
« no previous file with comments | « src/gpu/GrDistanceFieldTextContext.cpp ('k') | src/gpu/GrOvalRenderer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698