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

Side by Side Diff: src/gpu/effects/GrBezierEffect.h

Issue 543623004: Removing vertex attrib indices (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: feedback inc 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
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 GrBezierEffect_DEFINED 8 #ifndef GrBezierEffect_DEFINED
9 #define GrBezierEffect_DEFINED 9 #define GrBezierEffect_DEFINED
10 10
11 #include "GrDrawTargetCaps.h" 11 #include "GrDrawTargetCaps.h"
12 #include "GrEffect.h" 12 #include "GrEffect.h"
13 #include "GrVertexEffect.h" 13 #include "GrGeometryProcessor.h"
14 #include "GrTypesPriv.h" 14 #include "GrTypesPriv.h"
15 15
16 /** 16 /**
17 * Shader is based off of Loop-Blinn Quadratic GPU Rendering 17 * Shader is based off of Loop-Blinn Quadratic GPU Rendering
18 * The output of this effect is a hairline edge for conics. 18 * The output of this effect is a hairline edge for conics.
19 * Conics specified by implicit equation K^2 - LM. 19 * Conics specified by implicit equation K^2 - LM.
20 * K, L, and M, are the first three values of the vertex attribute, 20 * K, L, and M, are the first three values of the vertex attribute,
21 * the fourth value is not used. Distance is calculated using a 21 * the fourth value is not used. Distance is calculated using a
22 * first order approximation from the taylor series. 22 * first order approximation from the taylor series.
23 * Coverage for AA is max(0, 1-distance). 23 * Coverage for AA is max(0, 1-distance).
(...skipping 24 matching lines...) Expand all
48 * looking for. It is able to render ellipses (even thin ones) without the need to chop. 48 * looking for. It is able to render ellipses (even thin ones) without the need to chop.
49 * However, it can not handle thin hyperbolas well and thus would still rely on 49 * However, it can not handle thin hyperbolas well and thus would still rely on
50 * chopping to tighten the clipping. Another side effect of the overestimating i s 50 * chopping to tighten the clipping. Another side effect of the overestimating i s
51 * that the curves become much thinner and "ropey". If all that was ever rendere d 51 * that the curves become much thinner and "ropey". If all that was ever rendere d
52 * were "not too thin" curves and ellipses then 2nd order may have an advantage since 52 * were "not too thin" curves and ellipses then 2nd order may have an advantage since
53 * only one geometry would need to be rendered. However no benches were run comp aring 53 * only one geometry would need to be rendered. However no benches were run comp aring
54 * chopped first order and non chopped 2nd order. 54 * chopped first order and non chopped 2nd order.
55 */ 55 */
56 class GrGLConicEffect; 56 class GrGLConicEffect;
57 57
58 class GrConicEffect : public GrVertexEffect { 58 class GrConicEffect : public GrGeometryProcessor {
59 public: 59 public:
60 static GrEffect* Create(const GrEffectEdgeType edgeType, const GrDrawTargetC aps& caps) { 60 static GrEffect* Create(const GrEffectEdgeType edgeType, const GrDrawTargetC aps& caps) {
61 GR_CREATE_STATIC_EFFECT(gConicFillAA, GrConicEffect, (kFillAA_GrEffectEd geType)); 61 GR_CREATE_STATIC_EFFECT(gConicFillAA, GrConicEffect, (kFillAA_GrEffectEd geType));
62 GR_CREATE_STATIC_EFFECT(gConicHairAA, GrConicEffect, (kHairlineAA_GrEffe ctEdgeType)); 62 GR_CREATE_STATIC_EFFECT(gConicHairAA, GrConicEffect, (kHairlineAA_GrEffe ctEdgeType));
63 GR_CREATE_STATIC_EFFECT(gConicFillBW, GrConicEffect, (kFillBW_GrEffectEd geType)); 63 GR_CREATE_STATIC_EFFECT(gConicFillBW, GrConicEffect, (kFillBW_GrEffectEd geType));
64 switch (edgeType) { 64 switch (edgeType) {
65 case kFillAA_GrEffectEdgeType: 65 case kFillAA_GrEffectEdgeType:
66 if (!caps.shaderDerivativeSupport()) { 66 if (!caps.shaderDerivativeSupport()) {
67 return NULL; 67 return NULL;
68 } 68 }
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 101
102 private: 102 private:
103 GrConicEffect(GrEffectEdgeType); 103 GrConicEffect(GrEffectEdgeType);
104 104
105 virtual bool onIsEqual(const GrEffect& other) const SK_OVERRIDE; 105 virtual bool onIsEqual(const GrEffect& other) const SK_OVERRIDE;
106 106
107 GrEffectEdgeType fEdgeType; 107 GrEffectEdgeType fEdgeType;
108 108
109 GR_DECLARE_EFFECT_TEST; 109 GR_DECLARE_EFFECT_TEST;
110 110
111 typedef GrVertexEffect INHERITED; 111 typedef GrGeometryProcessor INHERITED;
112 }; 112 };
113 113
114 /////////////////////////////////////////////////////////////////////////////// 114 ///////////////////////////////////////////////////////////////////////////////
115 /** 115 /**
116 * The output of this effect is a hairline edge for quadratics. 116 * The output of this effect is a hairline edge for quadratics.
117 * Quadratic specified by 0=u^2-v canonical coords. u and v are the first 117 * Quadratic specified by 0=u^2-v canonical coords. u and v are the first
118 * two components of the vertex attribute. At the three control points that defi ne 118 * two components of the vertex attribute. At the three control points that defi ne
119 * the Quadratic, u, v have the values {0,0}, {1/2, 0}, and {1, 1} respectively. 119 * the Quadratic, u, v have the values {0,0}, {1/2, 0}, and {1, 1} respectively.
120 * Coverage for AA is min(0, 1-distance). 3rd & 4th cimponent unused. 120 * Coverage for AA is min(0, 1-distance). 3rd & 4th cimponent unused.
121 * Requires shader derivative instruction support. 121 * Requires shader derivative instruction support.
122 */ 122 */
123 class GrGLQuadEffect; 123 class GrGLQuadEffect;
124 124
125 class GrQuadEffect : public GrVertexEffect { 125 class GrQuadEffect : public GrGeometryProcessor {
126 public: 126 public:
127 static GrEffect* Create(const GrEffectEdgeType edgeType, const GrDrawTargetC aps& caps) { 127 static GrEffect* Create(const GrEffectEdgeType edgeType, const GrDrawTargetC aps& caps) {
128 GR_CREATE_STATIC_EFFECT(gQuadFillAA, GrQuadEffect, (kFillAA_GrEffectEdge Type)); 128 GR_CREATE_STATIC_EFFECT(gQuadFillAA, GrQuadEffect, (kFillAA_GrEffectEdge Type));
129 GR_CREATE_STATIC_EFFECT(gQuadHairAA, GrQuadEffect, (kHairlineAA_GrEffect EdgeType)); 129 GR_CREATE_STATIC_EFFECT(gQuadHairAA, GrQuadEffect, (kHairlineAA_GrEffect EdgeType));
130 GR_CREATE_STATIC_EFFECT(gQuadFillBW, GrQuadEffect, (kFillBW_GrEffectEdge Type)); 130 GR_CREATE_STATIC_EFFECT(gQuadFillBW, GrQuadEffect, (kFillBW_GrEffectEdge Type));
131 switch (edgeType) { 131 switch (edgeType) {
132 case kFillAA_GrEffectEdgeType: 132 case kFillAA_GrEffectEdgeType:
133 if (!caps.shaderDerivativeSupport()) { 133 if (!caps.shaderDerivativeSupport()) {
134 return NULL; 134 return NULL;
135 } 135 }
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 168
169 private: 169 private:
170 GrQuadEffect(GrEffectEdgeType); 170 GrQuadEffect(GrEffectEdgeType);
171 171
172 virtual bool onIsEqual(const GrEffect& other) const SK_OVERRIDE; 172 virtual bool onIsEqual(const GrEffect& other) const SK_OVERRIDE;
173 173
174 GrEffectEdgeType fEdgeType; 174 GrEffectEdgeType fEdgeType;
175 175
176 GR_DECLARE_EFFECT_TEST; 176 GR_DECLARE_EFFECT_TEST;
177 177
178 typedef GrVertexEffect INHERITED; 178 typedef GrGeometryProcessor INHERITED;
179 }; 179 };
180 180
181 ////////////////////////////////////////////////////////////////////////////// 181 //////////////////////////////////////////////////////////////////////////////
182 /** 182 /**
183 * Shader is based off of "Resolution Independent Curve Rendering using 183 * Shader is based off of "Resolution Independent Curve Rendering using
184 * Programmable Graphics Hardware" by Loop and Blinn. 184 * Programmable Graphics Hardware" by Loop and Blinn.
185 * The output of this effect is a hairline edge for non rational cubics. 185 * The output of this effect is a hairline edge for non rational cubics.
186 * Cubics are specified by implicit equation K^3 - LM. 186 * Cubics are specified by implicit equation K^3 - LM.
187 * K, L, and M, are the first three values of the vertex attribute, 187 * K, L, and M, are the first three values of the vertex attribute,
188 * the fourth value is not used. Distance is calculated using a 188 * the fourth value is not used. Distance is calculated using a
189 * first order approximation from the taylor series. 189 * first order approximation from the taylor series.
190 * Coverage for AA is max(0, 1-distance). 190 * Coverage for AA is max(0, 1-distance).
191 */ 191 */
192 class GrGLCubicEffect; 192 class GrGLCubicEffect;
193 193
194 class GrCubicEffect : public GrVertexEffect { 194 class GrCubicEffect : public GrGeometryProcessor {
195 public: 195 public:
196 static GrEffect* Create(const GrEffectEdgeType edgeType, const GrDrawTargetC aps& caps) { 196 static GrEffect* Create(const GrEffectEdgeType edgeType, const GrDrawTargetC aps& caps) {
197 GR_CREATE_STATIC_EFFECT(gCubicFillAA, GrCubicEffect, (kFillAA_GrEffectEd geType)); 197 GR_CREATE_STATIC_EFFECT(gCubicFillAA, GrCubicEffect, (kFillAA_GrEffectEd geType));
198 GR_CREATE_STATIC_EFFECT(gCubicHairAA, GrCubicEffect, (kHairlineAA_GrEffe ctEdgeType)); 198 GR_CREATE_STATIC_EFFECT(gCubicHairAA, GrCubicEffect, (kHairlineAA_GrEffe ctEdgeType));
199 GR_CREATE_STATIC_EFFECT(gCubicFillBW, GrCubicEffect, (kFillBW_GrEffectEd geType)); 199 GR_CREATE_STATIC_EFFECT(gCubicFillBW, GrCubicEffect, (kFillBW_GrEffectEd geType));
200 switch (edgeType) { 200 switch (edgeType) {
201 case kFillAA_GrEffectEdgeType: 201 case kFillAA_GrEffectEdgeType:
202 if (!caps.shaderDerivativeSupport()) { 202 if (!caps.shaderDerivativeSupport()) {
203 return NULL; 203 return NULL;
204 } 204 }
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 237
238 private: 238 private:
239 GrCubicEffect(GrEffectEdgeType); 239 GrCubicEffect(GrEffectEdgeType);
240 240
241 virtual bool onIsEqual(const GrEffect& other) const SK_OVERRIDE; 241 virtual bool onIsEqual(const GrEffect& other) const SK_OVERRIDE;
242 242
243 GrEffectEdgeType fEdgeType; 243 GrEffectEdgeType fEdgeType;
244 244
245 GR_DECLARE_EFFECT_TEST; 245 GR_DECLARE_EFFECT_TEST;
246 246
247 typedef GrVertexEffect INHERITED; 247 typedef GrGeometryProcessor INHERITED;
248 }; 248 };
249 249
250 #endif 250 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698