aboutsummaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/core/SkColorFilter.h4
-rw-r--r--include/core/SkColorShader.h5
-rw-r--r--include/core/SkImageFilter.h20
-rw-r--r--include/core/SkMaskFilter.h18
-rw-r--r--include/core/SkShader.h7
-rw-r--r--include/core/SkXfermode.h18
-rw-r--r--include/effects/SkColorMatrixFilter.h2
-rw-r--r--include/effects/SkLumaColorFilter.h2
-rw-r--r--include/effects/SkMagnifierImageFilter.h4
-rw-r--r--include/effects/SkMatrixConvolutionImageFilter.h6
-rw-r--r--include/effects/SkPerlinNoiseShader.h4
-rw-r--r--include/gpu/GrBackendProcessorFactory.h (renamed from include/gpu/GrBackendEffectFactory.h)86
-rw-r--r--include/gpu/GrContext.h12
-rw-r--r--include/gpu/GrCoordTransform.h10
-rw-r--r--include/gpu/GrEffectUnitTest.h101
-rw-r--r--include/gpu/GrGeometryProcessor.h66
-rw-r--r--include/gpu/GrPaint.h53
-rw-r--r--include/gpu/GrProcessor.h (renamed from include/gpu/GrEffect.h)134
-rw-r--r--include/gpu/GrProcessorStage.h (renamed from include/gpu/GrEffectStage.h)65
-rw-r--r--include/gpu/GrProcessorUnitTest.h128
-rw-r--r--include/gpu/GrProgramElement.h4
-rw-r--r--include/gpu/GrProgramElementRef.h6
-rw-r--r--include/gpu/GrTBackendEffectFactory.h76
-rw-r--r--include/gpu/GrTBackendProcessorFactory.h101
-rw-r--r--include/gpu/GrTextureAccess.h8
-rw-r--r--include/gpu/GrTypesPriv.h68
-rw-r--r--include/gpu/SkGr.h2
27 files changed, 577 insertions, 433 deletions
diff --git a/include/core/SkColorFilter.h b/include/core/SkColorFilter.h
index 5ddd6af086..31d4a01ee7 100644
--- a/include/core/SkColorFilter.h
+++ b/include/core/SkColorFilter.h
@@ -15,7 +15,7 @@
#include "SkXfermode.h"
class SkBitmap;
-class GrEffect;
+class GrProcessor;
class GrContext;
/**
@@ -126,7 +126,7 @@ public:
/** A subclass may implement this factory function to work with the GPU backend. If the return
is non-NULL then the caller owns a ref on the returned object.
*/
- virtual GrEffect* asNewEffect(GrContext*) const;
+ virtual GrFragmentProcessor* asFragmentProcessor(GrContext*) const;
SK_TO_STRING_PUREVIRT()
diff --git a/include/core/SkColorShader.h b/include/core/SkColorShader.h
index 55d980b64e..dc45f2d6cb 100644
--- a/include/core/SkColorShader.h
+++ b/include/core/SkColorShader.h
@@ -54,9 +54,8 @@ public:
virtual GradientType asAGradient(GradientInfo* info) const SK_OVERRIDE;
- virtual bool asNewEffect(GrContext* context, const SkPaint& paint,
- const SkMatrix* localMatrix, GrColor* paintColor,
- GrEffect** effect) const SK_OVERRIDE;
+ virtual bool asFragmentProcessor(GrContext*, const SkPaint&, const SkMatrix*, GrColor*,
+ GrFragmentProcessor**) const SK_OVERRIDE;
SK_TO_STRING_OVERRIDE()
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkColorShader)
diff --git a/include/core/SkImageFilter.h b/include/core/SkImageFilter.h
index adddf93876..9f17f814d5 100644
--- a/include/core/SkImageFilter.h
+++ b/include/core/SkImageFilter.h
@@ -17,7 +17,7 @@ class SkBitmap;
class SkColorFilter;
class SkBaseDevice;
struct SkIPoint;
-class GrEffect;
+class GrFragmentProcessor;
class GrTexture;
/**
@@ -114,8 +114,8 @@ public:
/**
* Returns true if the filter can be processed on the GPU. This is most
* often used for multi-pass effects, where intermediate results must be
- * rendered to textures. For single-pass effects, use asNewEffect().
- * The default implementation returns asNewEffect(NULL, NULL, SkMatrix::I(),
+ * rendered to textures. For single-pass effects, use asFragmentProcessor().
+ * The default implementation returns asFragmentProcessor(NULL, NULL, SkMatrix::I(),
* SkIRect()).
*/
virtual bool canFilterImageGPU() const;
@@ -123,12 +123,12 @@ public:
/**
* Process this image filter on the GPU. This is most often used for
* multi-pass effects, where intermediate results must be rendered to
- * textures. For single-pass effects, use asNewEffect(). src is the
+ * textures. For single-pass effects, use asFragmentProcessor(). src is the
* source image for processing, as a texture-backed bitmap. result is
* the destination bitmap, which should contain a texture-backed pixelref
* on success. offset is the amount to translate the resulting image
* relative to the src when it is drawn. The default implementation does
- * single-pass processing using asNewEffect().
+ * single-pass processing using asFragmentProcessor().
*/
virtual bool filterImageGPU(Proxy*, const SkBitmap& src, const Context&,
SkBitmap* result, SkIPoint* offset) const;
@@ -290,10 +290,10 @@ protected:
/**
* Returns true if the filter can be expressed a single-pass
- * GrEffect, used to process this filter on the GPU, or false if
+ * GrProcessor, used to process this filter on the GPU, or false if
* not.
*
- * If effect is non-NULL, a new GrEffect instance is stored
+ * If effect is non-NULL, a new GrProcessor instance is stored
* in it. The caller assumes ownership of the stage, and it is up to the
* caller to unref it.
*
@@ -303,10 +303,8 @@ protected:
* will be called with (NULL, NULL, SkMatrix::I()) to query for support,
* so returning "true" indicates support for all possible matrices.
*/
- virtual bool asNewEffect(GrEffect** effect,
- GrTexture*,
- const SkMatrix& matrix,
- const SkIRect& bounds) const;
+ virtual bool asFragmentProcessor(GrFragmentProcessor**, GrTexture*, const SkMatrix&,
+ const SkIRect& bounds) const;
private:
bool usesSrcInput() const { return fUsesSrcInput; }
diff --git a/include/core/SkMaskFilter.h b/include/core/SkMaskFilter.h
index 51ede4b0ab..026ef40cb1 100644
--- a/include/core/SkMaskFilter.h
+++ b/include/core/SkMaskFilter.h
@@ -63,24 +63,22 @@ public:
#if SK_SUPPORT_GPU
/**
- * Returns true if the filter can be expressed a single-pass GrEffect without requiring an
+ * Returns true if the filter can be expressed a single-pass GrProcessor without requiring an
* explicit input mask. Per-pixel, the effect receives the incoming mask's coverage as
* the input color and outputs the filtered covereage value. This means that each pixel's
* filtered coverage must only depend on the unfiltered mask value for that pixel and not on
* surrounding values.
*
- * If effect is non-NULL, a new GrEffect instance is stored in it. The caller assumes ownership
- * of the effect and must unref it.
+ * If effect is non-NULL, a new GrProcessor instance is stored in it. The caller assumes
+ * ownership of the effect and must unref it.
*/
- virtual bool asNewEffect(GrEffect** effect,
- GrTexture*,
- const SkMatrix& ctm) const;
+ virtual bool asFragmentProcessor(GrFragmentProcessor**, GrTexture*, const SkMatrix& ctm) const;
/**
- * If asNewEffect() fails the filter may be implemented on the GPU by a subclass overriding
- * filterMaskGPU (declared below). That code path requires constructing a src mask as input.
- * Since that is a potentially expensive operation, the subclass must also override this
- * function to indicate whether filterTextureMaskGPU would succeeed if the mask were to be
+ * If asFragmentProcessor() fails the filter may be implemented on the GPU by a subclass
+ * overriding filterMaskGPU (declared below). That code path requires constructing a src mask
+ * as input. Since that is a potentially expensive operation, the subclass must also override
+ * this function to indicate whether filterTextureMaskGPU would succeeed if the mask were to be
* created.
*
* 'maskRect' returns the device space portion of the mask that the filter needs. The mask
diff --git a/include/core/SkShader.h b/include/core/SkShader.h
index 6effe797f7..0fbc1b8bd6 100644
--- a/include/core/SkShader.h
+++ b/include/core/SkShader.h
@@ -20,7 +20,7 @@ class SkPath;
class SkPicture;
class SkXfermode;
class GrContext;
-class GrEffect;
+class GrFragmentProcessor;
/** \class SkShader
*
@@ -385,9 +385,8 @@ public:
* The GrContext may be used by the effect to create textures. The GPU device does not
* call createContext. Instead we pass the SkPaint here in case the shader needs paint info.
*/
- virtual bool asNewEffect(GrContext* context, const SkPaint& paint,
- const SkMatrix* localMatrixOrNull, GrColor* paintColor,
- GrEffect** effect) const;
+ virtual bool asFragmentProcessor(GrContext*, const SkPaint&, const SkMatrix*, GrColor*,
+ GrFragmentProcessor**) const;
/**
* If the shader can represent its "average" luminance in a single color, return true and
diff --git a/include/core/SkXfermode.h b/include/core/SkXfermode.h
index 3fb3ab59a7..bedcc24569 100644
--- a/include/core/SkXfermode.h
+++ b/include/core/SkXfermode.h
@@ -13,7 +13,7 @@
#include "SkFlattenable.h"
#include "SkColor.h"
-class GrEffect;
+class GrFragmentProcessor;
class GrTexture;
class SkString;
@@ -198,18 +198,16 @@ public:
fragment shader. If NULL, the effect should request access to destination color
(setWillReadDstColor()), and use that in the fragment shader (builder->dstColor()).
*/
- virtual bool asNewEffect(GrEffect** effect, GrTexture* background = NULL) const;
+ virtual bool asFragmentProcessor(GrFragmentProcessor**, GrTexture* background = NULL) const;
/** Returns true if the xfermode can be expressed as coeffs (src, dst), or as an effect
- (effect). This helper calls the asCoeff() and asNewEffect() virtuals. If the xfermode is
- NULL, it is treated as kSrcOver_Mode. It is legal to call this with all params NULL to
- simply test the return value. effect, src, and dst must all be NULL or all non-NULL.
+ (effect). This helper calls the asCoeff() and asFragmentProcessor() virtuals. If the
+ xfermode is NULL, it is treated as kSrcOver_Mode. It is legal to call this with all params
+ NULL to simply test the return value. effect, src, and dst must all be NULL or all
+ non-NULL.
*/
- static bool AsNewEffectOrCoeff(SkXfermode*,
- GrEffect** effect,
- Coeff* src,
- Coeff* dst,
- GrTexture* background = NULL);
+ static bool asFragmentProcessorOrCoeff(SkXfermode*, GrFragmentProcessor**, Coeff* src,
+ Coeff* dst, GrTexture* background = NULL);
SK_TO_STRING_PUREVIRT()
SK_DECLARE_FLATTENABLE_REGISTRAR_GROUP()
diff --git a/include/effects/SkColorMatrixFilter.h b/include/effects/SkColorMatrixFilter.h
index b8464632b2..dad40623f1 100644
--- a/include/effects/SkColorMatrixFilter.h
+++ b/include/effects/SkColorMatrixFilter.h
@@ -26,7 +26,7 @@ public:
virtual uint32_t getFlags() const SK_OVERRIDE;
virtual bool asColorMatrix(SkScalar matrix[20]) const SK_OVERRIDE;
#if SK_SUPPORT_GPU
- virtual GrEffect* asNewEffect(GrContext*) const SK_OVERRIDE;
+ virtual GrFragmentProcessor* asFragmentProcessor(GrContext*) const SK_OVERRIDE;
#endif
struct State {
diff --git a/include/effects/SkLumaColorFilter.h b/include/effects/SkLumaColorFilter.h
index 38bab92ce4..420999f2e8 100644
--- a/include/effects/SkLumaColorFilter.h
+++ b/include/effects/SkLumaColorFilter.h
@@ -28,7 +28,7 @@ public:
virtual void filterSpan(const SkPMColor src[], int count, SkPMColor[]) const SK_OVERRIDE;
#if SK_SUPPORT_GPU
- virtual GrEffect* asNewEffect(GrContext*) const SK_OVERRIDE;
+ virtual GrFragmentProcessor* asFragmentProcessor(GrContext*) const SK_OVERRIDE;
#endif
SK_TO_STRING_OVERRIDE()
diff --git a/include/effects/SkMagnifierImageFilter.h b/include/effects/SkMagnifierImageFilter.h
index 9ea4b37484..4dd47ef7bd 100644
--- a/include/effects/SkMagnifierImageFilter.h
+++ b/include/effects/SkMagnifierImageFilter.h
@@ -28,8 +28,8 @@ protected:
virtual bool onFilterImage(Proxy*, const SkBitmap& src, const Context&,
SkBitmap* result, SkIPoint* offset) const SK_OVERRIDE;
#if SK_SUPPORT_GPU
- virtual bool asNewEffect(GrEffect** effect, GrTexture* texture, const SkMatrix& matrix,
- const SkIRect& bounds) const SK_OVERRIDE;
+ virtual bool asFragmentProcessor(GrFragmentProcessor**, GrTexture*, const SkMatrix&,
+ const SkIRect& bounds) const SK_OVERRIDE;
#endif
private:
diff --git a/include/effects/SkMatrixConvolutionImageFilter.h b/include/effects/SkMatrixConvolutionImageFilter.h
index e24d823294..c14d6f99f8 100644
--- a/include/effects/SkMatrixConvolutionImageFilter.h
+++ b/include/effects/SkMatrixConvolutionImageFilter.h
@@ -91,10 +91,8 @@ protected:
#if SK_SUPPORT_GPU
- virtual bool asNewEffect(GrEffect** effect,
- GrTexture*,
- const SkMatrix& ctm,
- const SkIRect& bounds) const SK_OVERRIDE;
+ virtual bool asFragmentProcessor(GrFragmentProcessor**, GrTexture*, const SkMatrix&,
+ const SkIRect& bounds) const SK_OVERRIDE;
#endif
private:
diff --git a/include/effects/SkPerlinNoiseShader.h b/include/effects/SkPerlinNoiseShader.h
index f5f1af01cf..2937926cd7 100644
--- a/include/effects/SkPerlinNoiseShader.h
+++ b/include/effects/SkPerlinNoiseShader.h
@@ -96,8 +96,8 @@ public:
typedef SkShader::Context INHERITED;
};
- virtual bool asNewEffect(GrContext* context, const SkPaint&, const SkMatrix*, GrColor*,
- GrEffect**) const SK_OVERRIDE;
+ virtual bool asFragmentProcessor(GrContext* context, const SkPaint&, const SkMatrix*, GrColor*,
+ GrFragmentProcessor**) const SK_OVERRIDE;
SK_TO_STRING_OVERRIDE()
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkPerlinNoiseShader)
diff --git a/include/gpu/GrBackendEffectFactory.h b/include/gpu/GrBackendProcessorFactory.h
index 936d632a7e..b51a474739 100644
--- a/include/gpu/GrBackendEffectFactory.h
+++ b/include/gpu/GrBackendProcessorFactory.h
@@ -5,8 +5,8 @@
* found in the LICENSE file.
*/
-#ifndef GrBackendEffectFactory_DEFINED
-#define GrBackendEffectFactory_DEFINED
+#ifndef GrBackendProcessorFactory_DEFINED
+#define GrBackendProcessorFactory_DEFINED
#include "GrTypes.h"
#include "SkTemplates.h"
@@ -14,16 +14,17 @@
#include "SkTypes.h"
#include "SkTArray.h"
-class GrGLEffect;
+class GrGLProcessor;
class GrGLCaps;
-class GrEffect;
+class GrProcessor;
/**
- * Used by effects to build their keys. It incorporates each per-effect key into a larger shader key.
+ * Used by effects to build their keys. It incorporates each per-processor key into a larger shader
+ * key.
*/
-class GrEffectKeyBuilder {
+class GrProcessorKeyBuilder {
public:
- GrEffectKeyBuilder(SkTArray<unsigned char, true>* data) : fData(data), fCount(0) {
+ GrProcessorKeyBuilder(SkTArray<unsigned char, true>* data) : fData(data), fCount(0) {
SkASSERT(0 == fData->count() % sizeof(uint32_t));
}
@@ -48,13 +49,13 @@ private:
};
/**
- * This class is used to pass the key that was created for a GrGLEffect back to it
+ * This class is used to pass the key that was created for a GrGLProcessor back to it
* when it emits code. It may allow the emit step to skip calculations that were
* performed when computing the key.
*/
-class GrEffectKey {
+class GrProcessorKey {
public:
- GrEffectKey(const uint32_t* key, int count) : fKey(key), fCount(count) {
+ GrProcessorKey(const uint32_t* key, int count) : fKey(key), fCount(count) {
SkASSERT(0 == reinterpret_cast<intptr_t>(key) % sizeof(uint32_t));
}
@@ -73,14 +74,14 @@ private:
};
/**
- * Given a GrEffect of a particular type, creates the corresponding graphics-backend-specific
+ * Given a GrProcessor of a particular type, creates the corresponding graphics-backend-specific
* effect object. It also tracks equivalence of shaders generated via a key. The factory for an
- * effect is accessed via GrEffect::getFactory(). Each factory instance is assigned an ID at
- * construction. The ID of GrEffect::getFactory() is used as a type identifier. Thus, a GrEffect
- * subclass must always return the same object from getFactory() and that factory object must be
- * unique to the GrEffect subclass (and unique from any further derived subclasses).
+ * effect is accessed via GrProcessor::getFactory(). Each factory instance is assigned an ID at
+ * construction. The ID of GrProcessor::getFactory() is used as a type identifier. Thus, a
+ * GrProcessor subclass must always return the same object from getFactory() and that factory object
+ * must be unique to the GrProcessor subclass (and unique from any further derived subclasses).
*
- * Rather than subclassing this class themselves, it is recommended that GrEffect authors use
+ * Rather than subclassing this class themselves, it is recommended that GrProcessor authors use
* the templated subclass GrTBackendEffectFactory by writing their getFactory() method as:
*
* const GrBackendEffectFactory& MyEffect::getFactory() const {
@@ -89,20 +90,15 @@ private:
*
* Using GrTBackendEffectFactory places a few constraints on the effect. See that class's comments.
*/
-class GrBackendEffectFactory : SkNoncopyable {
+class GrBackendProcessorFactory : SkNoncopyable {
public:
/**
- * Generates an effect's key. The key is based on the aspects of the GrEffect object's
- * configuration that affect GLSL code generation. Two GrEffect instances that would cause
+ * Generates an effect's key. The key is based on the aspects of the GrProcessor object's
+ * configuration that affect GLSL code generation. Two GrProcessor instances that would cause
* this->createGLInstance()->emitCode() to produce different code must produce different keys.
*/
- virtual void getGLEffectKey(const GrEffect&, const GrGLCaps&, GrEffectKeyBuilder*) const = 0;
-
- /**
- * Creates a GrGLEffect instance that is used both to generate code for the GrEffect in a GLSL
- * program and to manage updating uniforms for the program when it is used.
- */
- virtual GrGLEffect* createGLInstance(const GrEffect&) const = 0;
+ virtual void getGLProcessorKey(const GrProcessor&, const GrGLCaps&,
+ GrProcessorKeyBuilder*) const = 0;
/**
* Produces a human-reable name for the effect.
@@ -111,14 +107,14 @@ public:
/**
* A unique value for every instance of this factory. It is automatically incorporated into the
- * effect's key. This allows keys generated by getGLEffectKey() to only be unique within a
- * GrEffect subclass and not necessarily across subclasses.
+ * effect's key. This allows keys generated by getGLProcessorKey() to only be unique within a
+ * GrProcessor subclass and not necessarily across subclasses.
*/
uint32_t effectClassID() const { return fEffectClassID; }
protected:
- GrBackendEffectFactory() : fEffectClassID(GenID()) {}
- virtual ~GrBackendEffectFactory() {}
+ GrBackendProcessorFactory() : fEffectClassID(GenID()) {}
+ virtual ~GrBackendProcessorFactory() {}
private:
enum {
@@ -131,7 +127,7 @@ private:
// 1 to the returned value.
uint32_t id = static_cast<uint32_t>(sk_atomic_inc(&fCurrEffectClassID)) + 1;
if (!id) {
- SkFAIL("This should never wrap as it should only be called once for each GrEffect "
+ SkFAIL("This should never wrap as it should only be called once for each GrProcessor "
"subclass.");
}
return id;
@@ -141,4 +137,32 @@ private:
static int32_t fCurrEffectClassID;
};
+class GrFragmentProcessor;
+class GrGeometryProcessor;
+class GrGLFragmentProcessor;
+class GrGLGeometryProcessor;
+
+/**
+ * Backend processor factory cannot actually create anything, it is up to subclasses to implement
+ * a create binding which matches Gr to GL in a type safe way
+ */
+
+class GrBackendFragmentProcessorFactory : public GrBackendProcessorFactory {
+public:
+ /**
+ * Creates a GrGLProcessor instance that is used both to generate code for the GrProcessor in a
+ * GLSL program and to manage updating uniforms for the program when it is used.
+ */
+ virtual GrGLFragmentProcessor* createGLInstance(const GrFragmentProcessor&) const = 0;
+};
+
+class GrBackendGeometryProcessorFactory : public GrBackendProcessorFactory {
+public:
+ /**
+ * Creates a GrGLProcessor instance that is used both to generate code for the GrProcessor in a
+ * GLSL program and to manage updating uniforms for the program when it is used.
+ */
+ virtual GrGLGeometryProcessor* createGLInstance(const GrGeometryProcessor&) const = 0;
+};
+
#endif
diff --git a/include/gpu/GrContext.h b/include/gpu/GrContext.h
index f9c78ffbe3..45cd599132 100644
--- a/include/gpu/GrContext.h
+++ b/include/gpu/GrContext.h
@@ -22,8 +22,8 @@ class GrAARectRenderer;
class GrAutoScratchTexture;
class GrDrawState;
class GrDrawTarget;
-class GrEffect;
class GrFontCache;
+class GrFragmentProcessor;
class GrGpu;
class GrGpuTraceMarker;
class GrIndexBuffer;
@@ -759,7 +759,7 @@ public:
* Save/restore the view-matrix in the context. It can optionally adjust a paint to account
* for a coordinate system change. Here is an example of how the paint param can be used:
*
- * A GrPaint is setup with GrEffects. The stages will have access to the pre-matrix source
+ * A GrPaint is setup with GrProcessors. The stages will have access to the pre-matrix source
* geometry positions when the draw is executed. Later on a decision is made to transform the
* geometry to device space on the CPU. The effects now need to know that the space in which
* the geometry will be specified has changed.
@@ -1066,12 +1066,8 @@ private:
* of effects that make a readToUPM->writeToPM->readToUPM cycle invariant. Otherwise, they
* return NULL.
*/
- const GrEffect* createPMToUPMEffect(GrTexture* texture,
- bool swapRAndB,
- const SkMatrix& matrix);
- const GrEffect* createUPMToPMEffect(GrTexture* texture,
- bool swapRAndB,
- const SkMatrix& matrix);
+ const GrFragmentProcessor* createPMToUPMEffect(GrTexture*, bool swapRAndB, const SkMatrix&);
+ const GrFragmentProcessor* createUPMToPMEffect(GrTexture*, bool swapRAndB, const SkMatrix&);
/**
* This callback allows the resource cache to callback into the GrContext
diff --git a/include/gpu/GrCoordTransform.h b/include/gpu/GrCoordTransform.h
index 734c26fae9..718bbe774f 100644
--- a/include/gpu/GrCoordTransform.h
+++ b/include/gpu/GrCoordTransform.h
@@ -8,13 +8,13 @@
#ifndef GrCoordTransform_DEFINED
#define GrCoordTransform_DEFINED
-#include "GrEffect.h"
+#include "GrProcessor.h"
#include "SkMatrix.h"
#include "GrTexture.h"
#include "GrTypes.h"
/**
- * Coordinates available to GrEffect subclasses for requesting transformations. Transformed
+ * Coordinates available to GrProcessor subclasses for requesting transformations. Transformed
* coordinates are made available in the the portion of fragment shader emitted by the effect.
*/
enum GrCoordSet {
@@ -22,21 +22,21 @@ enum GrCoordSet {
* The user-space coordinates that map to the fragment being rendered. These coords account for
* any change of coordinate system done on the CPU by GrContext before rendering, and also are
* correct for draws that take explicit local coords rather than inferring them from the
- * primitive's positions (e.g. drawVertices). These are usually the coords a GrEffect wants.
+ * primitive's positions (e.g. drawVertices). These are usually the coords a GrProcessor wants.
*/
kLocal_GrCoordSet,
/**
* The actual vertex position. Note that GrContext may not draw using the original view matrix
* specified by the caller, as it may have transformed vertices into another space. These are
- * usually not the coordinates a GrEffect wants.
+ * usually not the coordinates a GrProcessor wants.
*/
kPosition_GrCoordSet
};
/**
* A class representing a linear transformation from one of the built-in coordinate sets (local or
- * position). GrEffects just define these transformations, and the framework does the rest of the
+ * position). GrProcessors just define these transformations, and the framework does the rest of the
* work to make the transformed coordinates available in their fragment shader.
*/
class GrCoordTransform : SkNoncopyable {
diff --git a/include/gpu/GrEffectUnitTest.h b/include/gpu/GrEffectUnitTest.h
deleted file mode 100644
index ffc64f2b82..0000000000
--- a/include/gpu/GrEffectUnitTest.h
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * Copyright 2012 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#ifndef GrEffectUnitTest_DEFINED
-#define GrEffectUnitTest_DEFINED
-
-#include "SkRandom.h"
-#include "SkTArray.h"
-#include "SkTypes.h"
-
-class SkMatrix;
-class GrDrawTargetCaps;
-
-namespace GrEffectUnitTest {
-// Used to access the dummy textures in TestCreate procs.
-enum {
- kSkiaPMTextureIdx = 0,
- kAlphaTextureIdx = 1,
-};
-
-/**
- * A helper for use in GrEffect::TestCreate functions.
- */
-const SkMatrix& TestMatrix(SkRandom*);
-
-}
-
-#if SK_ALLOW_STATIC_GLOBAL_INITIALIZERS
-
-class GrContext;
-class GrEffect;
-class GrTexture;
-
-class GrEffectTestFactory : SkNoncopyable {
-public:
-
- typedef GrEffect* (*CreateProc)(SkRandom*,
- GrContext*,
- const GrDrawTargetCaps& caps,
- GrTexture* dummyTextures[]);
-
- GrEffectTestFactory(CreateProc createProc) {
- fCreateProc = createProc;
- GetFactories()->push_back(this);
- }
-
- static GrEffect* CreateStage(SkRandom* random,
- GrContext* context,
- const GrDrawTargetCaps& caps,
- GrTexture* dummyTextures[]) {
- uint32_t idx = random->nextRangeU(0, GetFactories()->count() - 1);
- GrEffectTestFactory* factory = (*GetFactories())[idx];
- return factory->fCreateProc(random, context, caps, dummyTextures);
- }
-
-private:
- CreateProc fCreateProc;
- static SkTArray<GrEffectTestFactory*, true>* GetFactories();
-};
-
-/** GrEffect subclasses should insert this macro in their declaration to be included in the
- * program generation unit test.
- */
-#define GR_DECLARE_EFFECT_TEST \
- static GrEffectTestFactory gTestFactory; \
- static GrEffect* TestCreate(SkRandom*, \
- GrContext*, \
- const GrDrawTargetCaps&, \
- GrTexture* dummyTextures[2])
-
-/** GrEffect subclasses should insert this macro in their implementation file. They must then
- * also implement this static function:
- * GrEffect* TestCreate(SkRandom*,
- * GrContext*,
- * const GrDrawTargetCaps&,
- * GrTexture* dummyTextures[2]);
- * dummyTextures[] are valid textures that can optionally be used to construct GrTextureAccesses.
- * The first texture has config kSkia8888_GrPixelConfig and the second has
- * kAlpha_8_GrPixelConfig. TestCreate functions are also free to create additional textures using
- * the GrContext.
- */
-#define GR_DEFINE_EFFECT_TEST(Effect) \
- GrEffectTestFactory Effect :: gTestFactory(Effect :: TestCreate)
-
-#else // !SK_ALLOW_STATIC_GLOBAL_INITIALIZERS
-
-// The unit test relies on static initializers. Just declare the TestCreate function so that
-// its definitions will compile.
-#define GR_DECLARE_EFFECT_TEST \
- static GrEffect* TestCreate(SkRandom*, \
- GrContext*, \
- const GrDrawTargetCaps&, \
- GrTexture* dummyTextures[2])
-#define GR_DEFINE_EFFECT_TEST(X)
-
-#endif // !SK_ALLOW_STATIC_GLOBAL_INITIALIZERS
-#endif
diff --git a/include/gpu/GrGeometryProcessor.h b/include/gpu/GrGeometryProcessor.h
new file mode 100644
index 0000000000..61659cf171
--- /dev/null
+++ b/include/gpu/GrGeometryProcessor.h
@@ -0,0 +1,66 @@
+/*
+ * Copyright 2013 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef GrGeometryProcessor_DEFINED
+#define GrGeometryProcessor_DEFINED
+
+#include "GrProcessor.h"
+class GrBackendGeometryProcessorFactory;
+
+/**
+ * A GrGeomteryProcessor is used to perform computation in the vertex shader and
+ * add support for custom vertex attributes. A GrGemeotryProcessor is typically
+ * tied to the code that does a specific type of high-level primitive rendering
+ * (e.g. anti-aliased circle rendering). The GrGeometryProcessor used for a draw is
+ * specified using GrDrawState. There can only be one geometry processor active for
+ * a draw. The custom vertex attributes required by the geometry processor must be
+ * added to the vertex attribute array specified on the GrDrawState.
+ * GrGeometryProcessor subclasses should be immutable after construction.
+ */
+class GrGeometryProcessor : public GrProcessor {
+public:
+ GrGeometryProcessor() {}
+
+ virtual const GrBackendGeometryProcessorFactory& getFactory() const = 0;
+
+ /*
+ * This only has a max because GLProgramsTest needs to generate test arrays, and these have to
+ * be static
+ * TODO make this truly dynamic
+ */
+ static const int kMaxVertexAttribs = 2;
+ typedef SkTArray<GrShaderVar, true> VertexAttribArray;
+
+ const VertexAttribArray& getVertexAttribs() const { return fVertexAttribs; }
+
+protected:
+ /**
+ * Subclasses call this from their constructor to register vertex attributes (at most
+ * kMaxVertexAttribs). This must only be called from the constructor because GrProcessors are
+ * immutable.
+ */
+ const GrShaderVar& addVertexAttrib(const GrShaderVar& var) {
+ SkASSERT(fVertexAttribs.count() < kMaxVertexAttribs);
+ return fVertexAttribs.push_back(var);
+ }
+
+private:
+ SkSTArray<kMaxVertexAttribs, GrShaderVar, true> fVertexAttribs;
+
+ 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/GrPaint.h b/include/gpu/GrPaint.h
index 07b526f73c..d0531a3024 100644
--- a/include/gpu/GrPaint.h
+++ b/include/gpu/GrPaint.h
@@ -11,7 +11,7 @@
#define GrPaint_DEFINED
#include "GrColor.h"
-#include "GrEffectStage.h"
+#include "GrProcessorStage.h"
#include "SkXfermode.h"
@@ -20,7 +20,7 @@
* functions and the how color is blended with the destination pixel.
*
* The paint allows installation of custom color and coverage stages. New types of stages are
- * created by subclassing GrEffect.
+ * created by subclassing GrProcessor.
*
* The primitive color computation starts with the color specified by setColor(). This color is the
* input to the first color stage. Each color stage feeds its output to the next color stage. The
@@ -39,7 +39,7 @@
* Note that the coverage is applied after the blend. This is why they are computed as distinct
* values.
*
- * TODO: Encapsulate setXfermodeColorFilter in a GrEffect and remove from GrPaint.
+ * TODO: Encapsulate setXfermodeColorFilter in a GrProcessor and remove from GrPaint.
*/
class GrPaint {
public:
@@ -85,51 +85,44 @@ public:
bool isDither() const { return fDither; }
/**
- * Appends an additional color effect to the color computation.
+ * Appends an additional color processor to the color computation.
*/
- const GrEffect* addColorEffect(const GrEffect* effect) {
- SkASSERT(effect);
- SkASSERT(!effect->requiresVertexShader());
- if (!effect->willUseInputColor()) {
+ const GrFragmentProcessor* addColorProcessor(const GrFragmentProcessor* fp) {
+ SkASSERT(fp);
+ if (!fp->willUseInputColor()) {
fColorStages.reset();
}
- SkNEW_APPEND_TO_TARRAY(&fColorStages, GrEffectStage, (effect));
- return effect;
+ SkNEW_APPEND_TO_TARRAY(&fColorStages, GrProcessorStage, (fp));
+ return fp;
}
/**
- * Appends an additional coverage effect to the coverage computation.
+ * Appends an additional coverage processor to the coverage computation.
*/
- const GrEffect* addCoverageEffect(const GrEffect* effect) {
- SkASSERT(effect);
- SkASSERT(!effect->requiresVertexShader());
- if (!effect->willUseInputColor()) {
+ const GrFragmentProcessor* addCoverageProcessor(const GrFragmentProcessor* fp) {
+ SkASSERT(fp);
+ if (!fp->willUseInputColor()) {
fCoverageStages.reset();
}
- SkNEW_APPEND_TO_TARRAY(&fCoverageStages, GrEffectStage, (effect));
- return effect;
+ SkNEW_APPEND_TO_TARRAY(&fCoverageStages, GrProcessorStage, (fp));
+ return fp;
}
/**
* Helpers for adding color or coverage effects that sample a texture. The matrix is applied
* to the src space position to compute texture coordinates.
*/
- void addColorTextureEffect(GrTexture* texture, const SkMatrix& matrix);
- void addCoverageTextureEffect(GrTexture* texture, const SkMatrix& matrix);
-
- void addColorTextureEffect(GrTexture* texture,
- const SkMatrix& matrix,
- const GrTextureParams& params);
- void addCoverageTextureEffect(GrTexture* texture,
- const SkMatrix& matrix,
- const GrTextureParams& params);
+ void addColorTextureProcessor(GrTexture*, const SkMatrix&);
+ void addCoverageTextureProcessor(GrTexture*, const SkMatrix&);
+ void addColorTextureProcessor(GrTexture*, const SkMatrix&, const GrTextureParams&);
+ void addCoverageTextureProcessor(GrTexture*, const SkMatrix&, const GrTextureParams&);
int numColorStages() const { return fColorStages.count(); }
int numCoverageStages() const { return fCoverageStages.count(); }
int numTotalStages() const { return this->numColorStages() + this->numCoverageStages(); }
- const GrEffectStage& getColorStage(int s) const { return fColorStages[s]; }
- const GrEffectStage& getCoverageStage(int s) const { return fCoverageStages[s]; }
+ const GrFragmentStage& getColorStage(int s) const { return fColorStages[s]; }
+ const GrFragmentStage& getCoverageStage(int s) const { return fCoverageStages[s]; }
GrPaint& operator=(const GrPaint& paint) {
fSrcBlendCoeff = paint.fSrcBlendCoeff;
@@ -218,8 +211,8 @@ private:
friend class GrContext; // To access above two functions
friend class GrStencilAndCoverTextContext; // To access above two functions
- SkSTArray<4, GrEffectStage> fColorStages;
- SkSTArray<2, GrEffectStage> fCoverageStages;
+ SkSTArray<4, GrFragmentStage> fColorStages;
+ SkSTArray<2, GrFragmentStage> fCoverageStages;
GrBlendCoeff fSrcBlendCoeff;
GrBlendCoeff fDstBlendCoeff;
diff --git a/include/gpu/GrEffect.h b/include/gpu/GrProcessor.h
index e9259979f0..7053872bbe 100644
--- a/include/gpu/GrEffect.h
+++ b/include/gpu/GrProcessor.h
@@ -5,18 +5,19 @@
* found in the LICENSE file.
*/
-#ifndef GrEffect_DEFINED
-#define GrEffect_DEFINED
+#ifndef GrProcessor_DEFINED
+#define GrProcessor_DEFINED
+#include "GrBackendProcessorFactory.h"
#include "GrColor.h"
-#include "GrEffectUnitTest.h"
+#include "GrProcessorUnitTest.h"
#include "GrProgramElement.h"
#include "GrShaderVar.h"
#include "GrTextureAccess.h"
#include "GrTypesPriv.h"
#include "SkString.h"
-class GrBackendEffectFactory;
+class GrBackendProcessorFactory;
class GrContext;
class GrCoordTransform;
@@ -24,17 +25,17 @@ class GrCoordTransform;
Ganesh shading pipeline.
Subclasses must have a function that produces a human-readable name:
static const char* Name();
- GrEffect objects *must* be immutable: after being constructed, their fields may not change.
+ GrProcessor objects *must* be immutable: after being constructed, their fields may not change.
- Dynamically allocated GrEffects are managed by a per-thread memory pool. The ref count of an
+ 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.
*/
-class GrEffect : public GrProgramElement {
+class GrProcessor : public GrProgramElement {
public:
- SK_DECLARE_INST_COUNT(GrEffect)
+ SK_DECLARE_INST_COUNT(GrProcessor)
- virtual ~GrEffect();
+ virtual ~GrProcessor();
/**
* This function is used to perform optimizations. When called the color and validFlags params
@@ -45,17 +46,14 @@ public:
*/
virtual void getConstantColorComponents(GrColor* color, uint32_t* validFlags) const = 0;
- /** Will this effect read the source color value? */
- bool willUseInputColor() const { return fWillUseInputColor; }
-
/** This object, besides creating back-end-specific helper objects, is used for run-time-type-
identification. The factory should be an instance of templated class,
- GrTBackendEffectFactory. It is templated on the subclass of GrEffect. The subclass must have
- a nested type (or typedef) named GLEffect which will be the subclass of GrGLEffect created
- by the factory.
+ GrTBackendEffectFactory. It is templated on the subclass of GrProcessor. The subclass must
+ have a nested type (or typedef) named GLProcessor which will be the subclass of
+ GrGLProcessor created by the factory.
Example:
- class MyCustomEffect : public GrEffect {
+ class MyCustomEffect : public GrProcessor {
...
virtual const GrBackendEffectFactory& getFactory() const SK_OVERRIDE {
return GrTBackendEffectFactory<MyCustomEffect>::getInstance();
@@ -63,7 +61,7 @@ public:
...
};
*/
- virtual const GrBackendEffectFactory& getFactory() const = 0;
+ virtual const GrBackendProcessorFactory& getFactory() const = 0;
/** 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
@@ -73,7 +71,7 @@ public:
generate the same shader code. To test for identical code generation use the effects' keys
computed by the GrBackendEffectFactory.
*/
- bool isEqual(const GrEffect& other) const {
+ bool isEqual(const GrProcessor& other) const {
if (&this->getFactory() != &other.getFactory()) {
return false;
}
@@ -105,21 +103,9 @@ public:
/** Shortcut for textureAccess(index).texture(); */
GrTexture* texture(int index) const { return this->textureAccess(index).getTexture(); }
- /** Will this effect read the destination pixel value? */
- bool willReadDstColor() const { return fWillReadDstColor; }
-
/** Will this effect read the fragment position? */
bool willReadFragmentPosition() const { return fWillReadFragmentPosition; }
- /** Will this effect emit custom vertex shader code?
- (To set this value the effect must inherit from GrEffect.) */
- bool requiresVertexShader() const { return fRequiresVertexShader; }
-
- static const int kMaxVertexAttribs = 2;
- typedef SkSTArray<kMaxVertexAttribs, GrShaderVar, true> VertexAttribArray;
-
- const VertexAttribArray& getVertexAttribs() const { return fVertexAttribs; }
-
void* operator new(size_t size);
void operator delete(void* target);
@@ -131,7 +117,7 @@ public:
}
/**
- * Helper for down-casting to a GrEffect subclass
+ * Helper for down-casting to a GrProcessor subclass
*/
template <typename T> const T& cast() const { return *static_cast<const T*>(this); }
@@ -139,32 +125,23 @@ protected:
/**
* Subclasses call this from their constructor to register coordinate transformations. The
* effect subclass manages the lifetime of the transformations (this function only stores a
- * pointer). The GrCoordTransform is typically a member field of the GrEffect 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 GrEffects are immutable.
+ * 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* coordTransform);
/**
* Subclasses call this from their constructor to register GrTextureAccesses. The effect
* subclass manages the lifetime of the accesses (this function only stores a pointer). The
- * GrTextureAccess is typically a member field of the GrEffect subclass. This must only be
- * called from the constructor because GrEffects are immutable.
+ * GrTextureAccess is typically a member field of the GrProcessor subclass. This must only be
+ * called from the constructor because GrProcessors are immutable.
*/
void addTextureAccess(const GrTextureAccess* textureAccess);
- GrEffect()
- : fWillReadDstColor(false)
- , fWillReadFragmentPosition(false)
- , fWillUseInputColor(true)
- , fRequiresVertexShader(false) {}
-
- /**
- * 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; }
+ GrProcessor()
+ : fWillReadFragmentPosition(false) {}
/**
* If the effect will generate a backend-specific effect that will read the fragment position
@@ -173,41 +150,68 @@ protected:
*/
void setWillReadFragmentPosition() { fWillReadFragmentPosition = 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:
- SkDEBUGCODE(void assertEquality(const GrEffect& other) const;)
+ SkDEBUGCODE(void assertEquality(const GrProcessor& other) const;)
/** 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 GrEffect& other) const = 0;
+ virtual bool onIsEqual(const GrProcessor& other) const = 0;
friend class GrGeometryProcessor; // to set fRequiresVertexShader and build fVertexAttribTypes.
SkSTArray<4, const GrCoordTransform*, true> fCoordTransforms;
SkSTArray<4, const GrTextureAccess*, true> fTextureAccesses;
- VertexAttribArray fVertexAttribs;
- bool fWillReadDstColor;
bool fWillReadFragmentPosition;
- bool fWillUseInputColor;
- bool fRequiresVertexShader;
typedef GrProgramElement INHERITED;
};
+class GrFragmentProcessor : public GrProcessor {
+public:
+ GrFragmentProcessor()
+ : INHERITED()
+ , fWillReadDstColor(false)
+ , fWillUseInputColor(true) {}
+
+ virtual const GrBackendFragmentProcessorFactory& getFactory() const = 0;
+
+ /** 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; }
+
+protected:
+ /**
+ * 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:
+ 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 GrEffect.
+ * at global destruction time. NAME will be the name of the created GrProcessor.
*/
-#define GR_CREATE_STATIC_EFFECT(NAME, EFFECT_CLASS, ARGS) \
+#define GR_CREATE_STATIC_FRAGMENT_PROCESSOR(NAME, EFFECT_CLASS, ARGS) \
static SkAlignedSStorage<sizeof(EFFECT_CLASS)> g_##NAME##_Storage; \
-static GrEffect* NAME SkNEW_PLACEMENT_ARGS(g_##NAME##_Storage.get(), EFFECT_CLASS, ARGS); \
-static SkAutoTDestroy<GrEffect> NAME##_ad(NAME);
+static GrFragmentProcessor* \
+NAME SkNEW_PLACEMENT_ARGS(g_##NAME##_Storage.get(), EFFECT_CLASS, ARGS); \
+static SkAutoTDestroy<GrFragmentProcessor> NAME##_ad(NAME);
#endif
diff --git a/include/gpu/GrEffectStage.h b/include/gpu/GrProcessorStage.h
index b42d309d4b..1485ca7cd1 100644
--- a/include/gpu/GrEffectStage.h
+++ b/include/gpu/GrProcessorStage.h
@@ -8,12 +8,13 @@
-#ifndef GrEffectStage_DEFINED
-#define GrEffectStage_DEFINED
+#ifndef GrProcessorStage_DEFINED
+#define GrProcessorStage_DEFINED
-#include "GrBackendEffectFactory.h"
+#include "GrBackendProcessorFactory.h"
#include "GrCoordTransform.h"
-#include "GrEffect.h"
+#include "GrProcessor.h"
+#include "GrGeometryProcessor.h"
#include "GrProgramElementRef.h"
#include "SkMatrix.h"
#include "SkShader.h"
@@ -23,27 +24,27 @@
// is immutable, and only owns pending execution refs. This requries removing the common base
// class from GrDrawState and GrOptDrawState called GrRODrawState and converting to GrOptDrawState
// when draws are enqueued in the GrInOrderDrawBuffer.
-class GrEffectStage {
+class GrProcessorStage {
public:
- explicit GrEffectStage(const GrEffect* effect)
- : fEffect(SkRef(effect)) {
+ explicit GrProcessorStage(const GrProcessor* proc)
+ : fProc(SkRef(proc)) {
fCoordChangeMatrixSet = false;
}
- GrEffectStage(const GrEffectStage& other) {
+ GrProcessorStage(const GrProcessorStage& other) {
fCoordChangeMatrixSet = other.fCoordChangeMatrixSet;
if (other.fCoordChangeMatrixSet) {
fCoordChangeMatrix = other.fCoordChangeMatrix;
}
- fEffect.initAndRef(other.fEffect);
+ fProc.initAndRef(other.fProc);
}
- static bool AreCompatible(const GrEffectStage& a, const GrEffectStage& b,
+ static bool AreCompatible(const GrProcessorStage& a, const GrProcessorStage& b,
bool usingExplicitLocalCoords) {
- SkASSERT(a.fEffect.get());
- SkASSERT(b.fEffect.get());
+ SkASSERT(a.fProc.get());
+ SkASSERT(b.fProc.get());
- if (!a.getEffect()->isEqual(*b.getEffect())) {
+ if (!a.getProcessor()->isEqual(*b.getProcessor())) {
return false;
}
@@ -87,7 +88,7 @@ public:
SkMatrix fCoordChangeMatrix;
SkDEBUGCODE(mutable uint32_t fEffectUniqueID;)
- friend class GrEffectStage;
+ friend class GrProcessorStage;
};
/**
@@ -102,7 +103,7 @@ public:
savedCoordChange->fCoordChangeMatrix = fCoordChangeMatrix;
}
SkASSERT(SK_InvalidUniqueID == savedCoordChange->fEffectUniqueID);
- SkDEBUGCODE(savedCoordChange->fEffectUniqueID = fEffect->getUniqueID();)
+ SkDEBUGCODE(savedCoordChange->fEffectUniqueID = fProc->getUniqueID();)
}
/**
@@ -113,12 +114,12 @@ public:
if (fCoordChangeMatrixSet) {
fCoordChangeMatrix = savedCoordChange.fCoordChangeMatrix;
}
- SkASSERT(savedCoordChange.fEffectUniqueID == fEffect->getUniqueID());
+ SkASSERT(savedCoordChange.fEffectUniqueID == fProc->getUniqueID());
SkDEBUGCODE(savedCoordChange.fEffectUniqueID = SK_InvalidUniqueID);
}
/**
- * Gets the matrix representing all changes of coordinate system since the GrEffect was
+ * Gets the matrix representing all changes of coordinate system since the GrProcessor was
* installed in the stage.
*/
const SkMatrix& getCoordChangeMatrix() const {
@@ -130,7 +131,7 @@ public:
}
bool isPerspectiveCoordTransform(int matrixIndex, bool useExplicitLocalCoords) const {
- const GrCoordTransform& coordTransform = this->getEffect()->coordTransform(matrixIndex);
+ const GrCoordTransform& coordTransform = this->getProcessor()->coordTransform(matrixIndex);
SkMatrix::TypeMask type0 = coordTransform.getMatrix().getType();
SkMatrix::TypeMask type1 = SkMatrix::kIdentity_Mask;
if (kLocal_GrCoordSet == coordTransform.sourceCoords()) {
@@ -146,14 +147,32 @@ public:
}
}
- const GrEffect* getEffect() const { return fEffect.get(); }
+ const GrProcessor* getProcessor() const { return fProc.get(); }
- void convertToPendingExec() { fEffect.convertToPendingExec(); }
+ void convertToPendingExec() { fProc.convertToPendingExec(); }
private:
- bool fCoordChangeMatrixSet;
- SkMatrix fCoordChangeMatrix;
- GrProgramElementRef<const GrEffect> fEffect;
+ bool fCoordChangeMatrixSet;
+ SkMatrix fCoordChangeMatrix;
+ GrProgramElementRef<const GrProcessor> fProc;
+};
+
+class GrFragmentStage : public GrProcessorStage {
+public:
+ GrFragmentStage(const GrFragmentProcessor* fp) : GrProcessorStage(fp) {}
+
+ const GrFragmentProcessor* getFragmentProcessor() const {
+ return static_cast<const GrFragmentProcessor*>(this->getProcessor());
+ }
+};
+
+class GrGeometryStage : public GrProcessorStage {
+public:
+ GrGeometryStage(const GrGeometryProcessor* gp) : GrProcessorStage(gp) {}
+
+ const GrGeometryProcessor* getGeometryProcessor() const {
+ return static_cast<const GrGeometryProcessor*>(this->getProcessor());
+ }
};
#endif
diff --git a/include/gpu/GrProcessorUnitTest.h b/include/gpu/GrProcessorUnitTest.h
new file mode 100644
index 0000000000..04ab2d15eb
--- /dev/null
+++ b/include/gpu/GrProcessorUnitTest.h
@@ -0,0 +1,128 @@
+/*
+ * Copyright 2012 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef GrProcessorUnitTest_DEFINED
+#define GrProcessorUnitTest_DEFINED
+
+#include "SkRandom.h"
+#include "SkTArray.h"
+#include "SkTypes.h"
+
+class SkMatrix;
+class GrDrawTargetCaps;
+
+namespace GrProcessorUnitTest {
+// Used to access the dummy textures in TestCreate procs.
+enum {
+ kSkiaPMTextureIdx = 0,
+ kAlphaTextureIdx = 1,
+};
+
+/**
+ * A helper for use in GrProcessor::TestCreate functions.
+ */
+const SkMatrix& TestMatrix(SkRandom*);
+
+}
+
+#if SK_ALLOW_STATIC_GLOBAL_INITIALIZERS
+
+class GrContext;
+class GrProcessor;
+class GrTexture;
+
+template <class Processor>
+class GrProcessorTestFactory : SkNoncopyable {
+public:
+
+ typedef Processor* (*CreateProc)(SkRandom*,
+ GrContext*,
+ const GrDrawTargetCaps& caps,
+ GrTexture* dummyTextures[]);
+
+ GrProcessorTestFactory(CreateProc createProc) {
+ fCreateProc = createProc;
+ GetFactories()->push_back(this);
+ }
+
+ static Processor* CreateStage(SkRandom* random,
+ GrContext* context,
+ const GrDrawTargetCaps& caps,
+ GrTexture* dummyTextures[]) {
+ uint32_t idx = random->nextRangeU(0, GetFactories()->count() - 1);
+ GrProcessorTestFactory<Processor>* factory = (*GetFactories())[idx];
+ return factory->fCreateProc(random, context, caps, dummyTextures);
+ }
+
+private:
+ CreateProc fCreateProc;
+
+ #if SK_ALLOW_STATIC_GLOBAL_INITIALIZERS
+ static SkTArray<GrProcessorTestFactory<Processor>*, true>* GetFactories() {
+ static SkTArray<GrProcessorTestFactory<Processor>*, true> gFactories;
+ return &gFactories;
+ }
+ #endif
+};
+
+/** GrProcessor subclasses should insert this macro in their declaration to be included in the
+ * program generation unit test.
+ */
+
+#define GR_DECLARE_GEOMETRY_PROCESSOR_TEST \
+ static GrProcessorTestFactory<GrGeometryProcessor> gTestFactory; \
+ static GrGeometryProcessor* TestCreate(SkRandom*, \
+ GrContext*, \
+ const GrDrawTargetCaps&, \
+ GrTexture* dummyTextures[2])
+
+#define GR_DECLARE_FRAGMENT_PROCESSOR_TEST \
+ static GrProcessorTestFactory<GrFragmentProcessor> gTestFactory; \
+ static GrFragmentProcessor* TestCreate(SkRandom*, \
+ GrContext*, \
+ const GrDrawTargetCaps&, \
+ GrTexture* dummyTextures[2])
+
+/** GrProcessor subclasses should insert this macro in their implementation file. They must then
+ * also implement this static function:
+ * GrProcessor* TestCreate(SkRandom*,
+ * GrContext*,
+ * const GrDrawTargetCaps&,
+ * GrTexture* dummyTextures[2]);
+ * dummyTextures[] are valid textures that can optionally be used to construct GrTextureAccesses.
+ * The first texture has config kSkia8888_GrPixelConfig and the second has
+ * kAlpha_8_GrPixelConfig. TestCreate functions are also free to create additional textures using
+ * the GrContext.
+ */
+#define GR_DEFINE_FRAGMENT_PROCESSOR_TEST(Effect) \
+ GrProcessorTestFactory<GrFragmentProcessor> Effect :: gTestFactory(Effect :: TestCreate)
+
+#define GR_DEFINE_GEOMETRY_PROCESSOR_TEST(Effect) \
+ GrProcessorTestFactory<GrGeometryProcessor> Effect :: gTestFactory(Effect :: TestCreate)
+
+#else // !SK_ALLOW_STATIC_GLOBAL_INITIALIZERS
+
+// The unit test relies on static initializers. Just declare the TestCreate function so that
+// its definitions will compile.
+#define GR_DECLARE_FRAGMENT_PROCESSOR_TEST \
+ static GrFragmentProcessor* TestCreate(SkRandom*, \
+ GrContext*, \
+ const GrDrawTargetCaps&, \
+ GrTexture* dummyTextures[2])
+#define GR_DEFINE_FRAGMENT_PROCESSOR_TEST(X)
+
+// The unit test relies on static initializers. Just declare the TestCreate function so that
+// its definitions will compile.
+#define GR_DECLARE_GEOMETRY_PROCESSOR_TEST \
+ static GrGeometryProcessor* TestCreate(SkRandom*, \
+ GrContext*, \
+ const GrDrawTargetCaps&, \
+ GrTexture* dummyTextures[2])
+#define GR_DEFINE_GEOMETRY_PROCESSOR_TEST(X)
+
+#endif // !SK_ALLOW_STATIC_GLOBAL_INITIALIZERS
+#endif
diff --git a/include/gpu/GrProgramElement.h b/include/gpu/GrProgramElement.h
index 8d23ba2035..245dcd5fbc 100644
--- a/include/gpu/GrProgramElement.h
+++ b/include/gpu/GrProgramElement.h
@@ -14,8 +14,8 @@
class GrGpuResourceRef;
/**
- * Base class for GrEffect (and future GrGeometryProcessor). GrDrawState uses this to manage
- * transitioning a GrEffect from being owned by a client to being scheduled for execution. It
+ * Base class for GrProcessor. GrDrawState uses this to manage
+ * transitioning a GrProcessor from being owned by a client to being scheduled for execution. It
* converts resources owned by the effect from being ref'ed to having pending reads/writes.
*
* All GrGpuResource objects owned by a GrProgramElement or derived classes (either directly or
diff --git a/include/gpu/GrProgramElementRef.h b/include/gpu/GrProgramElementRef.h
index df083c0738..ecc802317b 100644
--- a/include/gpu/GrProgramElementRef.h
+++ b/include/gpu/GrProgramElementRef.h
@@ -38,12 +38,12 @@ public:
fOwnPendingExec = true;
}
- // In the short term we need to support copying a GrEffectStage and making the copy own
+ // In the short term we need to support copying a GrProcessorStage and making the copy own
// the same type of ref as the source. This function exists to support this. TODO: Once
// GrDrawState and GrOptDrawState no longer share a base class they won't have to share
- // GrEffectStage and we can have GrOptDrawState always own pending executions rather than
+ // GrProcessorStage and we can have GrOptDrawState always own pending executions rather than
// refs on GrProgramElements. At that point we should be able to delete this function.
- // This function makes assumptions that are valid in the GrEffectStage use case and should
+ // This function makes assumptions that are valid in the GrProcessorStage use case and should
// not be used elsewhere.
void initAndRef(const GrProgramElementRef& that) {
SkASSERT(!fObj);
diff --git a/include/gpu/GrTBackendEffectFactory.h b/include/gpu/GrTBackendEffectFactory.h
deleted file mode 100644
index a45aeacb72..0000000000
--- a/include/gpu/GrTBackendEffectFactory.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Copyright 2012 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#ifndef GrTBackendEffectFactory_DEFINED
-#define GrTBackendEffectFactory_DEFINED
-
-#include "GrBackendEffectFactory.h"
-#include "gl/GrGLProgramEffects.h"
-
-/**
- * Implements GrBackendEffectFactory for a GrEffect subclass as a singleton. This can be used by
- * most GrEffect subclasses to implement the GrEffect::getFactory() method:
- *
- * const GrBackendEffectFactory& MyEffect::getFactory() const {
- * return GrTBackendEffectFactory<MyEffect>::getInstance();
- * }
- *
- * Using this class requires that the GrEffect subclass always produces the same GrGLEffect
- * subclass. Additionally, It adds the following requirements to the GrEffect and GrGLEffect
- * subclasses:
- *
- * 1. The GrGLEffect used by GrEffect subclass MyEffect must be named or typedef'ed to
- * MyEffect::GLEffect.
- * 2. MyEffect::GLEffect must have a static function:
- * EffectKey GenKey(const GrEffect, const GrGLCaps&)
- * which generates a key that maps 1 to 1 with code variations emitted by
- * MyEffect::GLEffect::emitCode().
- * 3. MyEffect must have a static function:
- * const char* Name()
- * which returns a human-readable name for the effect.
- */
-template <typename EffectClass>
-class GrTBackendEffectFactory : public GrBackendEffectFactory {
-
-public:
- typedef typename EffectClass::GLEffect GLEffect;
-
- /** Returns a human-readable name for the effect. Implemented using GLEffect::Name as described
- * in this class's comment. */
- virtual const char* name() const SK_OVERRIDE { return EffectClass::Name(); }
-
-
- /** Implemented using GLEffect::GenKey as described in this class's comment. */
- virtual void getGLEffectKey(const GrEffect& effect,
- const GrGLCaps& caps,
- GrEffectKeyBuilder* b) const SK_OVERRIDE {
- GLEffect::GenKey(effect, caps, b);
- }
-
- /** Returns a new instance of the appropriate *GL* implementation class
- for the given GrEffect; caller is responsible for deleting
- the object. */
- virtual GrGLEffect* createGLInstance(const GrEffect& effect) const SK_OVERRIDE {
- return SkNEW_ARGS(GLEffect, (*this, effect));
- }
-
- /** This class is a singleton. This function returns the single instance. */
- static const GrBackendEffectFactory& getInstance() {
- static SkAlignedSTStorage<1, GrTBackendEffectFactory> gInstanceMem;
- static const GrTBackendEffectFactory* gInstance;
- if (!gInstance) {
- gInstance = SkNEW_PLACEMENT(gInstanceMem.get(),
- GrTBackendEffectFactory);
- }
- return *gInstance;
- }
-
-protected:
- GrTBackendEffectFactory() {}
-};
-
-#endif
diff --git a/include/gpu/GrTBackendProcessorFactory.h b/include/gpu/GrTBackendProcessorFactory.h
new file mode 100644
index 0000000000..c67f508f5d
--- /dev/null
+++ b/include/gpu/GrTBackendProcessorFactory.h
@@ -0,0 +1,101 @@
+/*
+ * Copyright 2012 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef GrTBackendProcessorFactory_DEFINED
+#define GrTBackendProcessorFactory_DEFINED
+
+#include "GrBackendProcessorFactory.h"
+#include "gl/GrGLProgramEffects.h"
+
+/**
+ * Implements GrBackendEffectFactory for a GrProcessor subclass as a singleton. This can be used by
+ * most GrProcessor subclasses to implement the GrProcessor::getFactory() method:
+ *
+ * const GrBackendEffectFactory& MyEffect::getFactory() const {
+ * return GrTBackendEffectFactory<MyEffect>::getInstance();
+ * }
+ *
+ * Using this class requires that the GrProcessor subclass always produces the same GrGLProcessor
+ * subclass. Additionally, it adds the following requirements to the GrProcessor and GrGLProcessor
+ * subclasses:
+ *
+ * 1. The GrGLProcessor used by GrProcessor subclass MyEffect must be named or typedef'ed to
+ * MyEffect::GLProcessor.
+ * 2. MyEffect::GLProcessor must have a static function:
+ * EffectKey GenKey(const GrProcessor, const GrGLCaps&)
+ * which generates a key that maps 1 to 1 with code variations emitted by
+ * MyEffect::GLProcessor::emitCode().
+ * 3. MyEffect must have a static function:
+ * const char* Name()
+ * which returns a human-readable name for the effect.
+ */
+template <class ProcessorClass, class BackEnd, class ProcessorBase, class GLProcessorBase>
+class GrTBackendProcessorFactory : public BackEnd {
+public:
+ typedef typename ProcessorClass::GLProcessor GLProcessor;
+
+ /** Returns a human-readable name for the effect. Implemented using GLProcessor::Name as
+ * described in this class's comment. */
+ virtual const char* name() const SK_OVERRIDE { return ProcessorClass::Name(); }
+
+
+ /** Implemented using GLProcessor::GenKey as described in this class's comment. */
+ virtual void getGLProcessorKey(const GrProcessor& effect,
+ const GrGLCaps& caps,
+ GrProcessorKeyBuilder* b) const SK_OVERRIDE {
+ GLProcessor::GenKey(effect, caps, b);
+ }
+
+ /** Returns a new instance of the appropriate *GL* implementation class
+ for the given GrProcessor; caller is responsible for deleting
+ the object. */
+ virtual GLProcessorBase* createGLInstance(const ProcessorBase& effect) const SK_OVERRIDE {
+ return SkNEW_ARGS(GLProcessor, (*this, effect));
+ }
+
+ /** This class is a singleton. This function returns the single instance. */
+ static const BackEnd& getInstance() {
+ static SkAlignedSTStorage<1, GrTBackendProcessorFactory> gInstanceMem;
+ static const GrTBackendProcessorFactory* gInstance;
+ if (!gInstance) {
+ gInstance = SkNEW_PLACEMENT(gInstanceMem.get(),
+ GrTBackendProcessorFactory);
+ }
+ return *gInstance;
+ }
+
+protected:
+ GrTBackendProcessorFactory() {}
+};
+
+/*
+ * Every effect so far derives from one of the following subclasses of GrTBackendProcessorFactory.
+ * All of this machinery is necessary to ensure that creatGLInstace is typesafe and does not
+ * require any casting
+ */
+template <class ProcessorClass>
+class GrTBackendGeometryProcessorFactory
+ : public GrTBackendProcessorFactory<ProcessorClass,
+ GrBackendGeometryProcessorFactory,
+ GrGeometryProcessor,
+ GrGLGeometryProcessor> {
+protected:
+ GrTBackendGeometryProcessorFactory() {}
+};
+
+template <class ProcessorClass>
+class GrTBackendFragmentProcessorFactory
+ : public GrTBackendProcessorFactory<ProcessorClass,
+ GrBackendFragmentProcessorFactory,
+ GrFragmentProcessor,
+ GrGLFragmentProcessor> {
+protected:
+ GrTBackendFragmentProcessorFactory() {}
+};
+
+
+#endif
diff --git a/include/gpu/GrTextureAccess.h b/include/gpu/GrTextureAccess.h
index d552e440ca..5055e103f5 100644
--- a/include/gpu/GrTextureAccess.h
+++ b/include/gpu/GrTextureAccess.h
@@ -108,7 +108,7 @@ private:
/** A class representing the swizzle access pattern for a texture. Note that if the texture is
* an alpha-only texture then the alpha channel is substituted for other components. Any mangling
* to handle the r,g,b->a conversions for alpha textures is automatically included in the stage
- * key. However, if a GrEffect uses different swizzles based on its input then it must
+ * key. However, if a GrProcessor uses different swizzles based on its input then it must
* consider that variation in its key-generation.
*/
class GrTextureAccess : public SkNoncopyable {
@@ -116,8 +116,8 @@ public:
SK_DECLARE_INST_COUNT_ROOT(GrTextureAccess);
/**
- * A default GrTextureAccess must have reset() called on it in a GrEffect subclass's
- * constructor if it will be accessible via GrEffect::textureAccess().
+ * A default GrTextureAccess must have reset() called on it in a GrProcessor subclass's
+ * constructor if it will be accessible via GrProcessor::textureAccess().
*/
GrTextureAccess();
@@ -165,7 +165,7 @@ public:
GrTexture* getTexture() const { return fTexture.get(); }
/**
- * For internal use by GrEffect.
+ * For internal use by GrProcessor.
*/
const GrGpuResourceRef* getProgramTexture() const { return &fTexture; }
diff --git a/include/gpu/GrTypesPriv.h b/include/gpu/GrTypesPriv.h
index dfe415345a..94ec1d7cfa 100644
--- a/include/gpu/GrTypesPriv.h
+++ b/include/gpu/GrTypesPriv.h
@@ -115,9 +115,9 @@ static inline size_t GrVertexAttribTypeSize(GrVertexAttribType type) {
}
/**
- * Semantic bindings for vertex attributes. kEffect means that the attribute is input to a GrEffect.
- * Each binding other than kEffect may not appear more than once in the current set of attributes.
- * kPosition must be appear for exactly one attribute.
+ * Semantic bindings for vertex attributes. kEffect means that the attribute is input to a
+ * GrProcessor. Each binding other than kEffect may not appear more than once in the current set of
+ * attributes. kPosition must be appear for exactly one attribute.
*/
enum GrVertexAttribBinding {
kPosition_GrVertexAttribBinding, // required, must have vector count of 2
@@ -127,10 +127,10 @@ enum GrVertexAttribBinding {
kLastFixedFunction_GrVertexAttribBinding = kCoverage_GrVertexAttribBinding,
- kEffect_GrVertexAttribBinding, // vector length must agree with
- // GrEffect::vertexAttribType() for each effect input to
+ kGeometryProcessor_GrVertexAttribBinding, // vector length must agree with
+ // GrProcessor::vertexAttribType() for each effect input to
// which the attribute is mapped by GrDrawState::setEffect()
- kLast_GrVertexAttribBinding = kEffect_GrVertexAttribBinding
+ kLast_GrVertexAttribBinding = kGeometryProcessor_GrVertexAttribBinding
};
static const int kGrVertexAttribBindingCnt = kLast_GrVertexAttribBinding + 1;
@@ -173,48 +173,48 @@ template <int N> class GrVertexAttribArray : public SkSTArray<N, GrVertexAttrib,
/**
* We have coverage effects that clip rendering to the edge of some geometric primitive.
* This enum specifies how that clipping is performed. Not all factories that take a
-* GrEffectEdgeType will succeed with all values and it is up to the caller to check for
+* GrProcessorEdgeType will succeed with all values and it is up to the caller to check for
* a NULL return.
*/
-enum GrEffectEdgeType {
- kFillBW_GrEffectEdgeType,
- kFillAA_GrEffectEdgeType,
- kInverseFillBW_GrEffectEdgeType,
- kInverseFillAA_GrEffectEdgeType,
- kHairlineAA_GrEffectEdgeType,
-
- kLast_GrEffectEdgeType = kHairlineAA_GrEffectEdgeType
+enum GrPrimitiveEdgeType {
+ kFillBW_GrProcessorEdgeType,
+ kFillAA_GrProcessorEdgeType,
+ kInverseFillBW_GrProcessorEdgeType,
+ kInverseFillAA_GrProcessorEdgeType,
+ kHairlineAA_GrProcessorEdgeType,
+
+ kLast_GrProcessorEdgeType = kHairlineAA_GrProcessorEdgeType
};
-static const int kGrEffectEdgeTypeCnt = kLast_GrEffectEdgeType + 1;
+static const int kGrProcessorEdgeTypeCnt = kLast_GrProcessorEdgeType + 1;
-static inline bool GrEffectEdgeTypeIsFill(const GrEffectEdgeType edgeType) {
- return (kFillAA_GrEffectEdgeType == edgeType || kFillBW_GrEffectEdgeType == edgeType);
+static inline bool GrProcessorEdgeTypeIsFill(const GrPrimitiveEdgeType edgeType) {
+ return (kFillAA_GrProcessorEdgeType == edgeType || kFillBW_GrProcessorEdgeType == edgeType);
}
-static inline bool GrEffectEdgeTypeIsInverseFill(const GrEffectEdgeType edgeType) {
- return (kInverseFillAA_GrEffectEdgeType == edgeType ||
- kInverseFillBW_GrEffectEdgeType == edgeType);
+static inline bool GrProcessorEdgeTypeIsInverseFill(const GrPrimitiveEdgeType edgeType) {
+ return (kInverseFillAA_GrProcessorEdgeType == edgeType ||
+ kInverseFillBW_GrProcessorEdgeType == edgeType);
}
-static inline bool GrEffectEdgeTypeIsAA(const GrEffectEdgeType edgeType) {
- return (kFillBW_GrEffectEdgeType != edgeType && kInverseFillBW_GrEffectEdgeType != edgeType);
+static inline bool GrProcessorEdgeTypeIsAA(const GrPrimitiveEdgeType edgeType) {
+ return (kFillBW_GrProcessorEdgeType != edgeType && kInverseFillBW_GrProcessorEdgeType != edgeType);
}
-static inline GrEffectEdgeType GrInvertEffectEdgeType(const GrEffectEdgeType edgeType) {
+static inline GrPrimitiveEdgeType GrInvertProcessorEdgeType(const GrPrimitiveEdgeType edgeType) {
switch (edgeType) {
- case kFillBW_GrEffectEdgeType:
- return kInverseFillBW_GrEffectEdgeType;
- case kFillAA_GrEffectEdgeType:
- return kInverseFillAA_GrEffectEdgeType;
- case kInverseFillBW_GrEffectEdgeType:
- return kFillBW_GrEffectEdgeType;
- case kInverseFillAA_GrEffectEdgeType:
- return kFillAA_GrEffectEdgeType;
- case kHairlineAA_GrEffectEdgeType:
+ case kFillBW_GrProcessorEdgeType:
+ return kInverseFillBW_GrProcessorEdgeType;
+ case kFillAA_GrProcessorEdgeType:
+ return kInverseFillAA_GrProcessorEdgeType;
+ case kInverseFillBW_GrProcessorEdgeType:
+ return kFillBW_GrProcessorEdgeType;
+ case kInverseFillAA_GrProcessorEdgeType:
+ return kFillAA_GrProcessorEdgeType;
+ case kHairlineAA_GrProcessorEdgeType:
SkFAIL("Hairline fill isn't invertible.");
}
- return kFillAA_GrEffectEdgeType; // suppress warning.
+ return kFillAA_GrProcessorEdgeType; // suppress warning.
}
#endif
diff --git a/include/gpu/SkGr.h b/include/gpu/SkGr.h
index cd5fabfde1..df2ae5a320 100644
--- a/include/gpu/SkGr.h
+++ b/include/gpu/SkGr.h
@@ -86,7 +86,7 @@ void SkPaint2GrPaintNoShader(GrContext* context, const SkPaint& skPaint, GrColor
bool constantColor, GrPaint* grPaint);
// This function is similar to skPaint2GrPaintNoShader but also converts
-// skPaint's shader to a GrTexture/GrEffectStage if possible.
+// skPaint's shader to a GrTexture/GrProcessorStage if possible.
// constantColor has the same meaning as in skPaint2GrPaintNoShader.
void SkPaint2GrPaintShader(GrContext* context, const SkPaint& skPaint,
bool constantColor, GrPaint* grPaint);