diff options
21 files changed, 49 insertions, 49 deletions
diff --git a/gyp/gpu.gypi b/gyp/gpu.gypi index 1e6605b64a..79cdecdb9c 100644 --- a/gyp/gpu.gypi +++ b/gyp/gpu.gypi @@ -144,6 +144,8 @@ '<(skia_src_path)/gpu/gl/GrGLCreateNativeInterface_none.cpp', '<(skia_src_path)/gpu/gl/GrGLDefaultInterface_none.cpp', '<(skia_src_path)/gpu/gl/GrGLDefines.h', + '<(skia_src_path)/gpu/gl/GrGLEffect.cpp', + '<(skia_src_path)/gpu/gl/GrGLEffect.h', '<(skia_src_path)/gpu/gl/GrGLIndexBuffer.cpp', '<(skia_src_path)/gpu/gl/GrGLIndexBuffer.h', '<(skia_src_path)/gpu/gl/GrGLInterface.cpp', @@ -152,8 +154,6 @@ '<(skia_src_path)/gpu/gl/GrGLPath.h', '<(skia_src_path)/gpu/gl/GrGLProgram.cpp', '<(skia_src_path)/gpu/gl/GrGLProgram.h', - '<(skia_src_path)/gpu/gl/GrGLProgramStage.cpp', - '<(skia_src_path)/gpu/gl/GrGLProgramStage.h', '<(skia_src_path)/gpu/gl/GrGLRenderTarget.cpp', '<(skia_src_path)/gpu/gl/GrGLRenderTarget.h', '<(skia_src_path)/gpu/gl/GrGLShaderBuilder.cpp', diff --git a/include/gpu/GrEffect.h b/include/gpu/GrEffect.h index 4eb8f2a74d..7f97e9250d 100644 --- a/include/gpu/GrEffect.h +++ b/include/gpu/GrEffect.h @@ -26,7 +26,7 @@ class SkString; their fields may not change. (Immutability isn't actually required until they've been used in a draw call, but supporting that would require setters and getters that could fail, copy-on-write, or deep copying of these - objects when they're stored by a GrGLProgramStage.) + objects when they're stored by a GrGLEffect.) */ class GrEffect : public GrRefCnt { @@ -47,7 +47,7 @@ public: an instance of templated class, GrTProgramStageFactory. It is templated on the subclass of GrEffect. The subclass must have a nested type (or typedef) named GLProgramStage which will be the subclass of - GrGLProgramStage created by the factory. + GrGLEffect created by the factory. Example: class MyCustomEffect : public GrEffect { diff --git a/include/gpu/GrProgramStageFactory.h b/include/gpu/GrProgramStageFactory.h index 5779862d09..96505d6c11 100644 --- a/include/gpu/GrProgramStageFactory.h +++ b/include/gpu/GrProgramStageFactory.h @@ -13,12 +13,12 @@ #include "GrNoncopyable.h" /** Given a GrEffect of a particular type, creates the corresponding - graphics-backend-specific GrGLProgramStage. Also tracks equivalence + graphics-backend-specific GrGLEffect. Also tracks equivalence of shaders generated via a key. */ class GrEffect; -class GrGLProgramStage; +class GrGLEffect; class GrGLCaps; class GrProgramStageFactory : public GrNoncopyable { @@ -30,7 +30,7 @@ public: }; virtual StageKey glStageKey(const GrEffect&, const GrGLCaps&) const = 0; - virtual GrGLProgramStage* createGLInstance(const GrEffect&) const = 0; + virtual GrGLEffect* createGLInstance(const GrEffect&) const = 0; bool operator ==(const GrProgramStageFactory& b) const { return fEffectClassID == b.fEffectClassID; @@ -72,7 +72,7 @@ public: typedef typename EffectClass::GLProgramStage GLProgramStage; /** Returns a human-readable name that is accessible via GrEffect or - GrGLProgramStage and is consistent between the two of them. + GrGLEffect and is consistent between the two of them. */ virtual const char* name() const SK_OVERRIDE { return EffectClass::Name(); } diff --git a/src/effects/SkBlendImageFilter.cpp b/src/effects/SkBlendImageFilter.cpp index e2dde8bd66..4f46d60d65 100644 --- a/src/effects/SkBlendImageFilter.cpp +++ b/src/effects/SkBlendImageFilter.cpp @@ -12,7 +12,7 @@ #if SK_SUPPORT_GPU #include "SkGr.h" #include "SkGrPixelRef.h" -#include "gl/GrGLProgramStage.h" +#include "gl/GrGLEffect.h" #endif namespace { @@ -275,7 +275,7 @@ void GrGLBlendEffect::emitFS(GrGLShaderBuilder* builder, } } -GrGLProgramStage::StageKey GrGLBlendEffect::GenKey(const GrEffect& s, const GrGLCaps&) { +GrGLEffect::StageKey GrGLBlendEffect::GenKey(const GrEffect& s, const GrGLCaps&) { return static_cast<const GrBlendEffect&>(s).mode(); } #endif diff --git a/src/effects/SkColorMatrixFilter.cpp b/src/effects/SkColorMatrixFilter.cpp index 226aed76b4..37b3e20a3d 100644 --- a/src/effects/SkColorMatrixFilter.cpp +++ b/src/effects/SkColorMatrixFilter.cpp @@ -320,7 +320,7 @@ bool SkColorMatrixFilter::asColorMatrix(SkScalar matrix[20]) { #if SK_SUPPORT_GPU #include "GrEffect.h" -#include "gl/GrGLProgramStage.h" +#include "gl/GrGLEffect.h" class ColorMatrixEffect : public GrEffect { public: diff --git a/src/effects/SkLightingImageFilter.cpp b/src/effects/SkLightingImageFilter.cpp index 4402bde35f..6dda94dca6 100644 --- a/src/effects/SkLightingImageFilter.cpp +++ b/src/effects/SkLightingImageFilter.cpp @@ -16,7 +16,7 @@ #if SK_SUPPORT_GPU #include "GrProgramStageFactory.h" #include "effects/GrSingleTextureEffect.h" -#include "gl/GrGLProgramStage.h" +#include "gl/GrGLEffect.h" #include "gl/GrGLTexture.h" #include "GrEffect.h" @@ -1168,7 +1168,7 @@ void GrGLLightingEffect::emitFS(GrGLShaderBuilder* builder, GrGLSLMulVarBy4f(code, 2, outputColor, inputColor); } -GrGLProgramStage::StageKey GrGLLightingEffect::GenKey(const GrEffect& s, +GrGLEffect::StageKey GrGLLightingEffect::GenKey(const GrEffect& s, const GrGLCaps& caps) { return static_cast<const GrLightingEffect&>(s).light()->type(); } diff --git a/src/effects/SkMagnifierImageFilter.cpp b/src/effects/SkMagnifierImageFilter.cpp index 9f5a6753d3..56991b9220 100644 --- a/src/effects/SkMagnifierImageFilter.cpp +++ b/src/effects/SkMagnifierImageFilter.cpp @@ -15,7 +15,7 @@ //////////////////////////////////////////////////////////////////////////////// #if SK_SUPPORT_GPU #include "effects/GrSingleTextureEffect.h" -#include "gl/GrGLProgramStage.h" +#include "gl/GrGLEffect.h" #include "gl/GrGLSL.h" #include "gl/GrGLTexture.h" #include "GrProgramStageFactory.h" @@ -174,7 +174,7 @@ void GrGLMagnifierEffect::setData(const GrGLUniformManager& uman, uman.set2f(fInsetVar, zoom.x_inset(), zoom.y_inset()); } -GrGLProgramStage::StageKey GrGLMagnifierEffect::GenKey(const GrEffect& s, +GrGLEffect::StageKey GrGLMagnifierEffect::GenKey(const GrEffect& s, const GrGLCaps& caps) { return 0; } diff --git a/src/effects/SkMatrixConvolutionImageFilter.cpp b/src/effects/SkMatrixConvolutionImageFilter.cpp index eeb61a7917..ddd93ba3ec 100644 --- a/src/effects/SkMatrixConvolutionImageFilter.cpp +++ b/src/effects/SkMatrixConvolutionImageFilter.cpp @@ -13,7 +13,7 @@ #include "SkUnPreMultiply.h" #if SK_SUPPORT_GPU -#include "gl/GrGLProgramStage.h" +#include "gl/GrGLEffect.h" #endif SkMatrixConvolutionImageFilter::SkMatrixConvolutionImageFilter(const SkISize& kernelSize, const SkScalar* kernel, SkScalar gain, SkScalar bias, const SkIPoint& target, TileMode tileMode, bool convolveAlpha, SkImageFilter* input) @@ -415,7 +415,7 @@ int encodeXY(int x, int y) { }; -GrGLProgramStage::StageKey GrGLMatrixConvolutionEffect::GenKey(const GrEffect& s, +GrGLEffect::StageKey GrGLMatrixConvolutionEffect::GenKey(const GrEffect& s, const GrGLCaps& caps) { const GrMatrixConvolutionEffect& m = static_cast<const GrMatrixConvolutionEffect&>(s); StageKey key = encodeXY(m.kernelSize().width(), m.kernelSize().height()); diff --git a/src/effects/SkMorphologyImageFilter.cpp b/src/effects/SkMorphologyImageFilter.cpp index 2348815512..8e12b5e275 100644 --- a/src/effects/SkMorphologyImageFilter.cpp +++ b/src/effects/SkMorphologyImageFilter.cpp @@ -14,7 +14,7 @@ #include "GrContext.h" #include "GrTexture.h" #include "GrGpu.h" -#include "gl/GrGLProgramStage.h" +#include "gl/GrGLEffect.h" #include "effects/Gr1DKernelEffect.h" #endif @@ -341,7 +341,7 @@ void GrGLMorphologyEffect::emitFS(GrGLShaderBuilder* builder, GrGLSLMulVarBy4f(code, 2, outputColor, inputColor); } -GrGLProgramStage::StageKey GrGLMorphologyEffect::GenKey(const GrEffect& s, +GrGLEffect::StageKey GrGLMorphologyEffect::GenKey(const GrEffect& s, const GrGLCaps& caps) { const GrMorphologyEffect& m = static_cast<const GrMorphologyEffect&>(s); StageKey key = static_cast<StageKey>(m.radius()); diff --git a/src/effects/SkTableColorFilter.cpp b/src/effects/SkTableColorFilter.cpp index 076db5d1d3..c9dec5500c 100644 --- a/src/effects/SkTableColorFilter.cpp +++ b/src/effects/SkTableColorFilter.cpp @@ -217,7 +217,7 @@ bool SkTable_ColorFilter::asComponentTable(SkBitmap* table) const { #if SK_SUPPORT_GPU #include "GrEffect.h" -#include "gl/GrGLProgramStage.h" +#include "gl/GrGLEffect.h" #include "SkGr.h" class GLColorTableEffect; @@ -312,7 +312,7 @@ void GLColorTableEffect::emitFS(GrGLShaderBuilder* builder, code->appendf("\t\t%s.rgb *= %s.a;\n", outputColor, outputColor); } -GrGLProgramStage::StageKey GLColorTableEffect::GenKey(const GrEffect& s, +GrGLEffect::StageKey GLColorTableEffect::GenKey(const GrEffect& s, const GrGLCaps& caps) { return 0; } diff --git a/src/effects/gradients/SkGradientShaderPriv.h b/src/effects/gradients/SkGradientShaderPriv.h index 36550cdb8f..841771644c 100644 --- a/src/effects/gradients/SkGradientShaderPriv.h +++ b/src/effects/gradients/SkGradientShaderPriv.h @@ -192,7 +192,7 @@ private: #if SK_SUPPORT_GPU -#include "gl/GrGLProgramStage.h" +#include "gl/GrGLEffect.h" class GrSamplerState; class GrProgramStageFactory; diff --git a/src/gpu/effects/GrConfigConversionEffect.cpp b/src/gpu/effects/GrConfigConversionEffect.cpp index 7bc203b062..4b288c801b 100644 --- a/src/gpu/effects/GrConfigConversionEffect.cpp +++ b/src/gpu/effects/GrConfigConversionEffect.cpp @@ -6,7 +6,7 @@ */ #include "GrConfigConversionEffect.h" -#include "gl/GrGLProgramStage.h" +#include "gl/GrGLEffect.h" class GrGLConfigConversionEffect : public GrGLLegacyProgramStage { public: diff --git a/src/gpu/effects/GrConvolutionEffect.cpp b/src/gpu/effects/GrConvolutionEffect.cpp index e49302ef94..8713c5bfc3 100644 --- a/src/gpu/effects/GrConvolutionEffect.cpp +++ b/src/gpu/effects/GrConvolutionEffect.cpp @@ -6,7 +6,7 @@ */ #include "GrConvolutionEffect.h" -#include "gl/GrGLProgramStage.h" +#include "gl/GrGLEffect.h" #include "gl/GrGLSL.h" #include "gl/GrGLTexture.h" #include "GrProgramStageFactory.h" @@ -108,7 +108,7 @@ void GrGLConvolutionEffect::setData(const GrGLUniformManager& uman, const GrEffe uman.set1fv(fKernelUni, 0, this->width(), conv.kernel()); } -GrGLProgramStage::StageKey GrGLConvolutionEffect::GenKey(const GrEffect& s, +GrGLEffect::StageKey GrGLConvolutionEffect::GenKey(const GrEffect& s, const GrGLCaps& caps) { return static_cast<const GrConvolutionEffect&>(s).radius(); } diff --git a/src/gpu/effects/GrSingleTextureEffect.cpp b/src/gpu/effects/GrSingleTextureEffect.cpp index 47e26e5093..715303098b 100644 --- a/src/gpu/effects/GrSingleTextureEffect.cpp +++ b/src/gpu/effects/GrSingleTextureEffect.cpp @@ -6,7 +6,7 @@ */ #include "effects/GrSingleTextureEffect.h" -#include "gl/GrGLProgramStage.h" +#include "gl/GrGLEffect.h" #include "gl/GrGLSL.h" #include "gl/GrGLTexture.h" #include "GrProgramStageFactory.h" diff --git a/src/gpu/effects/GrTextureDomainEffect.cpp b/src/gpu/effects/GrTextureDomainEffect.cpp index 1203392d66..ca54794936 100644 --- a/src/gpu/effects/GrTextureDomainEffect.cpp +++ b/src/gpu/effects/GrTextureDomainEffect.cpp @@ -6,7 +6,7 @@ */ #include "GrTextureDomainEffect.h" -#include "gl/GrGLProgramStage.h" +#include "gl/GrGLEffect.h" #include "GrProgramStageFactory.h" class GrGLTextureDomainEffect : public GrGLLegacyProgramStage { diff --git a/src/gpu/gl/GrGLProgramStage.cpp b/src/gpu/gl/GrGLEffect.cpp index cc4cc91fcf..eb11909060 100644 --- a/src/gpu/gl/GrGLProgramStage.cpp +++ b/src/gpu/gl/GrGLEffect.cpp @@ -6,21 +6,21 @@ */ #include "GrGLSL.h" -#include "GrGLProgramStage.h" +#include "GrGLEffect.h" -GrGLProgramStage::GrGLProgramStage(const GrProgramStageFactory& factory) +GrGLEffect::GrGLEffect(const GrProgramStageFactory& factory) : fFactory(factory) { } -GrGLProgramStage::~GrGLProgramStage() { +GrGLEffect::~GrGLEffect() { } /////////////////////////////////////////////////////////////////////////////// -void GrGLProgramStage::setData(const GrGLUniformManager&, const GrEffect&) { +void GrGLEffect::setData(const GrGLUniformManager&, const GrEffect&) { } -GrGLProgramStage::StageKey GrGLProgramStage::GenTextureKey(const GrEffect& effect, +GrGLEffect::StageKey GrGLEffect::GenTextureKey(const GrEffect& effect, const GrGLCaps& caps) { StageKey key = 0; for (int index = 0; index < effect.numTextures(); ++index) { diff --git a/src/gpu/gl/GrGLProgramStage.h b/src/gpu/gl/GrGLEffect.h index 190ea8a699..32adcdd37d 100644 --- a/src/gpu/gl/GrGLProgramStage.h +++ b/src/gpu/gl/GrGLEffect.h @@ -20,7 +20,7 @@ class GrGLTexture; /** @file This file contains specializations for OpenGL of the shader stages declared in - include/gpu/GrEffect.h. Objects of type GrGLProgramStage are responsible for emitting the + include/gpu/GrEffect.h. Objects of type GrGLEffect 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 GrEffect&, const GrGLCaps&) @@ -30,7 +30,7 @@ class GrGLTexture; These objects are created by the factory object returned by the GrEffect::getFactory(). */ -class GrGLProgramStage { +class GrGLEffect { public: typedef GrEffect::StageKey StageKey; @@ -41,9 +41,9 @@ public: typedef GrGLShaderBuilder::TextureSamplerArray TextureSamplerArray; - GrGLProgramStage(const GrProgramStageFactory&); + GrGLEffect(const GrProgramStageFactory&); - virtual ~GrGLProgramStage(); + virtual ~GrGLEffect(); /** Called when the program stage should insert its code into the shaders. The code in each shader will be in its own block ({}) and so locally scoped names will not collide across @@ -63,7 +63,7 @@ public: color is solid white, trans black, known to be opaque, etc.) that allows 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 + GrGLEffect. These can be passed to the builder to emit texture reads in the generated code. */ virtual void emitCode(GrGLShaderBuilder* builder, @@ -74,7 +74,7 @@ public: const char* inputColor, const TextureSamplerArray& samplers) = 0; - /** A GrGLProgramStage instance can be reused with any GrEffect that produces the same stage + /** A GrGLEffect 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 GrEffect&); @@ -89,13 +89,13 @@ protected: }; /** - * This allows program stages that implemented an older set of virtual functions on GrGLProgramStage + * This allows program stages that implemented an older set of virtual functions on GrGLEffect * to continue to work by change their parent class to this class. New program stages should not use * this interface. It will be removed once older stages are modified to implement emitCode(). */ -class GrGLLegacyProgramStage : public GrGLProgramStage { +class GrGLLegacyProgramStage : public GrGLEffect { public: - GrGLLegacyProgramStage(const GrProgramStageFactory& factory) : GrGLProgramStage(factory) {} + GrGLLegacyProgramStage(const GrProgramStageFactory& factory) : GrGLEffect(factory) {} virtual void setupVariables(GrGLShaderBuilder* builder) {}; virtual void emitVS(GrGLShaderBuilder* builder, diff --git a/src/gpu/gl/GrGLProgram.cpp b/src/gpu/gl/GrGLProgram.cpp index ae957e9f9d..e817c1afc3 100644 --- a/src/gpu/gl/GrGLProgram.cpp +++ b/src/gpu/gl/GrGLProgram.cpp @@ -9,7 +9,7 @@ #include "GrAllocator.h" #include "GrEffect.h" -#include "GrGLProgramStage.h" +#include "GrGLEffect.h" #include "gl/GrGLShaderBuilder.h" #include "GrGLShaderVar.h" #include "GrProgramStageFactory.h" @@ -896,7 +896,7 @@ void GrGLProgram::initSamplerUniforms() { // Stage code generation // TODO: Move this function to GrGLShaderBuilder -GrGLProgramStage* GrGLProgram::GenStageCode(const GrEffect* effect, +GrGLEffect* GrGLProgram::GenStageCode(const GrEffect* effect, const StageDesc& desc, StageUniforms* uniforms, const char* fsInColor, // NULL means no incoming color @@ -904,7 +904,7 @@ GrGLProgramStage* GrGLProgram::GenStageCode(const GrEffect* effect, const char* vsInCoord, GrGLShaderBuilder* builder) { - GrGLProgramStage* glStage = effect->getFactory().createGLInstance(*effect); + GrGLEffect* glStage = effect->getFactory().createGLInstance(*effect); /// Vertex Shader Stuff diff --git a/src/gpu/gl/GrGLProgram.h b/src/gpu/gl/GrGLProgram.h index 056b7edf58..91239acaa9 100644 --- a/src/gpu/gl/GrGLProgram.h +++ b/src/gpu/gl/GrGLProgram.h @@ -19,7 +19,7 @@ #include "SkXfermode.h" class GrBinHashKeyBuilder; -class GrGLProgramStage; +class GrGLEffect; class GrGLShaderBuilder; // optionally compile the experimental GS code. Set to GR_DEBUG @@ -175,7 +175,7 @@ private: void genInputColor(GrGLShaderBuilder* builder, SkString* inColor); - static GrGLProgramStage* GenStageCode(const GrEffect* effect, + static GrGLEffect* GenStageCode(const GrEffect* effect, const StageDesc& desc, // TODO: Eliminate this StageUniforms* stageUniforms, // TODO: Eliminate this const char* fsInColor, // NULL means no incoming color @@ -254,7 +254,7 @@ private: GrMatrix fTextureMatrices[GrDrawState::kNumStages]; GrGLTexture::Orientation fTextureOrientation[GrDrawState::kNumStages]; - GrGLProgramStage* fProgramStage[GrDrawState::kNumStages]; + GrGLEffect* fProgramStage[GrDrawState::kNumStages]; Desc fDesc; const GrGLContextInfo& fContextInfo; diff --git a/src/gpu/gl/GrGLSL.h b/src/gpu/gl/GrGLSL.h index af0da296ee..c0d3d5e596 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 GrGLProgramStage-generated lines.) If a zeros vec is assigned then the return value is + * tabs to GrGLEffect-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/GrGpuGL_program.cpp b/src/gpu/gl/GrGpuGL_program.cpp index 5bc84f8055..c6a8e90f0b 100644 --- a/src/gpu/gl/GrGpuGL_program.cpp +++ b/src/gpu/gl/GrGpuGL_program.cpp @@ -8,7 +8,7 @@ #include "GrGpuGL.h" #include "GrEffect.h" -#include "GrGLProgramStage.h" +#include "GrGLEffect.h" #include "GrGpuVertex.h" typedef GrGLUniformManager::UniformHandle UniformHandle; |