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

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

Issue 1287023009: Added tree structure to GrGLFragmentProcessor, i.e. GL instances (Closed) Base URL: https://skia.googlesource.com/skia@cs3_isequal_nonrecursive
Patch Set: moved onSetData from public to protected, onCreateGLInstance from public to private in subclasses Created 5 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 | « 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 #include "GrStagedProcessor.h" 12 #include "GrStagedProcessor.h"
13 13
14 class GrCoordTransform; 14 class GrCoordTransform;
15 class GrGLSLCaps; 15 class GrGLSLCaps;
16 class GrGLFragmentProcessor; 16 class GrGLFragmentProcessor;
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:
26 GrFragmentProcessor() 26 GrFragmentProcessor()
27 : INHERITED() 27 : INHERITED()
28 , fUsesLocalCoords(false) {} 28 , fUsesLocalCoords(false) {}
29 29
30 /** Returns a new instance of the appropriate *GL* implementation class 30 GrGLFragmentProcessor* createGLInstance() const;
31 for the given GrFragmentProcessor; caller is responsible for deleting
32 the object. */
33 virtual GrGLFragmentProcessor* createGLInstance() const = 0;
34 31
35 /** Human-meaningful string to identify this GrFragmentProcessor; may be emb edded 32 /** Human-meaningful string to identify this GrFragmentProcessor; may be emb edded
36 in generated shader code. */ 33 in generated shader code. */
37 virtual const char* name() const = 0; 34 virtual const char* name() const = 0;
38 35
39 void getGLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) con st { 36 void getGLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) con st {
40 this->onGetGLProcessorKey(caps, b); 37 this->onGetGLProcessorKey(caps, b);
41 for (int i = 0; i < fChildProcessors.count(); ++i) { 38 for (int i = 0; i < fChildProcessors.count(); ++i) {
42 fChildProcessors[i].processor()->getGLProcessorKey(caps, b); 39 fChildProcessors[i].processor()->getGLProcessorKey(caps, b);
43 } 40 }
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 115
119 /** 116 /**
120 * Subclass implements this to support getConstantColorComponents(...). 117 * Subclass implements this to support getConstantColorComponents(...).
121 * 118 *
122 * Note: it's up to the subclass implementation to do any recursive call to compute the child 119 * Note: it's up to the subclass implementation to do any recursive call to compute the child
123 * procs' output invariants; computeInvariantOutput will not be recursive. 120 * procs' output invariants; computeInvariantOutput will not be recursive.
124 */ 121 */
125 virtual void onComputeInvariantOutput(GrInvariantOutput* inout) const = 0; 122 virtual void onComputeInvariantOutput(GrInvariantOutput* inout) const = 0;
126 123
127 private: 124 private:
125 /** Returns a new instance of the appropriate *GL* implementation class
126 for the given GrFragmentProcessor; caller is responsible for deleting
127 the object. */
128 virtual GrGLFragmentProcessor* onCreateGLInstance() const = 0;
129
128 /** Implemented using GLFragmentProcessor::GenKey as described in this class 's comment. */ 130 /** Implemented using GLFragmentProcessor::GenKey as described in this class 's comment. */
129 virtual void onGetGLProcessorKey(const GrGLSLCaps& caps, 131 virtual void onGetGLProcessorKey(const GrGLSLCaps& caps,
130 GrProcessorKeyBuilder* b) const = 0; 132 GrProcessorKeyBuilder* b) const = 0;
131 133
132 /** 134 /**
133 * Subclass implements this to support isEqual(). It will only be called if it is known that 135 * Subclass implements this to support isEqual(). It will only be called if it is known that
134 * the two processors are of the same subclass (i.e. they return the same ob ject from 136 * the two processors are of the same subclass (i.e. they return the same ob ject from
135 * getFactory()). The processor subclass should not compare its coord transf orms as that will 137 * getFactory()). The processor subclass should not compare its coord transf orms as that will
136 * be performed automatically in the non-virtual isEqual(). 138 * be performed automatically in the non-virtual isEqual().
137 */ 139 */
(...skipping 27 matching lines...) Expand all
165 * The same goes for fTextureAccesses with textures. 167 * The same goes for fTextureAccesses with textures.
166 */ 168 */
167 SkSTArray<4, const GrCoordTransform*, true> fCoordTransforms; 169 SkSTArray<4, const GrCoordTransform*, true> fCoordTransforms;
168 170
169 SkTArray<GrFragmentStage, false> fChildProcessors; 171 SkTArray<GrFragmentStage, false> fChildProcessors;
170 172
171 typedef GrProcessor INHERITED; 173 typedef GrProcessor INHERITED;
172 }; 174 };
173 175
174 #endif 176 #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