aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu
diff options
context:
space:
mode:
authorGravatar bsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-10-24 18:28:34 +0000
committerGravatar bsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-10-24 18:28:34 +0000
commita469c28c3c16214733a25201a286970f57b3d944 (patch)
tree2493bd735990ff40770ed8cfa601db0a2babe549 /src/gpu
parent96182216f187fd103392ccaa34f505fe54fcff7e (diff)
CustomStage Renaming Part 1
Search and replace: GrCustomStage->GrEffect GrCustomStageTestFactory->GrEffectTestFactory renamed the cpp/h files from customStage->effect reordered gypi, #includes, forward decls to maintain alphabetical sort. manually fixed up some whitespace and linewraps deleted a commented out #include R=robertphillips@google.com Review URL: https://codereview.appspot.com/6758046 git-svn-id: http://skia.googlecode.com/svn/trunk@6076 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/gpu')
-rw-r--r--src/gpu/GrContext.cpp8
-rw-r--r--src/gpu/GrDrawState.h4
-rw-r--r--src/gpu/GrDrawTarget.cpp4
-rw-r--r--src/gpu/GrEffect.cpp (renamed from src/gpu/GrCustomStage.cpp)22
-rw-r--r--src/gpu/SkGpuDevice.cpp8
-rw-r--r--src/gpu/effects/GrConfigConversionEffect.cpp26
-rw-r--r--src/gpu/effects/GrConfigConversionEffect.h4
-rw-r--r--src/gpu/effects/GrConvolutionEffect.cpp20
-rw-r--r--src/gpu/effects/GrConvolutionEffect.h2
-rw-r--r--src/gpu/effects/GrSingleTextureEffect.cpp10
-rw-r--r--src/gpu/effects/GrSingleTextureEffect.h6
-rw-r--r--src/gpu/effects/GrTextureDomainEffect.cpp18
-rw-r--r--src/gpu/effects/GrTextureDomainEffect.h3
-rw-r--r--src/gpu/gl/GrGLProgram.cpp10
-rw-r--r--src/gpu/gl/GrGLProgram.h12
-rw-r--r--src/gpu/gl/GrGLProgramStage.cpp4
-rw-r--r--src/gpu/gl/GrGLProgramStage.h33
-rw-r--r--src/gpu/gl/GrGLShaderBuilder.cpp4
-rw-r--r--src/gpu/gl/GrGLShaderBuilder.h4
-rw-r--r--src/gpu/gl/GrGpuGL.cpp2
-rw-r--r--src/gpu/gl/GrGpuGL.h4
-rw-r--r--src/gpu/gl/GrGpuGL_program.cpp16
22 files changed, 111 insertions, 113 deletions
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp
index e729e6d4ca..93b8b31351 100644
--- a/src/gpu/GrContext.cpp
+++ b/src/gpu/GrContext.cpp
@@ -1317,7 +1317,7 @@ bool GrContext::readRenderTargetPixels(GrRenderTarget* target,
ast.set(this, desc, match);
GrTexture* texture = ast.texture();
if (texture) {
- SkAutoTUnref<GrCustomStage> stage;
+ SkAutoTUnref<GrEffect> stage;
if (unpremul) {
stage.reset(this->createPMToUPMEffect(src, swapRAndB));
}
@@ -1490,7 +1490,7 @@ void GrContext::writeRenderTargetPixels(GrRenderTarget* target,
return;
}
#endif
- SkAutoTUnref<GrCustomStage> stage;
+ SkAutoTUnref<GrEffect> stage;
bool swapRAndB = (fGpu->preferredReadPixelsConfig(config) == GrPixelConfigSwapRAndB(config));
GrPixelConfig textureConfig;
@@ -1736,7 +1736,7 @@ void test_pm_conversions(GrContext* ctx, int* pmToUPMValue, int* upmToPMValue) {
}
}
-GrCustomStage* GrContext::createPMToUPMEffect(GrTexture* texture, bool swapRAndB) {
+GrEffect* GrContext::createPMToUPMEffect(GrTexture* texture, bool swapRAndB) {
if (!fDidTestPMConversions) {
test_pm_conversions(this, &fPMToUPMConversion, &fUPMToPMConversion);
fDidTestPMConversions = true;
@@ -1750,7 +1750,7 @@ GrCustomStage* GrContext::createPMToUPMEffect(GrTexture* texture, bool swapRAndB
}
}
-GrCustomStage* GrContext::createUPMToPMEffect(GrTexture* texture, bool swapRAndB) {
+GrEffect* GrContext::createUPMToPMEffect(GrTexture* texture, bool swapRAndB) {
if (!fDidTestPMConversions) {
test_pm_conversions(this, &fPMToUPMConversion, &fUPMToPMConversion);
fDidTestPMConversions = true;
diff --git a/src/gpu/GrDrawState.h b/src/gpu/GrDrawState.h
index e3121eadb5..6951d46e1d 100644
--- a/src/gpu/GrDrawState.h
+++ b/src/gpu/GrDrawState.h
@@ -196,14 +196,14 @@ public:
}
void createTextureEffect(int stage, GrTexture* texture, const GrMatrix& matrix) {
GrAssert(!this->getSampler(stage).getCustomStage());
- GrCustomStage* customStage = SkNEW_ARGS(GrSingleTextureEffect, (texture));
+ GrEffect* customStage = SkNEW_ARGS(GrSingleTextureEffect, (texture));
this->sampler(stage)->setCustomStage(customStage, matrix)->unref();
}
void createTextureEffect(int stage, GrTexture* texture,
const GrMatrix& matrix,
const GrTextureParams& params) {
GrAssert(!this->getSampler(stage).getCustomStage());
- GrCustomStage* customStage = SkNEW_ARGS(GrSingleTextureEffect, (texture, params));
+ GrEffect* customStage = SkNEW_ARGS(GrSingleTextureEffect, (texture, params));
this->sampler(stage)->setCustomStage(customStage, matrix)->unref();
}
diff --git a/src/gpu/GrDrawTarget.cpp b/src/gpu/GrDrawTarget.cpp
index 3b27172fb4..56dc8d812a 100644
--- a/src/gpu/GrDrawTarget.cpp
+++ b/src/gpu/GrDrawTarget.cpp
@@ -748,7 +748,7 @@ bool GrDrawTarget::checkDraw(GrPrimitiveType type, int startVertex,
GrAssert(NULL != drawState.getRenderTarget());
for (int s = 0; s < GrDrawState::kNumStages; ++s) {
if (drawState.isStageEnabled(s)) {
- const GrCustomStage* stage = drawState.getSampler(s).getCustomStage();
+ const GrEffect* stage = drawState.getSampler(s).getCustomStage();
int numTextures = stage->numTextures();
for (int t = 0; t < numTextures; ++t) {
GrTexture* texture = stage->texture(t);
@@ -831,7 +831,7 @@ bool GrDrawTarget::srcAlphaWillBeOne(GrVertexLayout layout) const {
// Check if a color stage could create a partial alpha
for (int s = 0; s < drawState.getFirstCoverageStage(); ++s) {
if (this->isStageEnabled(s)) {
- const GrCustomStage* stage = drawState.getSampler(s).getCustomStage();
+ const GrEffect* stage = drawState.getSampler(s).getCustomStage();
// FIXME: The param indicates whether the texture is opaque or not. However, the stage
// already controls its textures. It really needs to know whether the incoming color
// (from a uni, per-vertex colors, or previous stage) is opaque or not.
diff --git a/src/gpu/GrCustomStage.cpp b/src/gpu/GrEffect.cpp
index 0000278955..7997fb05e0 100644
--- a/src/gpu/GrCustomStage.cpp
+++ b/src/gpu/GrEffect.cpp
@@ -6,15 +6,15 @@
*/
#include "GrContext.h"
-#include "GrCustomStage.h"
+#include "GrEffect.h"
#include "GrMemoryPool.h"
#include "SkTLS.h"
-SK_DEFINE_INST_COUNT(GrCustomStage)
+SK_DEFINE_INST_COUNT(GrEffect)
#if SK_ALLOW_STATIC_GLOBAL_INITIALIZERS
-SkTArray<GrCustomStageTestFactory*, true>* GrCustomStageTestFactory::GetFactories() {
- static SkTArray<GrCustomStageTestFactory*, true> gFactories;
+SkTArray<GrEffectTestFactory*, true>* GrEffectTestFactory::GetFactories() {
+ static SkTArray<GrEffectTestFactory*, true> gFactories;
return &gFactories;
}
#endif
@@ -38,19 +38,19 @@ private:
int32_t GrProgramStageFactory::fCurrStageClassID =
GrProgramStageFactory::kIllegalStageClassID;
-GrCustomStage::GrCustomStage(int numTextures)
+GrEffect::GrEffect(int numTextures)
: fNumTextures(numTextures) {
}
-GrCustomStage::~GrCustomStage() {
+GrEffect::~GrEffect() {
}
-bool GrCustomStage::isOpaque(bool inputTextureIsOpaque) const {
+bool GrEffect::isOpaque(bool inputTextureIsOpaque) const {
return false;
}
-bool GrCustomStage::isEqual(const GrCustomStage& s) const {
+bool GrEffect::isEqual(const GrEffect& s) const {
if (this->numTextures() != s.numTextures()) {
return false;
}
@@ -62,16 +62,16 @@ bool GrCustomStage::isEqual(const GrCustomStage& s) const {
return true;
}
-const GrTextureAccess& GrCustomStage::textureAccess(int index) const {
+const GrTextureAccess& GrEffect::textureAccess(int index) const {
GrCrash("We shouldn't be calling this function on the base class.");
static GrTextureAccess kDummy;
return kDummy;
}
-void * GrCustomStage::operator new(size_t size) {
+void * GrEffect::operator new(size_t size) {
return GrCustomStage_Globals::GetTLS()->allocate(size);
}
-void GrCustomStage::operator delete(void* target) {
+void GrEffect::operator delete(void* target) {
GrCustomStage_Globals::GetTLS()->release(target);
}
diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp
index fc1f86cb16..74a288888c 100644
--- a/src/gpu/SkGpuDevice.cpp
+++ b/src/gpu/SkGpuDevice.cpp
@@ -512,7 +512,7 @@ inline bool skPaint2GrPaintNoShader(SkGpuDevice* dev,
SkColor filtered = colorFilter->filterColor(skPaint.getColor());
grPaint->setColor(SkColor2GrColor(filtered));
} else {
- SkAutoTUnref<GrCustomStage> stage(colorFilter->asNewCustomStage(dev->context()));
+ SkAutoTUnref<GrEffect> stage(colorFilter->asNewCustomStage(dev->context()));
if (NULL != stage.get()) {
grPaint->colorSampler(kColorFilterTextureIdx)->setCustomStage(stage);
} else {
@@ -1415,7 +1415,7 @@ void SkGpuDevice::internalDrawBitmap(const SkBitmap& bitmap,
}
GrRect textureDomain = GrRect::MakeEmpty();
- SkAutoTUnref<GrCustomStage> stage;
+ SkAutoTUnref<GrEffect> stage;
if (needsTextureDomain) {
// Use a constrained texture domain to avoid color bleeding
GrScalar left, top, right, bottom;
@@ -1448,7 +1448,7 @@ void apply_custom_stage(GrContext* context,
GrTexture* srcTexture,
GrTexture* dstTexture,
const GrRect& rect,
- GrCustomStage* stage) {
+ GrEffect* stage) {
SkASSERT(srcTexture && srcTexture->getContext() == context);
GrContext::AutoMatrix am;
am.setIdentity(context);
@@ -1475,7 +1475,7 @@ static GrTexture* filter_texture(SkDevice* device, GrContext* context,
desc.fWidth = SkScalarCeilToInt(rect.width());
desc.fHeight = SkScalarCeilToInt(rect.height());
desc.fConfig = kRGBA_8888_GrPixelConfig;
- GrCustomStage* stage;
+ GrEffect* stage;
if (filter->canFilterImageGPU()) {
// Save the render target and set it to NULL, so we don't accidentally draw to it in the
diff --git a/src/gpu/effects/GrConfigConversionEffect.cpp b/src/gpu/effects/GrConfigConversionEffect.cpp
index 9d6435060d..9689c0faa4 100644
--- a/src/gpu/effects/GrConfigConversionEffect.cpp
+++ b/src/gpu/effects/GrConfigConversionEffect.cpp
@@ -11,7 +11,7 @@
class GrGLConfigConversionEffect : public GrGLLegacyProgramStage {
public:
GrGLConfigConversionEffect(const GrProgramStageFactory& factory,
- const GrCustomStage& s) : INHERITED (factory) {
+ const GrEffect& s) : INHERITED (factory) {
const GrConfigConversionEffect& stage = static_cast<const GrConfigConversionEffect&>(s);
fSwapRedAndBlue = stage.swapsRedAndBlue();
fPMConversion = stage.pmConversion();
@@ -58,7 +58,7 @@ public:
GrGLSLMulVarBy4f(&builder->fFSCode, 2, outputColor, inputColor);
}
- static inline StageKey GenKey(const GrCustomStage& s, const GrGLCaps&) {
+ static inline StageKey GenKey(const GrEffect& s, const GrGLCaps&) {
const GrConfigConversionEffect& stage = static_cast<const GrConfigConversionEffect&>(s);
return static_cast<int>(stage.swapsRedAndBlue()) | (stage.pmConversion() << 1);
}
@@ -89,7 +89,7 @@ const GrProgramStageFactory& GrConfigConversionEffect::getFactory() const {
return GrTProgramStageFactory<GrConfigConversionEffect>::getInstance();
}
-bool GrConfigConversionEffect::isEqual(const GrCustomStage& s) const {
+bool GrConfigConversionEffect::isEqual(const GrEffect& s) const {
const GrConfigConversionEffect& other = static_cast<const GrConfigConversionEffect&>(s);
return other.fSwapRedAndBlue == fSwapRedAndBlue && other.fPMConversion == fPMConversion;
}
@@ -98,9 +98,9 @@ bool GrConfigConversionEffect::isEqual(const GrCustomStage& s) const {
GR_DEFINE_CUSTOM_STAGE_TEST(GrConfigConversionEffect);
-GrCustomStage* GrConfigConversionEffect::TestCreate(SkRandom* random,
- GrContext* context,
- GrTexture* textures[]) {
+GrEffect* GrConfigConversionEffect::TestCreate(SkRandom* random,
+ GrContext* context,
+ GrTexture* textures[]) {
PMConversion pmConv = static_cast<PMConversion>(random->nextULessThan(kPMConversionCnt));
bool swapRB;
if (kNone_PMConversion == pmConv) {
@@ -177,12 +177,12 @@ void GrConfigConversionEffect::TestForPreservingPMConversions(GrContext* context
GrPaint paint;
- SkAutoTUnref<GrCustomStage> pmToUPMStage1(SkNEW_ARGS(GrConfigConversionEffect,
- (dataTex, false, *pmToUPMRule)));
- SkAutoTUnref<GrCustomStage> upmToPMStage(SkNEW_ARGS(GrConfigConversionEffect,
- (readTex, false, *upmToPMRule)));
- SkAutoTUnref<GrCustomStage> pmToUPMStage2(SkNEW_ARGS(GrConfigConversionEffect,
- (tempTex, false, *pmToUPMRule)));
+ SkAutoTUnref<GrEffect> pmToUPMStage1(SkNEW_ARGS(GrConfigConversionEffect,
+ (dataTex, false, *pmToUPMRule)));
+ SkAutoTUnref<GrEffect> upmToPMStage(SkNEW_ARGS(GrConfigConversionEffect,
+ (readTex, false, *upmToPMRule)));
+ SkAutoTUnref<GrEffect> pmToUPMStage2(SkNEW_ARGS(GrConfigConversionEffect,
+ (tempTex, false, *pmToUPMRule)));
context->setRenderTarget(readTex->asRenderTarget());
paint.colorSampler(0)->setCustomStage(pmToUPMStage1);
@@ -215,7 +215,7 @@ void GrConfigConversionEffect::TestForPreservingPMConversions(GrContext* context
}
}
-GrCustomStage* GrConfigConversionEffect::Create(GrTexture* texture,
+GrEffect* GrConfigConversionEffect::Create(GrTexture* texture,
bool swapRedAndBlue,
PMConversion pmConversion) {
if (!swapRedAndBlue && kNone_PMConversion == pmConversion) {
diff --git a/src/gpu/effects/GrConfigConversionEffect.h b/src/gpu/effects/GrConfigConversionEffect.h
index 9bb7e3a8c2..fb2c770e36 100644
--- a/src/gpu/effects/GrConfigConversionEffect.h
+++ b/src/gpu/effects/GrConfigConversionEffect.h
@@ -34,7 +34,7 @@ public:
};
// This will fail if the config is not 8888 and a PM conversion is requested.
- static GrCustomStage* Create(GrTexture*,
+ static GrEffect* Create(GrTexture*,
bool swapRedAndBlue,
PMConversion pmConversion = kNone_PMConversion);
@@ -42,7 +42,7 @@ public:
typedef GrGLConfigConversionEffect GLProgramStage;
virtual const GrProgramStageFactory& getFactory() const SK_OVERRIDE;
- virtual bool isEqual(const GrCustomStage&) const SK_OVERRIDE;
+ virtual bool isEqual(const GrEffect&) const SK_OVERRIDE;
bool swapsRedAndBlue() const { return fSwapRedAndBlue; }
PMConversion pmConversion() const { return fPMConversion; }
diff --git a/src/gpu/effects/GrConvolutionEffect.cpp b/src/gpu/effects/GrConvolutionEffect.cpp
index 726c2c39a7..930a0e3a3f 100644
--- a/src/gpu/effects/GrConvolutionEffect.cpp
+++ b/src/gpu/effects/GrConvolutionEffect.cpp
@@ -18,7 +18,7 @@ static const UniformHandle kInvalidUniformHandle = GrGLUniformManager::kInvalidU
class GrGLConvolutionEffect : public GrGLLegacyProgramStage {
public:
GrGLConvolutionEffect(const GrProgramStageFactory& factory,
- const GrCustomStage& stage);
+ const GrEffect& stage);
virtual void setupVariables(GrGLShaderBuilder* builder) SK_OVERRIDE;
virtual void emitVS(GrGLShaderBuilder* builder,
@@ -28,9 +28,9 @@ public:
const char* inputColor,
const TextureSamplerArray&) SK_OVERRIDE;
- virtual void setData(const GrGLUniformManager& uman, const GrCustomStage&) SK_OVERRIDE;
+ virtual void setData(const GrGLUniformManager& uman, const GrEffect&) SK_OVERRIDE;
- static inline StageKey GenKey(const GrCustomStage&, const GrGLCaps&);
+ static inline StageKey GenKey(const GrEffect&, const GrGLCaps&);
private:
int width() const { return Gr1DKernelEffect::WidthFromRadius(fRadius); }
@@ -43,7 +43,7 @@ private:
};
GrGLConvolutionEffect::GrGLConvolutionEffect(const GrProgramStageFactory& factory,
- const GrCustomStage& stage)
+ const GrEffect& stage)
: INHERITED(factory)
, fKernelUni(kInvalidUniformHandle)
, fImageIncrementUni(kInvalidUniformHandle) {
@@ -88,7 +88,7 @@ void GrGLConvolutionEffect::emitFS(GrGLShaderBuilder* builder,
GrGLSLMulVarBy4f(&builder->fFSCode, 2, outputColor, inputColor);
}
-void GrGLConvolutionEffect::setData(const GrGLUniformManager& uman, const GrCustomStage& data) {
+void GrGLConvolutionEffect::setData(const GrGLUniformManager& uman, const GrEffect& data) {
const GrConvolutionEffect& conv =
static_cast<const GrConvolutionEffect&>(data);
GrTexture& texture = *data.texture(0);
@@ -109,7 +109,7 @@ void GrGLConvolutionEffect::setData(const GrGLUniformManager& uman, const GrCust
uman.set1fv(fKernelUni, 0, this->width(), conv.kernel());
}
-GrGLProgramStage::StageKey GrGLConvolutionEffect::GenKey(const GrCustomStage& s,
+GrGLProgramStage::StageKey GrGLConvolutionEffect::GenKey(const GrEffect& s,
const GrGLCaps& caps) {
return static_cast<const GrConvolutionEffect&>(s).radius();
}
@@ -161,7 +161,7 @@ const GrProgramStageFactory& GrConvolutionEffect::getFactory() const {
return GrTProgramStageFactory<GrConvolutionEffect>::getInstance();
}
-bool GrConvolutionEffect::isEqual(const GrCustomStage& sBase) const {
+bool GrConvolutionEffect::isEqual(const GrEffect& sBase) const {
const GrConvolutionEffect& s =
static_cast<const GrConvolutionEffect&>(sBase);
return (INHERITED::isEqual(sBase) &&
@@ -174,9 +174,9 @@ bool GrConvolutionEffect::isEqual(const GrCustomStage& sBase) const {
GR_DEFINE_CUSTOM_STAGE_TEST(GrConvolutionEffect);
-GrCustomStage* GrConvolutionEffect::TestCreate(SkRandom* random,
- GrContext* context,
- GrTexture* textures[]) {
+GrEffect* GrConvolutionEffect::TestCreate(SkRandom* random,
+ GrContext* context,
+ GrTexture* textures[]) {
int texIdx = random->nextBool() ? GrCustomStageUnitTest::kSkiaPMTextureIdx :
GrCustomStageUnitTest::kAlphaTextureIdx;
Direction dir = random->nextBool() ? kX_Direction : kY_Direction;
diff --git a/src/gpu/effects/GrConvolutionEffect.h b/src/gpu/effects/GrConvolutionEffect.h
index 4c42a6ce41..50639940bc 100644
--- a/src/gpu/effects/GrConvolutionEffect.h
+++ b/src/gpu/effects/GrConvolutionEffect.h
@@ -37,7 +37,7 @@ public:
typedef GrGLConvolutionEffect GLProgramStage;
virtual const GrProgramStageFactory& getFactory() const SK_OVERRIDE;
- virtual bool isEqual(const GrCustomStage&) const SK_OVERRIDE;
+ virtual bool isEqual(const GrEffect&) const SK_OVERRIDE;
enum {
// This was decided based on the min allowed value for the max texture
diff --git a/src/gpu/effects/GrSingleTextureEffect.cpp b/src/gpu/effects/GrSingleTextureEffect.cpp
index 51d302592c..52a7448ecb 100644
--- a/src/gpu/effects/GrSingleTextureEffect.cpp
+++ b/src/gpu/effects/GrSingleTextureEffect.cpp
@@ -15,7 +15,7 @@
class GrGLSingleTextureEffect : public GrGLLegacyProgramStage {
public:
GrGLSingleTextureEffect(const GrProgramStageFactory& factory,
- const GrCustomStage& stage) : INHERITED (factory) { }
+ const GrEffect& stage) : INHERITED (factory) { }
virtual void emitVS(GrGLShaderBuilder* builder,
const char* vertexCoords) SK_OVERRIDE { }
@@ -28,7 +28,7 @@ public:
builder->fFSCode.append(";\n");
}
- static inline StageKey GenKey(const GrCustomStage&, const GrGLCaps&) { return 0; }
+ static inline StageKey GenKey(const GrEffect&, const GrGLCaps&) { return 0; }
private:
@@ -68,9 +68,9 @@ const GrProgramStageFactory& GrSingleTextureEffect::getFactory() const {
GR_DEFINE_CUSTOM_STAGE_TEST(GrSingleTextureEffect);
-GrCustomStage* GrSingleTextureEffect::TestCreate(SkRandom* random,
- GrContext* context,
- GrTexture* textures[]) {
+GrEffect* GrSingleTextureEffect::TestCreate(SkRandom* random,
+ GrContext* context,
+ GrTexture* textures[]) {
int texIdx = random->nextBool() ? GrCustomStageUnitTest::kSkiaPMTextureIdx :
GrCustomStageUnitTest::kAlphaTextureIdx;
return SkNEW_ARGS(GrSingleTextureEffect, (textures[texIdx]));
diff --git a/src/gpu/effects/GrSingleTextureEffect.h b/src/gpu/effects/GrSingleTextureEffect.h
index ad47eb7ba7..92ab92a275 100644
--- a/src/gpu/effects/GrSingleTextureEffect.h
+++ b/src/gpu/effects/GrSingleTextureEffect.h
@@ -8,14 +8,14 @@
#ifndef GrSingleTextureEffect_DEFINED
#define GrSingleTextureEffect_DEFINED
-#include "GrCustomStage.h"
+#include "GrEffect.h"
class GrGLSingleTextureEffect;
/**
* An effect that merely blits a single texture; commonly used as a base class.
*/
-class GrSingleTextureEffect : public GrCustomStage {
+class GrSingleTextureEffect : public GrEffect {
public:
/** Uses default texture params (unfiltered, clamp) */
@@ -41,7 +41,7 @@ private:
GrTextureAccess fTextureAccess;
- typedef GrCustomStage INHERITED;
+ typedef GrEffect INHERITED;
};
#endif
diff --git a/src/gpu/effects/GrTextureDomainEffect.cpp b/src/gpu/effects/GrTextureDomainEffect.cpp
index f40604156a..289b6210b4 100644
--- a/src/gpu/effects/GrTextureDomainEffect.cpp
+++ b/src/gpu/effects/GrTextureDomainEffect.cpp
@@ -12,7 +12,7 @@
class GrGLTextureDomainEffect : public GrGLLegacyProgramStage {
public:
GrGLTextureDomainEffect(const GrProgramStageFactory& factory,
- const GrCustomStage& stage);
+ const GrEffect& stage);
virtual void setupVariables(GrGLShaderBuilder* builder) SK_OVERRIDE;
virtual void emitVS(GrGLShaderBuilder* builder,
@@ -22,9 +22,9 @@ public:
const char* inputColor,
const TextureSamplerArray&) SK_OVERRIDE;
- virtual void setData(const GrGLUniformManager&, const GrCustomStage&) SK_OVERRIDE;
+ virtual void setData(const GrGLUniformManager&, const GrEffect&) SK_OVERRIDE;
- static inline StageKey GenKey(const GrCustomStage&, const GrGLCaps&) { return 0; }
+ static inline StageKey GenKey(const GrEffect&, const GrGLCaps&) { return 0; }
private:
GrGLUniformManager::UniformHandle fNameUni;
@@ -33,7 +33,7 @@ private:
};
GrGLTextureDomainEffect::GrGLTextureDomainEffect(const GrProgramStageFactory& factory,
- const GrCustomStage& stage)
+ const GrEffect& stage)
: INHERITED(factory)
, fNameUni(GrGLUniformManager::kInvalidUniformHandle) {
}
@@ -60,7 +60,7 @@ void GrGLTextureDomainEffect::emitFS(GrGLShaderBuilder* builder,
builder->fFSCode.append(";\n");
}
-void GrGLTextureDomainEffect::setData(const GrGLUniformManager& uman, const GrCustomStage& data) {
+void GrGLTextureDomainEffect::setData(const GrGLUniformManager& uman, const GrEffect& data) {
const GrTextureDomainEffect& effect = static_cast<const GrTextureDomainEffect&>(data);
const GrRect& domain = effect.domain();
@@ -105,7 +105,7 @@ const GrProgramStageFactory& GrTextureDomainEffect::getFactory() const {
return GrTProgramStageFactory<GrTextureDomainEffect>::getInstance();
}
-bool GrTextureDomainEffect::isEqual(const GrCustomStage& sBase) const {
+bool GrTextureDomainEffect::isEqual(const GrEffect& sBase) const {
const GrTextureDomainEffect& s = static_cast<const GrTextureDomainEffect&>(sBase);
return (INHERITED::isEqual(sBase) && this->fTextureDomain == s.fTextureDomain);
}
@@ -114,9 +114,9 @@ bool GrTextureDomainEffect::isEqual(const GrCustomStage& sBase) const {
GR_DEFINE_CUSTOM_STAGE_TEST(GrTextureDomainEffect);
-GrCustomStage* GrTextureDomainEffect::TestCreate(SkRandom* random,
- GrContext* context,
- GrTexture* textures[]) {
+GrEffect* GrTextureDomainEffect::TestCreate(SkRandom* random,
+ GrContext* context,
+ GrTexture* textures[]) {
int texIdx = random->nextBool() ? GrCustomStageUnitTest::kSkiaPMTextureIdx :
GrCustomStageUnitTest::kAlphaTextureIdx;
GrRect domain;
diff --git a/src/gpu/effects/GrTextureDomainEffect.h b/src/gpu/effects/GrTextureDomainEffect.h
index 872d57de2d..64a6466c02 100644
--- a/src/gpu/effects/GrTextureDomainEffect.h
+++ b/src/gpu/effects/GrTextureDomainEffect.h
@@ -8,7 +8,6 @@
#ifndef GrTextureDomainEffect_DEFINED
#define GrTextureDomainEffect_DEFINED
-//#include "GrCustomStage.h"
#include "GrSingleTextureEffect.h"
#include "GrRect.h"
@@ -32,7 +31,7 @@ public:
typedef GrGLTextureDomainEffect GLProgramStage;
virtual const GrProgramStageFactory& getFactory() const SK_OVERRIDE;
- virtual bool isEqual(const GrCustomStage&) const SK_OVERRIDE;
+ virtual bool isEqual(const GrEffect&) const SK_OVERRIDE;
const GrRect& domain() const { return fTextureDomain; }
diff --git a/src/gpu/gl/GrGLProgram.cpp b/src/gpu/gl/GrGLProgram.cpp
index d5ccdac9a8..847b6efe47 100644
--- a/src/gpu/gl/GrGLProgram.cpp
+++ b/src/gpu/gl/GrGLProgram.cpp
@@ -8,7 +8,7 @@
#include "GrGLProgram.h"
#include "GrAllocator.h"
-#include "GrCustomStage.h"
+#include "GrEffect.h"
#include "GrGLProgramStage.h"
#include "gl/GrGLShaderBuilder.h"
#include "GrGLShaderVar.h"
@@ -53,7 +53,7 @@ inline const char* dual_source_output_name() { return "dualSourceOut"; }
GrGLProgram* GrGLProgram::Create(const GrGLContextInfo& gl,
const Desc& desc,
- const GrCustomStage** customStages) {
+ const GrEffect** customStages) {
GrGLProgram* program = SkNEW_ARGS(GrGLProgram, (gl, desc, customStages));
if (!program->succeeded()) {
delete program;
@@ -64,7 +64,7 @@ GrGLProgram* GrGLProgram::Create(const GrGLContextInfo& gl,
GrGLProgram::GrGLProgram(const GrGLContextInfo& gl,
const Desc& desc,
- const GrCustomStage** customStages)
+ const GrEffect** customStages)
: fContextInfo(gl)
, fUniformManager(gl) {
fDesc = desc;
@@ -500,7 +500,7 @@ bool GrGLProgram::compileShaders(const GrGLShaderBuilder& builder) {
return true;
}
-bool GrGLProgram::genProgram(const GrCustomStage** customStages) {
+bool GrGLProgram::genProgram(const GrEffect** customStages) {
GrAssert(0 == fProgramID);
GrGLShaderBuilder builder(fContextInfo, fUniformManager);
@@ -896,7 +896,7 @@ void GrGLProgram::initSamplerUniforms() {
// Stage code generation
// TODO: Move this function to GrGLShaderBuilder
-GrGLProgramStage* GrGLProgram::GenStageCode(const GrCustomStage* stage,
+GrGLProgramStage* GrGLProgram::GenStageCode(const GrEffect* stage,
const StageDesc& desc,
StageUniforms* uniforms,
const char* fsInColor, // NULL means no incoming color
diff --git a/src/gpu/gl/GrGLProgram.h b/src/gpu/gl/GrGLProgram.h
index 2500417ba2..c9afc2bd75 100644
--- a/src/gpu/gl/GrGLProgram.h
+++ b/src/gpu/gl/GrGLProgram.h
@@ -43,7 +43,7 @@ public:
static GrGLProgram* Create(const GrGLContextInfo& gl,
const Desc& desc,
- const GrCustomStage** customStages);
+ const GrEffect** customStages);
virtual ~GrGLProgram();
@@ -67,8 +67,8 @@ public:
static int TexCoordAttributeIdx(int tcIdx) { return 4 + tcIdx; }
/**
- * This function uploads uniforms and calls each GrCustomStage's setData. It is called before a
- * draw occurs using the program after the program has already been bound.
+ * This function uploads uniforms and calls each GrEffect's setData. It is called before a draw
+ * occurs using the program after the program has already been bound.
*/
void setData(const GrDrawState& drawState);
@@ -164,18 +164,18 @@ private:
GrGLProgram(const GrGLContextInfo& gl,
const Desc& desc,
- const GrCustomStage** customStages);
+ const GrEffect** customStages);
bool succeeded() const { return 0 != fProgramID; }
/**
* This is the heavy initialization routine for building a GLProgram.
*/
- bool genProgram(const GrCustomStage** customStages);
+ bool genProgram(const GrEffect** customStages);
void genInputColor(GrGLShaderBuilder* builder, SkString* inColor);
- static GrGLProgramStage* GenStageCode(const GrCustomStage* stage,
+ static GrGLProgramStage* GenStageCode(const GrEffect* stage,
const StageDesc& desc, // TODO: Eliminate this
StageUniforms* stageUniforms, // TODO: Eliminate this
const char* fsInColor, // NULL means no incoming color
diff --git a/src/gpu/gl/GrGLProgramStage.cpp b/src/gpu/gl/GrGLProgramStage.cpp
index 4702f378f5..8cbb7c37b2 100644
--- a/src/gpu/gl/GrGLProgramStage.cpp
+++ b/src/gpu/gl/GrGLProgramStage.cpp
@@ -17,10 +17,10 @@ GrGLProgramStage::~GrGLProgramStage() {
///////////////////////////////////////////////////////////////////////////////
-void GrGLProgramStage::setData(const GrGLUniformManager&, const GrCustomStage&) {
+void GrGLProgramStage::setData(const GrGLUniformManager&, const GrEffect&) {
}
-GrGLProgramStage::StageKey GrGLProgramStage::GenTextureKey(const GrCustomStage& stage,
+GrGLProgramStage::StageKey GrGLProgramStage::GenTextureKey(const GrEffect& stage,
const GrGLCaps& caps) {
StageKey key = 0;
for (int index = 0; index < stage.numTextures(); ++index) {
diff --git a/src/gpu/gl/GrGLProgramStage.h b/src/gpu/gl/GrGLProgramStage.h
index fce82d2eed..3f8afe4a90 100644
--- a/src/gpu/gl/GrGLProgramStage.h
+++ b/src/gpu/gl/GrGLProgramStage.h
@@ -9,7 +9,7 @@
#define GrGLCustomStage_DEFINED
#include "GrAllocator.h"
-#include "GrCustomStage.h"
+#include "GrEffect.h"
#include "GrGLProgram.h"
#include "GrGLShaderBuilder.h"
#include "GrGLShaderVar.h"
@@ -20,20 +20,20 @@ class GrGLTexture;
/** @file
This file contains specializations for OpenGL of the shader stages declared in
- include/gpu/GrCustomStage.h. Objects of type GrGLProgramStage are responsible for emitting the
- GLSL code that implements a GrCustomStage and for uploading uniforms at draw time. They also
+ include/gpu/GrEffect.h. Objects of type GrGLProgramStage are responsible for emitting the
+ GLSL code that implements a GrEffect and for uploading uniforms at draw time. They also
must have a function:
- static inline StageKey GenKey(const GrCustomStage&, const GrGLCaps&)
- that is used to implement a program cache. When two GrCustomStages produce the same key this
+ static inline StageKey GenKey(const GrEffect&, const GrGLCaps&)
+ that is used to implement a program cache. When two GrCustomEffects produce the same key this
means that their GrGLProgramStages would emit the same GLSL code.
- These objects are created by the factory object returned by the GrCustomStage::getFactory().
+ These objects are created by the factory object returned by the GrEffect::getFactory().
*/
class GrGLProgramStage {
public:
- typedef GrCustomStage::StageKey StageKey;
+ typedef GrEffect::StageKey StageKey;
enum {
// the number of bits in StageKey available to GenKey
kProgramStageKeyBits = GrProgramStageFactory::kProgramStageKeyBits,
@@ -51,8 +51,7 @@ public:
@param builder Interface used to emit code in the shaders.
@param stage The custom stage that generated this program stage.
- @param key The key that was computed by StageKey() from the generating
- GrCustomStage.
+ @param key The key that was computed by StageKey() from the generating GrEffect.
@param vertexCoords A vec2 of texture coordinates in the VS, which may be altered. This will
be removed soon and stages will be responsible for computing their own
coords.
@@ -64,26 +63,26 @@ public:
color is solid white, trans black, known to be opaque, etc.) that allows
the custom stage to communicate back similar known info about its
output.
- @param samplers One entry for each GrTextureAccess of the GrCustomStage that generated
- the GrGLProgramStage. These can be passed to the builder to emit texture
+ @param samplers One entry for each GrTextureAccess of the GrEffect that generated the
+ GrGLProgramStage. These can be passed to the builder to emit texture
reads in the generated code.
*/
virtual void emitCode(GrGLShaderBuilder* builder,
- const GrCustomStage& stage,
+ const GrEffect& stage,
StageKey key,
const char* vertexCoords,
const char* outputColor,
const char* inputColor,
const TextureSamplerArray& samplers) = 0;
- /** A GrGLProgramStage instance can be reused with any GrCustomStage that produces the same
- stage key; this function reads data from a stage and uploads any uniform variables required
+ /** A GrGLProgramStage instance can be reused with any GrEffect that produces the same stage
+ key; this function reads data from a stage and uploads any uniform variables required
by the shaders created in emitCode(). */
- virtual void setData(const GrGLUniformManager&, const GrCustomStage& stage);
+ virtual void setData(const GrGLUniformManager&, const GrEffect& stage);
const char* name() const { return fFactory.name(); }
- static StageKey GenTextureKey(const GrCustomStage&, const GrGLCaps&);
+ static StageKey GenTextureKey(const GrEffect&, const GrGLCaps&);
protected:
@@ -108,7 +107,7 @@ public:
const TextureSamplerArray&) = 0;
virtual void emitCode(GrGLShaderBuilder* builder,
- const GrCustomStage&,
+ const GrEffect&,
StageKey,
const char* vertexCoords,
const char* outputColor,
diff --git a/src/gpu/gl/GrGLShaderBuilder.cpp b/src/gpu/gl/GrGLShaderBuilder.cpp
index 04fe63e534..f11a8d9007 100644
--- a/src/gpu/gl/GrGLShaderBuilder.cpp
+++ b/src/gpu/gl/GrGLShaderBuilder.cpp
@@ -153,9 +153,9 @@ void GrGLShaderBuilder::appendTextureLookupAndModulate(
GrGLSLModulate4f(out, modulation, lookup.c_str());
}
-GrCustomStage::StageKey GrGLShaderBuilder::KeyForTextureAccess(const GrTextureAccess& access,
+GrEffect::StageKey GrGLShaderBuilder::KeyForTextureAccess(const GrTextureAccess& access,
const GrGLCaps& caps) {
- GrCustomStage::StageKey key = 0;
+ GrEffect::StageKey key = 0;
// Assume that swizzle support implies that we never have to modify a shader to adjust
// for texture format/swizzle settings.
diff --git a/src/gpu/gl/GrGLShaderBuilder.h b/src/gpu/gl/GrGLShaderBuilder.h
index aa88cf2b15..0b5eb178d4 100644
--- a/src/gpu/gl/GrGLShaderBuilder.h
+++ b/src/gpu/gl/GrGLShaderBuilder.h
@@ -9,7 +9,7 @@
#define GrGLShaderBuilder_DEFINED
#include "GrAllocator.h"
-#include "GrCustomStage.h"
+#include "GrEffect.h"
#include "gl/GrGLShaderVar.h"
#include "gl/GrGLSL.h"
#include "gl/GrGLUniformManager.h"
@@ -122,7 +122,7 @@ public:
/** Generates a StageKey for the shader code based on the texture access parameters and the
capabilities of the GL context. This is useful for keying the shader programs that may
have multiple representations, based on the type/format of textures used. */
- static GrCustomStage::StageKey KeyForTextureAccess(const GrTextureAccess& access,
+ static GrEffect::StageKey KeyForTextureAccess(const GrTextureAccess& access,
const GrGLCaps& caps);
/** If texture swizzling is available using tex parameters then it is preferred over mangling
diff --git a/src/gpu/gl/GrGpuGL.cpp b/src/gpu/gl/GrGpuGL.cpp
index 4df7a983f3..a810d67ccc 100644
--- a/src/gpu/gl/GrGpuGL.cpp
+++ b/src/gpu/gl/GrGpuGL.cpp
@@ -2019,7 +2019,7 @@ inline GrGLenum tile_to_gl_wrap(SkShader::TileMode tm) {
void GrGpuGL::flushBoundTextureAndParams(int stage) {
GrDrawState* drawState = this->drawState();
// FIXME: Assuming at most one texture per custom stage
- const GrCustomStage* customStage = drawState->sampler(stage)->getCustomStage();
+ const GrEffect* customStage = drawState->sampler(stage)->getCustomStage();
if (customStage->numTextures() > 0) {
GrGLTexture* nextTexture = static_cast<GrGLTexture*>(customStage->texture(0));
if (NULL != nextTexture) {
diff --git a/src/gpu/gl/GrGpuGL.h b/src/gpu/gl/GrGpuGL.h
index 0a0c52bb5a..eab0a774a0 100644
--- a/src/gpu/gl/GrGpuGL.h
+++ b/src/gpu/gl/GrGpuGL.h
@@ -166,7 +166,7 @@ private:
ProgramCache(const GrGLContextInfo& gl);
void abandon();
- GrGLProgram* getProgram(const GrGLProgram::Desc& desc, const GrCustomStage** stages);
+ GrGLProgram* getProgram(const GrGLProgram::Desc& desc, const GrEffect** stages);
private:
enum {
kKeySize = sizeof(ProgramDesc),
@@ -240,7 +240,7 @@ private:
void buildProgram(bool isPoints,
BlendOptFlags blendOpts,
GrBlendCoeff dstCoeff,
- const GrCustomStage** customStages,
+ const GrEffect** customStages,
ProgramDesc* desc);
// Inits GrDrawTarget::Caps, subclass may enable additional caps.
diff --git a/src/gpu/gl/GrGpuGL_program.cpp b/src/gpu/gl/GrGpuGL_program.cpp
index 343923098e..6608c66bec 100644
--- a/src/gpu/gl/GrGpuGL_program.cpp
+++ b/src/gpu/gl/GrGpuGL_program.cpp
@@ -7,7 +7,7 @@
#include "GrGpuGL.h"
-#include "GrCustomStage.h"
+#include "GrEffect.h"
#include "GrGLProgramStage.h"
#include "GrGpuVertex.h"
@@ -33,7 +33,7 @@ void GrGpuGL::ProgramCache::abandon() {
}
GrGLProgram* GrGpuGL::ProgramCache::getProgram(const ProgramDesc& desc,
- const GrCustomStage** stages) {
+ const GrEffect** stages) {
Entry newEntry;
newEntry.fKey.setKeyData(desc.asKey());
@@ -199,7 +199,7 @@ void GrGpuGL::flushTextureMatrix(int s) {
const GrDrawState& drawState = this->getDrawState();
// FIXME: Still assuming only a single texture per custom stage
- const GrCustomStage* stage = drawState.getSampler(s).getCustomStage();
+ const GrEffect* stage = drawState.getSampler(s).getCustomStage();
if (0 == stage->numTextures()) {
return;
}
@@ -350,7 +350,7 @@ bool GrGpuGL::flushGraphicsState(DrawType type) {
return false;
}
- const GrCustomStage* customStages [GrDrawState::kNumStages];
+ const GrEffect* customStages [GrDrawState::kNumStages];
GrGLProgram::Desc desc;
this->buildProgram(kDrawPoints_DrawType == type, blendOpts, dstCoeff, customStages, &desc);
@@ -568,9 +568,9 @@ namespace {
void setup_custom_stage(GrGLProgram::Desc::StageDesc* stage,
const GrSamplerState& sampler,
const GrGLCaps& caps,
- const GrCustomStage** customStages,
+ const GrEffect** customStages,
GrGLProgram* program, int index) {
- const GrCustomStage* customStage = sampler.getCustomStage();
+ const GrEffect* customStage = sampler.getCustomStage();
if (customStage) {
const GrProgramStageFactory& factory = customStage->getFactory();
stage->fCustomStageKey = factory.glStageKey(*customStage, caps);
@@ -586,7 +586,7 @@ void setup_custom_stage(GrGLProgram::Desc::StageDesc* stage,
void GrGpuGL::buildProgram(bool isPoints,
BlendOptFlags blendOpts,
GrBlendCoeff dstCoeff,
- const GrCustomStage** customStages,
+ const GrEffect** customStages,
ProgramDesc* desc) {
const GrDrawState& drawState = this->getDrawState();
@@ -675,7 +675,7 @@ void GrGpuGL::buildProgram(bool isPoints,
lastEnabledStage = s;
const GrSamplerState& sampler = drawState.getSampler(s);
// FIXME: Still assuming one texture per custom stage
- const GrCustomStage* customStage = drawState.getSampler(s).getCustomStage();
+ const GrEffect* customStage = drawState.getSampler(s).getCustomStage();
if (customStage->numTextures() > 0) {
const GrGLTexture* texture =