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

Unified Diff: include/gpu/GrProcessor.h

Issue 660573002: Split GrFragmentProcessor into its own header (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: add file to git Created 6 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « include/gpu/GrGeometryProcessor.h ('k') | include/gpu/GrProcessorStage.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/gpu/GrProcessor.h
diff --git a/include/gpu/GrProcessor.h b/include/gpu/GrProcessor.h
index 7991a069d1f8b11c6177480b2fb88ca1a1975677..b41f94d25af08c48c82a9df15a9843146f9bf838 100644
--- a/include/gpu/GrProcessor.h
+++ b/include/gpu/GrProcessor.h
@@ -12,12 +12,8 @@
#include "GrColor.h"
#include "GrProcessorUnitTest.h"
#include "GrProgramElement.h"
-#include "GrShaderVar.h"
#include "GrTextureAccess.h"
-#include "GrTypesPriv.h"
-#include "SkString.h"
-class GrBackendProcessorFactory;
class GrContext;
class GrCoordTransform;
@@ -240,93 +236,4 @@ private:
typedef GrProgramElement INHERITED;
};
-class GrFragmentProcessor : public GrProcessor {
-public:
- GrFragmentProcessor()
- : INHERITED()
- , fWillReadDstColor(false)
- , fWillUseInputColor(true) {}
-
- virtual const GrBackendFragmentProcessorFactory& getFactory() const = 0;
-
- int numTransforms() const { return fCoordTransforms.count(); }
-
- /** Returns the coordinate transformation at index. index must be valid according to
- numTransforms(). */
- const GrCoordTransform& coordTransform(int index) const { return *fCoordTransforms[index]; }
-
- /** Will this effect read the destination pixel value? */
- bool willReadDstColor() const { return fWillReadDstColor; }
-
- /** Will this effect read the source color value? */
- bool willUseInputColor() const { return fWillUseInputColor; }
-
- /** Returns true if this and other effect conservatively draw identically. It can only return
- true when the two effects are of the same subclass (i.e. they return the same object from
- from getFactory()).
-
- A return value of true from isEqual() should not be used to test whether the effects would
- generate the same shader code. To test for identical code generation use the effects' keys
- computed by the GrBackendEffectFactory. */
- bool isEqual(const GrFragmentProcessor& other) const {
- if (&this->getFactory() != &other.getFactory()) {
- return false;
- }
- bool result = this->onIsEqual(other);
-#ifdef SK_DEBUG
- if (result) {
- this->assertTexturesEqual(other);
- }
-#endif
- return result;
- }
-
-protected:
- /**
- * Fragment Processor subclasses call this from their constructor to register coordinate
- * transformations. The processor subclass manages the lifetime of the transformations (this
- * function only stores a pointer). The GrCoordTransform is typically a member field of the
- * GrProcessor subclass. When the matrix has perspective, the transformed coordinates will have
- * 3 components. Otherwise they'll have 2. This must only be called from the constructor because
- * GrProcessors are immutable.
- */
- void addCoordTransform(const GrCoordTransform*);
-
- /**
- * If the effect subclass will read the destination pixel value then it must call this function
- * from its constructor. Otherwise, when its generated backend-specific effect class attempts
- * to generate code that reads the destination pixel it will fail.
- */
- void setWillReadDstColor() { fWillReadDstColor = true; }
-
- /**
- * If the effect will generate a result that does not depend on the input color value then it
- * must call this function from its constructor. Otherwise, when its generated backend-specific
- * code might fail during variable binding due to unused variables.
- */
- void setWillNotUseInputColor() { fWillUseInputColor = false; }
-
-private:
- /** Subclass implements this to support isEqual(). It will only be called if it is known that
- the two effects are of the same subclass (i.e. they return the same object from
- getFactory()).*/
- virtual bool onIsEqual(const GrFragmentProcessor& other) const = 0;
-
- SkSTArray<4, const GrCoordTransform*, true> fCoordTransforms;
- bool fWillReadDstColor;
- bool fWillUseInputColor;
-
- typedef GrProcessor INHERITED;
-};
-
-/**
- * This creates an effect outside of the effect memory pool. The effect's destructor will be called
- * at global destruction time. NAME will be the name of the created GrProcessor.
- */
-#define GR_CREATE_STATIC_FRAGMENT_PROCESSOR(NAME, EFFECT_CLASS, ARGS) \
-static SkAlignedSStorage<sizeof(EFFECT_CLASS)> g_##NAME##_Storage; \
-static GrFragmentProcessor* \
-NAME SkNEW_PLACEMENT_ARGS(g_##NAME##_Storage.get(), EFFECT_CLASS, ARGS); \
-static SkAutoTDestroy<GrFragmentProcessor> NAME##_ad(NAME);
-
#endif
« no previous file with comments | « include/gpu/GrGeometryProcessor.h ('k') | include/gpu/GrProcessorStage.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698