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

Side by Side Diff: include/gpu/GrFragmentProcessor.h

Issue 2114993002: GrFP can express distance vector field req., program builder declares variable for it (Closed) Base URL: https://skia.googlesource.com/skia@dvonbeck-bevel-api-change
Patch Set: rebase Created 4 years, 5 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 | « no previous file | include/gpu/GrPaint.h » ('j') | include/gpu/GrPaint.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2014 Google Inc. 2 * Copyright 2014 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 GrFragmentProcessor_DEFINED 8 #ifndef GrFragmentProcessor_DEFINED
9 #define GrFragmentProcessor_DEFINED 9 #define GrFragmentProcessor_DEFINED
10 10
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 * series. The original input is passed to the first, the first's output is passed to the 52 * series. The original input is passed to the first, the first's output is passed to the
53 * second, etc. The output of the returned processor is the output of the la st processor of the 53 * second, etc. The output of the returned processor is the output of the la st processor of the
54 * series. 54 * series.
55 * 55 *
56 * The array elements with be moved. 56 * The array elements with be moved.
57 */ 57 */
58 static sk_sp<GrFragmentProcessor> RunInSeries(sk_sp<GrFragmentProcessor>*, i nt cnt); 58 static sk_sp<GrFragmentProcessor> RunInSeries(sk_sp<GrFragmentProcessor>*, i nt cnt);
59 59
60 GrFragmentProcessor() 60 GrFragmentProcessor()
61 : INHERITED() 61 : INHERITED()
62 , fUsesDistanceVectorField(false)
62 , fUsesLocalCoords(false) 63 , fUsesLocalCoords(false)
63 , fNumTexturesExclChildren(0) 64 , fNumTexturesExclChildren(0)
64 , fNumBuffersExclChildren(0) 65 , fNumBuffersExclChildren(0)
65 , fNumTransformsExclChildren(0) {} 66 , fNumTransformsExclChildren(0) {}
66 67
67 ~GrFragmentProcessor() override; 68 ~GrFragmentProcessor() override;
68 69
69 GrGLSLFragmentProcessor* createGLSLInstance() const; 70 GrGLSLFragmentProcessor* createGLSLInstance() const;
70 71
71 void getGLSLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) c onst { 72 void getGLSLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) c onst {
(...skipping 25 matching lines...) Expand all
97 } 98 }
98 } 99 }
99 100
100 int numChildProcessors() const { return fChildProcessors.count(); } 101 int numChildProcessors() const { return fChildProcessors.count(); }
101 102
102 const GrFragmentProcessor& childProcessor(int index) const { return *fChildP rocessors[index]; } 103 const GrFragmentProcessor& childProcessor(int index) const { return *fChildP rocessors[index]; }
103 104
104 /** Do any of the coordtransforms for this processor require local coords? * / 105 /** Do any of the coordtransforms for this processor require local coords? * /
105 bool usesLocalCoords() const { return fUsesLocalCoords; } 106 bool usesLocalCoords() const { return fUsesLocalCoords; }
106 107
108 /** Does this FP need a vector to the nearest edge? */
109 bool usesDistanceVectorField() const { return fUsesDistanceVectorField; }
110
107 /** Returns true if this and other processor conservatively draw identically . It can only return 111 /** Returns true if this and other processor conservatively draw identically . It can only return
108 true when the two processor are of the same subclass (i.e. they return t he same object from 112 true when the two processor are of the same subclass (i.e. they return t he same object from
109 from getFactory()). 113 from getFactory()).
110 114
111 A return value of true from isEqual() should not be used to test whether the processor would 115 A return value of true from isEqual() should not be used to test whether the processor would
112 generate the same shader code. To test for identical code generation use getGLSLProcessorKey 116 generate the same shader code. To test for identical code generation use getGLSLProcessorKey
113 */ 117 */
114 bool isEqual(const GrFragmentProcessor& that, bool ignoreCoordTransforms) co nst; 118 bool isEqual(const GrFragmentProcessor& that, bool ignoreCoordTransforms) co nst;
115 119
116 /** 120 /**
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 int registerChildProcessor(sk_sp<GrFragmentProcessor> child); 164 int registerChildProcessor(sk_sp<GrFragmentProcessor> child);
161 165
162 /** 166 /**
163 * Subclass implements this to support getConstantColorComponents(...). 167 * Subclass implements this to support getConstantColorComponents(...).
164 * 168 *
165 * Note: it's up to the subclass implementation to do any recursive call to compute the child 169 * Note: it's up to the subclass implementation to do any recursive call to compute the child
166 * procs' output invariants; computeInvariantOutput will not be recursive. 170 * procs' output invariants; computeInvariantOutput will not be recursive.
167 */ 171 */
168 virtual void onComputeInvariantOutput(GrInvariantOutput* inout) const = 0; 172 virtual void onComputeInvariantOutput(GrInvariantOutput* inout) const = 0;
169 173
174 /* Sub-classes should set this to true in their constructors if they need ac cess to a distance
175 * vector field to the nearest edge
176 */
177 bool fUsesDistanceVectorField;
178
170 private: 179 private:
171 void notifyRefCntIsZero() const final; 180 void notifyRefCntIsZero() const final;
172 181
173 /** Returns a new instance of the appropriate *GL* implementation class 182 /** Returns a new instance of the appropriate *GL* implementation class
174 for the given GrFragmentProcessor; caller is responsible for deleting 183 for the given GrFragmentProcessor; caller is responsible for deleting
175 the object. */ 184 the object. */
176 virtual GrGLSLFragmentProcessor* onCreateGLSLInstance() const = 0; 185 virtual GrGLSLFragmentProcessor* onCreateGLSLInstance() const = 0;
177 186
178 /** Implemented using GLFragmentProcessor::GenKey as described in this class 's comment. */ 187 /** Implemented using GLFragmentProcessor::GenKey as described in this class 's comment. */
179 virtual void onGetGLSLProcessorKey(const GrGLSLCaps& caps, 188 virtual void onGetGLSLProcessorKey(const GrGLSLCaps& caps,
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 /** 231 /**
223 * This is not SkSTArray<1, sk_sp<GrFragmentProcessor>> because this class h olds strong 232 * This is not SkSTArray<1, sk_sp<GrFragmentProcessor>> because this class h olds strong
224 * references until notifyRefCntIsZero and then it holds pending executions. 233 * references until notifyRefCntIsZero and then it holds pending executions.
225 */ 234 */
226 SkSTArray<1, GrFragmentProcessor*, true> fChildProcessors; 235 SkSTArray<1, GrFragmentProcessor*, true> fChildProcessors;
227 236
228 typedef GrProcessor INHERITED; 237 typedef GrProcessor INHERITED;
229 }; 238 };
230 239
231 #endif 240 #endif
OLDNEW
« no previous file with comments | « no previous file | include/gpu/GrPaint.h » ('j') | include/gpu/GrPaint.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698