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

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

Issue 1434313002: Make all GrFragmentProcessors GL independent. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 1 month 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 | « gyp/gpu.gypi ('k') | include/gpu/effects/GrConstColorProcessor.h » ('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 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
11 #include "GrProcessor.h" 11 #include "GrProcessor.h"
12 12
13 class GrCoordTransform; 13 class GrCoordTransform;
14 class GrGLSLCaps; 14 class GrGLSLCaps;
15 class GrGLFragmentProcessor; 15 class GrGLSLFragmentProcessor;
16 class GrInvariantOutput; 16 class GrInvariantOutput;
17 class GrProcessorKeyBuilder; 17 class GrProcessorKeyBuilder;
18 18
19 /** Provides custom fragment shader code. Fragment processors receive an input c olor (vec4f) and 19 /** Provides custom fragment shader code. Fragment processors receive an input c olor (vec4f) and
20 produce an output color. They may reference textures and uniforms. They may use 20 produce an output color. They may reference textures and uniforms. They may use
21 GrCoordTransforms to receive a transformation of the local coordinates that map from local space 21 GrCoordTransforms to receive a transformation of the local coordinates that map from local space
22 to the fragment being processed. 22 to the fragment being processed.
23 */ 23 */
24 class GrFragmentProcessor : public GrProcessor { 24 class GrFragmentProcessor : public GrProcessor {
25 public: 25 public:
(...skipping 30 matching lines...) Expand all
56 static const GrFragmentProcessor* RunInSeries(const GrFragmentProcessor*[], int cnt); 56 static const GrFragmentProcessor* RunInSeries(const GrFragmentProcessor*[], int cnt);
57 57
58 GrFragmentProcessor() 58 GrFragmentProcessor()
59 : INHERITED() 59 : INHERITED()
60 , fUsesLocalCoords(false) 60 , fUsesLocalCoords(false)
61 , fNumTexturesExclChildren(0) 61 , fNumTexturesExclChildren(0)
62 , fNumTransformsExclChildren(0) {} 62 , fNumTransformsExclChildren(0) {}
63 63
64 ~GrFragmentProcessor() override; 64 ~GrFragmentProcessor() override;
65 65
66 GrGLFragmentProcessor* createGLInstance() const; 66 GrGLSLFragmentProcessor* createGLInstance() const;
67 67
68 void getGLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) con st { 68 void getGLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) con st {
69 this->onGetGLProcessorKey(caps, b); 69 this->onGetGLProcessorKey(caps, b);
70 for (int i = 0; i < fChildProcessors.count(); ++i) { 70 for (int i = 0; i < fChildProcessors.count(); ++i) {
71 fChildProcessors[i]->getGLProcessorKey(caps, b); 71 fChildProcessors[i]->getGLProcessorKey(caps, b);
72 } 72 }
73 } 73 }
74 74
75 int numTexturesExclChildren() const { return fNumTexturesExclChildren; } 75 int numTexturesExclChildren() const { return fNumTexturesExclChildren; }
76 76
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 * procs' output invariants; computeInvariantOutput will not be recursive. 159 * procs' output invariants; computeInvariantOutput will not be recursive.
160 */ 160 */
161 virtual void onComputeInvariantOutput(GrInvariantOutput* inout) const = 0; 161 virtual void onComputeInvariantOutput(GrInvariantOutput* inout) const = 0;
162 162
163 private: 163 private:
164 void notifyRefCntIsZero() const final; 164 void notifyRefCntIsZero() const final;
165 165
166 /** Returns a new instance of the appropriate *GL* implementation class 166 /** Returns a new instance of the appropriate *GL* implementation class
167 for the given GrFragmentProcessor; caller is responsible for deleting 167 for the given GrFragmentProcessor; caller is responsible for deleting
168 the object. */ 168 the object. */
169 virtual GrGLFragmentProcessor* onCreateGLInstance() const = 0; 169 virtual GrGLSLFragmentProcessor* onCreateGLInstance() const = 0;
170 170
171 /** Implemented using GLFragmentProcessor::GenKey as described in this class 's comment. */ 171 /** Implemented using GLFragmentProcessor::GenKey as described in this class 's comment. */
172 virtual void onGetGLProcessorKey(const GrGLSLCaps& caps, 172 virtual void onGetGLProcessorKey(const GrGLSLCaps& caps,
173 GrProcessorKeyBuilder* b) const = 0; 173 GrProcessorKeyBuilder* b) const = 0;
174 174
175 /** 175 /**
176 * Subclass implements this to support isEqual(). It will only be called if it is known that 176 * Subclass implements this to support isEqual(). It will only be called if it is known that
177 * the two processors are of the same subclass (i.e. they return the same ob ject from 177 * the two processors are of the same subclass (i.e. they return the same ob ject from
178 * getFactory()). The processor subclass should not compare its coord transf orms as that will 178 * getFactory()). The processor subclass should not compare its coord transf orms as that will
179 * be performed automatically in the non-virtual isEqual(). 179 * be performed automatically in the non-virtual isEqual().
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 int fNumTransformsExclChildren; 213 int fNumTransformsExclChildren;
214 214
215 // TODO: These must convert their processors to pending-execution refs when the parent is 215 // TODO: These must convert their processors to pending-execution refs when the parent is
216 // converted (do this automatically in GrProgramElement?). 216 // converted (do this automatically in GrProgramElement?).
217 SkTArray<const GrFragmentProcessor*, true> fChildProcessors; 217 SkTArray<const GrFragmentProcessor*, true> fChildProcessors;
218 218
219 typedef GrProcessor INHERITED; 219 typedef GrProcessor INHERITED;
220 }; 220 };
221 221
222 #endif 222 #endif
OLDNEW
« no previous file with comments | « gyp/gpu.gypi ('k') | include/gpu/effects/GrConstColorProcessor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698