From 6af0c9394301b9f976813cc6dbdbbfe779030fe1 Mon Sep 17 00:00:00 2001 From: wangyix Date: Wed, 22 Jul 2015 10:21:17 -0700 Subject: Moved GrGLFragmentProcessor definition to its own file BUG=skia: Review URL: https://codereview.chromium.org/1246193002 --- src/effects/SkAlphaThresholdFilter.cpp | 2 +- src/effects/SkArithmeticMode_gpu.cpp | 2 +- src/effects/SkBlurMaskFilter.cpp | 2 +- src/effects/SkColorCubeFilter.cpp | 2 +- src/effects/SkColorFilters.cpp | 2 +- src/effects/SkColorMatrixFilter.cpp | 2 +- src/effects/SkDisplacementMapEffect.cpp | 2 +- src/effects/SkLightingImageFilter.cpp | 2 +- src/effects/SkLumaColorFilter.cpp | 2 +- src/effects/SkMagnifierImageFilter.cpp | 2 +- src/effects/SkMorphologyImageFilter.cpp | 2 +- src/effects/SkPerlinNoiseShader.cpp | 2 +- src/effects/SkTableColorFilter.cpp | 2 +- src/effects/gradients/SkGradientShaderPriv.h | 2 +- src/gpu/effects/GrBezierEffect.cpp | 2 +- src/gpu/effects/GrBicubicEffect.h | 2 +- src/gpu/effects/GrBitmapTextGeoProc.cpp | 2 +- src/gpu/effects/GrConfigConversionEffect.cpp | 2 +- src/gpu/effects/GrConstColorProcessor.cpp | 2 +- src/gpu/effects/GrConvexPolyEffect.cpp | 2 +- src/gpu/effects/GrConvolutionEffect.cpp | 2 +- src/gpu/effects/GrCustomXfermode.cpp | 2 +- src/gpu/effects/GrDashingEffect.cpp | 2 +- src/gpu/effects/GrDistanceFieldGeoProc.cpp | 2 +- src/gpu/effects/GrDitherEffect.cpp | 2 +- src/gpu/effects/GrMatrixConvolutionEffect.cpp | 2 +- src/gpu/effects/GrOvalEffect.cpp | 2 +- src/gpu/effects/GrRRectEffect.cpp | 2 +- src/gpu/effects/GrSimpleTextureEffect.cpp | 2 +- src/gpu/effects/GrTextureDomain.cpp | 2 +- src/gpu/effects/GrTextureDomain.h | 2 +- src/gpu/effects/GrYUVtoRGBEffect.cpp | 2 +- src/gpu/gl/GrGLFragmentProcessor.h | 67 +++++++++++++++++++++++++++ src/gpu/gl/GrGLGpuProgramCache.cpp | 2 +- src/gpu/gl/GrGLProcessor.h | 52 --------------------- src/gpu/gl/GrGLProgramDesc.cpp | 2 +- src/gpu/gl/GrGLXferProcessor.h | 2 +- src/gpu/gl/builders/GrGLShaderBuilder.h | 2 +- 38 files changed, 103 insertions(+), 88 deletions(-) create mode 100644 src/gpu/gl/GrGLFragmentProcessor.h diff --git a/src/effects/SkAlphaThresholdFilter.cpp b/src/effects/SkAlphaThresholdFilter.cpp index 237949c3ae..55e113efe1 100644 --- a/src/effects/SkAlphaThresholdFilter.cpp +++ b/src/effects/SkAlphaThresholdFilter.cpp @@ -56,7 +56,7 @@ SkImageFilter* SkAlphaThresholdFilter::Create(const SkRegion& region, #include "SkGr.h" -#include "gl/GrGLProcessor.h" +#include "gl/GrGLFragmentProcessor.h" #include "gl/builders/GrGLProgramBuilder.h" class AlphaThresholdEffect : public GrFragmentProcessor { diff --git a/src/effects/SkArithmeticMode_gpu.cpp b/src/effects/SkArithmeticMode_gpu.cpp index 17b17ffce3..4f0107bcde 100644 --- a/src/effects/SkArithmeticMode_gpu.cpp +++ b/src/effects/SkArithmeticMode_gpu.cpp @@ -14,7 +14,7 @@ #include "GrProcessor.h" #include "GrTexture.h" #include "gl/GrGLCaps.h" -#include "gl/GrGLProcessor.h" +#include "gl/GrGLFragmentProcessor.h" #include "gl/GrGLProgramDataManager.h" #include "gl/builders/GrGLProgramBuilder.h" diff --git a/src/effects/SkBlurMaskFilter.cpp b/src/effects/SkBlurMaskFilter.cpp index 2017170780..402641c980 100644 --- a/src/effects/SkBlurMaskFilter.cpp +++ b/src/effects/SkBlurMaskFilter.cpp @@ -26,7 +26,7 @@ #include "SkGrPixelRef.h" #include "SkDraw.h" #include "effects/GrSimpleTextureEffect.h" -#include "gl/GrGLProcessor.h" +#include "gl/GrGLFragmentProcessor.h" #include "gl/builders/GrGLProgramBuilder.h" #endif diff --git a/src/effects/SkColorCubeFilter.cpp b/src/effects/SkColorCubeFilter.cpp index 16010b4f96..bce9a600d7 100644 --- a/src/effects/SkColorCubeFilter.cpp +++ b/src/effects/SkColorCubeFilter.cpp @@ -17,7 +17,7 @@ #include "GrInvariantOutput.h" #include "GrTexturePriv.h" #include "SkGr.h" -#include "gl/GrGLProcessor.h" +#include "gl/GrGLFragmentProcessor.h" #include "gl/builders/GrGLProgramBuilder.h" #endif diff --git a/src/effects/SkColorFilters.cpp b/src/effects/SkColorFilters.cpp index 7025715b46..92fe4d708e 100644 --- a/src/effects/SkColorFilters.cpp +++ b/src/effects/SkColorFilters.cpp @@ -69,7 +69,7 @@ SkFlattenable* SkModeColorFilter::CreateProc(SkReadBuffer& buffer) { #include "GrInvariantOutput.h" #include "GrProcessorUnitTest.h" #include "SkGr.h" -#include "gl/GrGLProcessor.h" +#include "gl/GrGLFragmentProcessor.h" #include "gl/builders/GrGLProgramBuilder.h" namespace { diff --git a/src/effects/SkColorMatrixFilter.cpp b/src/effects/SkColorMatrixFilter.cpp index 99c29f9928..205bcdb491 100644 --- a/src/effects/SkColorMatrixFilter.cpp +++ b/src/effects/SkColorMatrixFilter.cpp @@ -383,7 +383,7 @@ SkColorFilter* SkColorMatrixFilter::newComposed(const SkColorFilter* innerFilter #if SK_SUPPORT_GPU #include "GrFragmentProcessor.h" #include "GrInvariantOutput.h" -#include "gl/GrGLProcessor.h" +#include "gl/GrGLFragmentProcessor.h" #include "gl/builders/GrGLProgramBuilder.h" class ColorMatrixEffect : public GrFragmentProcessor { diff --git a/src/effects/SkDisplacementMapEffect.cpp b/src/effects/SkDisplacementMapEffect.cpp index 2f1d0119a3..27509dc55b 100644 --- a/src/effects/SkDisplacementMapEffect.cpp +++ b/src/effects/SkDisplacementMapEffect.cpp @@ -16,7 +16,7 @@ #include "GrCoordTransform.h" #include "GrInvariantOutput.h" #include "effects/GrTextureDomain.h" -#include "gl/GrGLProcessor.h" +#include "gl/GrGLFragmentProcessor.h" #include "gl/builders/GrGLProgramBuilder.h" #endif diff --git a/src/effects/SkLightingImageFilter.cpp b/src/effects/SkLightingImageFilter.cpp index b82f6ad916..3cac4fc054 100644 --- a/src/effects/SkLightingImageFilter.cpp +++ b/src/effects/SkLightingImageFilter.cpp @@ -20,7 +20,7 @@ #include "GrInvariantOutput.h" #include "GrPaint.h" #include "effects/GrSingleTextureEffect.h" -#include "gl/GrGLProcessor.h" +#include "gl/GrGLFragmentProcessor.h" #include "gl/builders/GrGLProgramBuilder.h" class GrGLDiffuseLightingEffect; diff --git a/src/effects/SkLumaColorFilter.cpp b/src/effects/SkLumaColorFilter.cpp index 05cbaaaf40..99399092b3 100644 --- a/src/effects/SkLumaColorFilter.cpp +++ b/src/effects/SkLumaColorFilter.cpp @@ -13,7 +13,7 @@ #if SK_SUPPORT_GPU #include "GrContext.h" #include "GrInvariantOutput.h" -#include "gl/GrGLProcessor.h" +#include "gl/GrGLFragmentProcessor.h" #include "gl/builders/GrGLProgramBuilder.h" #endif diff --git a/src/effects/SkMagnifierImageFilter.cpp b/src/effects/SkMagnifierImageFilter.cpp index 09a598e264..9efd252e50 100644 --- a/src/effects/SkMagnifierImageFilter.cpp +++ b/src/effects/SkMagnifierImageFilter.cpp @@ -16,7 +16,7 @@ #if SK_SUPPORT_GPU #include "GrInvariantOutput.h" #include "effects/GrSingleTextureEffect.h" -#include "gl/GrGLProcessor.h" +#include "gl/GrGLFragmentProcessor.h" #include "gl/GrGLTexture.h" #include "gl/builders/GrGLProgramBuilder.h" diff --git a/src/effects/SkMorphologyImageFilter.cpp b/src/effects/SkMorphologyImageFilter.cpp index 62b90cb32d..b5c3700da0 100644 --- a/src/effects/SkMorphologyImageFilter.cpp +++ b/src/effects/SkMorphologyImageFilter.cpp @@ -18,7 +18,7 @@ #include "GrInvariantOutput.h" #include "GrTexture.h" #include "effects/Gr1DKernelEffect.h" -#include "gl/GrGLProcessor.h" +#include "gl/GrGLFragmentProcessor.h" #include "gl/builders/GrGLProgramBuilder.h" #endif diff --git a/src/effects/SkPerlinNoiseShader.cpp b/src/effects/SkPerlinNoiseShader.cpp index 8288a53583..116c947144 100644 --- a/src/effects/SkPerlinNoiseShader.cpp +++ b/src/effects/SkPerlinNoiseShader.cpp @@ -19,7 +19,7 @@ #include "GrCoordTransform.h" #include "GrInvariantOutput.h" #include "SkGr.h" -#include "gl/GrGLProcessor.h" +#include "gl/GrGLFragmentProcessor.h" #include "gl/builders/GrGLProgramBuilder.h" #endif diff --git a/src/effects/SkTableColorFilter.cpp b/src/effects/SkTableColorFilter.cpp index 88ee5e4b03..11fdb89061 100644 --- a/src/effects/SkTableColorFilter.cpp +++ b/src/effects/SkTableColorFilter.cpp @@ -337,7 +337,7 @@ SkColorFilter* SkTable_ColorFilter::newComposed(const SkColorFilter* innerFilter #include "GrInvariantOutput.h" #include "SkGr.h" #include "effects/GrTextureStripAtlas.h" -#include "gl/GrGLProcessor.h" +#include "gl/GrGLFragmentProcessor.h" #include "gl/builders/GrGLProgramBuilder.h" class ColorTableEffect : public GrFragmentProcessor { diff --git a/src/effects/gradients/SkGradientShaderPriv.h b/src/effects/gradients/SkGradientShaderPriv.h index cb882b2a6d..9bd66daa66 100644 --- a/src/effects/gradients/SkGradientShaderPriv.h +++ b/src/effects/gradients/SkGradientShaderPriv.h @@ -294,7 +294,7 @@ static inline int next_dither_toggle16(int toggle) { #include "GrCoordTransform.h" #include "GrFragmentProcessor.h" -#include "gl/GrGLProcessor.h" +#include "gl/GrGLFragmentProcessor.h" class GrInvariantOutput; diff --git a/src/gpu/effects/GrBezierEffect.cpp b/src/gpu/effects/GrBezierEffect.cpp index 6f492c76ac..6a39be439d 100644 --- a/src/gpu/effects/GrBezierEffect.cpp +++ b/src/gpu/effects/GrBezierEffect.cpp @@ -7,7 +7,7 @@ #include "GrBezierEffect.h" -#include "gl/GrGLProcessor.h" +#include "gl/GrGLFragmentProcessor.h" #include "gl/GrGLGeometryProcessor.h" #include "gl/builders/GrGLProgramBuilder.h" diff --git a/src/gpu/effects/GrBicubicEffect.h b/src/gpu/effects/GrBicubicEffect.h index 11075f2398..86118f7b78 100644 --- a/src/gpu/effects/GrBicubicEffect.h +++ b/src/gpu/effects/GrBicubicEffect.h @@ -10,7 +10,7 @@ #include "GrSingleTextureEffect.h" #include "GrTextureDomain.h" -#include "gl/GrGLProcessor.h" +#include "gl/GrGLFragmentProcessor.h" class GrGLBicubicEffect; class GrInvariantOutput; diff --git a/src/gpu/effects/GrBitmapTextGeoProc.cpp b/src/gpu/effects/GrBitmapTextGeoProc.cpp index 4bfa01644c..a0350e99f5 100644 --- a/src/gpu/effects/GrBitmapTextGeoProc.cpp +++ b/src/gpu/effects/GrBitmapTextGeoProc.cpp @@ -9,7 +9,7 @@ #include "GrFontAtlasSizes.h" #include "GrInvariantOutput.h" #include "GrTexture.h" -#include "gl/GrGLProcessor.h" +#include "gl/GrGLFragmentProcessor.h" #include "gl/GrGLTexture.h" #include "gl/GrGLGeometryProcessor.h" #include "gl/builders/GrGLProgramBuilder.h" diff --git a/src/gpu/effects/GrConfigConversionEffect.cpp b/src/gpu/effects/GrConfigConversionEffect.cpp index 4927e29f8a..fa97f324be 100644 --- a/src/gpu/effects/GrConfigConversionEffect.cpp +++ b/src/gpu/effects/GrConfigConversionEffect.cpp @@ -11,7 +11,7 @@ #include "GrInvariantOutput.h" #include "GrSimpleTextureEffect.h" #include "SkMatrix.h" -#include "gl/GrGLProcessor.h" +#include "gl/GrGLFragmentProcessor.h" #include "gl/builders/GrGLProgramBuilder.h" class GrGLConfigConversionEffect : public GrGLFragmentProcessor { diff --git a/src/gpu/effects/GrConstColorProcessor.cpp b/src/gpu/effects/GrConstColorProcessor.cpp index 964e85c708..bc09156a71 100644 --- a/src/gpu/effects/GrConstColorProcessor.cpp +++ b/src/gpu/effects/GrConstColorProcessor.cpp @@ -6,7 +6,7 @@ */ #include "effects/GrConstColorProcessor.h" -#include "gl/GrGLProcessor.h" +#include "gl/GrGLFragmentProcessor.h" #include "gl/builders/GrGLProgramBuilder.h" class GLConstColorProcessor : public GrGLFragmentProcessor { diff --git a/src/gpu/effects/GrConvexPolyEffect.cpp b/src/gpu/effects/GrConvexPolyEffect.cpp index a3d032f4a0..6ecba24c5f 100644 --- a/src/gpu/effects/GrConvexPolyEffect.cpp +++ b/src/gpu/effects/GrConvexPolyEffect.cpp @@ -8,7 +8,7 @@ #include "GrConvexPolyEffect.h" #include "GrInvariantOutput.h" #include "SkPathPriv.h" -#include "gl/GrGLProcessor.h" +#include "gl/GrGLFragmentProcessor.h" #include "gl/builders/GrGLProgramBuilder.h" ////////////////////////////////////////////////////////////////////////////// diff --git a/src/gpu/effects/GrConvolutionEffect.cpp b/src/gpu/effects/GrConvolutionEffect.cpp index f5b5e22ce1..7bb5434f8d 100644 --- a/src/gpu/effects/GrConvolutionEffect.cpp +++ b/src/gpu/effects/GrConvolutionEffect.cpp @@ -6,7 +6,7 @@ */ #include "GrConvolutionEffect.h" -#include "gl/GrGLProcessor.h" +#include "gl/GrGLFragmentProcessor.h" #include "gl/GrGLTexture.h" #include "gl/builders/GrGLProgramBuilder.h" diff --git a/src/gpu/effects/GrCustomXfermode.cpp b/src/gpu/effects/GrCustomXfermode.cpp index 7fc65a477c..350243ebc7 100644 --- a/src/gpu/effects/GrCustomXfermode.cpp +++ b/src/gpu/effects/GrCustomXfermode.cpp @@ -18,7 +18,7 @@ #include "SkXfermode.h" #include "gl/GrGLCaps.h" #include "gl/GrGLGpu.h" -#include "gl/GrGLProcessor.h" +#include "gl/GrGLFragmentProcessor.h" #include "gl/GrGLProgramDataManager.h" #include "gl/builders/GrGLProgramBuilder.h" #include "glsl/GrGLSLCaps.h" diff --git a/src/gpu/effects/GrDashingEffect.cpp b/src/gpu/effects/GrDashingEffect.cpp index f6fe81ba36..550823aacb 100644 --- a/src/gpu/effects/GrDashingEffect.cpp +++ b/src/gpu/effects/GrDashingEffect.cpp @@ -22,7 +22,7 @@ #include "GrVertexBuffer.h" #include "SkGr.h" #include "gl/GrGLGeometryProcessor.h" -#include "gl/GrGLProcessor.h" +#include "gl/GrGLFragmentProcessor.h" #include "gl/builders/GrGLProgramBuilder.h" /////////////////////////////////////////////////////////////////////////////// diff --git a/src/gpu/effects/GrDistanceFieldGeoProc.cpp b/src/gpu/effects/GrDistanceFieldGeoProc.cpp index 393a99db57..8af5631cc5 100755 --- a/src/gpu/effects/GrDistanceFieldGeoProc.cpp +++ b/src/gpu/effects/GrDistanceFieldGeoProc.cpp @@ -12,7 +12,7 @@ #include "SkDistanceFieldGen.h" -#include "gl/GrGLProcessor.h" +#include "gl/GrGLFragmentProcessor.h" #include "gl/GrGLTexture.h" #include "gl/GrGLGeometryProcessor.h" #include "gl/builders/GrGLProgramBuilder.h" diff --git a/src/gpu/effects/GrDitherEffect.cpp b/src/gpu/effects/GrDitherEffect.cpp index eb8466b0b5..1638b1fdec 100644 --- a/src/gpu/effects/GrDitherEffect.cpp +++ b/src/gpu/effects/GrDitherEffect.cpp @@ -9,7 +9,7 @@ #include "GrFragmentProcessor.h" #include "GrInvariantOutput.h" #include "SkRect.h" -#include "gl/GrGLProcessor.h" +#include "gl/GrGLFragmentProcessor.h" #include "gl/builders/GrGLProgramBuilder.h" ////////////////////////////////////////////////////////////////////////////// diff --git a/src/gpu/effects/GrMatrixConvolutionEffect.cpp b/src/gpu/effects/GrMatrixConvolutionEffect.cpp index 24e78208d5..87b38eee3b 100644 --- a/src/gpu/effects/GrMatrixConvolutionEffect.cpp +++ b/src/gpu/effects/GrMatrixConvolutionEffect.cpp @@ -5,7 +5,7 @@ * found in the LICENSE file. */ #include "GrMatrixConvolutionEffect.h" -#include "gl/GrGLProcessor.h" +#include "gl/GrGLFragmentProcessor.h" #include "gl/GrGLTexture.h" #include "gl/builders/GrGLProgramBuilder.h" diff --git a/src/gpu/effects/GrOvalEffect.cpp b/src/gpu/effects/GrOvalEffect.cpp index 1b6df12790..e7b52359fc 100644 --- a/src/gpu/effects/GrOvalEffect.cpp +++ b/src/gpu/effects/GrOvalEffect.cpp @@ -10,7 +10,7 @@ #include "GrFragmentProcessor.h" #include "GrInvariantOutput.h" #include "SkRect.h" -#include "gl/GrGLProcessor.h" +#include "gl/GrGLFragmentProcessor.h" #include "gl/builders/GrGLProgramBuilder.h" ////////////////////////////////////////////////////////////////////////////// diff --git a/src/gpu/effects/GrRRectEffect.cpp b/src/gpu/effects/GrRRectEffect.cpp index a31e89ce3e..432e6ff402 100644 --- a/src/gpu/effects/GrRRectEffect.cpp +++ b/src/gpu/effects/GrRRectEffect.cpp @@ -12,7 +12,7 @@ #include "GrInvariantOutput.h" #include "GrOvalEffect.h" #include "SkRRect.h" -#include "gl/GrGLProcessor.h" +#include "gl/GrGLFragmentProcessor.h" #include "gl/builders/GrGLProgramBuilder.h" // The effects defined here only handle rrect radii >= kRadiusMin. diff --git a/src/gpu/effects/GrSimpleTextureEffect.cpp b/src/gpu/effects/GrSimpleTextureEffect.cpp index c1b28116d8..8e6243dca0 100644 --- a/src/gpu/effects/GrSimpleTextureEffect.cpp +++ b/src/gpu/effects/GrSimpleTextureEffect.cpp @@ -9,7 +9,7 @@ #include "GrInvariantOutput.h" #include "GrTexture.h" #include "gl/GrGLCaps.h" -#include "gl/GrGLProcessor.h" +#include "gl/GrGLFragmentProcessor.h" #include "gl/GrGLTexture.h" #include "gl/builders/GrGLProgramBuilder.h" diff --git a/src/gpu/effects/GrTextureDomain.cpp b/src/gpu/effects/GrTextureDomain.cpp index 00067c491c..1ebbea8303 100644 --- a/src/gpu/effects/GrTextureDomain.cpp +++ b/src/gpu/effects/GrTextureDomain.cpp @@ -9,7 +9,7 @@ #include "GrInvariantOutput.h" #include "GrSimpleTextureEffect.h" #include "SkFloatingPoint.h" -#include "gl/GrGLProcessor.h" +#include "gl/GrGLFragmentProcessor.h" #include "gl/builders/GrGLProgramBuilder.h" GrTextureDomain::GrTextureDomain(const SkRect& domain, Mode mode, int index) diff --git a/src/gpu/effects/GrTextureDomain.h b/src/gpu/effects/GrTextureDomain.h index f9de4fa75e..77c6ce3d3a 100644 --- a/src/gpu/effects/GrTextureDomain.h +++ b/src/gpu/effects/GrTextureDomain.h @@ -9,7 +9,7 @@ #define GrTextureDomainEffect_DEFINED #include "GrSingleTextureEffect.h" -#include "gl/GrGLProcessor.h" +#include "gl/GrGLFragmentProcessor.h" class GrGLProgramBuilder; class GrGLShaderBuilder; diff --git a/src/gpu/effects/GrYUVtoRGBEffect.cpp b/src/gpu/effects/GrYUVtoRGBEffect.cpp index dd1b48082c..7e62868c95 100644 --- a/src/gpu/effects/GrYUVtoRGBEffect.cpp +++ b/src/gpu/effects/GrYUVtoRGBEffect.cpp @@ -10,7 +10,7 @@ #include "GrCoordTransform.h" #include "GrInvariantOutput.h" #include "GrProcessor.h" -#include "gl/GrGLProcessor.h" +#include "gl/GrGLFragmentProcessor.h" #include "gl/builders/GrGLProgramBuilder.h" namespace { diff --git a/src/gpu/gl/GrGLFragmentProcessor.h b/src/gpu/gl/GrGLFragmentProcessor.h new file mode 100644 index 0000000000..723806feab --- /dev/null +++ b/src/gpu/gl/GrGLFragmentProcessor.h @@ -0,0 +1,67 @@ +/* + * 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 GrGLFragmentProcessor_DEFINED +#define GrGLFragmentProcessor_DEFINED + +#include "GrGLProgramDataManager.h" +#include "GrGLProcessor.h" +#include "GrTextureAccess.h" + +class GrGLFPBuilder; + +class GrGLFragmentProcessor { +public: + GrGLFragmentProcessor() {} + + virtual ~GrGLFragmentProcessor() {} + + typedef GrGLProgramDataManager::UniformHandle UniformHandle; + typedef GrGLProcessor::TransformedCoordsArray TransformedCoordsArray; + typedef GrGLProcessor::TextureSamplerArray TextureSamplerArray; + + /** 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 + stages. + + @param builder Interface used to emit code in the shaders. + @param processor The processor that generated this program stage. + @param key The key that was computed by GenKey() from the generating GrProcessor. + @param outputColor A predefined vec4 in the FS in which the stage should place its output + color (or coverage). + @param inputColor A vec4 that holds the input color to the stage in the FS. This may be + 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 processor to communicate back similar known info about its output. + @param samplers Contains one entry for each GrTextureAccess of the GrProcessor. These + can be passed to the builder to emit texture reads in the generated + code. + TODO this should take a struct + */ + virtual void emitCode(GrGLFPBuilder* builder, + const GrFragmentProcessor&, + const char* outputColor, + const char* inputColor, + const TransformedCoordsArray& coords, + const TextureSamplerArray& samplers) = 0; + + /** A GrGLFragmentProcessor instance can be reused with any GrFragmentProcessor that produces + the same stage key; this function reads data from a GrFragmentProcessor and uploads any + uniform variables required by the shaders created in emitCode(). The GrFragmentProcessor + parameter is guaranteed to be of the same type that created this GrGLFragmentProcessor and + to have an identical processor key as the one that created this GrGLFragmentProcessor. */ + // TODO update this to pass in GrFragmentProcessor + virtual void setData(const GrGLProgramDataManager&, const GrProcessor&) {} + + static void GenKey(const GrProcessor&, const GrGLSLCaps&, GrProcessorKeyBuilder*) {} + +private: + typedef GrGLProcessor INHERITED; +}; + +#endif diff --git a/src/gpu/gl/GrGLGpuProgramCache.cpp b/src/gpu/gl/GrGLGpuProgramCache.cpp index 919e9bbb9f..11e237a73c 100644 --- a/src/gpu/gl/GrGLGpuProgramCache.cpp +++ b/src/gpu/gl/GrGLGpuProgramCache.cpp @@ -9,7 +9,7 @@ #include "builders/GrGLProgramBuilder.h" #include "GrProcessor.h" -#include "GrGLProcessor.h" +#include "GrGLFragmentProcessor.h" #include "GrGLPathRendering.h" #include "SkRTConf.h" #include "SkTSearch.h" diff --git a/src/gpu/gl/GrGLProcessor.h b/src/gpu/gl/GrGLProcessor.h index 017585d306..f99b1c5030 100644 --- a/src/gpu/gl/GrGLProcessor.h +++ b/src/gpu/gl/GrGLProcessor.h @@ -65,56 +65,4 @@ public: typedef SkTArray TextureSamplerArray; }; -class GrGLFPBuilder; - -class GrGLFragmentProcessor { -public: - GrGLFragmentProcessor() {} - - virtual ~GrGLFragmentProcessor() {} - - typedef GrGLProgramDataManager::UniformHandle UniformHandle; - typedef GrGLProcessor::TransformedCoordsArray TransformedCoordsArray; - typedef GrGLProcessor::TextureSamplerArray TextureSamplerArray; - - /** 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 - stages. - - @param builder Interface used to emit code in the shaders. - @param processor The processor that generated this program stage. - @param key The key that was computed by GenKey() from the generating GrProcessor. - @param outputColor A predefined vec4 in the FS in which the stage should place its output - color (or coverage). - @param inputColor A vec4 that holds the input color to the stage in the FS. This may be - 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 processor to communicate back similar known info about its output. - @param samplers Contains one entry for each GrTextureAccess of the GrProcessor. These - can be passed to the builder to emit texture reads in the generated - code. - TODO this should take a struct - */ - virtual void emitCode(GrGLFPBuilder* builder, - const GrFragmentProcessor&, - const char* outputColor, - const char* inputColor, - const TransformedCoordsArray& coords, - const TextureSamplerArray& samplers) = 0; - - /** A GrGLFragmentProcessor instance can be reused with any GrFragmentProcessor that produces - the same stage key; this function reads data from a GrFragmentProcessor and uploads any - uniform variables required by the shaders created in emitCode(). The GrFragmentProcessor - parameter is guaranteed to be of the same type that created this GrGLFragmentProcessor and - to have an identical processor key as the one that created this GrGLFragmentProcessor. */ - // TODO update this to pass in GrFragmentProcessor - virtual void setData(const GrGLProgramDataManager&, const GrProcessor&) {} - - static void GenKey(const GrProcessor&, const GrGLSLCaps&, GrProcessorKeyBuilder*) {} - -private: - typedef GrGLProcessor INHERITED; -}; - #endif diff --git a/src/gpu/gl/GrGLProgramDesc.cpp b/src/gpu/gl/GrGLProgramDesc.cpp index 34cb11463b..7eb4fe1517 100644 --- a/src/gpu/gl/GrGLProgramDesc.cpp +++ b/src/gpu/gl/GrGLProgramDesc.cpp @@ -6,7 +6,7 @@ */ #include "GrGLProgramDesc.h" -#include "GrGLProcessor.h" +#include "GrGLFragmentProcessor.h" #include "GrProcessor.h" #include "GrGLGpu.h" #include "GrPipeline.h" diff --git a/src/gpu/gl/GrGLXferProcessor.h b/src/gpu/gl/GrGLXferProcessor.h index 4b913d5a98..c9c6cb5c41 100644 --- a/src/gpu/gl/GrGLXferProcessor.h +++ b/src/gpu/gl/GrGLXferProcessor.h @@ -8,7 +8,7 @@ #ifndef GrGLXferProcessor_DEFINED #define GrGLXferProcessor_DEFINED -#include "GrGLProcessor.h" +#include "GrGLFragmentProcessor.h" class GrGLXPBuilder; class GrXferProcessor; diff --git a/src/gpu/gl/builders/GrGLShaderBuilder.h b/src/gpu/gl/builders/GrGLShaderBuilder.h index 95337683c6..4a6d2e13d8 100644 --- a/src/gpu/gl/builders/GrGLShaderBuilder.h +++ b/src/gpu/gl/builders/GrGLShaderBuilder.h @@ -9,7 +9,7 @@ #define GrGLShaderBuilder_DEFINED #include "SkTArray.h" -#include "gl/GrGLProcessor.h" +#include "gl/GrGLFragmentProcessor.h" #include "gl/GrGLProgramDesc.h" #include "gl/GrGLProgramDataManager.h" -- cgit v1.2.3