diff options
author | 2014-10-15 11:05:26 -0700 | |
---|---|---|
committer | 2014-10-15 11:05:26 -0700 | |
commit | 98b33ebe6f66ed59b023cf16a09c0a40eb4510ce (patch) | |
tree | 174a7a08bb3dec332bc25df960372cc83e226d2c /include | |
parent | 8e6c3b93a39e19111662a760ede97df55e51d39f (diff) |
Some cleanup in processor header files.
R=joshualitt@google.com
Review URL: https://codereview.chromium.org/659803004
Diffstat (limited to 'include')
-rw-r--r-- | include/gpu/GrFragmentProcessor.h | 15 | ||||
-rw-r--r-- | include/gpu/GrGeometryProcessor.h | 19 | ||||
-rw-r--r-- | include/gpu/GrProcessor.h | 41 |
3 files changed, 32 insertions, 43 deletions
diff --git a/include/gpu/GrFragmentProcessor.h b/include/gpu/GrFragmentProcessor.h index 28778fd10a..f872d90835 100644 --- a/include/gpu/GrFragmentProcessor.h +++ b/include/gpu/GrFragmentProcessor.h @@ -70,9 +70,9 @@ protected: void addCoordTransform(const GrCoordTransform*); /** - * If the prceossor subclass will read the destination pixel value then it must call this function - * from its constructor. Otherwise, when its generated backend-specific prceossor class attempts - * to generate code that reads the destination pixel it will fail. + * If the prceossor subclass will read the destination pixel value then it must call this + * function from its constructor. Otherwise, when its generated backend-specific prceossor class + * attempts to generate code that reads the destination pixel it will fail. */ void setWillReadDstColor() { fWillReadDstColor = true; } @@ -96,13 +96,4 @@ private: 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, FP_CLASS, ARGS) \ -static SkAlignedSStorage<sizeof(FP_CLASS)> g_##NAME##_Storage; \ -static GrFragmentProcessor* NAME SkNEW_PLACEMENT_ARGS(g_##NAME##_Storage.get(), FP_CLASS, ARGS); \ -static SkAutoTDestroy<GrFragmentProcessor> NAME##_ad(NAME); - #endif diff --git a/include/gpu/GrGeometryProcessor.h b/include/gpu/GrGeometryProcessor.h index 5b509ca24f..5f32c5d0cc 100644 --- a/include/gpu/GrGeometryProcessor.h +++ b/include/gpu/GrGeometryProcessor.h @@ -37,12 +37,12 @@ public: const VertexAttribArray& getVertexAttribs() const { return fVertexAttribs; } - /** 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 + /** Returns true if this and other processor conservatively draw identically. It can only return + true when the two prcoessors 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. */ + A return value of true from isEqual() should not be used to test whether the prcoessors + would generate the same shader code. To test for identical code generation use the + processors' keys computed by the GrBackendEffectFactory. */ bool isEqual(const GrGeometryProcessor& that) const { if (&this->getFactory() != &that.getFactory()) { return false; @@ -75,13 +75,4 @@ private: 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_GEOMETRY_PROCESSOR(NAME, GP_CLASS, ARGS) \ -static SkAlignedSStorage<sizeof(GP_CLASS)> g_##NAME##_Storage; \ -static GrGeometryProcessor* NAME SkNEW_PLACEMENT_ARGS(g_##NAME##_Storage.get(), GP_CLASS, ARGS); \ -static SkAutoTDestroy<GrGeometryProcessor> NAME##_ad(NAME); - #endif diff --git a/include/gpu/GrProcessor.h b/include/gpu/GrProcessor.h index b41f94d25a..63ab7ba6f7 100644 --- a/include/gpu/GrProcessor.h +++ b/include/gpu/GrProcessor.h @@ -17,16 +17,13 @@ class GrContext; class GrCoordTransform; -/** Provides custom vertex shader, fragment shader, uniform data for a particular stage of the - Ganesh shading pipeline. - Subclasses must have a function that produces a human-readable name: - static const char* Name(); - GrProcessor objects *must* be immutable: after being constructed, their fields may not change. +/** Provides custom shader code to the Ganesh shading pipeline. GrProcessor objects *must* be + immutable: after being constructed, their fields may not change. Dynamically allocated GrProcessors are managed by a per-thread memory pool. The ref count of an - effect must reach 0 before the thread terminates and the pool is destroyed. To create a static - effect use the macro GR_CREATE_STATIC_EFFECT declared below. - */ + processor must reach 0 before the thread terminates and the pool is destroyed. To create a + static processor use the helper macro GR_CREATE_STATIC_PROCESSOR declared below. + */ class GrProcessor : public GrProgramElement { public: SK_DECLARE_INST_COUNT(GrProcessor) @@ -141,7 +138,7 @@ public: /** * This function is used to perform optimizations. When called the invarientOuput param - * indicate whether the input components to this effect in the FS will have known values. + * indicate whether the input components to this processor in the FS will have known values. * In inout the validFlags member is a bitfield of GrColorComponentFlags. The isSingleComponent * member indicates whether the input will be 1 or 4 bytes. The function updates the members of * inout to indicate known values of its output. A component of the color member only has @@ -161,17 +158,17 @@ public: GrGLProcessor created by the factory. Example: - class MyCustomEffect : public GrProcessor { + class MyCustomProcessor : public GrProcessor { ... virtual const GrBackendEffectFactory& getFactory() const SK_OVERRIDE { - return GrTBackendEffectFactory<MyCustomEffect>::getInstance(); + return GrTBackendEffectFactory<MyCustomProcessor>::getInstance(); } ... }; */ virtual const GrBackendProcessorFactory& getFactory() const = 0; - /** Human-meaningful string to identify this effect; may be embedded + /** Human-meaningful string to identify this prcoessor; may be embedded in generated shader code. */ const char* name() const; @@ -184,7 +181,7 @@ public: /** Shortcut for textureAccess(index).texture(); */ GrTexture* texture(int index) const { return this->textureAccess(index).getTexture(); } - /** Will this effect read the fragment position? */ + /** Will this processor read the fragment position? */ bool willReadFragmentPosition() const { return fWillReadFragmentPosition; } void* operator new(size_t size); @@ -204,7 +201,7 @@ public: protected: /** - * Subclasses call this from their constructor to register GrTextureAccesses. The effect + * Subclasses call this from their constructor to register GrTextureAccesses. The processor * subclass manages the lifetime of the accesses (this function only stores a pointer). The * GrTextureAccess is typically a member field of the GrProcessor subclass. This must only be * called from the constructor because GrProcessors are immutable. @@ -215,9 +212,9 @@ protected: : fWillReadFragmentPosition(false) {} /** - * If the effect will generate a backend-specific effect that will read the fragment position - * in the FS then it must call this method from its constructor. Otherwise, the request to - * access the fragment position will be denied. + * If the prcoessor will generate a backend-specific processor that will read the fragment + * position in the FS then it must call this method from its constructor. Otherwise, the + * request to access the fragment position will be denied. */ void setWillReadFragmentPosition() { fWillReadFragmentPosition = true; } @@ -236,4 +233,14 @@ private: typedef GrProgramElement INHERITED; }; + +/** + * This creates a processor outside of the memory pool. The processor's destructor will be called + * at global destruction time. NAME will be the name of the created instance. + */ +#define GR_CREATE_STATIC_PROCESSOR(NAME, PROC_CLASS, ARGS) \ +static SkAlignedSStorage<sizeof(PROC_CLASS)> g_##NAME##_Storage; \ +static PROC_CLASS* NAME SkNEW_PLACEMENT_ARGS(g_##NAME##_Storage.get(), PROC_CLASS, ARGS); \ +static SkAutoTDestroy<GrProcessor> NAME##_ad(NAME); + #endif |