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

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

Issue 2248323003: Simplify adding attributes to GrGeometryProcessor (Closed) Base URL: https://chromium.googlesource.com/skia.git@xformhelper
Patch Set: Revert removal of fAttribNames Created 4 years, 4 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/GrDefaultGeoProcFactory.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 2013 Google Inc. 2 * Copyright 2013 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 GrGeometryProcessor_DEFINED 8 #ifndef GrGeometryProcessor_DEFINED
9 #define GrGeometryProcessor_DEFINED 9 #define GrGeometryProcessor_DEFINED
10 10
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 protected: 46 protected:
47 /** 47 /**
48 * Subclasses call this from their constructor to register vertex attributes . Attributes 48 * Subclasses call this from their constructor to register vertex attributes . Attributes
49 * will be padded to the nearest 4 bytes for performance reasons. 49 * will be padded to the nearest 4 bytes for performance reasons.
50 * TODO After deferred geometry, we should do all of this inline in Generate Geometry alongside 50 * TODO After deferred geometry, we should do all of this inline in Generate Geometry alongside
51 * the struct used to actually populate the attributes. This is all extreme ly fragile, vertex 51 * the struct used to actually populate the attributes. This is all extreme ly fragile, vertex
52 * attributes have to be added in the order they will appear in the struct w hich maps memory. 52 * attributes have to be added in the order they will appear in the struct w hich maps memory.
53 * The processor key should reflect the vertex attributes, or there lack the reof in the 53 * The processor key should reflect the vertex attributes, or there lack the reof in the
54 * GrGeometryProcessor. 54 * GrGeometryProcessor.
55 */ 55 */
56 const Attribute& addVertexAttrib(const Attribute& attribute) { 56 const Attribute& addVertexAttrib(const char* name, GrVertexAttribType type,
57 fVertexStride += attribute.fOffset; 57 GrSLPrecision precision = kDefault_GrSLPrec ision) {
58 fAttribs.push_back(attribute); 58 fAttribs.emplace_back(name, type, precision);
59 fVertexStride += fAttribs.back().fOffset;
59 return fAttribs.back(); 60 return fAttribs.back();
60 } 61 }
61 62
62 void setWillUseGeoShader() { fWillUseGeoShader = true; } 63 void setWillUseGeoShader() { fWillUseGeoShader = true; }
63 64
64 /** 65 /**
65 * If a GrFragmentProcessor in the GrPipeline needs localCoods, we will prov ide them in one of 66 * If a GrFragmentProcessor in the GrPipeline needs localCoods, we will prov ide them in one of
66 * three ways 67 * three ways
67 * 1) LocalCoordTransform * Position - in Shader 68 * 1) LocalCoordTransform * Position - in Shader
68 * 2) LocalCoordTransform * ExplicitLocalCoords- in Shader 69 * 2) LocalCoordTransform * ExplicitLocalCoords- in Shader
(...skipping 21 matching lines...) Expand all
90 91
91 private: 92 private:
92 bool fWillUseGeoShader; 93 bool fWillUseGeoShader;
93 LocalCoordsType fLocalCoordsType; 94 LocalCoordsType fLocalCoordsType;
94 float fSampleShading; 95 float fSampleShading;
95 96
96 typedef GrPrimitiveProcessor INHERITED; 97 typedef GrPrimitiveProcessor INHERITED;
97 }; 98 };
98 99
99 #endif 100 #endif
OLDNEW
« no previous file with comments | « src/gpu/GrDefaultGeoProcFactory.cpp ('k') | src/gpu/GrOvalRenderer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698