diff options
Diffstat (limited to 'src')
30 files changed, 91 insertions, 95 deletions
diff --git a/src/effects/SkColorMatrixFilter.cpp b/src/effects/SkColorMatrixFilter.cpp index 77f99963f7..cd7f1551fa 100644 --- a/src/effects/SkColorMatrixFilter.cpp +++ b/src/effects/SkColorMatrixFilter.cpp @@ -337,7 +337,7 @@ public: return cme.fMatrix == fMatrix; } - GR_DECLARE_CUSTOM_STAGE_TEST; + GR_DECLARE_EFFECT_TEST; class GLProgramStage : public GrGLLegacyProgramStage { public: @@ -412,7 +412,7 @@ private: typedef GrGLLegacyProgramStage INHERITED; }; -GR_DEFINE_CUSTOM_STAGE_TEST(ColorMatrixEffect); +GR_DEFINE_EFFECT_TEST(ColorMatrixEffect); GrEffect* ColorMatrixEffect::TestCreate(SkRandom* random, GrContext*, diff --git a/src/effects/SkLightingImageFilter.cpp b/src/effects/SkLightingImageFilter.cpp index ab962fb2b7..267ce99a54 100644 --- a/src/effects/SkLightingImageFilter.cpp +++ b/src/effects/SkLightingImageFilter.cpp @@ -332,7 +332,7 @@ public: virtual bool isEqual(const GrEffect&) const SK_OVERRIDE; SkScalar kd() const { return fKD; } private: - GR_DECLARE_CUSTOM_STAGE_TEST; + GR_DECLARE_EFFECT_TEST; typedef GrLightingEffect INHERITED; SkScalar fKD; }; @@ -355,7 +355,7 @@ public: SkScalar shininess() const { return fShininess; } private: - GR_DECLARE_CUSTOM_STAGE_TEST; + GR_DECLARE_EFFECT_TEST; typedef GrLightingEffect INHERITED; SkScalar fKS; SkScalar fShininess; @@ -1038,7 +1038,7 @@ bool GrDiffuseLightingEffect::isEqual(const GrEffect& sBase) const { this->kd() == s.kd(); } -GR_DEFINE_CUSTOM_STAGE_TEST(GrDiffuseLightingEffect); +GR_DEFINE_EFFECT_TEST(GrDiffuseLightingEffect); GrEffect* GrDiffuseLightingEffect::TestCreate(SkRandom* random, GrContext* context, @@ -1244,7 +1244,7 @@ bool GrSpecularLightingEffect::isEqual(const GrEffect& sBase) const { this->shininess() == s.shininess(); } -GR_DEFINE_CUSTOM_STAGE_TEST(GrSpecularLightingEffect); +GR_DEFINE_EFFECT_TEST(GrSpecularLightingEffect); GrEffect* GrSpecularLightingEffect::TestCreate(SkRandom* random, GrContext* context, diff --git a/src/effects/SkMagnifierImageFilter.cpp b/src/effects/SkMagnifierImageFilter.cpp index 5ce00e943b..c25e951ccf 100644 --- a/src/effects/SkMagnifierImageFilter.cpp +++ b/src/effects/SkMagnifierImageFilter.cpp @@ -57,7 +57,7 @@ public: typedef GrGLMagnifierEffect GLProgramStage; private: - GR_DECLARE_CUSTOM_STAGE_TEST; + GR_DECLARE_EFFECT_TEST; float fXOffset; float fYOffset; @@ -181,7 +181,7 @@ GrGLProgramStage::StageKey GrGLMagnifierEffect::GenKey(const GrEffect& s, ///////////////////////////////////////////////////////////////////// -GR_DEFINE_CUSTOM_STAGE_TEST(GrMagnifierEffect); +GR_DEFINE_EFFECT_TEST(GrMagnifierEffect); GrEffect* GrMagnifierEffect::TestCreate(SkRandom* random, GrContext* context, diff --git a/src/effects/SkMatrixConvolutionImageFilter.cpp b/src/effects/SkMatrixConvolutionImageFilter.cpp index 2f6d71ca88..988c9018cb 100644 --- a/src/effects/SkMatrixConvolutionImageFilter.cpp +++ b/src/effects/SkMatrixConvolutionImageFilter.cpp @@ -274,7 +274,7 @@ private: TileMode fTileMode; bool fConvolveAlpha; - GR_DECLARE_CUSTOM_STAGE_TEST; + GR_DECLARE_EFFECT_TEST; typedef GrSingleTextureEffect INHERITED; }; @@ -486,7 +486,7 @@ bool GrMatrixConvolutionEffect::isEqual(const GrEffect& sBase) const { fConvolveAlpha == s.convolveAlpha(); } -GR_DEFINE_CUSTOM_STAGE_TEST(GrMatrixConvolutionEffect); +GR_DEFINE_EFFECT_TEST(GrMatrixConvolutionEffect); // A little bit less than the minimum # uniforms required by DX9SM2 (32). // Allows for a 5x5 kernel (or 25x1, for that matter). diff --git a/src/effects/SkMorphologyImageFilter.cpp b/src/effects/SkMorphologyImageFilter.cpp index fb82f4f4cf..8df5def977 100644 --- a/src/effects/SkMorphologyImageFilter.cpp +++ b/src/effects/SkMorphologyImageFilter.cpp @@ -259,7 +259,7 @@ protected: MorphologyType fType; private: - GR_DECLARE_CUSTOM_STAGE_TEST; + GR_DECLARE_EFFECT_TEST; typedef Gr1DKernelEffect INHERITED; }; @@ -398,7 +398,7 @@ bool GrMorphologyEffect::isEqual(const GrEffect& sBase) const { /////////////////////////////////////////////////////////////////////////////// -GR_DEFINE_CUSTOM_STAGE_TEST(GrMorphologyEffect); +GR_DEFINE_EFFECT_TEST(GrMorphologyEffect); GrEffect* GrMorphologyEffect::TestCreate(SkRandom* random, GrContext* context, diff --git a/src/effects/SkTableColorFilter.cpp b/src/effects/SkTableColorFilter.cpp index cbbf7e1fc7..1412952ef7 100644 --- a/src/effects/SkTableColorFilter.cpp +++ b/src/effects/SkTableColorFilter.cpp @@ -237,7 +237,7 @@ public: typedef GLColorTableEffect GLProgramStage; private: - GR_DECLARE_CUSTOM_STAGE_TEST; + GR_DECLARE_EFFECT_TEST; GrTextureAccess fTextureAccess; @@ -342,7 +342,7 @@ const GrTextureAccess& ColorTableEffect::textureAccess(int index) const { /////////////////////////////////////////////////////////////////////////////// -GR_DEFINE_CUSTOM_STAGE_TEST(ColorTableEffect); +GR_DEFINE_EFFECT_TEST(ColorTableEffect); GrEffect* ColorTableEffect::TestCreate(SkRandom* random, GrContext* context, diff --git a/src/effects/gradients/SkLinearGradient.cpp b/src/effects/gradients/SkLinearGradient.cpp index 21b415d58b..2de4fc6187 100644 --- a/src/effects/gradients/SkLinearGradient.cpp +++ b/src/effects/gradients/SkLinearGradient.cpp @@ -515,14 +515,14 @@ public: typedef GrGLLinearGradient GLProgramStage; private: - GR_DECLARE_CUSTOM_STAGE_TEST; + GR_DECLARE_EFFECT_TEST; typedef GrGradientEffect INHERITED; }; ///////////////////////////////////////////////////////////////////// -GR_DEFINE_CUSTOM_STAGE_TEST(GrLinearGradient); +GR_DEFINE_EFFECT_TEST(GrLinearGradient); GrEffect* GrLinearGradient::TestCreate(SkRandom* random, GrContext* context, diff --git a/src/effects/gradients/SkRadialGradient.cpp b/src/effects/gradients/SkRadialGradient.cpp index 74d16d56cc..dbf5e7e009 100644 --- a/src/effects/gradients/SkRadialGradient.cpp +++ b/src/effects/gradients/SkRadialGradient.cpp @@ -514,14 +514,14 @@ public: typedef GrGLRadialGradient GLProgramStage; private: - GR_DECLARE_CUSTOM_STAGE_TEST; + GR_DECLARE_EFFECT_TEST; typedef GrGradientEffect INHERITED; }; ///////////////////////////////////////////////////////////////////// -GR_DEFINE_CUSTOM_STAGE_TEST(GrRadialGradient); +GR_DEFINE_EFFECT_TEST(GrRadialGradient); GrEffect* GrRadialGradient::TestCreate(SkRandom* random, GrContext* context, diff --git a/src/effects/gradients/SkSweepGradient.cpp b/src/effects/gradients/SkSweepGradient.cpp index 365507b98f..11e1a78a13 100644 --- a/src/effects/gradients/SkSweepGradient.cpp +++ b/src/effects/gradients/SkSweepGradient.cpp @@ -422,14 +422,14 @@ public: typedef GrGLSweepGradient GLProgramStage; private: - GR_DECLARE_CUSTOM_STAGE_TEST; + GR_DECLARE_EFFECT_TEST; typedef GrGradientEffect INHERITED; }; ///////////////////////////////////////////////////////////////////// -GR_DEFINE_CUSTOM_STAGE_TEST(GrSweepGradient); +GR_DEFINE_EFFECT_TEST(GrSweepGradient); GrEffect* GrSweepGradient::TestCreate(SkRandom* random, GrContext* context, diff --git a/src/effects/gradients/SkTwoPointConicalGradient.cpp b/src/effects/gradients/SkTwoPointConicalGradient.cpp index 4472d03d9f..4e85c73367 100644 --- a/src/effects/gradients/SkTwoPointConicalGradient.cpp +++ b/src/effects/gradients/SkTwoPointConicalGradient.cpp @@ -398,7 +398,7 @@ public: typedef GrGLConical2Gradient GLProgramStage; private: - GR_DECLARE_CUSTOM_STAGE_TEST; + GR_DECLARE_EFFECT_TEST; // @{ // Cache of values - these can change arbitrarily, EXCEPT @@ -413,7 +413,7 @@ private: typedef GrGradientEffect INHERITED; }; -GR_DEFINE_CUSTOM_STAGE_TEST(GrConical2Gradient); +GR_DEFINE_EFFECT_TEST(GrConical2Gradient); GrEffect* GrConical2Gradient::TestCreate(SkRandom* random, GrContext* context, diff --git a/src/effects/gradients/SkTwoPointRadialGradient.cpp b/src/effects/gradients/SkTwoPointRadialGradient.cpp index 78220f8d2a..d4ce9fa931 100644 --- a/src/effects/gradients/SkTwoPointRadialGradient.cpp +++ b/src/effects/gradients/SkTwoPointRadialGradient.cpp @@ -430,7 +430,7 @@ public: typedef GrGLRadial2Gradient GLProgramStage; private: - GR_DECLARE_CUSTOM_STAGE_TEST; + GR_DECLARE_EFFECT_TEST; // @{ // Cache of values - these can change arbitrarily, EXCEPT @@ -447,7 +447,7 @@ private: ///////////////////////////////////////////////////////////////////// -GR_DEFINE_CUSTOM_STAGE_TEST(GrRadial2Gradient); +GR_DEFINE_EFFECT_TEST(GrRadial2Gradient); GrEffect* GrRadial2Gradient::TestCreate(SkRandom* random, GrContext* context, diff --git a/src/gpu/GrDrawState.h b/src/gpu/GrDrawState.h index f8db4a5d14..330ae66642 100644 --- a/src/gpu/GrDrawState.h +++ b/src/gpu/GrDrawState.h @@ -195,15 +195,15 @@ public: } void createTextureEffect(int stage, GrTexture* texture, const GrMatrix& matrix) { GrAssert(!this->getSampler(stage).getEffect()); - GrEffect* customStage = SkNEW_ARGS(GrSingleTextureEffect, (texture)); - this->sampler(stage)->setEffect(customStage, matrix)->unref(); + GrEffect* effect = SkNEW_ARGS(GrSingleTextureEffect, (texture)); + this->sampler(stage)->setEffect(effect, matrix)->unref(); } void createTextureEffect(int stage, GrTexture* texture, const GrMatrix& matrix, const GrTextureParams& params) { GrAssert(!this->getSampler(stage).getEffect()); - GrEffect* customStage = SkNEW_ARGS(GrSingleTextureEffect, (texture, params)); - this->sampler(stage)->setEffect(customStage, matrix)->unref(); + GrEffect* effect = SkNEW_ARGS(GrSingleTextureEffect, (texture, params)); + this->sampler(stage)->setEffect(effect, matrix)->unref(); } @@ -221,8 +221,7 @@ public: } /** - * Release all the textures and custom stages referred to by this - * draw state. + * Release all the GrEffects referred to by this draw state. */ void disableStages() { for (int i = 0; i < kNumStages; ++i) { diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp index b87089ce02..eae8ce867c 100644 --- a/src/gpu/SkGpuDevice.cpp +++ b/src/gpu/SkGpuDevice.cpp @@ -1444,11 +1444,11 @@ void SkGpuDevice::internalDrawBitmap(const SkBitmap& bitmap, namespace { -void apply_custom_stage(GrContext* context, - GrTexture* srcTexture, - GrTexture* dstTexture, - const GrRect& rect, - GrEffect* stage) { +void apply_effect(GrContext* context, + GrTexture* srcTexture, + GrTexture* dstTexture, + const GrRect& rect, + GrEffect* effect) { SkASSERT(srcTexture && srcTexture->getContext() == context); GrContext::AutoMatrix am; am.setIdentity(context); @@ -1458,7 +1458,7 @@ void apply_custom_stage(GrContext* context, GrMatrix sampleM; sampleM.setIDiv(srcTexture->width(), srcTexture->height()); GrPaint paint; - paint.colorSampler(0)->setEffect(stage, sampleM); + paint.colorSampler(0)->setEffect(effect, sampleM); context->drawRect(paint, rect); } @@ -1484,7 +1484,7 @@ static GrTexture* filter_texture(SkDevice* device, GrContext* context, texture = filter->onFilterImageGPU(&proxy, texture, rect); } else if (filter->asNewCustomStage(&stage, texture)) { GrAutoScratchTexture dst(context, desc); - apply_custom_stage(context, texture, dst.texture(), rect, stage); + apply_effect(context, texture, dst.texture(), rect, stage); texture = dst.detach(); stage->unref(); } diff --git a/src/gpu/effects/GrConfigConversionEffect.cpp b/src/gpu/effects/GrConfigConversionEffect.cpp index 1502905de1..beb6107cac 100644 --- a/src/gpu/effects/GrConfigConversionEffect.cpp +++ b/src/gpu/effects/GrConfigConversionEffect.cpp @@ -96,7 +96,7 @@ bool GrConfigConversionEffect::isEqual(const GrEffect& s) const { /////////////////////////////////////////////////////////////////////////////// -GR_DEFINE_CUSTOM_STAGE_TEST(GrConfigConversionEffect); +GR_DEFINE_EFFECT_TEST(GrConfigConversionEffect); GrEffect* GrConfigConversionEffect::TestCreate(SkRandom* random, GrContext* context, diff --git a/src/gpu/effects/GrConfigConversionEffect.h b/src/gpu/effects/GrConfigConversionEffect.h index fb2c770e36..511f59541f 100644 --- a/src/gpu/effects/GrConfigConversionEffect.h +++ b/src/gpu/effects/GrConfigConversionEffect.h @@ -64,7 +64,7 @@ private: bool fSwapRedAndBlue; PMConversion fPMConversion; - GR_DECLARE_CUSTOM_STAGE_TEST; + GR_DECLARE_EFFECT_TEST; typedef GrSingleTextureEffect INHERITED; }; diff --git a/src/gpu/effects/GrConvolutionEffect.cpp b/src/gpu/effects/GrConvolutionEffect.cpp index 392475f150..32086ca57b 100644 --- a/src/gpu/effects/GrConvolutionEffect.cpp +++ b/src/gpu/effects/GrConvolutionEffect.cpp @@ -172,7 +172,7 @@ bool GrConvolutionEffect::isEqual(const GrEffect& sBase) const { /////////////////////////////////////////////////////////////////////////////// -GR_DEFINE_CUSTOM_STAGE_TEST(GrConvolutionEffect); +GR_DEFINE_EFFECT_TEST(GrConvolutionEffect); GrEffect* GrConvolutionEffect::TestCreate(SkRandom* random, GrContext* context, diff --git a/src/gpu/effects/GrConvolutionEffect.h b/src/gpu/effects/GrConvolutionEffect.h index 50639940bc..7f2ead5f4a 100644 --- a/src/gpu/effects/GrConvolutionEffect.h +++ b/src/gpu/effects/GrConvolutionEffect.h @@ -55,7 +55,7 @@ protected: float fKernel[kMaxKernelWidth]; private: - GR_DECLARE_CUSTOM_STAGE_TEST; + GR_DECLARE_EFFECT_TEST; typedef Gr1DKernelEffect INHERITED; }; diff --git a/src/gpu/effects/GrSingleTextureEffect.cpp b/src/gpu/effects/GrSingleTextureEffect.cpp index 2f8801c75a..7717f6a882 100644 --- a/src/gpu/effects/GrSingleTextureEffect.cpp +++ b/src/gpu/effects/GrSingleTextureEffect.cpp @@ -66,7 +66,7 @@ const GrProgramStageFactory& GrSingleTextureEffect::getFactory() const { /////////////////////////////////////////////////////////////////////////////// -GR_DEFINE_CUSTOM_STAGE_TEST(GrSingleTextureEffect); +GR_DEFINE_EFFECT_TEST(GrSingleTextureEffect); GrEffect* GrSingleTextureEffect::TestCreate(SkRandom* random, GrContext* context, diff --git a/src/gpu/effects/GrSingleTextureEffect.h b/src/gpu/effects/GrSingleTextureEffect.h index 92ab92a275..230bf5be1b 100644 --- a/src/gpu/effects/GrSingleTextureEffect.h +++ b/src/gpu/effects/GrSingleTextureEffect.h @@ -37,7 +37,7 @@ public: virtual const GrProgramStageFactory& getFactory() const SK_OVERRIDE; private: - GR_DECLARE_CUSTOM_STAGE_TEST; + GR_DECLARE_EFFECT_TEST; GrTextureAccess fTextureAccess; diff --git a/src/gpu/effects/GrTextureDomainEffect.cpp b/src/gpu/effects/GrTextureDomainEffect.cpp index 1319814d6d..fb0bcff1f3 100644 --- a/src/gpu/effects/GrTextureDomainEffect.cpp +++ b/src/gpu/effects/GrTextureDomainEffect.cpp @@ -112,7 +112,7 @@ bool GrTextureDomainEffect::isEqual(const GrEffect& sBase) const { /////////////////////////////////////////////////////////////////////////////// -GR_DEFINE_CUSTOM_STAGE_TEST(GrTextureDomainEffect); +GR_DEFINE_EFFECT_TEST(GrTextureDomainEffect); GrEffect* GrTextureDomainEffect::TestCreate(SkRandom* random, GrContext* context, diff --git a/src/gpu/effects/GrTextureDomainEffect.h b/src/gpu/effects/GrTextureDomainEffect.h index 64a6466c02..e045ab1556 100644 --- a/src/gpu/effects/GrTextureDomainEffect.h +++ b/src/gpu/effects/GrTextureDomainEffect.h @@ -40,7 +40,7 @@ protected: GrRect fTextureDomain; private: - GR_DECLARE_CUSTOM_STAGE_TEST; + GR_DECLARE_EFFECT_TEST; typedef GrSingleTextureEffect INHERITED; }; diff --git a/src/gpu/gl/GrGLProgram.cpp b/src/gpu/gl/GrGLProgram.cpp index 08e58e8cd5..5549e5819b 100644 --- a/src/gpu/gl/GrGLProgram.cpp +++ b/src/gpu/gl/GrGLProgram.cpp @@ -53,8 +53,8 @@ inline const char* dual_source_output_name() { return "dualSourceOut"; } GrGLProgram* GrGLProgram::Create(const GrGLContextInfo& gl, const Desc& desc, - const GrEffect** customStages) { - GrGLProgram* program = SkNEW_ARGS(GrGLProgram, (gl, desc, customStages)); + const GrEffect** effects) { + GrGLProgram* program = SkNEW_ARGS(GrGLProgram, (gl, desc, effects)); if (!program->succeeded()) { delete program; program = NULL; @@ -64,7 +64,7 @@ GrGLProgram* GrGLProgram::Create(const GrGLContextInfo& gl, GrGLProgram::GrGLProgram(const GrGLContextInfo& gl, const Desc& desc, - const GrEffect** customStages) + const GrEffect** effects) : fContextInfo(gl) , fUniformManager(gl) { fDesc = desc; @@ -86,7 +86,7 @@ GrGLProgram::GrGLProgram(const GrGLContextInfo& gl, fTextureOrientation[s] = GrGLTexture::kBottomUp_Orientation; } - this->genProgram(customStages); + this->genProgram(effects); } GrGLProgram::~GrGLProgram() { @@ -500,7 +500,7 @@ bool GrGLProgram::compileShaders(const GrGLShaderBuilder& builder) { return true; } -bool GrGLProgram::genProgram(const GrEffect** customStages) { +bool GrGLProgram::genProgram(const GrEffect** effects) { GrAssert(0 == fProgramID); GrGLShaderBuilder builder(fContextInfo, fUniformManager); @@ -624,7 +624,7 @@ bool GrGLProgram::genProgram(const GrEffect** customStages) { } builder.setCurrentStage(s); - fProgramStage[s] = GenStageCode(customStages[s], + fProgramStage[s] = GenStageCode(effects[s], fDesc.fStages[s], &fUniforms.fStages[s], inColor.size() ? inColor.c_str() : NULL, @@ -729,7 +729,7 @@ bool GrGLProgram::genProgram(const GrEffect** customStages) { inCoverage.append("4"); } builder.setCurrentStage(s); - fProgramStage[s] = GenStageCode(customStages[s], + fProgramStage[s] = GenStageCode(effects[s], fDesc.fStages[s], &fUniforms.fStages[s], inCoverage.size() ? inCoverage.c_str() : NULL, @@ -880,7 +880,7 @@ void GrGLProgram::initSamplerUniforms() { for (int s = 0; s < GrDrawState::kNumStages; ++s) { int count = fUniforms.fStages[s].fSamplerUniforms.count(); // FIXME: We're still always reserving one texture per stage. After GrTextureParams are - // expressed by the custom stage rather than the GrSamplerState we can move texture binding + // expressed by the effect rather than the GrSamplerState we can move texture binding // into GrGLProgram and it should be easier to fix this. GrAssert(count <= 1); for (int t = 0; t < count; ++t) { diff --git a/src/gpu/gl/GrGLProgram.h b/src/gpu/gl/GrGLProgram.h index c9afc2bd75..f6760a98f7 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 GrEffect** customStages); + const GrEffect** effects); virtual ~GrGLProgram(); @@ -164,14 +164,14 @@ private: GrGLProgram(const GrGLContextInfo& gl, const Desc& desc, - const GrEffect** customStages); + const GrEffect** effects); bool succeeded() const { return 0 != fProgramID; } /** * This is the heavy initialization routine for building a GLProgram. */ - bool genProgram(const GrEffect** customStages); + bool genProgram(const GrEffect** effects); void genInputColor(GrGLShaderBuilder* builder, SkString* inColor); diff --git a/src/gpu/gl/GrGLProgramStage.h b/src/gpu/gl/GrGLProgramStage.h index 3f8afe4a90..37d0b039a7 100644 --- a/src/gpu/gl/GrGLProgramStage.h +++ b/src/gpu/gl/GrGLProgramStage.h @@ -50,7 +50,7 @@ public: stages. @param builder Interface used to emit code in the shaders. - @param stage The custom stage that generated this program stage. + @param effect The effect that generated this program stage. @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 @@ -61,14 +61,13 @@ public: NULL in which case the implied input is solid white (all ones). TODO: Better system for communicating optimization info (e.g. input 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. + the effect to communicate back similar known info about its output. @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 GrEffect& stage, + const GrEffect& effect, StageKey key, const char* vertexCoords, const char* outputColor, diff --git a/src/gpu/gl/GrGLSL.h b/src/gpu/gl/GrGLSL.h index ec34eeaa3b..af0da296ee 100644 --- a/src/gpu/gl/GrGLSL.h +++ b/src/gpu/gl/GrGLSL.h @@ -153,7 +153,7 @@ GrSLConstantVec GrGLSLModulate4f(SkString* outAppend, * mulFactor may be either "" or NULL. In this case either nothing will be appended (kOnes) or an * assignment of vec(0,0,0,0) will be appended (kZeros). The assignment is prepended by tabCnt tabs. * A semicolon and newline are added after the assignment. (TODO: Remove tabCnt when we auto-insert - * tabs to custom stage-generated lines.) If a zeros vec is assigned then the return value is + * tabs to GrGLProgramStage-generated lines.) If a zeros vec is assigned then the return value is * kZeros, otherwise kNone. */ GrSLConstantVec GrGLSLMulVarBy4f(SkString* outAppend, diff --git a/src/gpu/gl/GrGLShaderBuilder.cpp b/src/gpu/gl/GrGLShaderBuilder.cpp index f11a8d9007..217b874769 100644 --- a/src/gpu/gl/GrGLShaderBuilder.cpp +++ b/src/gpu/gl/GrGLShaderBuilder.cpp @@ -99,7 +99,7 @@ GrGLShaderBuilder::GrGLShaderBuilder(const GrGLContextInfo& ctx, GrGLUniformMana } void GrGLShaderBuilder::setupTextureAccess(const char* varyingFSName, GrSLType varyingType) { - // FIXME: We don't know how the custom stage will manipulate the coords. So we give up on using + // FIXME: We don't know how the effect will manipulate the coords. So we give up on using // projective texturing and always give the stage 2D coords. This will be fixed when custom // stages are responsible for setting up their own tex coords / tex matrices. switch (varyingType) { diff --git a/src/gpu/gl/GrGLShaderBuilder.h b/src/gpu/gl/GrGLShaderBuilder.h index 0b5eb178d4..cb382474b8 100644 --- a/src/gpu/gl/GrGLShaderBuilder.h +++ b/src/gpu/gl/GrGLShaderBuilder.h @@ -173,13 +173,13 @@ public: void getShader(ShaderType, SkString*) const; /** - * TODO: Make this do all the compiling, linking, etc. Hide from the custom stages + * TODO: Make this do all the compiling, linking, etc. Hide from the GrEffects */ void finished(GrGLuint programID); /** * Sets the current stage (used to make variable names unique). - * TODO: Hide from the custom stages + * TODO: Hide from the GrEffects */ void setCurrentStage(int stage) { fCurrentStage = stage; } void setNonStage() { fCurrentStage = kNonStageIdx; } diff --git a/src/gpu/gl/GrGpuGL.cpp b/src/gpu/gl/GrGpuGL.cpp index 858e93891a..7a58c53aef 100644 --- a/src/gpu/gl/GrGpuGL.cpp +++ b/src/gpu/gl/GrGpuGL.cpp @@ -2018,12 +2018,12 @@ 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 GrEffect* customStage = drawState->sampler(stage)->getEffect(); - if (customStage->numTextures() > 0) { - GrGLTexture* nextTexture = static_cast<GrGLTexture*>(customStage->texture(0)); + // FIXME: Assuming at most one texture per effect + const GrEffect* effect = drawState->sampler(stage)->getEffect(); + if (effect->numTextures() > 0) { + GrGLTexture* nextTexture = static_cast<GrGLTexture*>(effect->texture(0)); if (NULL != nextTexture) { - const GrTextureParams& texParams = customStage->textureAccess(0).getParams(); + const GrTextureParams& texParams = effect->textureAccess(0).getParams(); this->flushBoundTextureAndParams(stage, texParams, nextTexture); } } diff --git a/src/gpu/gl/GrGpuGL.h b/src/gpu/gl/GrGpuGL.h index eab0a774a0..0cd7eb58a0 100644 --- a/src/gpu/gl/GrGpuGL.h +++ b/src/gpu/gl/GrGpuGL.h @@ -240,7 +240,7 @@ private: void buildProgram(bool isPoints, BlendOptFlags blendOpts, GrBlendCoeff dstCoeff, - const GrEffect** customStages, + const GrEffect** effects, 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 b0656b2512..9f78aa416b 100644 --- a/src/gpu/gl/GrGpuGL_program.cpp +++ b/src/gpu/gl/GrGpuGL_program.cpp @@ -198,7 +198,7 @@ int GrGpuGL::TextureMatrixOptFlags(const GrGLTexture* texture, void GrGpuGL::flushTextureMatrix(int s) { const GrDrawState& drawState = this->getDrawState(); - // FIXME: Still assuming only a single texture per custom stage + // FIXME: Still assuming only a single texture per effect const GrEffect* stage = drawState.getSampler(s).getEffect(); if (0 == stage->numTextures()) { return; @@ -350,11 +350,11 @@ bool GrGpuGL::flushGraphicsState(DrawType type) { return false; } - const GrEffect* customStages [GrDrawState::kNumStages]; + const GrEffect* effects[GrDrawState::kNumStages]; GrGLProgram::Desc desc; - this->buildProgram(kDrawPoints_DrawType == type, blendOpts, dstCoeff, customStages, &desc); + this->buildProgram(kDrawPoints_DrawType == type, blendOpts, dstCoeff, effects, &desc); - fCurrentProgram.reset(fProgramCache->getProgram(desc, customStages)); + fCurrentProgram.reset(fProgramCache->getProgram(desc, effects)); if (NULL == fCurrentProgram.get()) { GrAssert(!"Failed to create program!"); return false; @@ -565,19 +565,19 @@ void GrGpuGL::setupGeometry(int* startVertex, namespace { -void setup_custom_stage(GrGLProgram::Desc::StageDesc* stage, - const GrSamplerState& sampler, - const GrGLCaps& caps, - const GrEffect** customStages, - GrGLProgram* program, int index) { - const GrEffect* customStage = sampler.getEffect(); - if (customStage) { - const GrProgramStageFactory& factory = customStage->getFactory(); - stage->fCustomStageKey = factory.glStageKey(*customStage, caps); - customStages[index] = customStage; +void setup_effect(GrGLProgram::Desc::StageDesc* stage, + const GrSamplerState& sampler, + const GrGLCaps& caps, + const GrEffect** effects, + GrGLProgram* program, int index) { + const GrEffect* effect = sampler.getEffect(); + if (effect) { + const GrProgramStageFactory& factory = effect->getFactory(); + stage->fCustomStageKey = factory.glStageKey(*effect, caps); + effects[index] = effect; } else { stage->fCustomStageKey = 0; - customStages[index] = NULL; + effects[index] = NULL; } } @@ -586,7 +586,7 @@ void setup_custom_stage(GrGLProgram::Desc::StageDesc* stage, void GrGpuGL::buildProgram(bool isPoints, BlendOptFlags blendOpts, GrBlendCoeff dstCoeff, - const GrEffect** customStages, + const GrEffect** effects, ProgramDesc* desc) { const GrDrawState& drawState = this->getDrawState(); @@ -674,12 +674,11 @@ void GrGpuGL::buildProgram(bool isPoints, if (!skip && stage.isEnabled()) { lastEnabledStage = s; const GrSamplerState& sampler = drawState.getSampler(s); - // FIXME: Still assuming one texture per custom stage - const GrEffect* customStage = drawState.getSampler(s).getEffect(); + // FIXME: Still assuming one texture per effect + const GrEffect* effect = drawState.getSampler(s).getEffect(); - if (customStage->numTextures() > 0) { - const GrGLTexture* texture = - static_cast<const GrGLTexture*>(customStage->texture(0)); + if (effect->numTextures() > 0) { + const GrGLTexture* texture = static_cast<const GrGLTexture*>(effect->texture(0)); GrMatrix samplerMatrix; sampler.getTotalMatrix(&samplerMatrix); if (NULL != texture) { @@ -690,16 +689,15 @@ void GrGpuGL::buildProgram(bool isPoints, } } else { // Set identity to do the minimal amount of extra work for the no texture case. - // This will go away when custom stages manage their own texture matrix. + // This will go away when effects manage their own texture matrix. stage.fOptFlags |= StageDesc::kIdentityMatrix_OptFlagBit; } - setup_custom_stage(&stage, sampler, this->glCaps(), customStages, - fCurrentProgram.get(), s); + setup_effect(&stage, sampler, this->glCaps(), effects, fCurrentProgram.get(), s); } else { stage.fOptFlags = 0; stage.fCustomStageKey = 0; - customStages[s] = NULL; + effects[s] = NULL; } } |