8 #ifndef GrFragmentProcessor_DEFINED
9 #define GrFragmentProcessor_DEFINED
11 #include "GrProcessor.h"
15 class GrGLSLFragmentProcessor;
68 , fUsesDistanceVectorField(
false)
69 , fUsesLocalCoords(
false)
70 , fNumTexturesExclChildren(0)
71 , fNumBuffersExclChildren(0)
72 , fNumTransformsExclChildren(0) {}
76 GrGLSLFragmentProcessor* createGLSLInstance()
const;
85 int numTexturesExclChildren()
const {
return fNumTexturesExclChildren; }
87 int numBuffersExclChildren()
const {
return fNumBuffersExclChildren; }
89 int numTransformsExclChildren()
const {
return fNumTransformsExclChildren; }
97 const SkTArray<const GrCoordTransform*, true>& coordTransforms()
const {
101 void gatherCoordTransforms(SkTArray<const GrCoordTransform*, true>* outTransforms)
const {
183 bool fUsesDistanceVectorField;
207 bool fUsesLocalCoords;
233 int fNumTexturesExclChildren;
234 int fNumBuffersExclChildren;
235 int fNumTransformsExclChildren;
Used to represent a texture that is required by a GrProcessor.
Definition: GrTextureAccess.h:21
SkSTArray< 1, GrFragmentProcessor *, true > fChildProcessors
This is not SkSTArray<1, sk_sp<GrFragmentProcessor>> because this class holds strong references until...
Definition: GrFragmentProcessor.h:241
void addTextureAccess(const GrTextureAccess *textureAccess) override
Subclasses call these from their constructor to register sampler sources.
Provides custom fragment shader code.
Definition: GrFragmentProcessor.h:24
const GrCoordTransform & coordTransform(int index) const
Returns the coordinate transformation at index.
Definition: GrFragmentProcessor.h:95
Used to represent a texel buffer that will be read in a GrProcessor.
Definition: GrBufferAccess.h:18
static sk_sp< GrFragmentProcessor > MulOutputByInputUnpremulColor(sk_sp< GrFragmentProcessor >)
Similar to the above but it modulates the output r,g,b of the child processor by the input rgb and th...
int registerChildProcessor(sk_sp< GrFragmentProcessor > child)
FragmentProcessor subclasses call this from their constructor to register any child FragmentProcessor...
virtual bool onIsEqual(const GrFragmentProcessor &) const =0
Subclass implements this to support isEqual().
void notifyRefCntIsZero() const final
This will be called when the ref cnt is zero.
Used by processors to build their keys.
Definition: GrProcessor.h:28
bool isEqual(const GrFragmentProcessor &that, bool ignoreCoordTransforms) const
Returns true if this and other processor conservatively draw identically.
bool usesDistanceVectorField() const
Does this FP need a vector to the nearest edge?
Definition: GrFragmentProcessor.h:115
void computeInvariantOutput(GrInvariantOutput *inout) const
This function is used to perform optimizations.
Definition: GrFragmentProcessor.h:134
static sk_sp< GrFragmentProcessor > PremulInput(sk_sp< GrFragmentProcessor >)
Returns a fragment processor that premuls the input before calling the passed in fragment processor...
Shared pointer class to wrap classes that support a ref()/unref() interface.
Definition: SkRefCnt.h:258
static sk_sp< GrFragmentProcessor > MulOutputByInputAlpha(sk_sp< GrFragmentProcessor >)
In many instances (e.g.
bool usesLocalCoords() const
Do any of the coordtransforms for this processor require local coords?
Definition: GrFragmentProcessor.h:112
Definition: GrInvariantOutput.h:57
virtual GrGLSLFragmentProcessor * onCreateGLSLInstance() const =0
Returns a new instance of the appropriate GL implementation class for the given GrFragmentProcessor; ...
const GrTextureAccess & textureAccess(int index) const
Returns the access pattern for the texture at index.
Definition: GrProcessor.h:79
static sk_sp< GrFragmentProcessor > RunInSeries(sk_sp< GrFragmentProcessor > *, int cnt)
Returns a fragment processor that runs the passed in array of fragment processors in a series...
virtual void onGetGLSLProcessorKey(const GrGLSLCaps &caps, GrProcessorKeyBuilder *b) const =0
Implemented using GLFragmentProcessor::GenKey as described in this class's comment.
Provides custom shader code to the Ganesh shading pipeline.
Definition: GrProcessor.h:60
SkSTArray< 4, const GrCoordTransform *, true > fCoordTransforms
fCoordTransforms stores the transforms of this proc, followed by all the transforms of this proc's ch...
Definition: GrFragmentProcessor.h:232
virtual void onComputeInvariantOutput(GrInvariantOutput *inout) const =0
Subclass implements this to support getConstantColorComponents(...).
static sk_sp< GrFragmentProcessor > OverrideInput(sk_sp< GrFragmentProcessor >, GrColor)
Returns a parent fragment processor that adopts the passed fragment processor as a child...
void addCoordTransform(const GrCoordTransform *)
Fragment Processor subclasses call this from their constructor to register coordinate transformations...