OLD | NEW |
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 "GrInvariantOutput.h" | |
13 | 12 |
14 class GrCoordTransform; | 13 class GrCoordTransform; |
15 class GrGLSLCaps; | 14 class GrGLSLCaps; |
16 class GrGLFragmentProcessor; | 15 class GrGLFragmentProcessor; |
17 class GrProcessorKeyBuilder; | 16 class GrProcessorKeyBuilder; |
18 | 17 |
19 /** Provides custom fragment shader code. Fragment processors receive an input c
olor (vec4f) and | 18 /** 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 | 19 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 | 20 GrCoordTransforms to receive a transformation of the local coordinates that
map from local space |
22 to the fragment being processed. | 21 to the fragment being processed. |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 bool isEqual(const GrFragmentProcessor& that, bool ignoreCoordTransforms) co
nst; | 75 bool isEqual(const GrFragmentProcessor& that, bool ignoreCoordTransforms) co
nst; |
77 | 76 |
78 /** | 77 /** |
79 * This function is used to perform optimizations. When called the invarient
Ouput param | 78 * This function is used to perform optimizations. When called the invarient
Ouput param |
80 * indicate whether the input components to this processor in the FS will ha
ve known values. | 79 * indicate whether the input components to this processor in the FS will ha
ve known values. |
81 * In inout the validFlags member is a bitfield of GrColorComponentFlags. Th
e isSingleComponent | 80 * In inout the validFlags member is a bitfield of GrColorComponentFlags. Th
e isSingleComponent |
82 * member indicates whether the input will be 1 or 4 bytes. The function upd
ates the members of | 81 * member indicates whether the input will be 1 or 4 bytes. The function upd
ates the members of |
83 * inout to indicate known values of its output. A component of the color me
mber only has | 82 * inout to indicate known values of its output. A component of the color me
mber only has |
84 * meaning if the corresponding bit in validFlags is set. | 83 * meaning if the corresponding bit in validFlags is set. |
85 */ | 84 */ |
86 void computeInvariantOutput(GrInvariantOutput* inout) const { | 85 void computeInvariantOutput(GrInvariantOutput* inout) const; |
87 this->onComputeInvariantOutput(inout); | |
88 } | |
89 | 86 |
90 protected: | 87 protected: |
91 void addTextureAccess(const GrTextureAccess* textureAccess) override; | 88 void addTextureAccess(const GrTextureAccess* textureAccess) override; |
92 | 89 |
93 /** | 90 /** |
94 * Fragment Processor subclasses call this from their constructor to registe
r coordinate | 91 * Fragment Processor subclasses call this from their constructor to registe
r coordinate |
95 * transformations. Coord transforms provide a mechanism for a processor to
receive coordinates | 92 * transformations. Coord transforms provide a mechanism for a processor to
receive coordinates |
96 * in their FS code. The matrix expresses a transformation from local space.
For a given | 93 * in their FS code. The matrix expresses a transformation from local space.
For a given |
97 * fragment the matrix will be applied to the local coordinate that maps to
the fragment. | 94 * fragment the matrix will be applied to the local coordinate that maps to
the fragment. |
98 * | 95 * |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 int fNumTransformsExclChildren; | 178 int fNumTransformsExclChildren; |
182 | 179 |
183 // TODO: These must convert their processors to pending-execution refs when
the parent is | 180 // TODO: These must convert their processors to pending-execution refs when
the parent is |
184 // converted (do this automatically in GrProgramElement?). | 181 // converted (do this automatically in GrProgramElement?). |
185 SkTArray<const GrFragmentProcessor*, true> fChildProcessors; | 182 SkTArray<const GrFragmentProcessor*, true> fChildProcessors; |
186 | 183 |
187 typedef GrProcessor INHERITED; | 184 typedef GrProcessor INHERITED; |
188 }; | 185 }; |
189 | 186 |
190 #endif | 187 #endif |
OLD | NEW |