From 6af0c9394301b9f976813cc6dbdbbfe779030fe1 Mon Sep 17 00:00:00 2001 From: wangyix Date: Wed, 22 Jul 2015 10:21:17 -0700 Subject: [PATCH] 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 237949c..55e113e 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 17b17ff..4f0107b 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 2017170..402641c 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 16010b4..bce9a60 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 7025715..92fe4d7 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 99c29f9..205bcdb 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 2f1d011..27509dc 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 b82f6ad..3cac4fc 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 05cbaaa..9939909 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 09a598e..9efd252 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 62b90cb..b5c3700 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 8288a53..116c947 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 88ee5e4..11fdb89 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 cb882b2..9bd66da 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 6f492c7..6a39be4 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 11075f2..86118f7 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 4bfa016..a0350e9 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 4927e29..fa97f32 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 964e85c..bc09156 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 a3d032f..6ecba24 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 f5b5e22..7bb5434 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 7fc65a4..350243e 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 f6fe81b..550823a 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 393a99d..8af5631 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 eb8466b..1638b1f 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 24e7820..87b38ee 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 1b6df12..e7b5235 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 a31e89c..432e6ff 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 c1b2811..8e6243d 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 00067c4..1ebbea8 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 f9de4fa..77c6ce3 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 dd1b480..7e62868 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 0000000..723806f --- /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 919e9bb..11e237a 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 017585d..f99b1c5 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 34cb114..7eb4fe1 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 4b913d5..c9c6cb5 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 9533768..4a6d2e1 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" -- 2.7.4