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