From 94efbf51f5a88d9e8aa961d3fbe38c5e335d6108 Mon Sep 17 00:00:00 2001 From: Brian Salomon Date: Tue, 29 Nov 2016 13:43:05 -0500 Subject: [PATCH] Merge GrGLSLCaps into GrShaderCaps GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=5121 Change-Id: If8d13638f80f42161cbc766a2666c5789e5772c8 Reviewed-on: https://skia-review.googlesource.com/5121 Reviewed-by: Ethan Nicholas Commit-Queue: Brian Salomon --- bench/GLInstancedArraysBench.cpp | 6 +- bench/GLVec4ScalarBench.cpp | 6 +- bench/GLVertexAttributesBench.cpp | 6 +- .../SkPerlinNoiseShader2.cpp | 12 +- gn/gpu.gni | 10 +- include/gpu/GrCaps.h | 110 +---------------- include/gpu/GrFragmentProcessor.h | 7 +- .../gpu/GrShaderCaps.h | 116 +++++++++++++++--- include/gpu/GrShaderVar.h | 6 +- include/gpu/GrXferProcessor.h | 6 +- include/gpu/effects/GrConstColorProcessor.h | 2 +- {src/gpu/glsl => include/private}/GrGLSL.h | 4 +- .../glsl => include/private}/GrGLSL_impl.h | 0 {src/gpu => include/private}/GrSwizzle.h | 0 src/core/SkColorMatrixFilterRowMajor255.cpp | 4 +- src/core/SkLightingShader.cpp | 5 +- src/core/SkNormalBevelSource.cpp | 5 +- src/core/SkNormalFlatSource.cpp | 5 +- src/core/SkNormalMapSource.cpp | 4 +- src/core/SkRadialShadowMapShader.cpp | 4 +- src/core/SkShadowShader.cpp | 4 +- .../GrAlphaThresholdFragmentProcessor.cpp | 6 +- .../GrAlphaThresholdFragmentProcessor.h | 2 +- src/effects/GrCircleBlurFragmentProcessor.cpp | 2 +- src/effects/GrCircleBlurFragmentProcessor.h | 2 +- src/effects/SkArithmeticMode_gpu.cpp | 11 +- src/effects/SkArithmeticMode_gpu.h | 2 +- src/effects/SkBlurMaskFilter.cpp | 14 +-- src/effects/SkColorCubeFilter.cpp | 8 +- src/effects/SkDisplacementMapEffect.cpp | 8 +- src/effects/SkGaussianEdgeShader.cpp | 5 +- src/effects/SkLightingImageFilter.cpp | 14 +-- src/effects/SkLumaColorFilter.cpp | 4 +- src/effects/SkMagnifierImageFilter.cpp | 6 +- src/effects/SkMorphologyImageFilter.cpp | 10 +- src/effects/SkOverdrawColorFilter.cpp | 2 +- src/effects/SkPerlinNoiseShader.cpp | 6 +- .../SkRRectsGaussianEdgeMaskFilter.cpp | 5 +- src/effects/SkTableColorFilter.cpp | 6 +- src/effects/gradients/SkGradientShader.cpp | 4 +- src/effects/gradients/SkGradientShaderPriv.h | 2 +- src/effects/gradients/SkLinearGradient.cpp | 8 +- src/effects/gradients/SkRadialGradient.cpp | 8 +- src/effects/gradients/SkSweepGradient.cpp | 8 +- .../SkTwoPointConicalGradient_gpu.cpp | 40 +++--- src/gpu/GrCaps.cpp | 77 ------------ src/gpu/GrDefaultGeoProcFactory.cpp | 6 +- src/gpu/GrFragmentProcessor.cpp | 8 +- src/gpu/GrOvalRenderer.cpp | 20 +-- src/gpu/GrPathProcessor.cpp | 8 +- src/gpu/GrPathProcessor.h | 4 +- src/gpu/GrPathRendererChain.cpp | 2 +- src/gpu/GrPrimitiveProcessor.h | 6 +- src/gpu/GrProgramDesc.cpp | 12 +- src/gpu/GrProgramDesc.h | 6 +- src/gpu/GrRenderTargetContext.cpp | 10 +- .../{glsl/GrGLSLCaps.cpp => GrShaderCaps.cpp} | 77 ++++++++++-- src/gpu/GrShaderVar.cpp | 4 +- src/gpu/GrXferProcessor.cpp | 3 +- src/gpu/batches/GrAAConvexPathRenderer.cpp | 6 +- src/gpu/batches/GrAnalyticRectBatch.cpp | 6 +- src/gpu/batches/GrMSAAPathRenderer.cpp | 6 +- src/gpu/batches/GrPLSPathRenderer.cpp | 18 +-- src/gpu/effects/GrBezierEffect.cpp | 26 ++-- src/gpu/effects/GrBezierEffect.h | 12 +- src/gpu/effects/GrBicubicEffect.cpp | 6 +- src/gpu/effects/GrBicubicEffect.h | 2 +- src/gpu/effects/GrBitmapTextGeoProc.cpp | 6 +- src/gpu/effects/GrBitmapTextGeoProc.h | 4 +- src/gpu/effects/GrConfigConversionEffect.cpp | 6 +- src/gpu/effects/GrConfigConversionEffect.h | 2 +- src/gpu/effects/GrConstColorProcessor.cpp | 2 +- src/gpu/effects/GrConvexPolyEffect.cpp | 16 +-- src/gpu/effects/GrConvexPolyEffect.h | 2 +- src/gpu/effects/GrConvolutionEffect.cpp | 8 +- src/gpu/effects/GrConvolutionEffect.h | 2 +- src/gpu/effects/GrCoverageSetOpXP.cpp | 10 +- src/gpu/effects/GrCustomXfermode.cpp | 11 +- src/gpu/effects/GrDashingEffect.cpp | 24 ++-- src/gpu/effects/GrDisableColorXP.cpp | 6 +- src/gpu/effects/GrDistanceFieldGeoProc.cpp | 20 +-- src/gpu/effects/GrDistanceFieldGeoProc.h | 12 +- src/gpu/effects/GrDitherEffect.cpp | 6 +- src/gpu/effects/GrGammaEffect.cpp | 6 +- src/gpu/effects/GrGammaEffect.h | 2 +- src/gpu/effects/GrMatrixConvolutionEffect.cpp | 8 +- src/gpu/effects/GrMatrixConvolutionEffect.h | 2 +- src/gpu/effects/GrOvalEffect.cpp | 20 +-- src/gpu/effects/GrPorterDuffXferProcessor.cpp | 14 +-- src/gpu/effects/GrRRectEffect.cpp | 18 +-- src/gpu/effects/GrShadowGeoProc.cpp | 6 +- src/gpu/effects/GrShadowGeoProc.h | 4 +- src/gpu/effects/GrSimpleTextureEffect.cpp | 4 +- src/gpu/effects/GrSimpleTextureEffect.h | 2 +- src/gpu/effects/GrTextureDomain.cpp | 6 +- src/gpu/effects/GrTextureDomain.h | 6 +- .../effects/GrXfermodeFragmentProcessor.cpp | 4 +- src/gpu/effects/GrYUVEffect.cpp | 4 +- src/gpu/gl/GrGLCaps.cpp | 22 ++-- src/gpu/gl/GrGLCaps.h | 9 +- src/gpu/gl/GrGLGLSL.cpp | 2 +- src/gpu/gl/GrGLGLSL.h | 2 +- src/gpu/gl/GrGLGpu.cpp | 11 +- src/gpu/gl/GrGLTexture.cpp | 2 +- src/gpu/gl/GrGLUniformHandler.cpp | 6 +- src/gpu/gl/builders/GrGLProgramBuilder.cpp | 6 +- src/gpu/gl/builders/GrGLProgramBuilder.h | 3 +- src/gpu/glsl/GrGLSL.cpp | 6 +- src/gpu/glsl/GrGLSLFragmentProcessor.h | 7 +- src/gpu/glsl/GrGLSLFragmentShaderBuilder.cpp | 22 ++-- src/gpu/glsl/GrGLSLPrimitiveProcessor.h | 6 +- src/gpu/glsl/GrGLSLProgramBuilder.cpp | 30 ++--- src/gpu/glsl/GrGLSLProgramBuilder.h | 5 +- src/gpu/glsl/GrGLSLShaderBuilder.cpp | 16 +-- src/gpu/glsl/GrGLSLVarying.cpp | 8 +- src/gpu/glsl/GrGLSLXferProcessor.cpp | 2 +- src/gpu/glsl/GrGLSLXferProcessor.h | 6 +- src/gpu/instanced/InstanceProcessor.cpp | 6 +- src/gpu/instanced/InstanceProcessor.h | 6 +- src/gpu/vk/GrVkCaps.cpp | 8 +- src/gpu/vk/GrVkCaps.h | 4 +- src/gpu/vk/GrVkCopyManager.cpp | 6 +- src/gpu/vk/GrVkPipelineState.cpp | 2 +- src/gpu/vk/GrVkPipelineState.h | 2 +- src/gpu/vk/GrVkPipelineStateBuilder.cpp | 5 +- src/gpu/vk/GrVkPipelineStateBuilder.h | 1 - src/gpu/vk/GrVkUniformHandler.cpp | 4 +- src/sksl/SkSLCompiler.cpp | 6 +- src/sksl/SkSLCompiler.h | 4 +- src/sksl/SkSLGLSLCodeGenerator.h | 6 +- src/sksl/SkSLUtil.h | 34 ++--- tests/EGLImageTest.cpp | 2 +- tests/GLProgramsTest.cpp | 6 +- tests/ImageStorageTest.cpp | 2 +- tests/PrimitiveProcessorTest.cpp | 4 +- tests/SkSLGLSLTest.cpp | 2 +- 136 files changed, 652 insertions(+), 702 deletions(-) rename src/gpu/glsl/GrGLSLCaps.h => include/gpu/GrShaderCaps.h (68%) rename {src/gpu/glsl => include/private}/GrGLSL.h (99%) rename {src/gpu/glsl => include/private}/GrGLSL_impl.h (100%) rename {src/gpu => include/private}/GrSwizzle.h (100%) rename src/gpu/{glsl/GrGLSLCaps.cpp => GrShaderCaps.cpp} (73%) diff --git a/bench/GLInstancedArraysBench.cpp b/bench/GLInstancedArraysBench.cpp index ca20673988..bb2c9e0990 100644 --- a/bench/GLInstancedArraysBench.cpp +++ b/bench/GLInstancedArraysBench.cpp @@ -11,12 +11,12 @@ #if SK_SUPPORT_GPU #include "GLBench.h" +#include "GrShaderCaps.h" #include "GrShaderVar.h" #include "gl/GrGLContext.h" #include "gl/GrGLInterface.h" #include "gl/GrGLUtil.h" -#include "glsl/GrGLSL.h" -#include "glsl/GrGLSLCaps.h" +#include "../private/GrGLSL.h" /* * This is a native GL benchmark for instanced arrays vs vertex buffer objects. To benchmark this @@ -107,7 +107,7 @@ private: /////////////////////////////////////////////////////////////////////////////////////////////////// GrGLuint GLCpuPosInstancedArraysBench::setupShader(const GrGLContext* ctx) { - const GrGLSLCaps* glslCaps = ctx->caps()->glslCaps(); + const GrShaderCaps* glslCaps = ctx->caps()->glslCaps(); const char* version = glslCaps->versionDeclString(); // setup vertex shader diff --git a/bench/GLVec4ScalarBench.cpp b/bench/GLVec4ScalarBench.cpp index 0da0a0dc0e..3b354f798b 100644 --- a/bench/GLVec4ScalarBench.cpp +++ b/bench/GLVec4ScalarBench.cpp @@ -11,12 +11,12 @@ #if SK_SUPPORT_GPU #include "GLBench.h" +#include "GrShaderCaps.h" #include "GrShaderVar.h" #include "gl/GrGLContext.h" #include "gl/GrGLInterface.h" #include "gl/GrGLUtil.h" -#include "glsl/GrGLSL.h" -#include "glsl/GrGLSLCaps.h" +#include "../private/GrGLSL.h" #include @@ -93,7 +93,7 @@ private: /////////////////////////////////////////////////////////////////////////////////////////////////// GrGLuint GLVec4ScalarBench::setupShader(const GrGLContext* ctx) { - const GrGLSLCaps* glslCaps = ctx->caps()->glslCaps(); + const GrShaderCaps* glslCaps = ctx->caps()->glslCaps(); const char* version = glslCaps->versionDeclString(); // this shader draws fNumStages overlapping circles of increasing opacity (coverage) and diff --git a/bench/GLVertexAttributesBench.cpp b/bench/GLVertexAttributesBench.cpp index c588f9b6b8..dfbcebe074 100644 --- a/bench/GLVertexAttributesBench.cpp +++ b/bench/GLVertexAttributesBench.cpp @@ -11,12 +11,12 @@ #if SK_SUPPORT_GPU #include "GLBench.h" +#include "GrShaderCaps.h" #include "GrShaderVar.h" #include "gl/GrGLContext.h" #include "gl/GrGLInterface.h" #include "gl/GrGLUtil.h" -#include "glsl/GrGLSL.h" -#include "glsl/GrGLSLCaps.h" +#include "../private/GrGLSL.h" #include /* @@ -65,7 +65,7 @@ private: GrGLuint GLVertexAttributesBench::setupShader(const GrGLContext* ctx, uint32_t attribs, uint32_t maxAttribs) { - const GrGLSLCaps* glslCaps = ctx->caps()->glslCaps(); + const GrShaderCaps* glslCaps = ctx->caps()->glslCaps(); const char* version = glslCaps->versionDeclString(); // setup vertex shader diff --git a/experimental/SkPerlinNoiseShader2/SkPerlinNoiseShader2.cpp b/experimental/SkPerlinNoiseShader2/SkPerlinNoiseShader2.cpp index 1dcd8de888..f3040673fc 100644 --- a/experimental/SkPerlinNoiseShader2/SkPerlinNoiseShader2.cpp +++ b/experimental/SkPerlinNoiseShader2/SkPerlinNoiseShader2.cpp @@ -614,7 +614,7 @@ class GrGLPerlinNoise2 : public GrGLSLFragmentProcessor { public: void emitCode(EmitArgs&) override; - static inline void GenKey(const GrProcessor&, const GrGLSLCaps&, GrProcessorKeyBuilder* b); + static inline void GenKey(const GrProcessor&, const GrShaderCaps&, GrProcessorKeyBuilder* b); protected: void onSetData(const GrGLSLProgramDataManager&, const GrProcessor&) override; @@ -657,7 +657,7 @@ private: return new GrGLPerlinNoise2; } - virtual void onGetGLSLProcessorKey(const GrGLSLCaps& caps, + virtual void onGetGLSLProcessorKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const override { GrGLPerlinNoise2::GenKey(*this, caps, b); } @@ -983,7 +983,7 @@ void GrGLPerlinNoise2::emitCode(EmitArgs& args) { args.fOutputColor, args.fOutputColor); } -void GrGLPerlinNoise2::GenKey(const GrProcessor& processor, const GrGLSLCaps&, +void GrGLPerlinNoise2::GenKey(const GrProcessor& processor, const GrShaderCaps&, GrProcessorKeyBuilder* b) { const GrPerlinNoise2Effect& turbulence = processor.cast(); @@ -1032,7 +1032,7 @@ class GrGLImprovedPerlinNoise : public GrGLSLFragmentProcessor { public: void emitCode(EmitArgs&) override; - static inline void GenKey(const GrProcessor&, const GrGLSLCaps&, GrProcessorKeyBuilder*); + static inline void GenKey(const GrProcessor&, const GrShaderCaps&, GrProcessorKeyBuilder*); protected: void onSetData(const GrGLSLProgramDataManager&, const GrProcessor&) override; @@ -1073,7 +1073,7 @@ private: return new GrGLImprovedPerlinNoise; } - void onGetGLSLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) const override { + void onGetGLSLProcessorKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const override { GrGLImprovedPerlinNoise::GenKey(*this, caps, b); } @@ -1278,7 +1278,7 @@ void GrGLImprovedPerlinNoise::emitCode(EmitArgs& args) { args.fOutputColor, args.fOutputColor); } -void GrGLImprovedPerlinNoise::GenKey(const GrProcessor& processor, const GrGLSLCaps&, +void GrGLImprovedPerlinNoise::GenKey(const GrProcessor& processor, const GrShaderCaps&, GrProcessorKeyBuilder* b) { } diff --git a/gn/gpu.gni b/gn/gpu.gni index e3b02b8bcb..439443eee6 100644 --- a/gn/gpu.gni +++ b/gn/gpu.gni @@ -29,6 +29,7 @@ skia_gpu_sources = [ "$_include/gpu/GrRenderTarget.h", "$_include/gpu/GrRenderTargetContext.h", "$_include/gpu/GrResourceKey.h", + "$_include/gpu/GrShaderCaps.h", "$_include/gpu/GrShaderVar.h", "$_include/gpu/GrSurface.h", "$_include/gpu/GrSurfaceContext.h", @@ -57,10 +58,13 @@ skia_gpu_sources = [ # Private includes "$_include/private/GrAuditTrail.h", + "$_include/private/GrGLSL.h", + "$_include/private/GrGLSL_impl.h", "$_include/private/GrInstancedPipelineInfo.h", "$_include/private/GrSingleOwner.h", "$_include/private/GrRenderTargetProxy.h", "$_include/private/GrSurfaceProxy.h", + "$_include/private/GrSwizzle.h", "$_include/private/GrTextureProxy.h", "$_include/private/GrTextureRenderTargetProxy.h", "$_include/private/GrTextureStripAtlas.h", @@ -173,6 +177,7 @@ skia_gpu_sources = [ "$_src/gpu/GrResourceProvider.cpp", "$_src/gpu/GrResourceProvider.h", "$_src/gpu/GrScissorState.h", + "$_src/gpu/GrShaderCaps.cpp", "$_src/gpu/GrShape.cpp", "$_src/gpu/GrShape.h", "$_src/gpu/GrStencilAttachment.cpp", @@ -198,7 +203,6 @@ skia_gpu_sources = [ "$_src/gpu/GrSurface.cpp", "$_src/gpu/GrSurfaceContext.cpp", "$_src/gpu/GrSurfaceProxy.cpp", - "$_src/gpu/GrSwizzle.h", "$_src/gpu/GrTexture.cpp", "$_src/gpu/GrTextureAdjuster.cpp", "$_src/gpu/GrTextureAdjuster.h", @@ -413,12 +417,8 @@ skia_gpu_sources = [ # GLSL "$_src/gpu/glsl/GrGLSL.cpp", - "$_src/gpu/glsl/GrGLSL.h", - "$_src/gpu/glsl/GrGLSL_impl.h", "$_src/gpu/glsl/GrGLSLBlend.cpp", "$_src/gpu/glsl/GrGLSLBlend.h", - "$_src/gpu/glsl/GrGLSLCaps.cpp", - "$_src/gpu/glsl/GrGLSLCaps.h", "$_src/gpu/glsl/GrGLSLColorSpaceXformHelper.h", "$_src/gpu/glsl/GrGLSLFragmentProcessor.cpp", "$_src/gpu/glsl/GrGLSLFragmentProcessor.h", diff --git a/include/gpu/GrCaps.h b/include/gpu/GrCaps.h index 60d0c70543..16a4ca9747 100644 --- a/include/gpu/GrCaps.h +++ b/include/gpu/GrCaps.h @@ -12,118 +12,12 @@ #include "GrTypesPriv.h" #include "GrBlend.h" #include "GrShaderVar.h" +#include "GrShaderCaps.h" #include "SkRefCnt.h" #include "SkString.h" struct GrContextOptions; -class GrShaderCaps : public SkRefCnt { -public: - /** Info about shader variable precision within a given shader stage. That is, this info - is relevant to a float (or vecNf) variable declared with a GrSLPrecision - in a given GrShaderType. The info here is hoisted from the OpenGL spec. */ - struct PrecisionInfo { - PrecisionInfo() { - fLogRangeLow = 0; - fLogRangeHigh = 0; - fBits = 0; - } - - /** Is this precision level allowed in the shader stage? */ - bool supported() const { return 0 != fBits; } - - bool operator==(const PrecisionInfo& that) const { - return fLogRangeLow == that.fLogRangeLow && fLogRangeHigh == that.fLogRangeHigh && - fBits == that.fBits; - } - bool operator!=(const PrecisionInfo& that) const { return !(*this == that); } - - /** floor(log2(|min_value|)) */ - int fLogRangeLow; - /** floor(log2(|max_value|)) */ - int fLogRangeHigh; - /** Number of bits of precision. As defined in OpenGL (with names modified to reflect this - struct) : - """ - If the smallest representable value greater than 1 is 1 + e, then fBits will - contain floor(log2(e)), and every value in the range [2^fLogRangeLow, - 2^fLogRangeHigh] can be represented to at least one part in 2^fBits. - """ - */ - int fBits; - }; - - GrShaderCaps(); - - virtual SkString dump() const; - - bool shaderDerivativeSupport() const { return fShaderDerivativeSupport; } - bool geometryShaderSupport() const { return fGeometryShaderSupport; } - bool pathRenderingSupport() const { return fPathRenderingSupport; } - bool dstReadInShaderSupport() const { return fDstReadInShaderSupport; } - bool dualSourceBlendingSupport() const { return fDualSourceBlendingSupport; } - bool integerSupport() const { return fIntegerSupport; } - bool texelBufferSupport() const { return fTexelBufferSupport; } - int imageLoadStoreSupport() const { return fImageLoadStoreSupport; } - - /** - * Get the precision info for a variable of type kFloat_GrSLType, kVec2f_GrSLType, etc in a - * given shader type. If the shader type is not supported or the precision level is not - * supported in that shader type then the returned struct will report false when supported() is - * called. - */ - const PrecisionInfo& getFloatShaderPrecisionInfo(GrShaderType shaderType, - GrSLPrecision precision) const { - return fFloatPrecisions[shaderType][precision]; - } - - /** - * Is there any difference between the float shader variable precision types? If this is true - * then unless the shader type is not supported, any call to getFloatShaderPrecisionInfo() would - * report the same info for all precisions in all shader types. - */ - bool floatPrecisionVaries() const { return fShaderPrecisionVaries; } - - /** - * PLS storage size in bytes (0 when not supported). The PLS spec defines a minimum size of 16 - * bytes whenever PLS is supported. - */ - int pixelLocalStorageSize() const { return fPixelLocalStorageSize; } - - /** - * True if this context supports the necessary extensions and features to enable the PLS path - * renderer. - */ - bool plsPathRenderingSupport() const { -#if GR_ENABLE_PLS_PATH_RENDERING - return fPLSPathRenderingSupport; -#else - return false; -#endif - } - -protected: - /** Subclasses must call this after initialization in order to apply caps overrides requested by - the client. Note that overrides will only reduce the caps never expand them. */ - void applyOptionsOverrides(const GrContextOptions& options); - - bool fShaderDerivativeSupport : 1; - bool fGeometryShaderSupport : 1; - bool fPathRenderingSupport : 1; - bool fDstReadInShaderSupport : 1; - bool fDualSourceBlendingSupport : 1; - bool fIntegerSupport : 1; - bool fTexelBufferSupport : 1; - bool fImageLoadStoreSupport : 1; - bool fPLSPathRenderingSupport : 1; - bool fShaderPrecisionVaries : 1; - PrecisionInfo fFloatPrecisions[kGrShaderTypeCount][kGrSLPrecisionCount]; - int fPixelLocalStorageSize; - -private: - virtual void onApplyOptionsOverrides(const GrContextOptions&) {} - typedef SkRefCnt INHERITED; -}; /** * Represents the capabilities of a GrContext. @@ -134,7 +28,7 @@ public: virtual SkString dump() const; - GrShaderCaps* shaderCaps() const { return fShaderCaps.get(); } + const GrShaderCaps* shaderCaps() const { return fShaderCaps.get(); } bool npotTextureTileSupport() const { return fNPOTTextureTileSupport; } /** To avoid as-yet-unnecessary complexity we don't allow any partial support of MIP Maps (e.g. diff --git a/include/gpu/GrFragmentProcessor.h b/include/gpu/GrFragmentProcessor.h index 30e92f6e8d..49ccceabae 100644 --- a/include/gpu/GrFragmentProcessor.h +++ b/include/gpu/GrFragmentProcessor.h @@ -11,11 +11,11 @@ #include "GrProcessor.h" class GrCoordTransform; -class GrGLSLCaps; class GrGLSLFragmentProcessor; class GrInvariantOutput; class GrPipeline; class GrProcessorKeyBuilder; +class GrShaderCaps; /** Provides custom fragment shader code. Fragment processors receive an input color (vec4f) and produce an output color. They may reference textures and uniforms. They may use @@ -73,7 +73,7 @@ public: GrGLSLFragmentProcessor* createGLSLInstance() const; - void getGLSLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) const { + void getGLSLProcessorKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const { this->onGetGLSLProcessorKey(caps, b); for (int i = 0; i < fChildProcessors.count(); ++i) { fChildProcessors[i]->getGLSLProcessorKey(caps, b); @@ -241,8 +241,7 @@ private: virtual GrGLSLFragmentProcessor* onCreateGLSLInstance() const = 0; /** Implemented using GLFragmentProcessor::GenKey as described in this class's comment. */ - virtual void onGetGLSLProcessorKey(const GrGLSLCaps& caps, - GrProcessorKeyBuilder* b) const = 0; + virtual void onGetGLSLProcessorKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const = 0; /** * Subclass implements this to support isEqual(). It will only be called if it is known that diff --git a/src/gpu/glsl/GrGLSLCaps.h b/include/gpu/GrShaderCaps.h similarity index 68% rename from src/gpu/glsl/GrGLSLCaps.h rename to include/gpu/GrShaderCaps.h index 11ce754527..ec5d7efd48 100644 --- a/src/gpu/glsl/GrGLSLCaps.h +++ b/include/gpu/GrShaderCaps.h @@ -6,19 +6,53 @@ */ -#ifndef GrGLSLCaps_DEFINED -#define GrGLSLCaps_DEFINED +#ifndef GrShaderCaps_DEFINED +#define GrShaderCaps_DEFINED -#include "GrCaps.h" -#include "GrGLSL.h" -#include "GrSwizzle.h" +#include "../private/GrSwizzle.h" +#include "../private/GrGLSL.h" namespace SkSL { class GLSLCapsFactory; } +struct GrContextOptions; -class GrGLSLCaps : public GrShaderCaps { +class GrShaderCaps : public SkRefCnt { public: + /** Info about shader variable precision within a given shader stage. That is, this info + is relevant to a float (or vecNf) variable declared with a GrSLPrecision + in a given GrShaderType. The info here is hoisted from the OpenGL spec. */ + struct PrecisionInfo { + PrecisionInfo() { + fLogRangeLow = 0; + fLogRangeHigh = 0; + fBits = 0; + } + + /** Is this precision level allowed in the shader stage? */ + bool supported() const { return 0 != fBits; } + + bool operator==(const PrecisionInfo& that) const { + return fLogRangeLow == that.fLogRangeLow && fLogRangeHigh == that.fLogRangeHigh && + fBits == that.fBits; + } + bool operator!=(const PrecisionInfo& that) const { return !(*this == that); } + + /** floor(log2(|min_value|)) */ + int fLogRangeLow; + /** floor(log2(|max_value|)) */ + int fLogRangeHigh; + /** Number of bits of precision. As defined in OpenGL (with names modified to reflect this + struct) : + """ + If the smallest representable value greater than 1 is 1 + e, then fBits will + contain floor(log2(e)), and every value in the range [2^fLogRangeLow, + 2^fLogRangeHigh] can be represented to at least one part in 2^fBits. + """ + */ + int fBits; + }; + /** * Indicates how GLSL must interact with advanced blend equations. The KHR extension requires * special layout qualifiers in the fragment shader. @@ -32,10 +66,54 @@ public: kLast_AdvBlendEqInteraction = kSpecificEnables_AdvBlendEqInteraction }; + GrShaderCaps(const GrContextOptions&); + + SkString dump() const; + + bool shaderDerivativeSupport() const { return fShaderDerivativeSupport; } + bool geometryShaderSupport() const { return fGeometryShaderSupport; } + bool pathRenderingSupport() const { return fPathRenderingSupport; } + bool dstReadInShaderSupport() const { return fDstReadInShaderSupport; } + bool dualSourceBlendingSupport() const { return fDualSourceBlendingSupport; } + bool integerSupport() const { return fIntegerSupport; } + bool texelBufferSupport() const { return fTexelBufferSupport; } + int imageLoadStoreSupport() const { return fImageLoadStoreSupport; } + + /** + * Get the precision info for a variable of type kFloat_GrSLType, kVec2f_GrSLType, etc in a + * given shader type. If the shader type is not supported or the precision level is not + * supported in that shader type then the returned struct will report false when supported() is + * called. + */ + const PrecisionInfo& getFloatShaderPrecisionInfo(GrShaderType shaderType, + GrSLPrecision precision) const { + return fFloatPrecisions[shaderType][precision]; + } + + /** + * Is there any difference between the float shader variable precision types? If this is true + * then unless the shader type is not supported, any call to getFloatShaderPrecisionInfo() would + * report the same info for all precisions in all shader types. + */ + bool floatPrecisionVaries() const { return fShaderPrecisionVaries; } + + /** + * PLS storage size in bytes (0 when not supported). The PLS spec defines a minimum size of 16 + * bytes whenever PLS is supported. + */ + int pixelLocalStorageSize() const { return fPixelLocalStorageSize; } + /** - * Initializes the GrGLSLCaps to a default set of features + * True if this context supports the necessary extensions and features to enable the PLS path + * renderer. */ - GrGLSLCaps(const GrContextOptions&); + bool plsPathRenderingSupport() const { +#if GR_ENABLE_PLS_PATH_RENDERING + return fPLSPathRenderingSupport; +#else + return false; +#endif + } /** * Some helper functions for encapsulating various extensions to read FB Buffer on openglES @@ -186,19 +264,24 @@ public: GrGLSLGeneration generation() const { return fGLSLGeneration; } - /** - * Returns a string containing the caps info. - */ - SkString dump() const override; - private: /** GrCaps subclasses must call this after filling in the shader precision table. */ void initSamplerPrecisionTable(); - void onApplyOptionsOverrides(const GrContextOptions& options) override; + void applyOptionsOverrides(const GrContextOptions& options); GrGLSLGeneration fGLSLGeneration; + bool fShaderDerivativeSupport : 1; + bool fGeometryShaderSupport : 1; + bool fPathRenderingSupport : 1; + bool fDstReadInShaderSupport : 1; + bool fDualSourceBlendingSupport : 1; + bool fIntegerSupport : 1; + bool fTexelBufferSupport : 1; + bool fImageLoadStoreSupport : 1; + bool fPLSPathRenderingSupport : 1; + bool fShaderPrecisionVaries : 1; bool fDropsTileOnZeroDivide : 1; bool fFBFetchSupport : 1; bool fFBFetchNeedsCustomOutput : 1; @@ -218,6 +301,9 @@ private: bool fMustForceNegatedAtanParamToFloat : 1; bool fRequiresLocalOutputColorForFBFetch : 1; + PrecisionInfo fFloatPrecisions[kGrShaderTypeCount][kGrSLPrecisionCount]; + int fPixelLocalStorageSize; + const char* fVersionDeclString; const char* fShaderDerivativeExtensionString; @@ -253,8 +339,6 @@ private: friend class GrGLCaps; // For initialization. friend class GrVkCaps; friend class SkSL::GLSLCapsFactory; - - typedef GrShaderCaps INHERITED; }; #endif diff --git a/include/gpu/GrShaderVar.h b/include/gpu/GrShaderVar.h index 1149f84cce..7f09f8cbf7 100644 --- a/include/gpu/GrShaderVar.h +++ b/include/gpu/GrShaderVar.h @@ -11,7 +11,7 @@ #include "SkString.h" #include "GrTypesPriv.h" -class GrGLSLCaps; +class GrShaderCaps; #define USE_UNIFORM_FLOAT_ARRAYS true @@ -301,7 +301,7 @@ public: /** * Write a declaration of this variable to out. */ - void appendDecl(const GrGLSLCaps* glslCaps, SkString* out) const; + void appendDecl(const GrShaderCaps*, SkString* out) const; void appendArrayAccess(int index, SkString* out) const { out->appendf("%s[%d]%s", @@ -331,4 +331,4 @@ private: SkString fExtraModifiers; }; - #endif +#endif diff --git a/include/gpu/GrXferProcessor.h b/include/gpu/GrXferProcessor.h index 1e94400f67..685c266cd9 100644 --- a/include/gpu/GrXferProcessor.h +++ b/include/gpu/GrXferProcessor.h @@ -15,7 +15,6 @@ #include "GrTypes.h" class GrShaderCaps; -class GrGLSLCaps; class GrGLSLXferProcessor; class GrProcOptInfo; struct GrPipelineOptimizations; @@ -94,7 +93,7 @@ public: * Sets a unique key on the GrProcessorKeyBuilder calls onGetGLSLProcessorKey(...) to get the * specific subclass's key. */ - void getGLSLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) const; + void getGLSLProcessorKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const; /** Returns a new instance of the appropriate *GL* implementation class for the given GrXferProcessor; caller is responsible for deleting @@ -245,8 +244,7 @@ private: * Sets a unique key on the GrProcessorKeyBuilder that is directly associated with this xfer * processor's GL backend implementation. */ - virtual void onGetGLSLProcessorKey(const GrGLSLCaps& caps, - GrProcessorKeyBuilder* b) const = 0; + virtual void onGetGLSLProcessorKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const = 0; /** * Determines the type of barrier (if any) required by the subclass. Note that the possibility diff --git a/include/gpu/effects/GrConstColorProcessor.h b/include/gpu/effects/GrConstColorProcessor.h index 1d23fc349e..73ea9eb196 100644 --- a/include/gpu/effects/GrConstColorProcessor.h +++ b/include/gpu/effects/GrConstColorProcessor.h @@ -49,7 +49,7 @@ private: GrGLSLFragmentProcessor* onCreateGLSLInstance() const override; - void onGetGLSLProcessorKey(const GrGLSLCaps&, GrProcessorKeyBuilder*) const override; + void onGetGLSLProcessorKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override; bool onIsEqual(const GrFragmentProcessor&) const override; diff --git a/src/gpu/glsl/GrGLSL.h b/include/private/GrGLSL.h similarity index 99% rename from src/gpu/glsl/GrGLSL.h rename to include/private/GrGLSL.h index 417f6d78d2..6d9e403cfe 100644 --- a/src/gpu/glsl/GrGLSL.h +++ b/include/private/GrGLSL.h @@ -11,7 +11,7 @@ #include "GrTypesPriv.h" #include "SkString.h" -class GrGLSLCaps; +class GrShaderCaps; // Limited set of GLSL versions we build shaders for. Caller should round // down the GLSL version to one of these enums. @@ -60,7 +60,7 @@ bool GrGLSLSupportsNamedFragmentShaderOutputs(GrGLSLGeneration); * Adds a line of GLSL code to declare the default precision for float types. */ void GrGLSLAppendDefaultFloatPrecisionDeclaration(GrSLPrecision, - const GrGLSLCaps& glslCaps, + const GrShaderCaps&, SkString* out); /** diff --git a/src/gpu/glsl/GrGLSL_impl.h b/include/private/GrGLSL_impl.h similarity index 100% rename from src/gpu/glsl/GrGLSL_impl.h rename to include/private/GrGLSL_impl.h diff --git a/src/gpu/GrSwizzle.h b/include/private/GrSwizzle.h similarity index 100% rename from src/gpu/GrSwizzle.h rename to include/private/GrSwizzle.h diff --git a/src/core/SkColorMatrixFilterRowMajor255.cpp b/src/core/SkColorMatrixFilterRowMajor255.cpp index c234025e82..e17f73a561 100644 --- a/src/core/SkColorMatrixFilterRowMajor255.cpp +++ b/src/core/SkColorMatrixFilterRowMajor255.cpp @@ -289,7 +289,7 @@ public: class GLSLProcessor : public GrGLSLFragmentProcessor { public: // this class always generates the same code. - static void GenKey(const GrProcessor&, const GrGLSLCaps&, GrProcessorKeyBuilder*) {} + static void GenKey(const GrProcessor&, const GrShaderCaps&, GrProcessorKeyBuilder*) {} void emitCode(EmitArgs& args) override { GrGLSLUniformHandler* uniformHandler = args.fUniformHandler; @@ -356,7 +356,7 @@ private: return new GLSLProcessor; } - virtual void onGetGLSLProcessorKey(const GrGLSLCaps& caps, + virtual void onGetGLSLProcessorKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const override { GLSLProcessor::GenKey(*this, caps, b); } diff --git a/src/core/SkLightingShader.cpp b/src/core/SkLightingShader.cpp index 51549f59a0..bb2828a13e 100644 --- a/src/core/SkLightingShader.cpp +++ b/src/core/SkLightingShader.cpp @@ -199,8 +199,7 @@ public: "diffuseColor.a);", args.fOutputColor); } - static void GenKey(const GrProcessor& proc, const GrGLSLCaps&, - GrProcessorKeyBuilder* b) { + static void GenKey(const GrProcessor& proc, const GrShaderCaps&, GrProcessorKeyBuilder* b) { const LightingFP& lightingFP = proc.cast(); b->add32(lightingFP.fDirectionalLights.count()); } @@ -240,7 +239,7 @@ public: GrGLSLProgramDataManager::UniformHandle fAmbientColorUni; }; - void onGetGLSLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) const override { + void onGetGLSLProcessorKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const override { GLSLLightingFP::GenKey(*this, caps, b); } diff --git a/src/core/SkNormalBevelSource.cpp b/src/core/SkNormalBevelSource.cpp index 4a08728a98..86206b3f4e 100644 --- a/src/core/SkNormalBevelSource.cpp +++ b/src/core/SkNormalBevelSource.cpp @@ -104,8 +104,7 @@ public: fragBuilder->codeAppendf("%s = vec4(normal, 0.0);", args.fOutputColor); } - static void GenKey(const GrProcessor& proc, const GrGLSLCaps&, - GrProcessorKeyBuilder* b) { + static void GenKey(const GrProcessor& proc, const GrShaderCaps&, GrProcessorKeyBuilder* b) { const NormalBevelFP& fp = proc.cast(); b->add32(static_cast(fp.fBevelType)); } @@ -217,7 +216,7 @@ public: GrGLSLProgramDataManager::UniformHandle fNormalizedHeightUni; }; - void onGetGLSLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) const override { + void onGetGLSLProcessorKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const override { GLSLNormalBevelFP::GenKey(*this, caps, b); } diff --git a/src/core/SkNormalFlatSource.cpp b/src/core/SkNormalFlatSource.cpp index c30cca14d1..4ecd86174f 100644 --- a/src/core/SkNormalFlatSource.cpp +++ b/src/core/SkNormalFlatSource.cpp @@ -34,8 +34,7 @@ public: fragBuilder->codeAppendf("%s = vec4(0, 0, 1, 0);", args.fOutputColor); } - static void GenKey(const GrProcessor& proc, const GrGLSLCaps&, - GrProcessorKeyBuilder* b) { + static void GenKey(const GrProcessor& proc, const GrShaderCaps&, GrProcessorKeyBuilder* b) { b->add32(0x0); } @@ -44,7 +43,7 @@ public: const GrProcessor& proc) override {} }; - void onGetGLSLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) const override { + void onGetGLSLProcessorKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const override { GLSLNormalFlatFP::GenKey(*this, caps, b); } diff --git a/src/core/SkNormalMapSource.cpp b/src/core/SkNormalMapSource.cpp index 70d6c4300e..04f6d5a651 100644 --- a/src/core/SkNormalMapSource.cpp +++ b/src/core/SkNormalMapSource.cpp @@ -73,7 +73,7 @@ public: fragBuilder->codeAppend( "}"); } - static void GenKey(const GrProcessor&, const GrGLSLCaps&, GrProcessorKeyBuilder* b) { + static void GenKey(const GrProcessor&, const GrShaderCaps&, GrProcessorKeyBuilder* b) { b->add32(0x0); } @@ -96,7 +96,7 @@ public: GrGLSLProgramDataManager::UniformHandle fXformUni; }; - void onGetGLSLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) const override { + void onGetGLSLProcessorKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const override { GLSLNormalMapFP::GenKey(*this, caps, b); } diff --git a/src/core/SkRadialShadowMapShader.cpp b/src/core/SkRadialShadowMapShader.cpp index 29773a63b5..b56d61e19d 100644 --- a/src/core/SkRadialShadowMapShader.cpp +++ b/src/core/SkRadialShadowMapShader.cpp @@ -176,7 +176,7 @@ public: fragBuilder->codeAppendf("%s = vec4(vec3(closestDistHere / 2.0),1);", args.fOutputColor); } - static void GenKey(const GrProcessor& proc, const GrGLSLCaps&, + static void GenKey(const GrProcessor& proc, const GrShaderCaps&, GrProcessorKeyBuilder* b) { b->add32(0); // nothing to add here } @@ -213,7 +213,7 @@ public: GrGLSLProgramDataManager::UniformHandle fHeightUni; }; - void onGetGLSLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) const override { + void onGetGLSLProcessorKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const override { GLSLRadialShadowMapFP::GenKey(*this, caps, b); } diff --git a/src/core/SkShadowShader.cpp b/src/core/SkShadowShader.cpp index 2d67ecb13b..80794daab8 100644 --- a/src/core/SkShadowShader.cpp +++ b/src/core/SkShadowShader.cpp @@ -448,7 +448,7 @@ public: } - static void GenKey(const GrProcessor& proc, const GrGLSLCaps&, + static void GenKey(const GrProcessor& proc, const GrShaderCaps&, GrProcessorKeyBuilder* b) { const ShadowFP& shadowFP = proc.cast(); b->add32(shadowFP.fNumNonAmbLights); @@ -552,7 +552,7 @@ public: GrGLSLProgramDataManager::UniformHandle fAmbientColorUni; }; - void onGetGLSLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) const override { + void onGetGLSLProcessorKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const override { GLSLShadowFP::GenKey(*this, caps, b); } diff --git a/src/effects/GrAlphaThresholdFragmentProcessor.cpp b/src/effects/GrAlphaThresholdFragmentProcessor.cpp index ed633b0294..afafe08279 100644 --- a/src/effects/GrAlphaThresholdFragmentProcessor.cpp +++ b/src/effects/GrAlphaThresholdFragmentProcessor.cpp @@ -12,11 +12,11 @@ #include "GrInvariantOutput.h" #include "SkRefCnt.h" -#include "glsl/GrGLSL.h" #include "glsl/GrGLSLColorSpaceXformHelper.h" #include "glsl/GrGLSLFragmentProcessor.h" #include "glsl/GrGLSLFragmentShaderBuilder.h" #include "glsl/GrGLSLUniformHandler.h" +#include "../private/GrGLSL.h" sk_sp GrAlphaThresholdFragmentProcessor::Make( GrTexture* texture, @@ -85,7 +85,7 @@ class GrGLAlphaThresholdFragmentProcessor : public GrGLSLFragmentProcessor { public: void emitCode(EmitArgs&) override; - static inline void GenKey(const GrProcessor& effect, const GrGLSLCaps&, + static inline void GenKey(const GrProcessor& effect, const GrShaderCaps&, GrProcessorKeyBuilder* b) { const GrAlphaThresholdFragmentProcessor& atfp = effect.cast(); @@ -187,7 +187,7 @@ sk_sp GrAlphaThresholdFragmentProcessor::TestCreate(GrProce /////////////////////////////////////////////////////////////////////////////// -void GrAlphaThresholdFragmentProcessor::onGetGLSLProcessorKey(const GrGLSLCaps& caps, +void GrAlphaThresholdFragmentProcessor::onGetGLSLProcessorKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const { GrGLAlphaThresholdFragmentProcessor::GenKey(*this, caps, b); } diff --git a/src/effects/GrAlphaThresholdFragmentProcessor.h b/src/effects/GrAlphaThresholdFragmentProcessor.h index 9805a22128..f7a2491aee 100644 --- a/src/effects/GrAlphaThresholdFragmentProcessor.h +++ b/src/effects/GrAlphaThresholdFragmentProcessor.h @@ -44,7 +44,7 @@ private: GrGLSLFragmentProcessor* onCreateGLSLInstance() const override; - void onGetGLSLProcessorKey(const GrGLSLCaps&, GrProcessorKeyBuilder*) const override; + void onGetGLSLProcessorKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override; bool onIsEqual(const GrFragmentProcessor&) const override; diff --git a/src/effects/GrCircleBlurFragmentProcessor.cpp b/src/effects/GrCircleBlurFragmentProcessor.cpp index 8afd009e85..329529dbbd 100644 --- a/src/effects/GrCircleBlurFragmentProcessor.cpp +++ b/src/effects/GrCircleBlurFragmentProcessor.cpp @@ -102,7 +102,7 @@ GrGLSLFragmentProcessor* GrCircleBlurFragmentProcessor::onCreateGLSLInstance() c return new GLSLProcessor; } -void GrCircleBlurFragmentProcessor::onGetGLSLProcessorKey(const GrGLSLCaps& caps, +void GrCircleBlurFragmentProcessor::onGetGLSLProcessorKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const { // The code for this processor is always the same so there is nothing to add to the key. return; diff --git a/src/effects/GrCircleBlurFragmentProcessor.h b/src/effects/GrCircleBlurFragmentProcessor.h index 73e5d04b05..4e7ed13020 100644 --- a/src/effects/GrCircleBlurFragmentProcessor.h +++ b/src/effects/GrCircleBlurFragmentProcessor.h @@ -51,7 +51,7 @@ private: GrGLSLFragmentProcessor* onCreateGLSLInstance() const override; - void onGetGLSLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) const override; + void onGetGLSLProcessorKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const override; bool onIsEqual(const GrFragmentProcessor& other) const override { const GrCircleBlurFragmentProcessor& cbfp = other.cast(); diff --git a/src/effects/SkArithmeticMode_gpu.cpp b/src/effects/SkArithmeticMode_gpu.cpp index d20ebbe42b..f9a443d235 100644 --- a/src/effects/SkArithmeticMode_gpu.cpp +++ b/src/effects/SkArithmeticMode_gpu.cpp @@ -64,7 +64,7 @@ public: arith.enforcePMColor()); } - static void GenKey(const GrProcessor& proc, const GrGLSLCaps&, GrProcessorKeyBuilder* b) { + static void GenKey(const GrProcessor& proc, const GrShaderCaps&, GrProcessorKeyBuilder* b) { const GrArithmeticFP& arith = proc.cast(); uint32_t key = arith.enforcePMColor() ? 1 : 0; b->add32(key); @@ -94,7 +94,8 @@ GrArithmeticFP::GrArithmeticFP(float k1, float k2, float k3, float k4, bool enfo SkASSERT(0 == dstIndex); } -void GrArithmeticFP::onGetGLSLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) const { +void GrArithmeticFP::onGetGLSLProcessorKey(const GrShaderCaps& caps, + GrProcessorKeyBuilder* b) const { GLArithmeticFP::GenKey(*this, caps, b); } @@ -156,7 +157,7 @@ private: GrColor* overrideColor, const GrCaps& caps) const override; - void onGetGLSLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) const override; + void onGetGLSLProcessorKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const override; bool onIsEqual(const GrXferProcessor& xpBase) const override { const ArithmeticXP& xp = xpBase.cast(); @@ -186,7 +187,7 @@ public: ~GLArithmeticXP() override {} - static void GenKey(const GrProcessor& processor, const GrGLSLCaps& caps, + static void GenKey(const GrProcessor& processor, const GrShaderCaps& caps, GrProcessorKeyBuilder* b) { const ArithmeticXP& arith = processor.cast(); uint32_t key = arith.enforcePMColor() ? 1 : 0; @@ -240,7 +241,7 @@ ArithmeticXP::ArithmeticXP(const DstTexture* dstTexture, bool hasMixedSamples, this->initClassID(); } -void ArithmeticXP::onGetGLSLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) const { +void ArithmeticXP::onGetGLSLProcessorKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const { GLArithmeticXP::GenKey(*this, caps, b); } diff --git a/src/effects/SkArithmeticMode_gpu.h b/src/effects/SkArithmeticMode_gpu.h index 28351fc5b5..8effc8a82d 100644 --- a/src/effects/SkArithmeticMode_gpu.h +++ b/src/effects/SkArithmeticMode_gpu.h @@ -55,7 +55,7 @@ public: private: GrGLSLFragmentProcessor* onCreateGLSLInstance() const override; - void onGetGLSLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) const override; + void onGetGLSLProcessorKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const override; bool onIsEqual(const GrFragmentProcessor&) const override; diff --git a/src/effects/SkBlurMaskFilter.cpp b/src/effects/SkBlurMaskFilter.cpp index b237b14b2f..dc8e26945c 100644 --- a/src/effects/SkBlurMaskFilter.cpp +++ b/src/effects/SkBlurMaskFilter.cpp @@ -22,9 +22,9 @@ #include "GrTexture.h" #include "GrFragmentProcessor.h" #include "GrInvariantOutput.h" +#include "GrShaderCaps.h" #include "GrStyle.h" #include "effects/GrSimpleTextureEffect.h" -#include "glsl/GrGLSLCaps.h" #include "glsl/GrGLSLFragmentProcessor.h" #include "glsl/GrGLSLFragmentShaderBuilder.h" #include "glsl/GrGLSLProgramDataManager.h" @@ -815,7 +815,7 @@ private: GrGLSLFragmentProcessor* onCreateGLSLInstance() const override; - void onGetGLSLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) const override; + void onGetGLSLProcessorKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const override; bool onIsEqual(const GrFragmentProcessor&) const override; @@ -837,7 +837,7 @@ class GrGLRectBlurEffect : public GrGLSLFragmentProcessor { public: void emitCode(EmitArgs&) override; - static void GenKey(const GrProcessor&, const GrGLSLCaps&, GrProcessorKeyBuilder* b); + static void GenKey(const GrProcessor&, const GrShaderCaps&, GrProcessorKeyBuilder* b); protected: void onSetData(const GrGLSLProgramDataManager&, const GrProcessor&) override; @@ -868,7 +868,7 @@ void OutputRectBlurProfileLookup(GrGLSLFPFragmentBuilder* fragBuilder, } -void GrGLRectBlurEffect::GenKey(const GrProcessor& proc, const GrGLSLCaps&, +void GrGLRectBlurEffect::GenKey(const GrProcessor& proc, const GrShaderCaps&, GrProcessorKeyBuilder* b) { const GrRectBlurEffect& rbe = proc.cast(); @@ -982,7 +982,7 @@ GrRectBlurEffect::GrRectBlurEffect(const SkRect& rect, float sigma, GrTexture *b this->setWillReadFragmentPosition(); } -void GrRectBlurEffect::onGetGLSLProcessorKey(const GrGLSLCaps& caps, +void GrRectBlurEffect::onGetGLSLProcessorKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const { GrGLRectBlurEffect::GenKey(*this, caps, b); } @@ -1084,7 +1084,7 @@ private: GrRRectBlurEffect(float sigma, const SkRRect&, GrTexture* profileTexture); - virtual void onGetGLSLProcessorKey(const GrGLSLCaps& caps, + virtual void onGetGLSLProcessorKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const override; bool onIsEqual(const GrFragmentProcessor& other) const override; @@ -1328,7 +1328,7 @@ void GrGLRRectBlurEffect::onSetData(const GrGLSLProgramDataManager& pdman, pdman.set1f(fCornerRadiusUniform, radius); } -void GrRRectBlurEffect::onGetGLSLProcessorKey(const GrGLSLCaps& caps, +void GrRRectBlurEffect::onGetGLSLProcessorKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const { GrGLRRectBlurEffect::GenKey(*this, caps, b); } diff --git a/src/effects/SkColorCubeFilter.cpp b/src/effects/SkColorCubeFilter.cpp index 6a15c557c8..6907f030d0 100644 --- a/src/effects/SkColorCubeFilter.cpp +++ b/src/effects/SkColorCubeFilter.cpp @@ -179,7 +179,7 @@ public: public: void emitCode(EmitArgs&) override; - static inline void GenKey(const GrProcessor&, const GrGLSLCaps&, GrProcessorKeyBuilder*); + static inline void GenKey(const GrProcessor&, const GrShaderCaps&, GrProcessorKeyBuilder*); protected: void onSetData(const GrGLSLProgramDataManager&, const GrProcessor&) override; @@ -192,7 +192,7 @@ public: }; private: - virtual void onGetGLSLProcessorKey(const GrGLSLCaps& caps, + virtual void onGetGLSLProcessorKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const override; GrGLSLFragmentProcessor* onCreateGLSLInstance() const override; @@ -217,7 +217,7 @@ GrColorCubeEffect::GrColorCubeEffect(GrTexture* colorCube) GrColorCubeEffect::~GrColorCubeEffect() { } -void GrColorCubeEffect::onGetGLSLProcessorKey(const GrGLSLCaps& caps, +void GrColorCubeEffect::onGetGLSLProcessorKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const { GLSLProcessor::GenKey(*this, caps, b); } @@ -295,7 +295,7 @@ void GrColorCubeEffect::GLSLProcessor::onSetData(const GrGLSLProgramDataManager& } void GrColorCubeEffect::GLSLProcessor::GenKey(const GrProcessor& proc, - const GrGLSLCaps&, GrProcessorKeyBuilder* b) { + const GrShaderCaps&, GrProcessorKeyBuilder* b) { } sk_sp SkColorCubeFilter::asFragmentProcessor(GrContext* context, diff --git a/src/effects/SkDisplacementMapEffect.cpp b/src/effects/SkDisplacementMapEffect.cpp index 6a8084c1d7..0e50bcc640 100644 --- a/src/effects/SkDisplacementMapEffect.cpp +++ b/src/effects/SkDisplacementMapEffect.cpp @@ -243,7 +243,7 @@ public: private: GrGLSLFragmentProcessor* onCreateGLSLInstance() const override; - void onGetGLSLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) const override; + void onGetGLSLProcessorKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const override; bool onIsEqual(const GrFragmentProcessor&) const override; @@ -454,7 +454,7 @@ class GrGLDisplacementMapEffect : public GrGLSLFragmentProcessor { public: void emitCode(EmitArgs&) override; - static inline void GenKey(const GrProcessor&, const GrGLSLCaps&, GrProcessorKeyBuilder*); + static inline void GenKey(const GrProcessor&, const GrShaderCaps&, GrProcessorKeyBuilder*); protected: void onSetData(const GrGLSLProgramDataManager&, const GrProcessor&) override; @@ -472,7 +472,7 @@ GrGLSLFragmentProcessor* GrDisplacementMapEffect::onCreateGLSLInstance() const { return new GrGLDisplacementMapEffect; } -void GrDisplacementMapEffect::onGetGLSLProcessorKey(const GrGLSLCaps& caps, +void GrDisplacementMapEffect::onGetGLSLProcessorKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const { GrGLDisplacementMapEffect::GenKey(*this, caps, b); } @@ -635,7 +635,7 @@ void GrGLDisplacementMapEffect::onSetData(const GrGLSLProgramDataManager& pdman, } void GrGLDisplacementMapEffect::GenKey(const GrProcessor& proc, - const GrGLSLCaps&, GrProcessorKeyBuilder* b) { + const GrShaderCaps&, GrProcessorKeyBuilder* b) { const GrDisplacementMapEffect& displacementMap = proc.cast(); uint32_t xKey = displacementMap.xChannelSelector(); diff --git a/src/effects/SkGaussianEdgeShader.cpp b/src/effects/SkGaussianEdgeShader.cpp index ddc5d96fc8..e1c30c8fbf 100644 --- a/src/effects/SkGaussianEdgeShader.cpp +++ b/src/effects/SkGaussianEdgeShader.cpp @@ -95,8 +95,7 @@ public: } } - static void GenKey(const GrProcessor& proc, const GrGLSLCaps&, - GrProcessorKeyBuilder* b) { + static void GenKey(const GrProcessor& proc, const GrShaderCaps&, GrProcessorKeyBuilder* b) { // only one shader generated currently b->add32(0x0); } @@ -107,7 +106,7 @@ public: bool fLargerBlur; }; - void onGetGLSLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) const override { + void onGetGLSLProcessorKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const override { GLSLGaussianEdgeFP::GenKey(*this, caps, b); } diff --git a/src/effects/SkLightingImageFilter.cpp b/src/effects/SkLightingImageFilter.cpp index 6b479e985d..6ad061806c 100644 --- a/src/effects/SkLightingImageFilter.cpp +++ b/src/effects/SkLightingImageFilter.cpp @@ -27,11 +27,11 @@ #include "SkGrPriv.h" #include "effects/GrSingleTextureEffect.h" #include "effects/GrTextureDomain.h" -#include "glsl/GrGLSL.h" #include "glsl/GrGLSLFragmentProcessor.h" #include "glsl/GrGLSLFragmentShaderBuilder.h" #include "glsl/GrGLSLProgramDataManager.h" #include "glsl/GrGLSLUniformHandler.h" +#include "../private/GrGLSL.h" class GrGLDiffuseLightingEffect; class GrGLSpecularLightingEffect; @@ -593,7 +593,7 @@ public: private: GrGLSLFragmentProcessor* onCreateGLSLInstance() const override; - void onGetGLSLProcessorKey(const GrGLSLCaps&, GrProcessorKeyBuilder*) const override; + void onGetGLSLProcessorKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override; bool onIsEqual(const GrFragmentProcessor&) const override; @@ -633,7 +633,7 @@ public: SkScalar shininess() const { return fShininess; } private: - void onGetGLSLProcessorKey(const GrGLSLCaps&, GrProcessorKeyBuilder*) const override; + void onGetGLSLProcessorKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override; bool onIsEqual(const GrFragmentProcessor&) const override; @@ -1636,7 +1636,7 @@ public: void emitCode(EmitArgs&) override; - static inline void GenKey(const GrProcessor&, const GrGLSLCaps&, GrProcessorKeyBuilder* b); + static inline void GenKey(const GrProcessor&, const GrShaderCaps&, GrProcessorKeyBuilder* b); protected: /** @@ -1751,7 +1751,7 @@ bool GrDiffuseLightingEffect::onIsEqual(const GrFragmentProcessor& sBase) const return INHERITED::onIsEqual(sBase) && this->kd() == s.kd(); } -void GrDiffuseLightingEffect::onGetGLSLProcessorKey(const GrGLSLCaps& caps, +void GrDiffuseLightingEffect::onGetGLSLProcessorKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const { GrGLDiffuseLightingEffect::GenKey(*this, caps, b); } @@ -1888,7 +1888,7 @@ void GrGLLightingEffect::emitCode(EmitArgs& args) { } void GrGLLightingEffect::GenKey(const GrProcessor& proc, - const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) { + const GrShaderCaps& caps, GrProcessorKeyBuilder* b) { const GrLightingEffect& lighting = proc.cast(); b->add32(lighting.boundaryMode() << 2 | lighting.light()->type()); b->add32(GrTextureDomain::GLDomain::DomainKey(lighting.domain())); @@ -1969,7 +1969,7 @@ bool GrSpecularLightingEffect::onIsEqual(const GrFragmentProcessor& sBase) const this->shininess() == s.shininess(); } -void GrSpecularLightingEffect::onGetGLSLProcessorKey(const GrGLSLCaps& caps, +void GrSpecularLightingEffect::onGetGLSLProcessorKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const { GrGLSpecularLightingEffect::GenKey(*this, caps, b); } diff --git a/src/effects/SkLumaColorFilter.cpp b/src/effects/SkLumaColorFilter.cpp index 94d800a4ff..6845c50ff0 100644 --- a/src/effects/SkLumaColorFilter.cpp +++ b/src/effects/SkLumaColorFilter.cpp @@ -75,7 +75,7 @@ public: class GLSLProcessor : public GrGLSLFragmentProcessor { public: - static void GenKey(const GrProcessor&, const GrGLSLCaps&, GrProcessorKeyBuilder*) {} + static void GenKey(const GrProcessor&, const GrShaderCaps&, GrProcessorKeyBuilder*) {} void emitCode(EmitArgs& args) override { if (nullptr == args.fInputColor) { @@ -106,7 +106,7 @@ private: return new GLSLProcessor; } - virtual void onGetGLSLProcessorKey(const GrGLSLCaps& caps, + virtual void onGetGLSLProcessorKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const override { GLSLProcessor::GenKey(*this, caps, b); } diff --git a/src/effects/SkMagnifierImageFilter.cpp b/src/effects/SkMagnifierImageFilter.cpp index 5b5525c3b6..916bd950a6 100644 --- a/src/effects/SkMagnifierImageFilter.cpp +++ b/src/effects/SkMagnifierImageFilter.cpp @@ -19,11 +19,11 @@ #include "GrContext.h" #include "GrInvariantOutput.h" #include "effects/GrSingleTextureEffect.h" -#include "glsl/GrGLSL.h" #include "glsl/GrGLSLFragmentProcessor.h" #include "glsl/GrGLSLFragmentShaderBuilder.h" #include "glsl/GrGLSLProgramDataManager.h" #include "glsl/GrGLSLUniformHandler.h" +#include "../private/GrGLSL.h" class GrMagnifierEffect : public GrSingleTextureEffect { @@ -81,7 +81,7 @@ private: GrGLSLFragmentProcessor* onCreateGLSLInstance() const override; - void onGetGLSLProcessorKey(const GrGLSLCaps&, GrProcessorKeyBuilder*) const override; + void onGetGLSLProcessorKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override; bool onIsEqual(const GrFragmentProcessor&) const override; @@ -181,7 +181,7 @@ void GrGLMagnifierEffect::onSetData(const GrGLSLProgramDataManager& pdman, ///////////////////////////////////////////////////////////////////// -void GrMagnifierEffect::onGetGLSLProcessorKey(const GrGLSLCaps& caps, +void GrMagnifierEffect::onGetGLSLProcessorKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const { GrGLMagnifierEffect::GenKey(*this, caps, b); } diff --git a/src/effects/SkMorphologyImageFilter.cpp b/src/effects/SkMorphologyImageFilter.cpp index 4ececb4dfb..2fa67a4aeb 100644 --- a/src/effects/SkMorphologyImageFilter.cpp +++ b/src/effects/SkMorphologyImageFilter.cpp @@ -26,11 +26,11 @@ #include "SkGr.h" #include "SkGrPriv.h" #include "effects/Gr1DKernelEffect.h" -#include "glsl/GrGLSL.h" #include "glsl/GrGLSLFragmentProcessor.h" #include "glsl/GrGLSLFragmentShaderBuilder.h" #include "glsl/GrGLSLProgramDataManager.h" #include "glsl/GrGLSLUniformHandler.h" +#include "../private/GrGLSL.h" #endif sk_sp SkDilateImageFilter::Make(int radiusX, int radiusY, @@ -175,7 +175,7 @@ protected: private: GrGLSLFragmentProcessor* onCreateGLSLInstance() const override; - void onGetGLSLProcessorKey(const GrGLSLCaps&, GrProcessorKeyBuilder*) const override; + void onGetGLSLProcessorKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override; bool onIsEqual(const GrFragmentProcessor&) const override; @@ -195,7 +195,7 @@ class GrGLMorphologyEffect : public GrGLSLFragmentProcessor { public: void emitCode(EmitArgs&) override; - static inline void GenKey(const GrProcessor&, const GrGLSLCaps&, GrProcessorKeyBuilder*); + static inline void GenKey(const GrProcessor&, const GrShaderCaps&, GrProcessorKeyBuilder*); protected: void onSetData(const GrGLSLProgramDataManager&, const GrProcessor&) override; @@ -281,7 +281,7 @@ void GrGLMorphologyEffect::emitCode(EmitArgs& args) { } void GrGLMorphologyEffect::GenKey(const GrProcessor& proc, - const GrGLSLCaps&, GrProcessorKeyBuilder* b) { + const GrShaderCaps&, GrProcessorKeyBuilder* b) { const GrMorphologyEffect& m = proc.cast(); uint32_t key = static_cast(m.radius()); key |= (m.type() << 8); @@ -349,7 +349,7 @@ GrMorphologyEffect::GrMorphologyEffect(GrTexture* texture, GrMorphologyEffect::~GrMorphologyEffect() { } -void GrMorphologyEffect::onGetGLSLProcessorKey(const GrGLSLCaps& caps, +void GrMorphologyEffect::onGetGLSLProcessorKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const { GrGLMorphologyEffect::GenKey(*this, caps, b); } diff --git a/src/effects/SkOverdrawColorFilter.cpp b/src/effects/SkOverdrawColorFilter.cpp index c3bcd0e616..7d95e3a7f1 100644 --- a/src/effects/SkOverdrawColorFilter.cpp +++ b/src/effects/SkOverdrawColorFilter.cpp @@ -62,7 +62,7 @@ public: private: GrGLSLFragmentProcessor* onCreateGLSLInstance() const override; - void onGetGLSLProcessorKey(const GrGLSLCaps&, GrProcessorKeyBuilder*) const override {} + void onGetGLSLProcessorKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override {} bool onIsEqual(const GrFragmentProcessor&) const override; void onComputeInvariantOutput(GrInvariantOutput* inout) const override; diff --git a/src/effects/SkPerlinNoiseShader.cpp b/src/effects/SkPerlinNoiseShader.cpp index 529a4fa13a..3f7f721fd3 100644 --- a/src/effects/SkPerlinNoiseShader.cpp +++ b/src/effects/SkPerlinNoiseShader.cpp @@ -479,7 +479,7 @@ class GrGLPerlinNoise : public GrGLSLFragmentProcessor { public: void emitCode(EmitArgs&) override; - static inline void GenKey(const GrProcessor&, const GrGLSLCaps&, GrProcessorKeyBuilder*); + static inline void GenKey(const GrProcessor&, const GrShaderCaps&, GrProcessorKeyBuilder*); protected: void onSetData(const GrGLSLProgramDataManager&, const GrProcessor&) override; @@ -522,7 +522,7 @@ private: return new GrGLPerlinNoise; } - virtual void onGetGLSLProcessorKey(const GrGLSLCaps& caps, + virtual void onGetGLSLProcessorKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const override { GrGLPerlinNoise::GenKey(*this, caps, b); } @@ -848,7 +848,7 @@ void GrGLPerlinNoise::emitCode(EmitArgs& args) { args.fOutputColor, args.fOutputColor); } -void GrGLPerlinNoise::GenKey(const GrProcessor& processor, const GrGLSLCaps&, +void GrGLPerlinNoise::GenKey(const GrProcessor& processor, const GrShaderCaps&, GrProcessorKeyBuilder* b) { const GrPerlinNoiseEffect& turbulence = processor.cast(); diff --git a/src/effects/SkRRectsGaussianEdgeMaskFilter.cpp b/src/effects/SkRRectsGaussianEdgeMaskFilter.cpp index 61933bedbb..978dbff7eb 100644 --- a/src/effects/SkRRectsGaussianEdgeMaskFilter.cpp +++ b/src/effects/SkRRectsGaussianEdgeMaskFilter.cpp @@ -393,8 +393,7 @@ public: args.fOutputColor, args.fInputColor); } - static void GenKey(const GrProcessor& proc, const GrGLSLCaps&, - GrProcessorKeyBuilder* b) { + static void GenKey(const GrProcessor& proc, const GrShaderCaps&, GrProcessorKeyBuilder* b) { const RRectsGaussianEdgeFP& fp = proc.cast(); b->add32(fp.firstMode() | (fp.secondMode() << 4)); @@ -451,7 +450,7 @@ public: typedef GrGLSLFragmentProcessor INHERITED; }; - void onGetGLSLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) const override { + void onGetGLSLProcessorKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const override { GLSLRRectsGaussianEdgeFP::GenKey(*this, caps, b); } diff --git a/src/effects/SkTableColorFilter.cpp b/src/effects/SkTableColorFilter.cpp index 68fd13fdaa..c2683b5406 100644 --- a/src/effects/SkTableColorFilter.cpp +++ b/src/effects/SkTableColorFilter.cpp @@ -355,7 +355,7 @@ public: private: GrGLSLFragmentProcessor* onCreateGLSLInstance() const override; - void onGetGLSLProcessorKey(const GrGLSLCaps&, GrProcessorKeyBuilder*) const override; + void onGetGLSLProcessorKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override; bool onIsEqual(const GrFragmentProcessor&) const override; @@ -380,7 +380,7 @@ class GLColorTableEffect : public GrGLSLFragmentProcessor { public: void emitCode(EmitArgs&) override; - static void GenKey(const GrProcessor&, const GrGLSLCaps&, GrProcessorKeyBuilder*) {} + static void GenKey(const GrProcessor&, const GrShaderCaps&, GrProcessorKeyBuilder*) {} protected: void onSetData(const GrGLSLProgramDataManager&, const GrProcessor&) override; @@ -499,7 +499,7 @@ ColorTableEffect::~ColorTableEffect() { } } -void ColorTableEffect::onGetGLSLProcessorKey(const GrGLSLCaps& caps, +void ColorTableEffect::onGetGLSLProcessorKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const { GLColorTableEffect::GenKey(*this, caps, b); } diff --git a/src/effects/gradients/SkGradientShader.cpp b/src/effects/gradients/SkGradientShader.cpp index 92c6fd958a..4651cc238b 100644 --- a/src/effects/gradients/SkGradientShader.cpp +++ b/src/effects/gradients/SkGradientShader.cpp @@ -1110,9 +1110,9 @@ SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END #include "GrContext.h" #include "GrInvariantOutput.h" +#include "GrShaderCaps.h" #include "GrTextureStripAtlas.h" #include "gl/GrGLContext.h" -#include "glsl/GrGLSLCaps.h" #include "glsl/GrGLSLColorSpaceXformHelper.h" #include "glsl/GrGLSLFragmentShaderBuilder.h" #include "glsl/GrGLSLProgramDataManager.h" @@ -1377,7 +1377,7 @@ uint32_t GrGradientEffect::GLSLProcessor::GenBaseGradientKey(const GrProcessor& void GrGradientEffect::GLSLProcessor::emitColor(GrGLSLFPFragmentBuilder* fragBuilder, GrGLSLUniformHandler* uniformHandler, - const GrGLSLCaps* glslCaps, + const GrShaderCaps* glslCaps, const GrGradientEffect& ge, const char* gradientTValue, const char* outputColor, diff --git a/src/effects/gradients/SkGradientShaderPriv.h b/src/effects/gradients/SkGradientShaderPriv.h index 120832f33c..47831705c1 100644 --- a/src/effects/gradients/SkGradientShaderPriv.h +++ b/src/effects/gradients/SkGradientShaderPriv.h @@ -481,7 +481,7 @@ protected: // of hard stop gradients void emitColor(GrGLSLFPFragmentBuilder* fragBuilder, GrGLSLUniformHandler* uniformHandler, - const GrGLSLCaps* caps, + const GrShaderCaps* caps, const GrGradientEffect&, const char* gradientTValue, const char* outputColor, diff --git a/src/effects/gradients/SkLinearGradient.cpp b/src/effects/gradients/SkLinearGradient.cpp index 66accd8aa8..4e7da61fc4 100644 --- a/src/effects/gradients/SkLinearGradient.cpp +++ b/src/effects/gradients/SkLinearGradient.cpp @@ -343,7 +343,7 @@ SkShader::GradientType SkLinearGradient::asAGradient(GradientInfo* info) const { #if SK_SUPPORT_GPU #include "GrColorSpaceXform.h" -#include "glsl/GrGLSLCaps.h" +#include "GrShaderCaps.h" #include "glsl/GrGLSLFragmentShaderBuilder.h" #include "SkGr.h" @@ -369,7 +369,7 @@ private: GrGLSLFragmentProcessor* onCreateGLSLInstance() const override; - virtual void onGetGLSLProcessorKey(const GrGLSLCaps& caps, + virtual void onGetGLSLProcessorKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const override; GR_DECLARE_FRAGMENT_PROCESSOR_TEST; @@ -387,7 +387,7 @@ public: virtual void emitCode(EmitArgs&) override; - static void GenKey(const GrProcessor& processor, const GrGLSLCaps&, GrProcessorKeyBuilder* b) { + static void GenKey(const GrProcessor& processor, const GrShaderCaps&, GrProcessorKeyBuilder* b) { b->add32(GenBaseGradientKey(processor)); } @@ -401,7 +401,7 @@ GrGLSLFragmentProcessor* GrLinearGradient::onCreateGLSLInstance() const { return new GrLinearGradient::GLSLLinearProcessor(*this); } -void GrLinearGradient::onGetGLSLProcessorKey(const GrGLSLCaps& caps, +void GrLinearGradient::onGetGLSLProcessorKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const { GrLinearGradient::GLSLLinearProcessor::GenKey(*this, caps, b); } diff --git a/src/effects/gradients/SkRadialGradient.cpp b/src/effects/gradients/SkRadialGradient.cpp index 8ad588013b..5c4aabdb6d 100644 --- a/src/effects/gradients/SkRadialGradient.cpp +++ b/src/effects/gradients/SkRadialGradient.cpp @@ -240,7 +240,7 @@ void SkRadialGradient::RadialGradientContext::shadeSpan(int x, int y, #if SK_SUPPORT_GPU #include "SkGr.h" -#include "glsl/GrGLSLCaps.h" +#include "GrShaderCaps.h" #include "glsl/GrGLSLFragmentShaderBuilder.h" class GrRadialGradient : public GrGradientEffect { @@ -263,7 +263,7 @@ private: GrGLSLFragmentProcessor* onCreateGLSLInstance() const override; - virtual void onGetGLSLProcessorKey(const GrGLSLCaps& caps, + virtual void onGetGLSLProcessorKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const override; GR_DECLARE_FRAGMENT_PROCESSOR_TEST; @@ -280,7 +280,7 @@ public: virtual void emitCode(EmitArgs&) override; - static void GenKey(const GrProcessor& processor, const GrGLSLCaps&, GrProcessorKeyBuilder* b) { + static void GenKey(const GrProcessor& processor, const GrShaderCaps&, GrProcessorKeyBuilder* b) { b->add32(GenBaseGradientKey(processor)); } @@ -295,7 +295,7 @@ GrGLSLFragmentProcessor* GrRadialGradient::onCreateGLSLInstance() const { return new GrRadialGradient::GLSLRadialProcessor(*this); } -void GrRadialGradient::onGetGLSLProcessorKey(const GrGLSLCaps& caps, +void GrRadialGradient::onGetGLSLProcessorKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const { GrRadialGradient::GLSLRadialProcessor::GenKey(*this, caps, b); } diff --git a/src/effects/gradients/SkSweepGradient.cpp b/src/effects/gradients/SkSweepGradient.cpp index b791f988f3..5b4df9f0ed 100644 --- a/src/effects/gradients/SkSweepGradient.cpp +++ b/src/effects/gradients/SkSweepGradient.cpp @@ -122,8 +122,8 @@ void SkSweepGradient::SweepGradientContext::shadeSpan(int x, int y, SkPMColor* S #if SK_SUPPORT_GPU #include "SkGr.h" +#include "GrShaderCaps.h" #include "gl/GrGLContext.h" -#include "glsl/GrGLSLCaps.h" #include "glsl/GrGLSLFragmentShaderBuilder.h" class GrSweepGradient : public GrGradientEffect { @@ -145,7 +145,7 @@ private: GrGLSLFragmentProcessor* onCreateGLSLInstance() const override; - virtual void onGetGLSLProcessorKey(const GrGLSLCaps& caps, + virtual void onGetGLSLProcessorKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const override; GR_DECLARE_FRAGMENT_PROCESSOR_TEST; @@ -162,7 +162,7 @@ public: virtual void emitCode(EmitArgs&) override; - static void GenKey(const GrProcessor& processor, const GrGLSLCaps&, GrProcessorKeyBuilder* b) { + static void GenKey(const GrProcessor& processor, const GrShaderCaps&, GrProcessorKeyBuilder* b) { b->add32(GenBaseGradientKey(processor)); } @@ -177,7 +177,7 @@ GrGLSLFragmentProcessor* GrSweepGradient::onCreateGLSLInstance() const { return new GrSweepGradient::GLSLSweepProcessor(*this); } -void GrSweepGradient::onGetGLSLProcessorKey(const GrGLSLCaps& caps, +void GrSweepGradient::onGetGLSLProcessorKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const { GrSweepGradient::GLSLSweepProcessor::GenKey(*this, caps, b); } diff --git a/src/effects/gradients/SkTwoPointConicalGradient_gpu.cpp b/src/effects/gradients/SkTwoPointConicalGradient_gpu.cpp index cf2a827cfe..3e9ee25c6e 100644 --- a/src/effects/gradients/SkTwoPointConicalGradient_gpu.cpp +++ b/src/effects/gradients/SkTwoPointConicalGradient_gpu.cpp @@ -81,7 +81,7 @@ public: private: GrGLSLFragmentProcessor* onCreateGLSLInstance() const override; - void onGetGLSLProcessorKey(const GrGLSLCaps&, GrProcessorKeyBuilder*) const override; + void onGetGLSLProcessorKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override; bool onIsEqual(const GrFragmentProcessor& sBase) const override { const Edge2PtConicalEffect& s = sBase.cast(); @@ -145,7 +145,7 @@ public: virtual void emitCode(EmitArgs&) override; - static void GenKey(const GrProcessor&, const GrGLSLCaps& caps, GrProcessorKeyBuilder* b); + static void GenKey(const GrProcessor&, const GrShaderCaps& caps, GrProcessorKeyBuilder* b); protected: void onSetData(const GrGLSLProgramDataManager&, const GrProcessor&) override; @@ -168,7 +168,7 @@ private: }; -void Edge2PtConicalEffect::onGetGLSLProcessorKey(const GrGLSLCaps& caps, +void Edge2PtConicalEffect::onGetGLSLProcessorKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const { Edge2PtConicalEffect::GLSLEdge2PtConicalProcessor::GenKey(*this, caps, b); } @@ -302,7 +302,7 @@ void Edge2PtConicalEffect::GLSLEdge2PtConicalProcessor::onSetData( } void Edge2PtConicalEffect::GLSLEdge2PtConicalProcessor::GenKey(const GrProcessor& processor, - const GrGLSLCaps&, GrProcessorKeyBuilder* b) { + const GrShaderCaps&, GrProcessorKeyBuilder* b) { b->add32(GenBaseGradientKey(processor)); } @@ -389,7 +389,7 @@ public: private: GrGLSLFragmentProcessor* onCreateGLSLInstance() const override; - void onGetGLSLProcessorKey(const GrGLSLCaps&, GrProcessorKeyBuilder*) const override; + void onGetGLSLProcessorKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override; bool onIsEqual(const GrFragmentProcessor& sBase) const override { const FocalOutside2PtConicalEffect& s = sBase.cast(); @@ -421,7 +421,7 @@ public: virtual void emitCode(EmitArgs&) override; - static void GenKey(const GrProcessor&, const GrGLSLCaps& caps, GrProcessorKeyBuilder* b); + static void GenKey(const GrProcessor&, const GrShaderCaps& caps, GrProcessorKeyBuilder* b); protected: void onSetData(const GrGLSLProgramDataManager&, const GrProcessor&) override; @@ -445,7 +445,7 @@ private: }; -void FocalOutside2PtConicalEffect::onGetGLSLProcessorKey(const GrGLSLCaps& caps, +void FocalOutside2PtConicalEffect::onGetGLSLProcessorKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const { FocalOutside2PtConicalEffect::GLSLFocalOutside2PtConicalProcessor::GenKey(*this, caps, b); } @@ -567,7 +567,7 @@ void FocalOutside2PtConicalEffect::GLSLFocalOutside2PtConicalProcessor::onSetDat void FocalOutside2PtConicalEffect::GLSLFocalOutside2PtConicalProcessor::GenKey( const GrProcessor& processor, - const GrGLSLCaps&, GrProcessorKeyBuilder* b) { + const GrShaderCaps&, GrProcessorKeyBuilder* b) { uint32_t* key = b->add32n(2); key[0] = GenBaseGradientKey(processor); key[1] = processor.cast().isFlipped(); @@ -597,7 +597,7 @@ public: private: GrGLSLFragmentProcessor* onCreateGLSLInstance() const override; - void onGetGLSLProcessorKey(const GrGLSLCaps&, GrProcessorKeyBuilder*) const override; + void onGetGLSLProcessorKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override; bool onIsEqual(const GrFragmentProcessor& sBase) const override { const FocalInside2PtConicalEffect& s = sBase.cast(); @@ -625,7 +625,7 @@ public: virtual void emitCode(EmitArgs&) override; - static void GenKey(const GrProcessor&, const GrGLSLCaps& caps, GrProcessorKeyBuilder* b); + static void GenKey(const GrProcessor&, const GrShaderCaps& caps, GrProcessorKeyBuilder* b); protected: void onSetData(const GrGLSLProgramDataManager&, const GrProcessor&) override; @@ -647,7 +647,7 @@ private: }; -void FocalInside2PtConicalEffect::onGetGLSLProcessorKey(const GrGLSLCaps& caps, +void FocalInside2PtConicalEffect::onGetGLSLProcessorKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const { FocalInside2PtConicalEffect::GLSLFocalInside2PtConicalProcessor::GenKey(*this, caps, b); } @@ -744,7 +744,7 @@ void FocalInside2PtConicalEffect::GLSLFocalInside2PtConicalProcessor::onSetData( void FocalInside2PtConicalEffect::GLSLFocalInside2PtConicalProcessor::GenKey( const GrProcessor& processor, - const GrGLSLCaps&, GrProcessorKeyBuilder* b) { + const GrShaderCaps&, GrProcessorKeyBuilder* b) { b->add32(GenBaseGradientKey(processor)); } @@ -834,7 +834,7 @@ public: private: GrGLSLFragmentProcessor* onCreateGLSLInstance() const override; - virtual void onGetGLSLProcessorKey(const GrGLSLCaps& caps, + virtual void onGetGLSLProcessorKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const override; bool onIsEqual(const GrFragmentProcessor& sBase) const override { @@ -866,7 +866,7 @@ public: virtual void emitCode(EmitArgs&) override; - static void GenKey(const GrProcessor&, const GrGLSLCaps& caps, GrProcessorKeyBuilder* b); + static void GenKey(const GrProcessor&, const GrShaderCaps& caps, GrProcessorKeyBuilder* b); protected: void onSetData(const GrGLSLProgramDataManager&, const GrProcessor&) override; @@ -893,7 +893,7 @@ private: }; -void CircleInside2PtConicalEffect::onGetGLSLProcessorKey(const GrGLSLCaps& caps, +void CircleInside2PtConicalEffect::onGetGLSLProcessorKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const { CircleInside2PtConicalEffect::GLSLCircleInside2PtConicalProcessor::GenKey(*this, caps, b); } @@ -1020,7 +1020,7 @@ void CircleInside2PtConicalEffect::GLSLCircleInside2PtConicalProcessor::onSetDat void CircleInside2PtConicalEffect::GLSLCircleInside2PtConicalProcessor::GenKey( const GrProcessor& processor, - const GrGLSLCaps&, GrProcessorKeyBuilder* b) { + const GrShaderCaps&, GrProcessorKeyBuilder* b) { b->add32(GenBaseGradientKey(processor)); } @@ -1050,7 +1050,7 @@ public: private: GrGLSLFragmentProcessor* onCreateGLSLInstance() const override; - void onGetGLSLProcessorKey(const GrGLSLCaps&, GrProcessorKeyBuilder*) const override; + void onGetGLSLProcessorKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override; bool onIsEqual(const GrFragmentProcessor& sBase) const override { const CircleOutside2PtConicalEffect& s = sBase.cast(); @@ -1094,7 +1094,7 @@ public: virtual void emitCode(EmitArgs&) override; - static void GenKey(const GrProcessor&, const GrGLSLCaps& caps, GrProcessorKeyBuilder* b); + static void GenKey(const GrProcessor&, const GrShaderCaps& caps, GrProcessorKeyBuilder* b); protected: void onSetData(const GrGLSLProgramDataManager&, const GrProcessor&) override; @@ -1124,7 +1124,7 @@ private: }; -void CircleOutside2PtConicalEffect::onGetGLSLProcessorKey(const GrGLSLCaps& caps, +void CircleOutside2PtConicalEffect::onGetGLSLProcessorKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const { CircleOutside2PtConicalEffect::GLSLCircleOutside2PtConicalProcessor::GenKey(*this, caps, b); } @@ -1277,7 +1277,7 @@ void CircleOutside2PtConicalEffect::GLSLCircleOutside2PtConicalProcessor::onSetD void CircleOutside2PtConicalEffect::GLSLCircleOutside2PtConicalProcessor::GenKey( const GrProcessor& processor, - const GrGLSLCaps&, GrProcessorKeyBuilder* b) { + const GrShaderCaps&, GrProcessorKeyBuilder* b) { uint32_t* key = b->add32n(2); key[0] = GenBaseGradientKey(processor); key[1] = processor.cast().isFlipped(); diff --git a/src/gpu/GrCaps.cpp b/src/gpu/GrCaps.cpp index 7b092145c5..0cc33462eb 100644 --- a/src/gpu/GrCaps.cpp +++ b/src/gpu/GrCaps.cpp @@ -9,83 +9,6 @@ #include "GrContextOptions.h" #include "GrWindowRectangles.h" -GrShaderCaps::GrShaderCaps() { - fShaderDerivativeSupport = false; - fGeometryShaderSupport = false; - fPathRenderingSupport = false; - fDstReadInShaderSupport = false; - fDualSourceBlendingSupport = false; - fIntegerSupport = false; - fTexelBufferSupport = false; - fImageLoadStoreSupport = false; - fShaderPrecisionVaries = false; - fPLSPathRenderingSupport = false; - fPixelLocalStorageSize = 0; -} - -static const char* shader_type_to_string(GrShaderType type) { - switch (type) { - case kVertex_GrShaderType: - return "vertex"; - case kGeometry_GrShaderType: - return "geometry"; - case kFragment_GrShaderType: - return "fragment"; - } - return ""; -} - -static const char* precision_to_string(GrSLPrecision p) { - switch (p) { - case kLow_GrSLPrecision: - return "low"; - case kMedium_GrSLPrecision: - return "medium"; - case kHigh_GrSLPrecision: - return "high"; - } - return ""; -} - -SkString GrShaderCaps::dump() const { - SkString r; - static const char* gNY[] = { "NO", "YES" }; - r.appendf("Shader Derivative Support : %s\n", gNY[fShaderDerivativeSupport]); - r.appendf("Geometry Shader Support : %s\n", gNY[fGeometryShaderSupport]); - r.appendf("Path Rendering Support : %s\n", gNY[fPathRenderingSupport]); - r.appendf("Dst Read In Shader Support : %s\n", gNY[fDstReadInShaderSupport]); - r.appendf("Dual Source Blending Support : %s\n", gNY[fDualSourceBlendingSupport]); - r.appendf("Integer Support : %s\n", gNY[fIntegerSupport]); - r.appendf("Texel Buffer Support : %s\n", gNY[fTexelBufferSupport]); - r.appendf("Image Load Store Support : %s\n", gNY[fImageLoadStoreSupport]); - - r.appendf("Shader Float Precisions (varies: %s):\n", gNY[fShaderPrecisionVaries]); - - for (int s = 0; s < kGrShaderTypeCount; ++s) { - GrShaderType shaderType = static_cast(s); - r.appendf("\t%s:\n", shader_type_to_string(shaderType)); - for (int p = 0; p < kGrSLPrecisionCount; ++p) { - if (fFloatPrecisions[s][p].supported()) { - GrSLPrecision precision = static_cast(p); - r.appendf("\t\t%s: log_low: %d log_high: %d bits: %d\n", - precision_to_string(precision), - fFloatPrecisions[s][p].fLogRangeLow, - fFloatPrecisions[s][p].fLogRangeHigh, - fFloatPrecisions[s][p].fBits); - } - } - } - - return r; -} - -void GrShaderCaps::applyOptionsOverrides(const GrContextOptions& options) { - fDualSourceBlendingSupport = fDualSourceBlendingSupport && !options.fSuppressDualSourceBlending; - this->onApplyOptionsOverrides(options); -} - -/////////////////////////////////////////////////////////////////////////////// - GrCaps::GrCaps(const GrContextOptions& options) { fMipMapSupport = false; fNPOTTextureTileSupport = false; diff --git a/src/gpu/GrDefaultGeoProcFactory.cpp b/src/gpu/GrDefaultGeoProcFactory.cpp index 7d89f2727b..406fe6ae39 100644 --- a/src/gpu/GrDefaultGeoProcFactory.cpp +++ b/src/gpu/GrDefaultGeoProcFactory.cpp @@ -132,7 +132,7 @@ public: } static inline void GenKey(const GrGeometryProcessor& gp, - const GrGLSLCaps&, + const GrShaderCaps&, GrProcessorKeyBuilder* b) { const DefaultGeoProc& def = gp.cast(); uint32_t key = def.fFlags; @@ -185,11 +185,11 @@ public: typedef GrGLSLGeometryProcessor INHERITED; }; - void getGLSLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) const override { + void getGLSLProcessorKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const override { GLSLProcessor::GenKey(*this, caps, b); } - GrGLSLPrimitiveProcessor* createGLSLInstance(const GrGLSLCaps&) const override { + GrGLSLPrimitiveProcessor* createGLSLInstance(const GrShaderCaps&) const override { return new GLSLProcessor(); } diff --git a/src/gpu/GrFragmentProcessor.cpp b/src/gpu/GrFragmentProcessor.cpp index de4ab9e860..75b6af7ca7 100644 --- a/src/gpu/GrFragmentProcessor.cpp +++ b/src/gpu/GrFragmentProcessor.cpp @@ -132,7 +132,7 @@ sk_sp GrFragmentProcessor::PremulInput(sk_sp GrFragmentProcessor::MulOutputByInputUnpremulColor( return new GLFP; } - void onGetGLSLProcessorKey(const GrGLSLCaps&, GrProcessorKeyBuilder*) const override {} + void onGetGLSLProcessorKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override {} bool onIsEqual(const GrFragmentProcessor&) const override { return true; } @@ -264,7 +264,7 @@ sk_sp GrFragmentProcessor::OverrideInput(sk_sp GrFragmentProcessor::RunInSeries(sk_sp(); uint16_t key; @@ -269,11 +269,11 @@ public: const char* name() const override { return "EllipseEdge"; } - void getGLSLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) const override { + void getGLSLProcessorKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const override { GLSLProcessor::GenKey(*this, caps, b); } - GrGLSLPrimitiveProcessor* createGLSLInstance(const GrGLSLCaps&) const override { + GrGLSLPrimitiveProcessor* createGLSLInstance(const GrShaderCaps&) const override { return new GLSLProcessor(); } @@ -344,7 +344,7 @@ private: } static void GenKey(const GrGeometryProcessor& gp, - const GrGLSLCaps&, + const GrShaderCaps&, GrProcessorKeyBuilder* b) { const EllipseGeometryProcessor& egp = gp.cast(); uint16_t key = egp.fStroke ? 0x1 : 0x0; @@ -412,11 +412,11 @@ public: const char* name() const override { return "DIEllipseEdge"; } - void getGLSLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) const override { + void getGLSLProcessorKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const override { GLSLProcessor::GenKey(*this, caps, b); } - GrGLSLPrimitiveProcessor* createGLSLInstance(const GrGLSLCaps&) const override { + GrGLSLPrimitiveProcessor* createGLSLInstance(const GrShaderCaps&) const override { return new GLSLProcessor(); } @@ -504,7 +504,7 @@ private: } static void GenKey(const GrGeometryProcessor& gp, - const GrGLSLCaps&, + const GrShaderCaps&, GrProcessorKeyBuilder* b) { const DIEllipseGeometryProcessor& diegp = gp.cast(); uint16_t key = static_cast(diegp.fStyle); diff --git a/src/gpu/GrPathProcessor.cpp b/src/gpu/GrPathProcessor.cpp index c90481b8da..5d7c0e1cc8 100644 --- a/src/gpu/GrPathProcessor.cpp +++ b/src/gpu/GrPathProcessor.cpp @@ -7,8 +7,8 @@ #include "GrPathProcessor.h" +#include "GrShaderCaps.h" #include "gl/GrGLGpu.h" -#include "glsl/GrGLSLCaps.h" #include "glsl/GrGLSLFragmentShaderBuilder.h" #include "glsl/GrGLSLUniformHandler.h" #include "glsl/GrGLSLVarying.h" @@ -18,7 +18,7 @@ public: GrGLPathProcessor() : fColor(GrColor_ILLEGAL) {} static void GenKey(const GrPathProcessor& pathProc, - const GrGLSLCaps&, + const GrShaderCaps&, GrProcessorKeyBuilder* b) { b->add32(SkToInt(pathProc.overrides().readsColor()) | (SkToInt(pathProc.overrides().readsCoverage()) << 1) | @@ -130,12 +130,12 @@ GrPathProcessor::GrPathProcessor(GrColor color, this->initClassID(); } -void GrPathProcessor::getGLSLProcessorKey(const GrGLSLCaps& caps, +void GrPathProcessor::getGLSLProcessorKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const { GrGLPathProcessor::GenKey(*this, caps, b); } -GrGLSLPrimitiveProcessor* GrPathProcessor::createGLSLInstance(const GrGLSLCaps& caps) const { +GrGLSLPrimitiveProcessor* GrPathProcessor::createGLSLInstance(const GrShaderCaps& caps) const { SkASSERT(caps.pathRenderingSupport()); return new GrGLPathProcessor(); } diff --git a/src/gpu/GrPathProcessor.h b/src/gpu/GrPathProcessor.h index 8c9e0d6be2..b5966b04a7 100644 --- a/src/gpu/GrPathProcessor.h +++ b/src/gpu/GrPathProcessor.h @@ -31,10 +31,10 @@ public: bool willUseGeoShader() const override { return false; } - virtual void getGLSLProcessorKey(const GrGLSLCaps& caps, + virtual void getGLSLProcessorKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const override; - virtual GrGLSLPrimitiveProcessor* createGLSLInstance(const GrGLSLCaps& caps) const override; + virtual GrGLSLPrimitiveProcessor* createGLSLInstance(const GrShaderCaps& caps) const override; const GrXPOverridesForBatch& overrides() const { return fOverrides; } diff --git a/src/gpu/GrPathRendererChain.cpp b/src/gpu/GrPathRendererChain.cpp index 95105ba079..05f47fdc7a 100644 --- a/src/gpu/GrPathRendererChain.cpp +++ b/src/gpu/GrPathRendererChain.cpp @@ -9,8 +9,8 @@ #include "GrPathRendererChain.h" #include "GrCaps.h" +#include "GrShaderCaps.h" #include "gl/GrGLCaps.h" -#include "glsl/GrGLSLCaps.h" #include "GrContext.h" #include "GrGpu.h" diff --git a/src/gpu/GrPrimitiveProcessor.h b/src/gpu/GrPrimitiveProcessor.h index 561f54be03..cb23897fb6 100644 --- a/src/gpu/GrPrimitiveProcessor.h +++ b/src/gpu/GrPrimitiveProcessor.h @@ -42,7 +42,6 @@ * it emits the appropriate color, or none at all, as directed. */ -class GrGLSLCaps; class GrGLSLPrimitiveProcessor; struct GrInitInvariantOutput; @@ -190,14 +189,13 @@ public: * * TODO: A better name for this function would be "compute" instead of "get". */ - virtual void getGLSLProcessorKey(const GrGLSLCaps& caps, - GrProcessorKeyBuilder* b) const = 0; + virtual void getGLSLProcessorKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const = 0; /** Returns a new instance of the appropriate *GL* implementation class for the given GrProcessor; caller is responsible for deleting the object. */ - virtual GrGLSLPrimitiveProcessor* createGLSLInstance(const GrGLSLCaps& caps) const = 0; + virtual GrGLSLPrimitiveProcessor* createGLSLInstance(const GrShaderCaps&) const = 0; virtual bool isPathRendering() const { return false; } diff --git a/src/gpu/GrProgramDesc.cpp b/src/gpu/GrProgramDesc.cpp index 9f3278c927..0390df01c0 100644 --- a/src/gpu/GrProgramDesc.cpp +++ b/src/gpu/GrProgramDesc.cpp @@ -9,11 +9,11 @@ #include "GrProcessor.h" #include "GrPipeline.h" #include "GrRenderTargetPriv.h" +#include "GrShaderCaps.h" #include "GrTexturePriv.h" #include "SkChecksum.h" #include "glsl/GrGLSLFragmentProcessor.h" #include "glsl/GrGLSLFragmentShaderBuilder.h" -#include "glsl/GrGLSLCaps.h" enum { kSamplerOrImageTypeKeyBits = 4 @@ -52,7 +52,7 @@ static inline uint16_t image_storage_or_sampler_uniform_type_key(GrSLType type ) } static uint16_t sampler_key(GrSLType samplerType, GrPixelConfig config, GrShaderFlags visibility, - const GrGLSLCaps& caps) { + const GrShaderCaps& caps) { int samplerTypeKey = image_storage_or_sampler_uniform_type_key(samplerType); GR_STATIC_ASSERT(1 == sizeof(caps.configTextureSwizzle(config).asKey())); @@ -68,7 +68,7 @@ static uint16_t storage_image_key(const GrProcessor::ImageStorageAccess& imageAc } static void add_sampler_and_image_keys(GrProcessorKeyBuilder* b, const GrProcessor& proc, - const GrGLSLCaps& caps) { + const GrShaderCaps& caps) { int numTextureSamplers = proc.numTextureSamplers(); int numBuffers = proc.numBuffers(); int numImageStorages = proc.numImageStorages(); @@ -110,7 +110,7 @@ static void add_sampler_and_image_keys(GrProcessorKeyBuilder* b, const GrProcess * function because it is hairy, though FPs do not have attribs, and GPs do not have transforms */ static bool gen_meta_key(const GrProcessor& proc, - const GrGLSLCaps& glslCaps, + const GrShaderCaps& glslCaps, uint32_t transformKey, GrProcessorKeyBuilder* b) { size_t processorKeySize = b->size(); @@ -132,7 +132,7 @@ static bool gen_meta_key(const GrProcessor& proc, static bool gen_frag_proc_and_meta_keys(const GrPrimitiveProcessor& primProc, const GrFragmentProcessor& fp, - const GrGLSLCaps& glslCaps, + const GrShaderCaps& glslCaps, GrProcessorKeyBuilder* b) { for (int i = 0; i < fp.numChildProcessors(); ++i) { if (!gen_frag_proc_and_meta_keys(primProc, fp.childProcessor(i), glslCaps, b)) { @@ -150,7 +150,7 @@ bool GrProgramDesc::Build(GrProgramDesc* desc, const GrPrimitiveProcessor& primProc, bool hasPointSize, const GrPipeline& pipeline, - const GrGLSLCaps& glslCaps) { + const GrShaderCaps& glslCaps) { // The descriptor is used as a cache key. Thus when a field of the // descriptor will not affect program generation (because of the attribute // bindings in use or other descriptor field settings) it should be set diff --git a/src/gpu/GrProgramDesc.h b/src/gpu/GrProgramDesc.h index f304ec53e1..5bb43f958b 100644 --- a/src/gpu/GrProgramDesc.h +++ b/src/gpu/GrProgramDesc.h @@ -13,7 +13,7 @@ #include "SkOpts.h" #include "SkTArray.h" -class GrGLSLCaps; +class GrShaderCaps; class GrPipeline; class GrPrimitiveProcessor; @@ -34,14 +34,14 @@ public: * general draw information, as well as the specific color, geometry, * and coverage stages which will be used to generate the GL Program for * this optstate. - * @param GrGLSLCaps Capabilities of the GLSL backend. + * @param GrShaderCaps Capabilities of the shading language. * @param GrProgramDesc The built and finalized descriptor **/ static bool Build(GrProgramDesc*, const GrPrimitiveProcessor&, bool hasPointSize, const GrPipeline&, - const GrGLSLCaps&); + const GrShaderCaps&); // Returns this as a uint32_t array to be used as a key in the program cache. const uint32_t* asKey() const { diff --git a/src/gpu/GrRenderTargetContext.cpp b/src/gpu/GrRenderTargetContext.cpp index 8cc6dd9c49..4cba6b9a70 100644 --- a/src/gpu/GrRenderTargetContext.cpp +++ b/src/gpu/GrRenderTargetContext.cpp @@ -891,7 +891,7 @@ void GrRenderTargetContext::drawRRect(const GrClip& origClip, } if (should_apply_coverage_aa(paint, fRenderTargetProxy.get(), &useHWAA)) { - GrShaderCaps* shaderCaps = fContext->caps()->shaderCaps(); + const GrShaderCaps* shaderCaps = fContext->caps()->shaderCaps(); sk_sp batch(GrOvalRenderer::CreateRRectBatch(paint.getColor(), paint.usesDistanceVectorField(), viewMatrix, @@ -948,7 +948,7 @@ void GrRenderTargetContext::drawShadowRRect(const GrClip& clip, //} if (should_apply_coverage_aa(paint, fRenderTargetProxy.get(), &useHWAA)) { - GrShaderCaps* shaderCaps = fContext->caps()->shaderCaps(); + const GrShaderCaps* shaderCaps = fContext->caps()->shaderCaps(); sk_sp batch(CreateShadowRRectBatch( paint.getColor(), viewMatrix, @@ -1134,7 +1134,7 @@ void GrRenderTargetContext::drawOval(const GrClip& clip, } if (should_apply_coverage_aa(paint, fRenderTargetProxy.get(), &useHWAA)) { - GrShaderCaps* shaderCaps = fContext->caps()->shaderCaps(); + const GrShaderCaps* shaderCaps = fContext->caps()->shaderCaps(); sk_sp batch(GrOvalRenderer::CreateOvalBatch(paint.getColor(), viewMatrix, oval, @@ -1163,7 +1163,7 @@ void GrRenderTargetContext::drawArc(const GrClip& clip, const GrStyle& style) { bool useHWAA; if (should_apply_coverage_aa(paint, fRenderTargetProxy.get(), &useHWAA)) { - GrShaderCaps* shaderCaps = fContext->caps()->shaderCaps(); + const GrShaderCaps* shaderCaps = fContext->caps()->shaderCaps(); sk_sp batch(GrOvalRenderer::CreateArcBatch(paint.getColor(), viewMatrix, oval, @@ -1377,7 +1377,7 @@ void GrRenderTargetContext::drawPath(const GrClip& clip, bool isOval = path.isOval(&ovalRect); if (isOval && !path.isInverseFillType()) { - GrShaderCaps* shaderCaps = fContext->caps()->shaderCaps(); + const GrShaderCaps* shaderCaps = fContext->caps()->shaderCaps(); sk_sp batch(GrOvalRenderer::CreateOvalBatch(paint.getColor(), viewMatrix, ovalRect, diff --git a/src/gpu/glsl/GrGLSLCaps.cpp b/src/gpu/GrShaderCaps.cpp similarity index 73% rename from src/gpu/glsl/GrGLSLCaps.cpp rename to src/gpu/GrShaderCaps.cpp index 57e5a0c04e..3e6323f255 100644 --- a/src/gpu/glsl/GrGLSLCaps.cpp +++ b/src/gpu/GrShaderCaps.cpp @@ -6,15 +6,48 @@ */ -#include "GrGLSLCaps.h" +#include "GrShaderCaps.h" #include "GrContextOptions.h" //////////////////////////////////////////////////////////////////////////////////////////// -GrGLSLCaps::GrGLSLCaps(const GrContextOptions& options) { - fGLSLGeneration = k330_GrGLSLGeneration; +static const char* shader_type_to_string(GrShaderType type) { + switch (type) { + case kVertex_GrShaderType: + return "vertex"; + case kGeometry_GrShaderType: + return "geometry"; + case kFragment_GrShaderType: + return "fragment"; + } + return ""; +} + +static const char* precision_to_string(GrSLPrecision p) { + switch (p) { + case kLow_GrSLPrecision: + return "low"; + case kMedium_GrSLPrecision: + return "medium"; + case kHigh_GrSLPrecision: + return "high"; + } + return ""; +} +GrShaderCaps::GrShaderCaps(const GrContextOptions& options) { + fGLSLGeneration = k330_GrGLSLGeneration; + fShaderDerivativeSupport = false; + fGeometryShaderSupport = false; + fPathRenderingSupport = false; + fDstReadInShaderSupport = false; + fDualSourceBlendingSupport = false; + fIntegerSupport = false; + fTexelBufferSupport = false; + fImageLoadStoreSupport = false; + fShaderPrecisionVaries = false; + fPLSPathRenderingSupport = false; fDropsTileOnZeroDivide = false; fFBFetchSupport = false; fFBFetchNeedsCustomOutput = false; @@ -31,6 +64,9 @@ GrGLSLCaps::GrGLSLCaps(const GrContextOptions& options) { fSampleMaskOverrideCoverageSupport = false; fExternalTextureSupport = false; fTexelFetchSupport = false; + + fPixelLocalStorageSize = 0; + fVersionDeclString = nullptr; fShaderDerivativeExtensionString = nullptr; fFragCoordConventionsExtensionString = nullptr; @@ -54,8 +90,34 @@ GrGLSLCaps::GrGLSLCaps(const GrContextOptions& options) { fAdvBlendEqInteraction = kNotSupported_AdvBlendEqInteraction; } -SkString GrGLSLCaps::dump() const { - SkString r = INHERITED::dump(); +SkString GrShaderCaps::dump() const { + SkString r; + static const char* gNY[] = { "NO", "YES" }; + r.appendf("Shader Derivative Support : %s\n", gNY[fShaderDerivativeSupport]); + r.appendf("Geometry Shader Support : %s\n", gNY[fGeometryShaderSupport]); + r.appendf("Path Rendering Support : %s\n", gNY[fPathRenderingSupport]); + r.appendf("Dst Read In Shader Support : %s\n", gNY[fDstReadInShaderSupport]); + r.appendf("Dual Source Blending Support : %s\n", gNY[fDualSourceBlendingSupport]); + r.appendf("Integer Support : %s\n", gNY[fIntegerSupport]); + r.appendf("Texel Buffer Support : %s\n", gNY[fTexelBufferSupport]); + r.appendf("Image Load Store Support : %s\n", gNY[fImageLoadStoreSupport]); + + r.appendf("Shader Float Precisions (varies: %s):\n", gNY[fShaderPrecisionVaries]); + + for (int s = 0; s < kGrShaderTypeCount; ++s) { + GrShaderType shaderType = static_cast(s); + r.appendf("\t%s:\n", shader_type_to_string(shaderType)); + for (int p = 0; p < kGrSLPrecisionCount; ++p) { + if (fFloatPrecisions[s][p].supported()) { + GrSLPrecision precision = static_cast(p); + r.appendf("\t\t%s: log_low: %d log_high: %d bits: %d\n", + precision_to_string(precision), + fFloatPrecisions[s][p].fLogRangeLow, + fFloatPrecisions[s][p].fLogRangeHigh, + fFloatPrecisions[s][p].fBits); + } + } + } static const char* kAdvBlendEqInteractionStr[] = { "Not Supported", @@ -104,7 +166,7 @@ SkString GrGLSLCaps::dump() const { return r; } -void GrGLSLCaps::initSamplerPrecisionTable() { +void GrShaderCaps::initSamplerPrecisionTable() { // Determine the largest precision qualifiers that are effectively the same as lowp/mediump. // e.g. if lowp == mediump, then use mediump instead of lowp. GrSLPrecision effectiveMediumP[kGrShaderTypeCount]; @@ -160,5 +222,6 @@ void GrGLSLCaps::initSamplerPrecisionTable() { } } -void GrGLSLCaps::onApplyOptionsOverrides(const GrContextOptions& options) { +void GrShaderCaps::applyOptionsOverrides(const GrContextOptions& options) { + fDualSourceBlendingSupport = fDualSourceBlendingSupport && !options.fSuppressDualSourceBlending; } diff --git a/src/gpu/GrShaderVar.cpp b/src/gpu/GrShaderVar.cpp index 75142cab7f..da8bc7a934 100644 --- a/src/gpu/GrShaderVar.cpp +++ b/src/gpu/GrShaderVar.cpp @@ -7,7 +7,7 @@ #include "GrShaderVar.h" -#include "glsl/GrGLSLCaps.h" +#include "GrShaderCaps.h" static const char* type_modifier_string(GrShaderVar::TypeModifier t) { switch (t) { @@ -80,7 +80,7 @@ void GrShaderVar::setIOType(GrIOType ioType) { SkFAIL("Unknown io type."); } -void GrShaderVar::appendDecl(const GrGLSLCaps* glslCaps, SkString* out) const { +void GrShaderVar::appendDecl(const GrShaderCaps* glslCaps, SkString* out) const { SkASSERT(kDefault_GrSLPrecision == fPrecision || GrSLTypeAcceptsPrecision(fType)); SkString layout = fLayoutQualifier; if (!fLayoutQualifier.isEmpty()) { diff --git a/src/gpu/GrXferProcessor.cpp b/src/gpu/GrXferProcessor.cpp index 2769c1810e..ebf949285b 100644 --- a/src/gpu/GrXferProcessor.cpp +++ b/src/gpu/GrXferProcessor.cpp @@ -67,7 +67,8 @@ void GrXferProcessor::getBlendInfo(BlendInfo* blendInfo) const { } } -void GrXferProcessor::getGLSLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) const { +void GrXferProcessor::getGLSLProcessorKey(const GrShaderCaps& caps, + GrProcessorKeyBuilder* b) const { uint32_t key = this->willReadDstColor() ? 0x1 : 0x0; if (key) { if (const GrTexture* dstTexture = this->getDstTexture()) { diff --git a/src/gpu/batches/GrAAConvexPathRenderer.cpp b/src/gpu/batches/GrAAConvexPathRenderer.cpp index 4683aa1484..bec774c281 100644 --- a/src/gpu/batches/GrAAConvexPathRenderer.cpp +++ b/src/gpu/batches/GrAAConvexPathRenderer.cpp @@ -601,7 +601,7 @@ public: } static inline void GenKey(const GrGeometryProcessor& gp, - const GrGLSLCaps&, + const GrShaderCaps&, GrProcessorKeyBuilder* b) { const QuadEdgeEffect& qee = gp.cast(); uint32_t key = 0; @@ -630,11 +630,11 @@ public: typedef GrGLSLGeometryProcessor INHERITED; }; - void getGLSLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) const override { + void getGLSLProcessorKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const override { GLSLProcessor::GenKey(*this, caps, b); } - GrGLSLPrimitiveProcessor* createGLSLInstance(const GrGLSLCaps&) const override { + GrGLSLPrimitiveProcessor* createGLSLInstance(const GrShaderCaps&) const override { return new GLSLProcessor(); } diff --git a/src/gpu/batches/GrAnalyticRectBatch.cpp b/src/gpu/batches/GrAnalyticRectBatch.cpp index 1ddcbdbef7..fb343df602 100644 --- a/src/gpu/batches/GrAnalyticRectBatch.cpp +++ b/src/gpu/batches/GrAnalyticRectBatch.cpp @@ -189,7 +189,7 @@ public: } static void GenKey(const GrGeometryProcessor& gp, - const GrGLSLCaps&, + const GrShaderCaps&, GrProcessorKeyBuilder* b) { b->add32(0x0); } @@ -204,11 +204,11 @@ public: typedef GrGLSLGeometryProcessor INHERITED; }; - void getGLSLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) const override { + void getGLSLProcessorKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const override { GLSLProcessor::GenKey(*this, caps, b); } - GrGLSLPrimitiveProcessor* createGLSLInstance(const GrGLSLCaps&) const override { + GrGLSLPrimitiveProcessor* createGLSLInstance(const GrShaderCaps&) const override { return new GLSLProcessor(); } diff --git a/src/gpu/batches/GrMSAAPathRenderer.cpp b/src/gpu/batches/GrMSAAPathRenderer.cpp index 0945c63faa..a1fc635c61 100644 --- a/src/gpu/batches/GrMSAAPathRenderer.cpp +++ b/src/gpu/batches/GrMSAAPathRenderer.cpp @@ -158,7 +158,7 @@ public: } static inline void GenKey(const GrGeometryProcessor& gp, - const GrGLSLCaps&, + const GrShaderCaps&, GrProcessorKeyBuilder* b) { const MSAAQuadProcessor& qp = gp.cast(); uint32_t key = 0; @@ -184,12 +184,12 @@ public: UniformHandle fViewMatrixUniform; }; - virtual void getGLSLProcessorKey(const GrGLSLCaps& caps, + virtual void getGLSLProcessorKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const override { GLSLProcessor::GenKey(*this, caps, b); } - virtual GrGLSLPrimitiveProcessor* createGLSLInstance(const GrGLSLCaps&) const override { + virtual GrGLSLPrimitiveProcessor* createGLSLInstance(const GrShaderCaps&) const override { return new GLSLProcessor(*this); } diff --git a/src/gpu/batches/GrPLSPathRenderer.cpp b/src/gpu/batches/GrPLSPathRenderer.cpp index 1aedccb5f9..a41e1401ca 100644 --- a/src/gpu/batches/GrPLSPathRenderer.cpp +++ b/src/gpu/batches/GrPLSPathRenderer.cpp @@ -381,7 +381,7 @@ public: } static inline void GenKey(const GrGeometryProcessor& gp, - const GrGLSLCaps&, + const GrShaderCaps&, GrProcessorKeyBuilder* b) { const PLSAATriangleEffect& te = gp.cast(); uint32_t key = 0; @@ -399,12 +399,12 @@ public: typedef GrGLSLGeometryProcessor INHERITED; }; - virtual void getGLSLProcessorKey(const GrGLSLCaps& caps, + virtual void getGLSLProcessorKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const override { GLSLProcessor::GenKey(*this, caps, b); } - virtual GrGLSLPrimitiveProcessor* createGLSLInstance(const GrGLSLCaps&) const override { + virtual GrGLSLPrimitiveProcessor* createGLSLInstance(const GrShaderCaps&) const override { return new GLSLProcessor(*this); } @@ -563,7 +563,7 @@ public: } static inline void GenKey(const GrGeometryProcessor& gp, - const GrGLSLCaps&, + const GrShaderCaps&, GrProcessorKeyBuilder* b) { const PLSQuadEdgeEffect& qee = gp.cast(); uint32_t key = 0; @@ -581,12 +581,12 @@ public: typedef GrGLSLGeometryProcessor INHERITED; }; - virtual void getGLSLProcessorKey(const GrGLSLCaps& caps, + virtual void getGLSLProcessorKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const override { GLSLProcessor::GenKey(*this, caps, b); } - virtual GrGLSLPrimitiveProcessor* createGLSLInstance(const GrGLSLCaps&) const override { + virtual GrGLSLPrimitiveProcessor* createGLSLInstance(const GrShaderCaps&) const override { return new GLSLProcessor(*this); } @@ -692,7 +692,7 @@ public: } static inline void GenKey(const GrGeometryProcessor& gp, - const GrGLSLCaps&, + const GrShaderCaps&, GrProcessorKeyBuilder* b) { const PLSFinishEffect& fe = gp.cast(); uint32_t key = 0; @@ -721,12 +721,12 @@ public: typedef GrGLSLGeometryProcessor INHERITED; }; - virtual void getGLSLProcessorKey(const GrGLSLCaps& caps, + virtual void getGLSLProcessorKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const override { GLSLProcessor::GenKey(*this, caps, b); } - virtual GrGLSLPrimitiveProcessor* createGLSLInstance(const GrGLSLCaps&) const override { + virtual GrGLSLPrimitiveProcessor* createGLSLInstance(const GrShaderCaps&) const override { return new GLSLProcessor(*this); } diff --git a/src/gpu/effects/GrBezierEffect.cpp b/src/gpu/effects/GrBezierEffect.cpp index cd7f763148..1465fbb54e 100644 --- a/src/gpu/effects/GrBezierEffect.cpp +++ b/src/gpu/effects/GrBezierEffect.cpp @@ -7,7 +7,7 @@ #include "GrBezierEffect.h" -#include "glsl/GrGLSLCaps.h" +#include "GrShaderCaps.h" #include "glsl/GrGLSLFragmentShaderBuilder.h" #include "glsl/GrGLSLGeometryProcessor.h" #include "glsl/GrGLSLProgramDataManager.h" @@ -23,7 +23,7 @@ public: void onEmitCode(EmitArgs&, GrGPArgs*) override; static inline void GenKey(const GrGeometryProcessor&, - const GrGLSLCaps&, + const GrShaderCaps&, GrProcessorKeyBuilder*); void setData(const GrGLSLProgramDataManager& pdman, const GrPrimitiveProcessor& primProc, @@ -218,7 +218,7 @@ void GrGLConicEffect::onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) { } void GrGLConicEffect::GenKey(const GrGeometryProcessor& gp, - const GrGLSLCaps&, + const GrShaderCaps&, GrProcessorKeyBuilder* b) { const GrConicEffect& ce = gp.cast(); uint32_t key = ce.isAntiAliased() ? (ce.isFilled() ? 0x0 : 0x1) : 0x2; @@ -233,12 +233,12 @@ void GrGLConicEffect::GenKey(const GrGeometryProcessor& gp, GrConicEffect::~GrConicEffect() {} -void GrConicEffect::getGLSLProcessorKey(const GrGLSLCaps& caps, +void GrConicEffect::getGLSLProcessorKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const { GrGLConicEffect::GenKey(*this, caps, b); } -GrGLSLPrimitiveProcessor* GrConicEffect::createGLSLInstance(const GrGLSLCaps&) const { +GrGLSLPrimitiveProcessor* GrConicEffect::createGLSLInstance(const GrShaderCaps&) const { return new GrGLConicEffect(*this); } @@ -285,7 +285,7 @@ public: void onEmitCode(EmitArgs&, GrGPArgs*) override; static inline void GenKey(const GrGeometryProcessor&, - const GrGLSLCaps&, + const GrShaderCaps&, GrProcessorKeyBuilder*); void setData(const GrGLSLProgramDataManager& pdman, const GrPrimitiveProcessor& primProc, @@ -422,7 +422,7 @@ void GrGLQuadEffect::onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) { } void GrGLQuadEffect::GenKey(const GrGeometryProcessor& gp, - const GrGLSLCaps&, + const GrShaderCaps&, GrProcessorKeyBuilder* b) { const GrQuadEffect& ce = gp.cast(); uint32_t key = ce.isAntiAliased() ? (ce.isFilled() ? 0x0 : 0x1) : 0x2; @@ -437,12 +437,12 @@ void GrGLQuadEffect::GenKey(const GrGeometryProcessor& gp, GrQuadEffect::~GrQuadEffect() {} -void GrQuadEffect::getGLSLProcessorKey(const GrGLSLCaps& caps, +void GrQuadEffect::getGLSLProcessorKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const { GrGLQuadEffect::GenKey(*this, caps, b); } -GrGLSLPrimitiveProcessor* GrQuadEffect::createGLSLInstance(const GrGLSLCaps&) const { +GrGLSLPrimitiveProcessor* GrQuadEffect::createGLSLInstance(const GrShaderCaps&) const { return new GrGLQuadEffect(*this); } @@ -490,7 +490,7 @@ public: void onEmitCode(EmitArgs&, GrGPArgs*) override; static inline void GenKey(const GrGeometryProcessor&, - const GrGLSLCaps&, + const GrShaderCaps&, GrProcessorKeyBuilder*); void setData(const GrGLSLProgramDataManager& pdman, const GrPrimitiveProcessor& primProc, @@ -652,7 +652,7 @@ void GrGLCubicEffect::onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) { } void GrGLCubicEffect::GenKey(const GrGeometryProcessor& gp, - const GrGLSLCaps&, + const GrShaderCaps&, GrProcessorKeyBuilder* b) { const GrCubicEffect& ce = gp.cast(); uint32_t key = ce.isAntiAliased() ? (ce.isFilled() ? 0x0 : 0x1) : 0x2; @@ -665,11 +665,11 @@ void GrGLCubicEffect::GenKey(const GrGeometryProcessor& gp, GrCubicEffect::~GrCubicEffect() {} -void GrCubicEffect::getGLSLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) const { +void GrCubicEffect::getGLSLProcessorKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const { GrGLCubicEffect::GenKey(*this, caps, b); } -GrGLSLPrimitiveProcessor* GrCubicEffect::createGLSLInstance(const GrGLSLCaps&) const { +GrGLSLPrimitiveProcessor* GrCubicEffect::createGLSLInstance(const GrShaderCaps&) const { return new GrGLCubicEffect(*this); } diff --git a/src/gpu/effects/GrBezierEffect.h b/src/gpu/effects/GrBezierEffect.h index 50dca99242..edb14080d4 100644 --- a/src/gpu/effects/GrBezierEffect.h +++ b/src/gpu/effects/GrBezierEffect.h @@ -106,9 +106,9 @@ public: bool usesLocalCoords() const { return fUsesLocalCoords; } uint8_t coverageScale() const { return fCoverageScale; } - void getGLSLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) const override; + void getGLSLProcessorKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const override; - GrGLSLPrimitiveProcessor* createGLSLInstance(const GrGLSLCaps&) const override; + GrGLSLPrimitiveProcessor* createGLSLInstance(const GrShaderCaps&) const override; private: GrConicEffect(GrColor, const SkMatrix& viewMatrix, uint8_t coverage, GrPrimitiveEdgeType, @@ -189,9 +189,9 @@ public: bool usesLocalCoords() const { return fUsesLocalCoords; } uint8_t coverageScale() const { return fCoverageScale; } - void getGLSLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) const override; + void getGLSLProcessorKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const override; - GrGLSLPrimitiveProcessor* createGLSLInstance(const GrGLSLCaps&) const override; + GrGLSLPrimitiveProcessor* createGLSLInstance(const GrShaderCaps&) const override; private: GrQuadEffect(GrColor, const SkMatrix& viewMatrix, uint8_t coverage, GrPrimitiveEdgeType, @@ -264,9 +264,9 @@ public: bool colorIgnored() const { return GrColor_ILLEGAL == fColor; } const SkMatrix& viewMatrix() const { return fViewMatrix; } - void getGLSLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) const override; + void getGLSLProcessorKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const override; - GrGLSLPrimitiveProcessor* createGLSLInstance(const GrGLSLCaps&) const override; + GrGLSLPrimitiveProcessor* createGLSLInstance(const GrShaderCaps&) const override; private: GrCubicEffect(GrColor, const SkMatrix& viewMatrix, GrPrimitiveEdgeType); diff --git a/src/gpu/effects/GrBicubicEffect.cpp b/src/gpu/effects/GrBicubicEffect.cpp index ce7f344c17..d109ef14a9 100644 --- a/src/gpu/effects/GrBicubicEffect.cpp +++ b/src/gpu/effects/GrBicubicEffect.cpp @@ -7,11 +7,11 @@ #include "GrBicubicEffect.h" #include "GrInvariantOutput.h" -#include "glsl/GrGLSL.h" #include "glsl/GrGLSLColorSpaceXformHelper.h" #include "glsl/GrGLSLFragmentShaderBuilder.h" #include "glsl/GrGLSLProgramDataManager.h" #include "glsl/GrGLSLUniformHandler.h" +#include "../private/GrGLSL.h" #define DS(x) SkDoubleToScalar(x) @@ -27,7 +27,7 @@ class GrGLBicubicEffect : public GrGLSLFragmentProcessor { public: void emitCode(EmitArgs&) override; - static inline void GenKey(const GrProcessor& effect, const GrGLSLCaps&, + static inline void GenKey(const GrProcessor& effect, const GrShaderCaps&, GrProcessorKeyBuilder* b) { const GrBicubicEffect& bicubicEffect = effect.cast(); b->add32(GrTextureDomain::GLDomain::DomainKey(bicubicEffect.domain())); @@ -177,7 +177,7 @@ GrBicubicEffect::GrBicubicEffect(GrTexture* texture, GrBicubicEffect::~GrBicubicEffect() { } -void GrBicubicEffect::onGetGLSLProcessorKey(const GrGLSLCaps& caps, +void GrBicubicEffect::onGetGLSLProcessorKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const { GrGLBicubicEffect::GenKey(*this, caps, b); } diff --git a/src/gpu/effects/GrBicubicEffect.h b/src/gpu/effects/GrBicubicEffect.h index 61ce7eb08a..0c6c43335c 100644 --- a/src/gpu/effects/GrBicubicEffect.h +++ b/src/gpu/effects/GrBicubicEffect.h @@ -103,7 +103,7 @@ private: GrGLSLFragmentProcessor* onCreateGLSLInstance() const override; - void onGetGLSLProcessorKey(const GrGLSLCaps&, GrProcessorKeyBuilder*) const override; + void onGetGLSLProcessorKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override; bool onIsEqual(const GrFragmentProcessor&) const override; diff --git a/src/gpu/effects/GrBitmapTextGeoProc.cpp b/src/gpu/effects/GrBitmapTextGeoProc.cpp index 76dc123275..8be4c2951a 100644 --- a/src/gpu/effects/GrBitmapTextGeoProc.cpp +++ b/src/gpu/effects/GrBitmapTextGeoProc.cpp @@ -98,7 +98,7 @@ public: } static inline void GenKey(const GrGeometryProcessor& proc, - const GrGLSLCaps&, + const GrShaderCaps&, GrProcessorKeyBuilder* b) { const GrBitmapTextGeoProc& gp = proc.cast(); uint32_t key = 0; @@ -146,12 +146,12 @@ GrBitmapTextGeoProc::GrBitmapTextGeoProc(GrColor color, GrTexture* texture, this->addTextureSampler(&fTextureSampler); } -void GrBitmapTextGeoProc::getGLSLProcessorKey(const GrGLSLCaps& caps, +void GrBitmapTextGeoProc::getGLSLProcessorKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const { GrGLBitmapTextGeoProc::GenKey(*this, caps, b); } -GrGLSLPrimitiveProcessor* GrBitmapTextGeoProc::createGLSLInstance(const GrGLSLCaps& caps) const { +GrGLSLPrimitiveProcessor* GrBitmapTextGeoProc::createGLSLInstance(const GrShaderCaps& caps) const { return new GrGLBitmapTextGeoProc(); } diff --git a/src/gpu/effects/GrBitmapTextGeoProc.h b/src/gpu/effects/GrBitmapTextGeoProc.h index c8fc99b020..bf7f08febd 100644 --- a/src/gpu/effects/GrBitmapTextGeoProc.h +++ b/src/gpu/effects/GrBitmapTextGeoProc.h @@ -42,9 +42,9 @@ public: const SkMatrix& localMatrix() const { return fLocalMatrix; } bool usesLocalCoords() const { return fUsesLocalCoords; } - void getGLSLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) const override; + void getGLSLProcessorKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const override; - GrGLSLPrimitiveProcessor* createGLSLInstance(const GrGLSLCaps& caps) const override; + GrGLSLPrimitiveProcessor* createGLSLInstance(const GrShaderCaps& caps) const override; private: GrBitmapTextGeoProc(GrColor, GrTexture* texture, const GrSamplerParams& params, diff --git a/src/gpu/effects/GrConfigConversionEffect.cpp b/src/gpu/effects/GrConfigConversionEffect.cpp index 6f67838270..becd84aea1 100644 --- a/src/gpu/effects/GrConfigConversionEffect.cpp +++ b/src/gpu/effects/GrConfigConversionEffect.cpp @@ -11,9 +11,9 @@ #include "GrInvariantOutput.h" #include "GrSimpleTextureEffect.h" #include "SkMatrix.h" -#include "glsl/GrGLSL.h" #include "glsl/GrGLSLFragmentProcessor.h" #include "glsl/GrGLSLFragmentShaderBuilder.h" +#include "../private/GrGLSL.h" class GrGLConfigConversionEffect : public GrGLSLFragmentProcessor { public: @@ -81,7 +81,7 @@ public: fragBuilder->codeAppend(modulate.c_str()); } - static inline void GenKey(const GrProcessor& processor, const GrGLSLCaps&, + static inline void GenKey(const GrProcessor& processor, const GrShaderCaps&, GrProcessorKeyBuilder* b) { const GrConfigConversionEffect& cce = processor.cast(); uint32_t key = (cce.swizzle().asKey()) | (cce.pmConversion() << 16); @@ -150,7 +150,7 @@ sk_sp GrConfigConversionEffect::TestCreate(GrProcessorTestD /////////////////////////////////////////////////////////////////////////////// -void GrConfigConversionEffect::onGetGLSLProcessorKey(const GrGLSLCaps& caps, +void GrConfigConversionEffect::onGetGLSLProcessorKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const { GrGLConfigConversionEffect::GenKey(*this, caps, b); } diff --git a/src/gpu/effects/GrConfigConversionEffect.h b/src/gpu/effects/GrConfigConversionEffect.h index 93b49aa656..27361f403c 100644 --- a/src/gpu/effects/GrConfigConversionEffect.h +++ b/src/gpu/effects/GrConfigConversionEffect.h @@ -58,7 +58,7 @@ private: GrGLSLFragmentProcessor* onCreateGLSLInstance() const override; - void onGetGLSLProcessorKey(const GrGLSLCaps&, GrProcessorKeyBuilder*) const override; + void onGetGLSLProcessorKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override; bool onIsEqual(const GrFragmentProcessor&) const override; diff --git a/src/gpu/effects/GrConstColorProcessor.cpp b/src/gpu/effects/GrConstColorProcessor.cpp index 019d6991c2..0efe997f78 100644 --- a/src/gpu/effects/GrConstColorProcessor.cpp +++ b/src/gpu/effects/GrConstColorProcessor.cpp @@ -86,7 +86,7 @@ void GrConstColorProcessor::onComputeInvariantOutput(GrInvariantOutput* inout) c } } -void GrConstColorProcessor::onGetGLSLProcessorKey(const GrGLSLCaps&, +void GrConstColorProcessor::onGetGLSLProcessorKey(const GrShaderCaps&, GrProcessorKeyBuilder* b) const { b->add32(fMode); } diff --git a/src/gpu/effects/GrConvexPolyEffect.cpp b/src/gpu/effects/GrConvexPolyEffect.cpp index fc28ec7fe3..a64e5cb490 100644 --- a/src/gpu/effects/GrConvexPolyEffect.cpp +++ b/src/gpu/effects/GrConvexPolyEffect.cpp @@ -9,11 +9,11 @@ #include "GrInvariantOutput.h" #include "SkPathPriv.h" #include "effects/GrConstColorProcessor.h" -#include "glsl/GrGLSL.h" #include "glsl/GrGLSLFragmentProcessor.h" #include "glsl/GrGLSLFragmentShaderBuilder.h" #include "glsl/GrGLSLProgramDataManager.h" #include "glsl/GrGLSLUniformHandler.h" +#include "../private/GrGLSL.h" ////////////////////////////////////////////////////////////////////////////// class AARectEffect : public GrFragmentProcessor { @@ -28,7 +28,7 @@ public: const char* name() const override { return "AARect"; } - void onGetGLSLProcessorKey(const GrGLSLCaps&, GrProcessorKeyBuilder*) const override; + void onGetGLSLProcessorKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override; private: AARectEffect(GrPrimitiveEdgeType edgeType, const SkRect& rect) @@ -89,7 +89,7 @@ public: void emitCode(EmitArgs&) override; - static inline void GenKey(const GrProcessor&, const GrGLSLCaps&, GrProcessorKeyBuilder*); + static inline void GenKey(const GrProcessor&, const GrShaderCaps&, GrProcessorKeyBuilder*); protected: void onSetData(const GrGLSLProgramDataManager&, const GrProcessor&) override; @@ -151,13 +151,13 @@ void GLAARectEffect::onSetData(const GrGLSLProgramDataManager& pdman, } } -void GLAARectEffect::GenKey(const GrProcessor& processor, const GrGLSLCaps&, +void GLAARectEffect::GenKey(const GrProcessor& processor, const GrShaderCaps&, GrProcessorKeyBuilder* b) { const AARectEffect& aare = processor.cast(); b->add32(aare.getEdgeType()); } -void AARectEffect::onGetGLSLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) const { +void AARectEffect::onGetGLSLProcessorKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const { GLAARectEffect::GenKey(*this, caps, b); } @@ -175,7 +175,7 @@ public: void emitCode(EmitArgs&) override; - static inline void GenKey(const GrProcessor&, const GrGLSLCaps&, GrProcessorKeyBuilder*); + static inline void GenKey(const GrProcessor&, const GrShaderCaps&, GrProcessorKeyBuilder*); protected: void onSetData(const GrGLSLProgramDataManager&, const GrProcessor&) override; @@ -228,7 +228,7 @@ void GrGLConvexPolyEffect::onSetData(const GrGLSLProgramDataManager& pdman, } } -void GrGLConvexPolyEffect::GenKey(const GrProcessor& processor, const GrGLSLCaps&, +void GrGLConvexPolyEffect::GenKey(const GrProcessor& processor, const GrShaderCaps&, GrProcessorKeyBuilder* b) { const GrConvexPolyEffect& cpe = processor.cast(); GR_STATIC_ASSERT(kGrProcessorEdgeTypeCnt <= 8); @@ -327,7 +327,7 @@ void GrConvexPolyEffect::onComputeInvariantOutput(GrInvariantOutput* inout) cons inout->mulByUnknownSingleComponent(); } -void GrConvexPolyEffect::onGetGLSLProcessorKey(const GrGLSLCaps& caps, +void GrConvexPolyEffect::onGetGLSLProcessorKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const { GrGLConvexPolyEffect::GenKey(*this, caps, b); } diff --git a/src/gpu/effects/GrConvexPolyEffect.h b/src/gpu/effects/GrConvexPolyEffect.h index 8fc76feb5b..2d9d20fc7f 100644 --- a/src/gpu/effects/GrConvexPolyEffect.h +++ b/src/gpu/effects/GrConvexPolyEffect.h @@ -74,7 +74,7 @@ private: GrGLSLFragmentProcessor* onCreateGLSLInstance() const override; - void onGetGLSLProcessorKey(const GrGLSLCaps&, GrProcessorKeyBuilder*) const override; + void onGetGLSLProcessorKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override; bool onIsEqual(const GrFragmentProcessor& other) const override; diff --git a/src/gpu/effects/GrConvolutionEffect.cpp b/src/gpu/effects/GrConvolutionEffect.cpp index fbca64668d..b4e1ec3e4c 100644 --- a/src/gpu/effects/GrConvolutionEffect.cpp +++ b/src/gpu/effects/GrConvolutionEffect.cpp @@ -6,11 +6,11 @@ */ #include "GrConvolutionEffect.h" -#include "glsl/GrGLSL.h" #include "glsl/GrGLSLFragmentProcessor.h" #include "glsl/GrGLSLFragmentShaderBuilder.h" #include "glsl/GrGLSLProgramDataManager.h" #include "glsl/GrGLSLUniformHandler.h" +#include "../private/GrGLSL.h" // For brevity typedef GrGLSLProgramDataManager::UniformHandle UniformHandle; @@ -19,7 +19,7 @@ class GrGLConvolutionEffect : public GrGLSLFragmentProcessor { public: void emitCode(EmitArgs&) override; - static inline void GenKey(const GrProcessor&, const GrGLSLCaps&, GrProcessorKeyBuilder*); + static inline void GenKey(const GrProcessor&, const GrShaderCaps&, GrProcessorKeyBuilder*); protected: void onSetData(const GrGLSLProgramDataManager& pdman, const GrProcessor&) override; @@ -130,7 +130,7 @@ void GrGLConvolutionEffect::onSetData(const GrGLSLProgramDataManager& pdman, pdman.set4fv(fKernelUni, arrayCount, conv.kernel()); } -void GrGLConvolutionEffect::GenKey(const GrProcessor& processor, const GrGLSLCaps&, +void GrGLConvolutionEffect::GenKey(const GrProcessor& processor, const GrShaderCaps&, GrProcessorKeyBuilder* b) { const GrConvolutionEffect& conv = processor.cast(); uint32_t key = conv.radius(); @@ -192,7 +192,7 @@ GrConvolutionEffect::GrConvolutionEffect(GrTexture* texture, GrConvolutionEffect::~GrConvolutionEffect() { } -void GrConvolutionEffect::onGetGLSLProcessorKey(const GrGLSLCaps& caps, +void GrConvolutionEffect::onGetGLSLProcessorKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const { GrGLConvolutionEffect::GenKey(*this, caps, b); } diff --git a/src/gpu/effects/GrConvolutionEffect.h b/src/gpu/effects/GrConvolutionEffect.h index c353542d03..c9a029ace9 100644 --- a/src/gpu/effects/GrConvolutionEffect.h +++ b/src/gpu/effects/GrConvolutionEffect.h @@ -84,7 +84,7 @@ private: GrGLSLFragmentProcessor* onCreateGLSLInstance() const override; - void onGetGLSLProcessorKey(const GrGLSLCaps&, GrProcessorKeyBuilder*) const override; + void onGetGLSLProcessorKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override; bool onIsEqual(const GrFragmentProcessor&) const override; diff --git a/src/gpu/effects/GrCoverageSetOpXP.cpp b/src/gpu/effects/GrCoverageSetOpXP.cpp index 78192c8b9b..a824c89b7a 100644 --- a/src/gpu/effects/GrCoverageSetOpXP.cpp +++ b/src/gpu/effects/GrCoverageSetOpXP.cpp @@ -39,7 +39,7 @@ private: GrColor* color, const GrCaps& caps) const override; - void onGetGLSLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) const override; + void onGetGLSLProcessorKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const override; void onGetBlendInfo(GrXferProcessor::BlendInfo* blendInfo) const override; @@ -63,7 +63,7 @@ public: ~GLCoverageSetOpXP() override {} - static void GenKey(const GrProcessor& processor, const GrGLSLCaps& caps, + static void GenKey(const GrProcessor& processor, const GrShaderCaps& caps, GrProcessorKeyBuilder* b) { const CoverageSetOpXP& xp = processor.cast(); uint32_t key = xp.invertCoverage() ? 0x0 : 0x1; @@ -98,7 +98,7 @@ CoverageSetOpXP::CoverageSetOpXP(SkRegion::Op regionOp, bool invertCoverage) CoverageSetOpXP::~CoverageSetOpXP() { } -void CoverageSetOpXP::onGetGLSLProcessorKey(const GrGLSLCaps& caps, +void CoverageSetOpXP::onGetGLSLProcessorKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const { GLCoverageSetOpXP::GenKey(*this, caps, b); } @@ -174,7 +174,7 @@ private: return GrXferProcessor::kIgnoreColor_OptFlag; } - void onGetGLSLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) const override; + void onGetGLSLProcessorKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const override; bool onIsEqual(const GrXferProcessor& xpBase) const override { const ShaderCSOXferProcessor& xp = xpBase.cast(); @@ -226,7 +226,7 @@ private: /////////////////////////////////////////////////////////////////////////////// -void ShaderCSOXferProcessor::onGetGLSLProcessorKey(const GrGLSLCaps&, +void ShaderCSOXferProcessor::onGetGLSLProcessorKey(const GrShaderCaps&, GrProcessorKeyBuilder* b) const { GLShaderCSOXferProcessor::GenKey(*this, b); } diff --git a/src/gpu/effects/GrCustomXfermode.cpp b/src/gpu/effects/GrCustomXfermode.cpp index 7303fd49e5..f5962c2a6f 100644 --- a/src/gpu/effects/GrCustomXfermode.cpp +++ b/src/gpu/effects/GrCustomXfermode.cpp @@ -13,9 +13,9 @@ #include "GrInvariantOutput.h" #include "GrPipeline.h" #include "GrProcessor.h" +#include "GrShaderCaps.h" #include "GrTexture.h" #include "glsl/GrGLSLBlend.h" -#include "glsl/GrGLSLCaps.h" #include "glsl/GrGLSLFragmentProcessor.h" #include "glsl/GrGLSLFragmentShaderBuilder.h" #include "glsl/GrGLSLProgramDataManager.h" @@ -107,7 +107,7 @@ private: GrColor* overrideColor, const GrCaps& caps) const override; - void onGetGLSLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) const override; + void onGetGLSLProcessorKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const override; GrXferBarrierType onXferBarrier(const GrRenderTarget*, const GrCaps&) const override; @@ -128,13 +128,14 @@ public: GLCustomXP(const GrXferProcessor&) {} ~GLCustomXP() override {} - static void GenKey(const GrXferProcessor& p, const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) { + static void GenKey(const GrXferProcessor& p, const GrShaderCaps& caps, + GrProcessorKeyBuilder* b) { const CustomXP& xp = p.cast(); uint32_t key = 0; if (xp.hasHWBlendEquation()) { SkASSERT(caps.advBlendEqInteraction() > 0); // 0 will mean !xp.hasHWBlendEquation(). key |= caps.advBlendEqInteraction(); - GR_STATIC_ASSERT(GrGLSLCaps::kLast_AdvBlendEqInteraction < 4); + GR_STATIC_ASSERT(GrShaderCaps::kLast_AdvBlendEqInteraction < 4); } if (!xp.hasHWBlendEquation() || caps.mustEnableSpecificAdvBlendEqs()) { key |= (int)xp.mode() << 3; @@ -185,7 +186,7 @@ private: /////////////////////////////////////////////////////////////////////////////// -void CustomXP::onGetGLSLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) const { +void CustomXP::onGetGLSLProcessorKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const { GLCustomXP::GenKey(*this, caps, b); } diff --git a/src/gpu/effects/GrDashingEffect.cpp b/src/gpu/effects/GrDashingEffect.cpp index 9ce725b7e6..669e604725 100644 --- a/src/gpu/effects/GrDashingEffect.cpp +++ b/src/gpu/effects/GrDashingEffect.cpp @@ -784,9 +784,9 @@ public: bool usesLocalCoords() const { return fUsesLocalCoords; } - void getGLSLProcessorKey(const GrGLSLCaps&, GrProcessorKeyBuilder* b) const override; + void getGLSLProcessorKey(const GrShaderCaps&, GrProcessorKeyBuilder* b) const override; - GrGLSLPrimitiveProcessor* createGLSLInstance(const GrGLSLCaps&) const override; + GrGLSLPrimitiveProcessor* createGLSLInstance(const GrShaderCaps&) const override; private: DashingCircleEffect(GrColor, AAMode aaMode, const SkMatrix& localMatrix, @@ -814,7 +814,7 @@ public: void onEmitCode(EmitArgs&, GrGPArgs*) override; static inline void GenKey(const GrGeometryProcessor&, - const GrGLSLCaps&, + const GrShaderCaps&, GrProcessorKeyBuilder*); void setData(const GrGLSLProgramDataManager&, const GrPrimitiveProcessor&, @@ -905,7 +905,7 @@ void GLDashingCircleEffect::setData(const GrGLSLProgramDataManager& pdman, } void GLDashingCircleEffect::GenKey(const GrGeometryProcessor& gp, - const GrGLSLCaps&, + const GrShaderCaps&, GrProcessorKeyBuilder* b) { const DashingCircleEffect& dce = gp.cast(); uint32_t key = 0; @@ -925,12 +925,12 @@ sk_sp DashingCircleEffect::Make(GrColor color, new DashingCircleEffect(color, aaMode, localMatrix, usesLocalCoords)); } -void DashingCircleEffect::getGLSLProcessorKey(const GrGLSLCaps& caps, +void DashingCircleEffect::getGLSLProcessorKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const { GLDashingCircleEffect::GenKey(*this, caps, b); } -GrGLSLPrimitiveProcessor* DashingCircleEffect::createGLSLInstance(const GrGLSLCaps&) const { +GrGLSLPrimitiveProcessor* DashingCircleEffect::createGLSLInstance(const GrShaderCaps&) const { return new GLDashingCircleEffect(); } @@ -997,9 +997,9 @@ public: bool usesLocalCoords() const { return fUsesLocalCoords; } - void getGLSLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) const override; + void getGLSLProcessorKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const override; - GrGLSLPrimitiveProcessor* createGLSLInstance(const GrGLSLCaps&) const override; + GrGLSLPrimitiveProcessor* createGLSLInstance(const GrShaderCaps&) const override; private: DashingLineEffect(GrColor, AAMode aaMode, const SkMatrix& localMatrix, @@ -1027,7 +1027,7 @@ public: void onEmitCode(EmitArgs&, GrGPArgs*) override; static inline void GenKey(const GrGeometryProcessor&, - const GrGLSLCaps&, + const GrShaderCaps&, GrProcessorKeyBuilder*); void setData(const GrGLSLProgramDataManager&, const GrPrimitiveProcessor&, @@ -1132,7 +1132,7 @@ void GLDashingLineEffect::setData(const GrGLSLProgramDataManager& pdman, } void GLDashingLineEffect::GenKey(const GrGeometryProcessor& gp, - const GrGLSLCaps&, + const GrShaderCaps&, GrProcessorKeyBuilder* b) { const DashingLineEffect& de = gp.cast(); uint32_t key = 0; @@ -1152,12 +1152,12 @@ sk_sp DashingLineEffect::Make(GrColor color, new DashingLineEffect(color, aaMode, localMatrix, usesLocalCoords)); } -void DashingLineEffect::getGLSLProcessorKey(const GrGLSLCaps& caps, +void DashingLineEffect::getGLSLProcessorKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const { GLDashingLineEffect::GenKey(*this, caps, b); } -GrGLSLPrimitiveProcessor* DashingLineEffect::createGLSLInstance(const GrGLSLCaps&) const { +GrGLSLPrimitiveProcessor* DashingLineEffect::createGLSLInstance(const GrShaderCaps&) const { return new GLDashingLineEffect(); } diff --git a/src/gpu/effects/GrDisableColorXP.cpp b/src/gpu/effects/GrDisableColorXP.cpp index 35009e1a07..fc3d4bbdd0 100644 --- a/src/gpu/effects/GrDisableColorXP.cpp +++ b/src/gpu/effects/GrDisableColorXP.cpp @@ -36,7 +36,7 @@ private: return GrXferProcessor::kIgnoreColor_OptFlag | GrXferProcessor::kIgnoreCoverage_OptFlag; } - void onGetGLSLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) const override; + void onGetGLSLProcessorKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const override; void onGetBlendInfo(GrXferProcessor::BlendInfo* blendInfo) const override; @@ -55,7 +55,7 @@ public: ~GLDisableColorXP() override {} - static void GenKey(const GrProcessor&, const GrGLSLCaps&, GrProcessorKeyBuilder*) {} + static void GenKey(const GrProcessor&, const GrShaderCaps&, GrProcessorKeyBuilder*) {} private: void emitOutputsForBlendState(const EmitArgs& args) override { @@ -77,7 +77,7 @@ DisableColorXP::DisableColorXP() { this->initClassID(); } -void DisableColorXP::onGetGLSLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) const { +void DisableColorXP::onGetGLSLProcessorKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const { GLDisableColorXP::GenKey(*this, caps, b); } diff --git a/src/gpu/effects/GrDistanceFieldGeoProc.cpp b/src/gpu/effects/GrDistanceFieldGeoProc.cpp index b77a8f438b..9d90ac9986 100644 --- a/src/gpu/effects/GrDistanceFieldGeoProc.cpp +++ b/src/gpu/effects/GrDistanceFieldGeoProc.cpp @@ -197,7 +197,7 @@ public: } static inline void GenKey(const GrGeometryProcessor& gp, - const GrGLSLCaps&, + const GrShaderCaps&, GrProcessorKeyBuilder* b) { const GrDistanceFieldA8TextGeoProc& dfTexEffect = gp.cast(); uint32_t key = dfTexEffect.getFlags(); @@ -254,12 +254,13 @@ GrDistanceFieldA8TextGeoProc::GrDistanceFieldA8TextGeoProc(GrColor color, this->addTextureSampler(&fTextureSampler); } -void GrDistanceFieldA8TextGeoProc::getGLSLProcessorKey(const GrGLSLCaps& caps, +void GrDistanceFieldA8TextGeoProc::getGLSLProcessorKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const { GrGLDistanceFieldA8TextGeoProc::GenKey(*this, caps, b); } -GrGLSLPrimitiveProcessor* GrDistanceFieldA8TextGeoProc::createGLSLInstance(const GrGLSLCaps&) const { +GrGLSLPrimitiveProcessor* +GrDistanceFieldA8TextGeoProc::createGLSLInstance(const GrShaderCaps&) const { return new GrGLDistanceFieldA8TextGeoProc(); } @@ -451,7 +452,7 @@ public: } static inline void GenKey(const GrGeometryProcessor& gp, - const GrGLSLCaps&, + const GrShaderCaps&, GrProcessorKeyBuilder* b) { const GrDistanceFieldPathGeoProc& dfTexEffect = gp.cast(); @@ -494,12 +495,13 @@ GrDistanceFieldPathGeoProc::GrDistanceFieldPathGeoProc( this->addTextureSampler(&fTextureSampler); } -void GrDistanceFieldPathGeoProc::getGLSLProcessorKey(const GrGLSLCaps& caps, +void GrDistanceFieldPathGeoProc::getGLSLProcessorKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const { GrGLDistanceFieldPathGeoProc::GenKey(*this, caps, b); } -GrGLSLPrimitiveProcessor* GrDistanceFieldPathGeoProc::createGLSLInstance(const GrGLSLCaps&) const { +GrGLSLPrimitiveProcessor* +GrDistanceFieldPathGeoProc::createGLSLInstance(const GrShaderCaps&) const { return new GrGLDistanceFieldPathGeoProc(); } @@ -745,7 +747,7 @@ public: } static inline void GenKey(const GrGeometryProcessor& gp, - const GrGLSLCaps&, + const GrShaderCaps&, GrProcessorKeyBuilder* b) { const GrDistanceFieldLCDTextGeoProc& dfTexEffect = gp.cast(); @@ -795,12 +797,12 @@ GrDistanceFieldLCDTextGeoProc::GrDistanceFieldLCDTextGeoProc( this->addTextureSampler(&fTextureSampler); } -void GrDistanceFieldLCDTextGeoProc::getGLSLProcessorKey(const GrGLSLCaps& caps, +void GrDistanceFieldLCDTextGeoProc::getGLSLProcessorKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const { GrGLDistanceFieldLCDTextGeoProc::GenKey(*this, caps, b); } -GrGLSLPrimitiveProcessor* GrDistanceFieldLCDTextGeoProc::createGLSLInstance(const GrGLSLCaps&) const { +GrGLSLPrimitiveProcessor* GrDistanceFieldLCDTextGeoProc::createGLSLInstance(const GrShaderCaps&) const { return new GrGLDistanceFieldLCDTextGeoProc(); } diff --git a/src/gpu/effects/GrDistanceFieldGeoProc.h b/src/gpu/effects/GrDistanceFieldGeoProc.h index 880c4e18dc..a0bfdd9dde 100644 --- a/src/gpu/effects/GrDistanceFieldGeoProc.h +++ b/src/gpu/effects/GrDistanceFieldGeoProc.h @@ -82,9 +82,9 @@ public: #endif uint32_t getFlags() const { return fFlags; } - void getGLSLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) const override; + void getGLSLProcessorKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const override; - GrGLSLPrimitiveProcessor* createGLSLInstance(const GrGLSLCaps&) const override; + GrGLSLPrimitiveProcessor* createGLSLInstance(const GrShaderCaps&) const override; private: GrDistanceFieldA8TextGeoProc(GrColor, const SkMatrix& viewMatrix, @@ -140,9 +140,9 @@ public: uint32_t getFlags() const { return fFlags; } bool usesLocalCoords() const { return fUsesLocalCoords; } - void getGLSLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) const override; + void getGLSLProcessorKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const override; - GrGLSLPrimitiveProcessor* createGLSLInstance(const GrGLSLCaps&) const override; + GrGLSLPrimitiveProcessor* createGLSLInstance(const GrShaderCaps&) const override; private: GrDistanceFieldPathGeoProc(GrColor, const SkMatrix& viewMatrix, GrTexture* texture, @@ -209,9 +209,9 @@ public: uint32_t getFlags() const { return fFlags; } bool usesLocalCoords() const { return fUsesLocalCoords; } - void getGLSLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) const override; + void getGLSLProcessorKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const override; - GrGLSLPrimitiveProcessor* createGLSLInstance(const GrGLSLCaps&) const override; + GrGLSLPrimitiveProcessor* createGLSLInstance(const GrShaderCaps&) const override; private: GrDistanceFieldLCDTextGeoProc(GrColor, const SkMatrix& viewMatrix, diff --git a/src/gpu/effects/GrDitherEffect.cpp b/src/gpu/effects/GrDitherEffect.cpp index c00284b23d..eb7fe6280a 100644 --- a/src/gpu/effects/GrDitherEffect.cpp +++ b/src/gpu/effects/GrDitherEffect.cpp @@ -9,9 +9,9 @@ #include "GrFragmentProcessor.h" #include "GrInvariantOutput.h" #include "SkRect.h" -#include "glsl/GrGLSL.h" #include "glsl/GrGLSLFragmentProcessor.h" #include "glsl/GrGLSLFragmentShaderBuilder.h" +#include "../private/GrGLSL.h" ////////////////////////////////////////////////////////////////////////////// @@ -33,7 +33,7 @@ private: GrGLSLFragmentProcessor* onCreateGLSLInstance() const override; - void onGetGLSLProcessorKey(const GrGLSLCaps&, GrProcessorKeyBuilder*) const override; + void onGetGLSLProcessorKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override; // All dither effects are equal bool onIsEqual(const GrFragmentProcessor&) const override { return true; } @@ -87,7 +87,7 @@ void GLDitherEffect::emitCode(EmitArgs& args) { ////////////////////////////////////////////////////////////////////////////// -void DitherEffect::onGetGLSLProcessorKey(const GrGLSLCaps& caps, +void DitherEffect::onGetGLSLProcessorKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const { GLDitherEffect::GenKey(*this, caps, b); } diff --git a/src/gpu/effects/GrGammaEffect.cpp b/src/gpu/effects/GrGammaEffect.cpp index 9e98b7ec9d..765612052c 100644 --- a/src/gpu/effects/GrGammaEffect.cpp +++ b/src/gpu/effects/GrGammaEffect.cpp @@ -80,7 +80,7 @@ public: } } - static inline void GenKey(const GrProcessor& processor, const GrGLSLCaps&, + static inline void GenKey(const GrProcessor& processor, const GrShaderCaps&, GrProcessorKeyBuilder* b) { const GrGammaEffect& ge = processor.cast(); uint32_t key = static_cast(ge.mode()); @@ -125,8 +125,8 @@ sk_sp GrGammaEffect::TestCreate(GrProcessorTestData* d) { /////////////////////////////////////////////////////////////////////////////// -void GrGammaEffect::onGetGLSLProcessorKey(const GrGLSLCaps& caps, - GrProcessorKeyBuilder* b) const { +void GrGammaEffect::onGetGLSLProcessorKey(const GrShaderCaps& caps, + GrProcessorKeyBuilder* b) const { GrGLGammaEffect::GenKey(*this, caps, b); } diff --git a/src/gpu/effects/GrGammaEffect.h b/src/gpu/effects/GrGammaEffect.h index 3f84ac91e0..a3e4b0e5e3 100644 --- a/src/gpu/effects/GrGammaEffect.h +++ b/src/gpu/effects/GrGammaEffect.h @@ -32,7 +32,7 @@ private: GrGammaEffect(Mode mode, SkScalar gamma); GrGLSLFragmentProcessor* onCreateGLSLInstance() const override; - void onGetGLSLProcessorKey(const GrGLSLCaps&, GrProcessorKeyBuilder*) const override; + void onGetGLSLProcessorKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override; bool onIsEqual(const GrFragmentProcessor&) const override; void onComputeInvariantOutput(GrInvariantOutput* inout) const override; diff --git a/src/gpu/effects/GrMatrixConvolutionEffect.cpp b/src/gpu/effects/GrMatrixConvolutionEffect.cpp index 0194eab3f6..5e4dc26c97 100644 --- a/src/gpu/effects/GrMatrixConvolutionEffect.cpp +++ b/src/gpu/effects/GrMatrixConvolutionEffect.cpp @@ -5,17 +5,17 @@ * found in the LICENSE file. */ #include "GrMatrixConvolutionEffect.h" -#include "glsl/GrGLSL.h" #include "glsl/GrGLSLFragmentProcessor.h" #include "glsl/GrGLSLFragmentShaderBuilder.h" #include "glsl/GrGLSLProgramDataManager.h" #include "glsl/GrGLSLUniformHandler.h" +#include "../private/GrGLSL.h" class GrGLMatrixConvolutionEffect : public GrGLSLFragmentProcessor { public: void emitCode(EmitArgs&) override; - static inline void GenKey(const GrProcessor&, const GrGLSLCaps&, GrProcessorKeyBuilder*); + static inline void GenKey(const GrProcessor&, const GrShaderCaps&, GrProcessorKeyBuilder*); protected: void onSetData(const GrGLSLProgramDataManager&, const GrProcessor&) override; @@ -118,7 +118,7 @@ void GrGLMatrixConvolutionEffect::emitCode(EmitArgs& args) { } void GrGLMatrixConvolutionEffect::GenKey(const GrProcessor& processor, - const GrGLSLCaps&, GrProcessorKeyBuilder* b) { + const GrShaderCaps&, GrProcessorKeyBuilder* b) { const GrMatrixConvolutionEffect& m = processor.cast(); SkASSERT(m.kernelSize().width() <= 0x7FFF && m.kernelSize().height() <= 0xFFFF); uint32_t key = m.kernelSize().width() << 16 | m.kernelSize().height(); @@ -170,7 +170,7 @@ GrMatrixConvolutionEffect::GrMatrixConvolutionEffect(GrTexture* texture, fKernelOffset[1] = static_cast(kernelOffset.y()); } -void GrMatrixConvolutionEffect::onGetGLSLProcessorKey(const GrGLSLCaps& caps, +void GrMatrixConvolutionEffect::onGetGLSLProcessorKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const { GrGLMatrixConvolutionEffect::GenKey(*this, caps, b); } diff --git a/src/gpu/effects/GrMatrixConvolutionEffect.h b/src/gpu/effects/GrMatrixConvolutionEffect.h index b8df437681..7cc88b651b 100644 --- a/src/gpu/effects/GrMatrixConvolutionEffect.h +++ b/src/gpu/effects/GrMatrixConvolutionEffect.h @@ -67,7 +67,7 @@ private: GrGLSLFragmentProcessor* onCreateGLSLInstance() const override; - void onGetGLSLProcessorKey(const GrGLSLCaps&, GrProcessorKeyBuilder*) const override; + void onGetGLSLProcessorKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override; bool onIsEqual(const GrFragmentProcessor&) const override; diff --git a/src/gpu/effects/GrOvalEffect.cpp b/src/gpu/effects/GrOvalEffect.cpp index 425d767c2b..993f269bf9 100644 --- a/src/gpu/effects/GrOvalEffect.cpp +++ b/src/gpu/effects/GrOvalEffect.cpp @@ -10,12 +10,12 @@ #include "GrFragmentProcessor.h" #include "GrInvariantOutput.h" #include "SkRect.h" -#include "glsl/GrGLSL.h" -#include "glsl/GrGLSLCaps.h" +#include "GrShaderCaps.h" #include "glsl/GrGLSLFragmentProcessor.h" #include "glsl/GrGLSLFragmentShaderBuilder.h" #include "glsl/GrGLSLProgramDataManager.h" #include "glsl/GrGLSLUniformHandler.h" +#include "../private/GrGLSL.h" ////////////////////////////////////////////////////////////////////////////// @@ -38,7 +38,7 @@ private: GrGLSLFragmentProcessor* onCreateGLSLInstance() const override; - void onGetGLSLProcessorKey(const GrGLSLCaps&, GrProcessorKeyBuilder*) const override; + void onGetGLSLProcessorKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override; bool onIsEqual(const GrFragmentProcessor&) const override; @@ -100,7 +100,7 @@ public: virtual void emitCode(EmitArgs&) override; - static inline void GenKey(const GrProcessor&, const GrGLSLCaps&, GrProcessorKeyBuilder*); + static inline void GenKey(const GrProcessor&, const GrShaderCaps&, GrProcessorKeyBuilder*); protected: void onSetData(const GrGLSLProgramDataManager&, const GrProcessor&) override; @@ -148,7 +148,7 @@ void GLCircleEffect::emitCode(EmitArgs& args) { (GrGLSLExpr4(args.fInputColor) * GrGLSLExpr1("d")).c_str()); } -void GLCircleEffect::GenKey(const GrProcessor& processor, const GrGLSLCaps&, +void GLCircleEffect::GenKey(const GrProcessor& processor, const GrShaderCaps&, GrProcessorKeyBuilder* b) { const CircleEffect& ce = processor.cast(); b->add32(ce.getEdgeType()); @@ -173,7 +173,7 @@ void GLCircleEffect::onSetData(const GrGLSLProgramDataManager& pdman, /////////////////////////////////////////////////////////////////////////////////////////////////// -void CircleEffect::onGetGLSLProcessorKey(const GrGLSLCaps& caps, +void CircleEffect::onGetGLSLProcessorKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const { GLCircleEffect::GenKey(*this, caps, b); } @@ -203,7 +203,7 @@ private: GrGLSLFragmentProcessor* onCreateGLSLInstance() const override; - void onGetGLSLProcessorKey(const GrGLSLCaps&, GrProcessorKeyBuilder*) const override; + void onGetGLSLProcessorKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override; bool onIsEqual(const GrFragmentProcessor&) const override; @@ -270,7 +270,7 @@ public: void emitCode(EmitArgs&) override; - static inline void GenKey(const GrProcessor&, const GrGLSLCaps&, GrProcessorKeyBuilder*); + static inline void GenKey(const GrProcessor&, const GrShaderCaps&, GrProcessorKeyBuilder*); protected: void onSetData(const GrGLSLProgramDataManager&, const GrProcessor&) override; @@ -345,7 +345,7 @@ void GLEllipseEffect::emitCode(EmitArgs& args) { (GrGLSLExpr4(args.fInputColor) * GrGLSLExpr1("alpha")).c_str()); } -void GLEllipseEffect::GenKey(const GrProcessor& effect, const GrGLSLCaps&, +void GLEllipseEffect::GenKey(const GrProcessor& effect, const GrShaderCaps&, GrProcessorKeyBuilder* b) { const EllipseEffect& ee = effect.cast(); b->add32(ee.getEdgeType()); @@ -383,7 +383,7 @@ void GLEllipseEffect::onSetData(const GrGLSLProgramDataManager& pdman, /////////////////////////////////////////////////////////////////////////////////////////////////// -void EllipseEffect::onGetGLSLProcessorKey(const GrGLSLCaps& caps, +void EllipseEffect::onGetGLSLProcessorKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const { GLEllipseEffect::GenKey(*this, caps, b); } diff --git a/src/gpu/effects/GrPorterDuffXferProcessor.cpp b/src/gpu/effects/GrPorterDuffXferProcessor.cpp index ff95dac723..3987db29b9 100644 --- a/src/gpu/effects/GrPorterDuffXferProcessor.cpp +++ b/src/gpu/effects/GrPorterDuffXferProcessor.cpp @@ -359,7 +359,7 @@ private: GrColor* overrideColor, const GrCaps& caps) const override; - void onGetGLSLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) const override; + void onGetGLSLProcessorKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const override; bool onHasSecondaryOutput() const override { return fBlendFormula.hasSecondaryOutput(); } @@ -462,7 +462,7 @@ private: /////////////////////////////////////////////////////////////////////////////// -void PorterDuffXferProcessor::onGetGLSLProcessorKey(const GrGLSLCaps&, +void PorterDuffXferProcessor::onGetGLSLProcessorKey(const GrShaderCaps&, GrProcessorKeyBuilder* b) const { GLPorterDuffXferProcessor::GenKey(*this, b); } @@ -524,7 +524,7 @@ private: return kNone_OptFlags; } - void onGetGLSLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) const override; + void onGetGLSLProcessorKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const override; bool onIsEqual(const GrXferProcessor& xpBase) const override { const ShaderPDXferProcessor& xp = xpBase.cast(); @@ -570,7 +570,7 @@ private: /////////////////////////////////////////////////////////////////////////////// -void ShaderPDXferProcessor::onGetGLSLProcessorKey(const GrGLSLCaps&, +void ShaderPDXferProcessor::onGetGLSLProcessorKey(const GrShaderCaps&, GrProcessorKeyBuilder* b) const { GLShaderPDXferProcessor::GenKey(*this, b); } @@ -599,7 +599,7 @@ private: GrColor* overrideColor, const GrCaps& caps) const override; - void onGetGLSLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) const override; + void onGetGLSLProcessorKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const override; void onGetBlendInfo(GrXferProcessor::BlendInfo* blendInfo) const override { blendInfo->fSrcBlend = kConstC_GrBlendCoeff; @@ -630,7 +630,7 @@ public: virtual ~GLPDLCDXferProcessor() {} - static void GenKey(const GrProcessor& processor, const GrGLSLCaps& caps, + static void GenKey(const GrProcessor& processor, const GrShaderCaps& caps, GrProcessorKeyBuilder* b) {} private: @@ -674,7 +674,7 @@ GrXferProcessor* PDLCDXferProcessor::Create(SkBlendMode xfermode, PDLCDXferProcessor::~PDLCDXferProcessor() { } -void PDLCDXferProcessor::onGetGLSLProcessorKey(const GrGLSLCaps& caps, +void PDLCDXferProcessor::onGetGLSLProcessorKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const { GLPDLCDXferProcessor::GenKey(*this, caps, b); } diff --git a/src/gpu/effects/GrRRectEffect.cpp b/src/gpu/effects/GrRRectEffect.cpp index 36570c9e9c..adf7bfd7ae 100644 --- a/src/gpu/effects/GrRRectEffect.cpp +++ b/src/gpu/effects/GrRRectEffect.cpp @@ -11,9 +11,9 @@ #include "GrFragmentProcessor.h" #include "GrInvariantOutput.h" #include "GrOvalEffect.h" +#include "GrShaderCaps.h" #include "SkRRect.h" #include "SkTLazy.h" -#include "glsl/GrGLSLCaps.h" #include "glsl/GrGLSLFragmentProcessor.h" #include "glsl/GrGLSLFragmentShaderBuilder.h" #include "glsl/GrGLSLProgramDataManager.h" @@ -64,7 +64,7 @@ private: GrGLSLFragmentProcessor* onCreateGLSLInstance() const override; - void onGetGLSLProcessorKey(const GrGLSLCaps&, GrProcessorKeyBuilder*) const override; + void onGetGLSLProcessorKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override; bool onIsEqual(const GrFragmentProcessor& other) const override; @@ -137,7 +137,7 @@ public: virtual void emitCode(EmitArgs&) override; - static inline void GenKey(const GrProcessor&, const GrGLSLCaps&, GrProcessorKeyBuilder*); + static inline void GenKey(const GrProcessor&, const GrShaderCaps&, GrProcessorKeyBuilder*); protected: void onSetData(const GrGLSLProgramDataManager&, const GrProcessor&) override; @@ -287,7 +287,7 @@ void GLCircularRRectEffect::emitCode(EmitArgs& args) { (GrGLSLExpr4(args.fInputColor) * GrGLSLExpr1("alpha")).c_str()); } -void GLCircularRRectEffect::GenKey(const GrProcessor& processor, const GrGLSLCaps&, +void GLCircularRRectEffect::GenKey(const GrProcessor& processor, const GrShaderCaps&, GrProcessorKeyBuilder* b) { const CircularRRectEffect& crre = processor.cast(); GR_STATIC_ASSERT(kGrProcessorEdgeTypeCnt <= 8); @@ -376,7 +376,7 @@ void GLCircularRRectEffect::onSetData(const GrGLSLProgramDataManager& pdman, //////////////////////////////////////////////////////////////////////////////////////////////////// -void CircularRRectEffect::onGetGLSLProcessorKey(const GrGLSLCaps& caps, +void CircularRRectEffect::onGetGLSLProcessorKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const { GLCircularRRectEffect::GenKey(*this, caps, b); } @@ -404,7 +404,7 @@ private: GrGLSLFragmentProcessor* onCreateGLSLInstance() const override; - void onGetGLSLProcessorKey(const GrGLSLCaps&, GrProcessorKeyBuilder*) const override; + void onGetGLSLProcessorKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override; bool onIsEqual(const GrFragmentProcessor& other) const override; @@ -492,7 +492,7 @@ public: void emitCode(EmitArgs&) override; - static inline void GenKey(const GrProcessor&, const GrGLSLCaps&, GrProcessorKeyBuilder*); + static inline void GenKey(const GrProcessor&, const GrShaderCaps&, GrProcessorKeyBuilder*); protected: void onSetData(const GrGLSLProgramDataManager&, const GrProcessor&) override; @@ -603,7 +603,7 @@ void GLEllipticalRRectEffect::emitCode(EmitArgs& args) { (GrGLSLExpr4(args.fInputColor) * GrGLSLExpr1("alpha")).c_str()); } -void GLEllipticalRRectEffect::GenKey(const GrProcessor& effect, const GrGLSLCaps&, +void GLEllipticalRRectEffect::GenKey(const GrProcessor& effect, const GrShaderCaps&, GrProcessorKeyBuilder* b) { const EllipticalRRectEffect& erre = effect.cast(); GR_STATIC_ASSERT(kLast_GrProcessorEdgeType < (1 << 3)); @@ -671,7 +671,7 @@ void GLEllipticalRRectEffect::onSetData(const GrGLSLProgramDataManager& pdman, //////////////////////////////////////////////////////////////////////////////////////////////////// -void EllipticalRRectEffect::onGetGLSLProcessorKey(const GrGLSLCaps& caps, +void EllipticalRRectEffect::onGetGLSLProcessorKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const { GLEllipticalRRectEffect::GenKey(*this, caps, b); } diff --git a/src/gpu/effects/GrShadowGeoProc.cpp b/src/gpu/effects/GrShadowGeoProc.cpp index 8544a05e35..cb4c834aea 100755 --- a/src/gpu/effects/GrShadowGeoProc.cpp +++ b/src/gpu/effects/GrShadowGeoProc.cpp @@ -62,7 +62,7 @@ public: } static inline void GenKey(const GrGeometryProcessor& gp, - const GrGLSLCaps&, + const GrShaderCaps&, GrProcessorKeyBuilder* b) { const GrRRectShadowGeoProc& rsgp = gp.cast(); uint16_t key; @@ -86,12 +86,12 @@ GrRRectShadowGeoProc::GrRRectShadowGeoProc(const SkMatrix& localMatrix) fInShadowParams = &this->addVertexAttrib("inShadowParams", kVec4f_GrVertexAttribType); } -void GrRRectShadowGeoProc::getGLSLProcessorKey(const GrGLSLCaps& caps, +void GrRRectShadowGeoProc::getGLSLProcessorKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const { GrGLSLRRectShadowGeoProc::GenKey(*this, caps, b); } -GrGLSLPrimitiveProcessor* GrRRectShadowGeoProc::createGLSLInstance(const GrGLSLCaps&) const { +GrGLSLPrimitiveProcessor* GrRRectShadowGeoProc::createGLSLInstance(const GrShaderCaps&) const { return new GrGLSLRRectShadowGeoProc(); } diff --git a/src/gpu/effects/GrShadowGeoProc.h b/src/gpu/effects/GrShadowGeoProc.h index 29e2bde84d..dc6872e701 100755 --- a/src/gpu/effects/GrShadowGeoProc.h +++ b/src/gpu/effects/GrShadowGeoProc.h @@ -34,9 +34,9 @@ public: bool colorIgnored() const { return GrColor_ILLEGAL == fColor; } const SkMatrix& localMatrix() const { return fLocalMatrix; } - void getGLSLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) const override; + void getGLSLProcessorKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const override; - GrGLSLPrimitiveProcessor* createGLSLInstance(const GrGLSLCaps&) const override; + GrGLSLPrimitiveProcessor* createGLSLInstance(const GrShaderCaps&) const override; private: GrRRectShadowGeoProc(const SkMatrix& localMatrix); diff --git a/src/gpu/effects/GrSimpleTextureEffect.cpp b/src/gpu/effects/GrSimpleTextureEffect.cpp index 1c213a759d..682539ff3b 100644 --- a/src/gpu/effects/GrSimpleTextureEffect.cpp +++ b/src/gpu/effects/GrSimpleTextureEffect.cpp @@ -30,7 +30,7 @@ public: fragBuilder->codeAppend(";"); } - static inline void GenKey(const GrProcessor& effect, const GrGLSLCaps&, + static inline void GenKey(const GrProcessor& effect, const GrShaderCaps&, GrProcessorKeyBuilder* b) { const GrSimpleTextureEffect& textureEffect = effect.cast(); b->add32(GrColorSpaceXform::XformKey(textureEffect.colorSpaceXform())); @@ -56,7 +56,7 @@ void GrSimpleTextureEffect::onComputeInvariantOutput(GrInvariantOutput* inout) c this->updateInvariantOutputForModulation(inout); } -void GrSimpleTextureEffect::onGetGLSLProcessorKey(const GrGLSLCaps& caps, +void GrSimpleTextureEffect::onGetGLSLProcessorKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const { GrGLSimpleTextureEffect::GenKey(*this, caps, b); } diff --git a/src/gpu/effects/GrSimpleTextureEffect.h b/src/gpu/effects/GrSimpleTextureEffect.h index ccb590e297..90f39acba0 100644 --- a/src/gpu/effects/GrSimpleTextureEffect.h +++ b/src/gpu/effects/GrSimpleTextureEffect.h @@ -68,7 +68,7 @@ private: GrGLSLFragmentProcessor* onCreateGLSLInstance() const override; - void onGetGLSLProcessorKey(const GrGLSLCaps&, GrProcessorKeyBuilder*) const override; + void onGetGLSLProcessorKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override; bool onIsEqual(const GrFragmentProcessor& other) const override { return true; } diff --git a/src/gpu/effects/GrTextureDomain.cpp b/src/gpu/effects/GrTextureDomain.cpp index f22d09675b..78be8fe59c 100644 --- a/src/gpu/effects/GrTextureDomain.cpp +++ b/src/gpu/effects/GrTextureDomain.cpp @@ -7,9 +7,9 @@ #include "GrTextureDomain.h" #include "GrInvariantOutput.h" +#include "GrShaderCaps.h" #include "GrSimpleTextureEffect.h" #include "SkFloatingPoint.h" -#include "glsl/GrGLSLCaps.h" #include "glsl/GrGLSLFragmentProcessor.h" #include "glsl/GrGLSLFragmentShaderBuilder.h" #include "glsl/GrGLSLProgramDataManager.h" @@ -45,7 +45,7 @@ GrTextureDomain::GrTextureDomain(const SkRect& domain, Mode mode, int index) void GrTextureDomain::GLDomain::sampleTexture(GrGLSLShaderBuilder* builder, GrGLSLUniformHandler* uniformHandler, - const GrGLSLCaps* glslCaps, + const GrShaderCaps* glslCaps, const GrTextureDomain& textureDomain, const char* outColor, const SkString& inCoords, @@ -199,7 +199,7 @@ GrTextureDomainEffect::GrTextureDomainEffect(GrTexture* texture, this->initClassID(); } -void GrTextureDomainEffect::onGetGLSLProcessorKey(const GrGLSLCaps& caps, +void GrTextureDomainEffect::onGetGLSLProcessorKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const { b->add32(GrTextureDomain::GLDomain::DomainKey(fTextureDomain)); } diff --git a/src/gpu/effects/GrTextureDomain.h b/src/gpu/effects/GrTextureDomain.h index 3ba6ee849f..7e7ec74912 100644 --- a/src/gpu/effects/GrTextureDomain.h +++ b/src/gpu/effects/GrTextureDomain.h @@ -115,7 +115,7 @@ public: */ void sampleTexture(GrGLSLShaderBuilder* builder, GrGLSLUniformHandler* uniformHandler, - const GrGLSLCaps* glslCaps, + const GrShaderCaps* glslCaps, const GrTextureDomain& textureDomain, const char* outColor, const SkString& inCoords, @@ -195,7 +195,7 @@ private: GrGLSLFragmentProcessor* onCreateGLSLInstance() const override; - void onGetGLSLProcessorKey(const GrGLSLCaps&, GrProcessorKeyBuilder*) const override; + void onGetGLSLProcessorKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override; bool onIsEqual(const GrFragmentProcessor&) const override; @@ -233,7 +233,7 @@ private: GrGLSLFragmentProcessor* onCreateGLSLInstance() const override; // Since we always use decal mode, there is no need for key data. - void onGetGLSLProcessorKey(const GrGLSLCaps&, GrProcessorKeyBuilder*) const override {} + void onGetGLSLProcessorKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override {} bool onIsEqual(const GrFragmentProcessor& fp) const override; void onComputeInvariantOutput(GrInvariantOutput* inout) const override; diff --git a/src/gpu/effects/GrXfermodeFragmentProcessor.cpp b/src/gpu/effects/GrXfermodeFragmentProcessor.cpp index 0e8e16c0e9..2954170e20 100644 --- a/src/gpu/effects/GrXfermodeFragmentProcessor.cpp +++ b/src/gpu/effects/GrXfermodeFragmentProcessor.cpp @@ -29,7 +29,7 @@ public: const char* name() const override { return "ComposeTwo"; } - void onGetGLSLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) const override { + void onGetGLSLProcessorKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const override { b->add32((int)fMode); } @@ -163,7 +163,7 @@ public: return str; } - void onGetGLSLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) const override { + void onGetGLSLProcessorKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const override { GR_STATIC_ASSERT(((int)SkBlendMode::kLastMode & SK_MaxU16) == (int)SkBlendMode::kLastMode); b->add32((int)fMode | (fChild << 16)); } diff --git a/src/gpu/effects/GrYUVEffect.cpp b/src/gpu/effects/GrYUVEffect.cpp index 297835773a..6d1fac2f32 100644 --- a/src/gpu/effects/GrYUVEffect.cpp +++ b/src/gpu/effects/GrYUVEffect.cpp @@ -177,7 +177,7 @@ private: return new GLSLProcessor; } - void onGetGLSLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) const override { + void onGetGLSLProcessorKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const override { b->add32(fNV12); } @@ -334,7 +334,7 @@ private: return new GLSLProcessor; } - void onGetGLSLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) const override { + void onGetGLSLProcessorKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const override { // kY, kU, and kV all generate the same code, just upload different coefficients. if (kU_OutputChannels == fOutputChannels || kV_OutputChannels == fOutputChannels) { b->add32(kY_OutputChannels); diff --git a/src/gpu/gl/GrGLCaps.cpp b/src/gpu/gl/GrGLCaps.cpp index c4f7560be4..c47763583c 100644 --- a/src/gpu/gl/GrGLCaps.cpp +++ b/src/gpu/gl/GrGLCaps.cpp @@ -11,7 +11,7 @@ #include "GrContextOptions.h" #include "GrGLContext.h" #include "GrGLRenderTarget.h" -#include "glsl/GrGLSLCaps.h" +#include "GrShaderCaps.h" #include "instanced/GLInstancedRendering.h" #include "SkTSearch.h" #include "SkTSort.h" @@ -54,7 +54,7 @@ GrGLCaps::GrGLCaps(const GrContextOptions& contextOptions, fBlitFramebufferFlags = kNoSupport_BlitFramebufferFlag; - fShaderCaps.reset(new GrGLSLCaps(contextOptions)); + fShaderCaps.reset(new GrShaderCaps(contextOptions)); this->init(contextOptions, ctxInfo, glInterface); } @@ -254,7 +254,7 @@ void GrGLCaps::init(const GrContextOptions& contextOptions, // This must be called after fCoreProfile is set on the GrGLCaps this->initGLSL(ctxInfo); - GrGLSLCaps* glslCaps = static_cast(fShaderCaps.get()); + GrShaderCaps* glslCaps = static_cast(fShaderCaps.get()); glslCaps->fPathRenderingSupport = this->hasPathRenderingSupport(ctxInfo, gli); @@ -688,7 +688,7 @@ void GrGLCaps::initGLSL(const GrGLContextInfo& ctxInfo) { * Caps specific to GrGLSLCaps **************************************************************************/ - GrGLSLCaps* glslCaps = static_cast(fShaderCaps.get()); + GrShaderCaps* glslCaps = fShaderCaps.get(); glslCaps->fGLSLGeneration = ctxInfo.glslGeneration(); if (kGLES_GrGLStandard == standard) { if (ctxInfo.hasExtension("GL_EXT_shader_framebuffer_fetch")) { @@ -1030,7 +1030,7 @@ void GrGLCaps::initFSAASupport(const GrGLContextInfo& ctxInfo, const GrGLInterfa } void GrGLCaps::initBlendEqationSupport(const GrGLContextInfo& ctxInfo) { - GrGLSLCaps* glslCaps = static_cast(fShaderCaps.get()); + GrShaderCaps* glslCaps = static_cast(fShaderCaps.get()); // Disabling advanced blend on various platforms with major known issues. We also block Chrome // for now until its own blacklists can be updated. @@ -1043,20 +1043,20 @@ void GrGLCaps::initBlendEqationSupport(const GrGLContextInfo& ctxInfo) { if (ctxInfo.hasExtension("GL_NV_blend_equation_advanced_coherent")) { fBlendEquationSupport = kAdvancedCoherent_BlendEquationSupport; - glslCaps->fAdvBlendEqInteraction = GrGLSLCaps::kAutomatic_AdvBlendEqInteraction; + glslCaps->fAdvBlendEqInteraction = GrShaderCaps::kAutomatic_AdvBlendEqInteraction; } else if (ctxInfo.hasExtension("GL_KHR_blend_equation_advanced_coherent")) { fBlendEquationSupport = kAdvancedCoherent_BlendEquationSupport; - glslCaps->fAdvBlendEqInteraction = GrGLSLCaps::kGeneralEnable_AdvBlendEqInteraction; + glslCaps->fAdvBlendEqInteraction = GrShaderCaps::kGeneralEnable_AdvBlendEqInteraction; } else if (kNVIDIA_GrGLDriver == ctxInfo.driver() && ctxInfo.driverVersion() < GR_GL_DRIVER_VER(337,00)) { // Non-coherent advanced blend has an issue on NVIDIA pre 337.00. return; } else if (ctxInfo.hasExtension("GL_NV_blend_equation_advanced")) { fBlendEquationSupport = kAdvanced_BlendEquationSupport; - glslCaps->fAdvBlendEqInteraction = GrGLSLCaps::kAutomatic_AdvBlendEqInteraction; + glslCaps->fAdvBlendEqInteraction = GrShaderCaps::kAutomatic_AdvBlendEqInteraction; } else if (ctxInfo.hasExtension("GL_KHR_blend_equation_advanced")) { fBlendEquationSupport = kAdvanced_BlendEquationSupport; - glslCaps->fAdvBlendEqInteraction = GrGLSLCaps::kGeneralEnable_AdvBlendEqInteraction; + glslCaps->fAdvBlendEqInteraction = GrShaderCaps::kGeneralEnable_AdvBlendEqInteraction; // TODO: Use kSpecificEnables_AdvBlendEqInteraction if "blend_support_all_equations" is // slow on a particular platform. } else { @@ -1260,7 +1260,7 @@ static GrGLenum shader_type_to_gl_shader(GrShaderType type) { void GrGLCaps::initShaderPrecisionTable(const GrGLContextInfo& ctxInfo, const GrGLInterface* intf, - GrGLSLCaps* glslCaps) { + GrShaderCaps* glslCaps) { if (kGLES_GrGLStandard == ctxInfo.standard() || ctxInfo.version() >= GR_GL_VER(4, 1) || ctxInfo.hasExtension("GL_ARB_ES2_compatibility")) { for (int s = 0; s < kGrShaderTypeCount; ++s) { @@ -1393,7 +1393,7 @@ bool GrGLCaps::getExternalFormat(GrPixelConfig surfaceConfig, GrPixelConfig memo } void GrGLCaps::initConfigTable(const GrGLContextInfo& ctxInfo, const GrGLInterface* gli, - GrGLSLCaps* glslCaps) { + GrShaderCaps* glslCaps) { /* Comments on renderability of configs on various GL versions. OpenGL < 3.0: diff --git a/src/gpu/gl/GrGLCaps.h b/src/gpu/gl/GrGLCaps.h index 63843a5fc2..155388dd61 100644 --- a/src/gpu/gl/GrGLCaps.h +++ b/src/gpu/gl/GrGLCaps.h @@ -11,16 +11,15 @@ #include -#include "glsl/GrGLSL.h" #include "GrCaps.h" #include "GrGLStencilAttachment.h" #include "GrSwizzle.h" #include "SkChecksum.h" #include "SkTHash.h" #include "SkTArray.h" +#include "../private/GrGLSL.h" class GrGLContextInfo; -class GrGLSLCaps; class GrGLRenderTarget; /** @@ -357,7 +356,7 @@ public: return fRGBAToBGRAReadbackConversionsAreSlow; } - const GrGLSLCaps* glslCaps() const { return reinterpret_cast(fShaderCaps.get()); } + const GrShaderCaps* glslCaps() const { return fShaderCaps.get(); } private: enum ExternalFormatUsage { @@ -381,11 +380,11 @@ private: void initBlendEqationSupport(const GrGLContextInfo&); void initStencilFormats(const GrGLContextInfo&); // This must be called after initFSAASupport(). - void initConfigTable(const GrGLContextInfo&, const GrGLInterface* gli, GrGLSLCaps* glslCaps); + void initConfigTable(const GrGLContextInfo&, const GrGLInterface* gli, GrShaderCaps* glslCaps); void initShaderPrecisionTable(const GrGLContextInfo& ctxInfo, const GrGLInterface* intf, - GrGLSLCaps* glslCaps); + GrShaderCaps* glslCaps); GrGLStandard fStandard; diff --git a/src/gpu/gl/GrGLGLSL.cpp b/src/gpu/gl/GrGLGLSL.cpp index 7813eabfb8..7ceb639ee0 100644 --- a/src/gpu/gl/GrGLGLSL.cpp +++ b/src/gpu/gl/GrGLGLSL.cpp @@ -5,10 +5,10 @@ * found in the LICENSE file. */ -#include "GrGLGLSL.h" #include "GrGLContext.h" #include "GrGLUtil.h" #include "SkString.h" +#include "../private/GrGLSL.h" bool GrGLGetGLSLGeneration(const GrGLInterface* gl, GrGLSLGeneration* generation) { SkASSERT(generation); diff --git a/src/gpu/gl/GrGLGLSL.h b/src/gpu/gl/GrGLGLSL.h index 31e2de7d74..88bb273d92 100644 --- a/src/gpu/gl/GrGLGLSL.h +++ b/src/gpu/gl/GrGLGLSL.h @@ -9,10 +9,10 @@ #define GrGLInitGLSL_DEFINED #include "gl/GrGLInterface.h" -#include "glsl/GrGLSL.h" #include "GrColor.h" #include "GrTypesPriv.h" #include "SkString.h" +#include "../private/GrGLSL.h" class GrGLContextInfo; diff --git a/src/gpu/gl/GrGLGpu.cpp b/src/gpu/gl/GrGLGpu.cpp index 8f81ccc826..7ec2029f99 100644 --- a/src/gpu/gl/GrGLGpu.cpp +++ b/src/gpu/gl/GrGLGpu.cpp @@ -7,7 +7,6 @@ #include "GrGLGpu.h" #include "GrGLBuffer.h" -#include "GrGLGLSL.h" #include "GrGLGpuCommandBuffer.h" #include "GrGLStencilAttachment.h" #include "GrGLTextureRenderTarget.h" @@ -17,12 +16,11 @@ #include "GrPipeline.h" #include "GrPLSGeometryProcessor.h" #include "GrRenderTargetPriv.h" +#include "GrShaderCaps.h" #include "GrSurfacePriv.h" #include "GrTexturePriv.h" #include "GrTypes.h" #include "builders/GrGLShaderStringBuilder.h" -#include "glsl/GrGLSL.h" -#include "glsl/GrGLSLCaps.h" #include "glsl/GrGLSLPLSPathRendering.h" #include "instanced/GLInstancedRendering.h" #include "SkMakeUnique.h" @@ -31,6 +29,7 @@ #include "SkStrokeRec.h" #include "SkTemplates.h" #include "SkTypes.h" +#include "../private/GrGLSL.h" #define GL_CALL(X) GR_GL_CALL(this->glInterface(), X) #define GL_CALL_RET(RET, X) GR_GL_CALL_RET(this->glInterface(), RET, X) @@ -334,7 +333,7 @@ bool GrGLGpu::createPLSSetupProgram() { return false; } - const GrGLSLCaps* glslCaps = this->glCaps().glslCaps(); + const GrShaderCaps* glslCaps = this->glCaps().glslCaps(); const char* version = glslCaps->versionDeclString(); GrShaderVar aVertex("a_vertex", kVec2f_GrSLType, GrShaderVar::kIn_TypeModifier); @@ -3761,7 +3760,7 @@ bool GrGLGpu::onCopySurface(GrSurface* dst, bool GrGLGpu::createCopyProgram(GrTexture* srcTex) { int progIdx = TextureToCopyProgramIdx(srcTex); - const GrGLSLCaps* glslCaps = this->glCaps().glslCaps(); + const GrShaderCaps* glslCaps = this->glCaps().glslCaps(); GrSLType samplerType = srcTex->texturePriv().samplerType(); if (!fCopyProgramArrayBuffer) { @@ -3880,7 +3879,7 @@ bool GrGLGpu::createMipmapProgram(int progIdx) { const bool oddHeight = SkToBool(progIdx & 0x1); const int numTaps = (oddWidth ? 2 : 1) * (oddHeight ? 2 : 1); - const GrGLSLCaps* glslCaps = this->glCaps().glslCaps(); + const GrShaderCaps* glslCaps = this->glCaps().glslCaps(); SkASSERT(!fMipmapPrograms[progIdx].fProgram); GL_CALL_RET(fMipmapPrograms[progIdx].fProgram, CreateProgram()); diff --git a/src/gpu/gl/GrGLTexture.cpp b/src/gpu/gl/GrGLTexture.cpp index 4a4f00bc0b..196ec86628 100644 --- a/src/gpu/gl/GrGLTexture.cpp +++ b/src/gpu/gl/GrGLTexture.cpp @@ -7,7 +7,7 @@ #include "GrGLTexture.h" #include "GrGLGpu.h" -#include "glsl/GrGLSLCaps.h" +#include "GrShaderCaps.h" #include "SkTraceMemoryDump.h" #define GPUGL static_cast(this->getGpu()) diff --git a/src/gpu/gl/GrGLUniformHandler.cpp b/src/gpu/gl/GrGLUniformHandler.cpp index 81755d552a..021a865358 100644 --- a/src/gpu/gl/GrGLUniformHandler.cpp +++ b/src/gpu/gl/GrGLUniformHandler.cpp @@ -110,19 +110,19 @@ GrGLSLUniformHandler::ImageStorageHandle GrGLUniformHandler::addImageStorage( void GrGLUniformHandler::appendUniformDecls(GrShaderFlags visibility, SkString* out) const { for (int i = 0; i < fUniforms.count(); ++i) { if (fUniforms[i].fVisibility & visibility) { - fUniforms[i].fVariable.appendDecl(fProgramBuilder->glslCaps(), out); + fUniforms[i].fVariable.appendDecl(fProgramBuilder->shaderCaps(), out); out->append(";"); } } for (int i = 0; i < fSamplers.count(); ++i) { if (fSamplers[i].fVisibility & visibility) { - fSamplers[i].fVariable.appendDecl(fProgramBuilder->glslCaps(), out); + fSamplers[i].fVariable.appendDecl(fProgramBuilder->shaderCaps(), out); out->append(";\n"); } } for (int i = 0; i < fImageStorages.count(); ++i) { if (fImageStorages[i].fVisibility & visibility) { - fImageStorages[i].fVariable.appendDecl(fProgramBuilder->glslCaps(), out); + fImageStorages[i].fVariable.appendDecl(fProgramBuilder->shaderCaps(), out); out->append(";"); } } diff --git a/src/gpu/gl/builders/GrGLProgramBuilder.cpp b/src/gpu/gl/builders/GrGLProgramBuilder.cpp index a774570b68..63e0aeb78d 100644 --- a/src/gpu/gl/builders/GrGLProgramBuilder.cpp +++ b/src/gpu/gl/builders/GrGLProgramBuilder.cpp @@ -11,6 +11,7 @@ #include "GrCoordTransform.h" #include "GrGLProgramBuilder.h" #include "GrProgramDesc.h" +#include "GrShaderCaps.h" #include "GrSwizzle.h" #include "GrTexture.h" #include "SkTraceEvent.h" @@ -18,7 +19,6 @@ #include "gl/GrGLProgram.h" #include "gl/GrGLSLPrettyPrint.h" #include "gl/builders/GrGLShaderStringBuilder.h" -#include "glsl/GrGLSLCaps.h" #include "glsl/GrGLSLFragmentProcessor.h" #include "glsl/GrGLSLGeometryProcessor.h" #include "glsl/GrGLSLProgramDataManager.h" @@ -66,10 +66,6 @@ const GrCaps* GrGLProgramBuilder::caps() const { return fGpu->caps(); } -const GrGLSLCaps* GrGLProgramBuilder::glslCaps() const { - return fGpu->ctxInfo().caps()->glslCaps(); -} - bool GrGLProgramBuilder::compileAndAttachShaders(GrGLSLShaderBuilder& shader, GrGLuint programId, GrGLenum type, diff --git a/src/gpu/gl/builders/GrGLProgramBuilder.h b/src/gpu/gl/builders/GrGLProgramBuilder.h index 253f9e6328..a88f278b93 100644 --- a/src/gpu/gl/builders/GrGLProgramBuilder.h +++ b/src/gpu/gl/builders/GrGLProgramBuilder.h @@ -19,7 +19,7 @@ class GrFragmentProcessor; class GrGLContextInfo; class GrProgramDesc; class GrGLSLShaderBuilder; -class GrGLSLCaps; +class GrShaderCaps; class GrGLProgramBuilder : public GrGLSLProgramBuilder { public: @@ -36,7 +36,6 @@ public: GrGLGpu*); const GrCaps* caps() const override; - const GrGLSLCaps* glslCaps() const override; GrGLGpu* gpu() const { return fGpu; } diff --git a/src/gpu/glsl/GrGLSL.cpp b/src/gpu/glsl/GrGLSL.cpp index 69f046cb82..2f69a3c5a2 100644 --- a/src/gpu/glsl/GrGLSL.cpp +++ b/src/gpu/glsl/GrGLSL.cpp @@ -5,9 +5,9 @@ * found in the LICENSE file. */ -#include "GrGLSL.h" -#include "GrGLSLCaps.h" +#include "GrShaderCaps.h" #include "SkString.h" +#include "../private/GrGLSL.h" bool GrGLSLSupportsNamedFragmentShaderOutputs(GrGLSLGeneration gen) { switch (gen) { @@ -27,7 +27,7 @@ bool GrGLSLSupportsNamedFragmentShaderOutputs(GrGLSLGeneration gen) { } void GrGLSLAppendDefaultFloatPrecisionDeclaration(GrSLPrecision p, - const GrGLSLCaps& glslCaps, + const GrShaderCaps& glslCaps, SkString* out) { if (glslCaps.usesPrecisionModifiers()) { switch (p) { diff --git a/src/gpu/glsl/GrGLSLFragmentProcessor.h b/src/gpu/glsl/GrGLSLFragmentProcessor.h index c8154231b5..c9230e4c92 100644 --- a/src/gpu/glsl/GrGLSLFragmentProcessor.h +++ b/src/gpu/glsl/GrGLSLFragmentProcessor.h @@ -15,7 +15,6 @@ class GrProcessor; class GrProcessorKeyBuilder; -class GrGLSLCaps; class GrGLSLFPBuilder; class GrGLSLFPFragmentBuilder; @@ -112,7 +111,7 @@ public: struct EmitArgs { EmitArgs(GrGLSLFPFragmentBuilder* fragBuilder, GrGLSLUniformHandler* uniformHandler, - const GrGLSLCaps* caps, + const GrShaderCaps* caps, const GrFragmentProcessor& fp, const char* outputColor, const char* inputColor, @@ -134,7 +133,7 @@ public: , fGpImplementsDistanceVector(gpImplementsDistanceVector) {} GrGLSLFPFragmentBuilder* fFragBuilder; GrGLSLUniformHandler* fUniformHandler; - const GrGLSLCaps* fGLSLCaps; + const GrShaderCaps* fGLSLCaps; const GrFragmentProcessor& fFp; const char* fOutputColor; const char* fInputColor; @@ -149,7 +148,7 @@ public: void setData(const GrGLSLProgramDataManager& pdman, const GrFragmentProcessor& processor); - static void GenKey(const GrProcessor&, const GrGLSLCaps&, GrProcessorKeyBuilder*) {} + static void GenKey(const GrProcessor&, const GrShaderCaps&, GrProcessorKeyBuilder*) {} int numChildProcessors() const { return fChildProcessors.count(); } diff --git a/src/gpu/glsl/GrGLSLFragmentShaderBuilder.cpp b/src/gpu/glsl/GrGLSLFragmentShaderBuilder.cpp index f6e1ad81d7..3d9802a720 100644 --- a/src/gpu/glsl/GrGLSLFragmentShaderBuilder.cpp +++ b/src/gpu/glsl/GrGLSLFragmentShaderBuilder.cpp @@ -8,12 +8,12 @@ #include "GrGLSLFragmentShaderBuilder.h" #include "GrRenderTarget.h" #include "GrRenderTargetPriv.h" +#include "GrShaderCaps.h" #include "gl/GrGLGpu.h" -#include "glsl/GrGLSL.h" -#include "glsl/GrGLSLCaps.h" #include "glsl/GrGLSLProgramBuilder.h" #include "glsl/GrGLSLUniformHandler.h" #include "glsl/GrGLSLVarying.h" +#include "../private/GrGLSL.h" const char* GrGLSLFragmentShaderBuilder::kDstColorName = "_dstColor"; @@ -94,7 +94,7 @@ GrGLSLFragmentShaderBuilder::GrGLSLFragmentShaderBuilder(GrGLSLProgramBuilder* p } bool GrGLSLFragmentShaderBuilder::enableFeature(GLSLFeature feature) { - const GrGLSLCaps& glslCaps = *fProgramBuilder->glslCaps(); + const GrShaderCaps& glslCaps = *fProgramBuilder->shaderCaps(); switch (feature) { case kPixelLocalStorage_GLSLFeature: if (glslCaps.pixelLocalStorageSize() <= 0) { @@ -133,7 +133,7 @@ SkString GrGLSLFragmentShaderBuilder::ensureCoords2D(const GrShaderVar& coords) const char* GrGLSLFragmentShaderBuilder::fragmentPosition() { SkDEBUGCODE(fUsedProcessorFeatures |= GrProcessor::kFragmentPosition_RequiredFeature;) - const GrGLSLCaps* glslCaps = fProgramBuilder->glslCaps(); + const GrShaderCaps* glslCaps = fProgramBuilder->shaderCaps(); // We only declare "gl_FragCoord" when we're in the case where we want to use layout qualifiers // to reverse y. Otherwise it isn't necessary and whether the "in" qualifier appears in the // declaration varies in earlier GLSL specs. So it is simpler to omit it. @@ -193,7 +193,7 @@ void GrGLSLFragmentShaderBuilder::appendOffsetToSample(const char* sampleIdx, Co } void GrGLSLFragmentShaderBuilder::maskSampleCoverage(const char* mask, bool invert) { - const GrGLSLCaps& glslCaps = *fProgramBuilder->glslCaps(); + const GrShaderCaps& glslCaps = *fProgramBuilder->shaderCaps(); if (!glslCaps.sampleVariablesSupport()) { SkDEBUGFAIL("Attempted to mask sample coverage without support."); return; @@ -213,7 +213,7 @@ void GrGLSLFragmentShaderBuilder::maskSampleCoverage(const char* mask, bool inve } void GrGLSLFragmentShaderBuilder::overrideSampleCoverage(const char* mask) { - const GrGLSLCaps& glslCaps = *fProgramBuilder->glslCaps(); + const GrShaderCaps& glslCaps = *fProgramBuilder->shaderCaps(); if (!glslCaps.sampleMaskOverrideCoverageSupport()) { SkDEBUGFAIL("Attempted to override sample coverage without support."); return; @@ -240,7 +240,7 @@ const char* GrGLSLFragmentShaderBuilder::dstColor() { return override; } - const GrGLSLCaps* glslCaps = fProgramBuilder->glslCaps(); + const GrShaderCaps* glslCaps = fProgramBuilder->shaderCaps(); if (glslCaps->fbFetchSupport()) { this->addFeature(1 << kFramebufferFetch_GLSLPrivateFeature, glslCaps->fbFetchExtensionString()); @@ -263,7 +263,7 @@ const char* GrGLSLFragmentShaderBuilder::dstColor() { void GrGLSLFragmentShaderBuilder::enableAdvancedBlendEquationIfNeeded(GrBlendEquation equation) { SkASSERT(GrBlendEquationIsAdvanced(equation)); - const GrGLSLCaps& caps = *fProgramBuilder->glslCaps(); + const GrShaderCaps& caps = *fProgramBuilder->shaderCaps(); if (!caps.mustEnableAdvBlendEqs()) { return; } @@ -290,7 +290,7 @@ void GrGLSLFragmentShaderBuilder::enableCustomOutput() { void GrGLSLFragmentShaderBuilder::enableSecondaryOutput() { SkASSERT(!fHasSecondaryOutput); fHasSecondaryOutput = true; - const GrGLSLCaps& caps = *fProgramBuilder->glslCaps(); + const GrShaderCaps& caps = *fProgramBuilder->shaderCaps(); if (const char* extension = caps.secondaryOutputExtensionString()) { this->addFeature(1 << kBlendFuncExtended_GLSLPrivateFeature, extension); } @@ -318,7 +318,7 @@ void GrGLSLFragmentBuilder::declAppendf(const char* fmt, ...) { } const char* GrGLSLFragmentShaderBuilder::getSecondaryColorOutputName() const { - const GrGLSLCaps& caps = *fProgramBuilder->glslCaps(); + const GrShaderCaps& caps = *fProgramBuilder->shaderCaps(); return caps.mustDeclareFragmentShaderOutput() ? DeclaredSecondaryColorOutputName() : "gl_SecondaryFragColorEXT"; } @@ -334,7 +334,7 @@ GrSurfaceOrigin GrGLSLFragmentShaderBuilder::getSurfaceOrigin() const { void GrGLSLFragmentShaderBuilder::onFinalize() { fProgramBuilder->varyingHandler()->getFragDecls(&this->inputs(), &this->outputs()); GrGLSLAppendDefaultFloatPrecisionDeclaration(kDefault_GrSLPrecision, - *fProgramBuilder->glslCaps(), + *fProgramBuilder->shaderCaps(), &this->precisionQualifier()); if (fUsedSampleOffsetArrays & (1 << kSkiaDevice_Coordinates)) { this->defineSampleOffsetArray(sample_offset_array_name(kSkiaDevice_Coordinates), diff --git a/src/gpu/glsl/GrGLSLPrimitiveProcessor.h b/src/gpu/glsl/GrGLSLPrimitiveProcessor.h index b398cfd5c7..6c3d3a8963 100644 --- a/src/gpu/glsl/GrGLSLPrimitiveProcessor.h +++ b/src/gpu/glsl/GrGLSLPrimitiveProcessor.h @@ -15,12 +15,12 @@ class GrBatchTracker; class GrPrimitiveProcessor; -class GrGLSLCaps; class GrGLSLPPFragmentBuilder; class GrGLSLGeometryBuilder; class GrGLSLGPBuilder; class GrGLSLVaryingHandler; class GrGLSLVertexBuilder; +class GrShaderCaps; class GrGLSLPrimitiveProcessor { public: @@ -71,7 +71,7 @@ public: GrGLSLPPFragmentBuilder* fragBuilder, GrGLSLVaryingHandler* varyingHandler, GrGLSLUniformHandler* uniformHandler, - const GrGLSLCaps* caps, + const GrShaderCaps* caps, const GrPrimitiveProcessor& gp, const char* outputColor, const char* outputCoverage, @@ -99,7 +99,7 @@ public: GrGLSLPPFragmentBuilder* fFragBuilder; GrGLSLVaryingHandler* fVaryingHandler; GrGLSLUniformHandler* fUniformHandler; - const GrGLSLCaps* fGLSLCaps; + const GrShaderCaps* fGLSLCaps; const GrPrimitiveProcessor& fGP; const char* fOutputColor; const char* fOutputCoverage; diff --git a/src/gpu/glsl/GrGLSLProgramBuilder.cpp b/src/gpu/glsl/GrGLSLProgramBuilder.cpp index 0c1661d3b7..40e5a43ded 100644 --- a/src/gpu/glsl/GrGLSLProgramBuilder.cpp +++ b/src/gpu/glsl/GrGLSLProgramBuilder.cpp @@ -7,9 +7,10 @@ #include "glsl/GrGLSLProgramBuilder.h" +#include "GrCaps.h" #include "GrPipeline.h" +#include "GrShaderCaps.h" #include "GrTexturePriv.h" -#include "glsl/GrGLSLCaps.h" #include "glsl/GrGLSLFragmentProcessor.h" #include "glsl/GrGLSLGeometryProcessor.h" #include "glsl/GrGLSLVarying.h" @@ -98,7 +99,7 @@ void GrGLSLProgramBuilder::emitAndInstallPrimProc(const GrPrimitiveProcessor& pr fVS.codeAppendf("// Primitive Processor %s\n", proc.name()); SkASSERT(!fGeometryProcessor); - fGeometryProcessor = proc.createGLSLInstance(*this->glslCaps()); + fGeometryProcessor = proc.createGLSLInstance(*this->shaderCaps()); SkSTArray<4, SamplerHandle> texSamplers(proc.numTextureSamplers()); SkSTArray<2, SamplerHandle> bufferSamplers(proc.numBuffers()); @@ -112,7 +113,7 @@ void GrGLSLProgramBuilder::emitAndInstallPrimProc(const GrPrimitiveProcessor& pr &fFS, this->varyingHandler(), this->uniformHandler(), - this->glslCaps(), + this->shaderCaps(), proc, outputColor->c_str(), outputCoverage->c_str(), @@ -182,7 +183,7 @@ void GrGLSLProgramBuilder::emitAndInstallFragProc(const GrFragmentProcessor& fp, GrGLSLFragmentProcessor::ImageStorages imageStorages(&fp, imageStorageArray.begin()); GrGLSLFragmentProcessor::EmitArgs args(&fFS, this->uniformHandler(), - this->glslCaps(), + this->shaderCaps(), fp, output->c_str(), input.isOnes() ? nullptr : input.c_str(), @@ -218,7 +219,7 @@ void GrGLSLProgramBuilder::emitAndInstallXferProc(const GrXferProcessor& xp, fFS.enableSecondaryOutput(); } - if (this->glslCaps()->mustDeclareFragmentShaderOutput()) { + if (this->shaderCaps()->mustDeclareFragmentShaderOutput()) { fFS.enableCustomOutput(); } @@ -234,7 +235,7 @@ void GrGLSLProgramBuilder::emitAndInstallXferProc(const GrXferProcessor& xp, bool usePLSDstRead = (plsState == GrPixelLocalStorageState::kFinish_GrPixelLocalStorageState); GrGLSLXferProcessor::EmitArgs args(&fFS, this->uniformHandler(), - this->glslCaps(), + this->shaderCaps(), xp, colorIn.c_str(), ignoresCoverage ? nullptr : coverageIn.c_str(), fFS.getPrimaryColorOutputName(), @@ -263,7 +264,8 @@ void GrGLSLProgramBuilder::emitSamplersAndImageStorages( name.printf("TextureSampler_%d", outTexSamplerHandles->count()); GrSLType samplerType = sampler.texture()->texturePriv().samplerType(); if (kTextureExternalSampler_GrSLType == samplerType) { - const char* externalFeatureString = this->glslCaps()->externalTextureExtensionString(); + const char* externalFeatureString = + this->shaderCaps()->externalTextureExtensionString(); // We shouldn't ever create a GrGLTexture that requires external sampler type SkASSERT(externalFeatureString); this->addFeature(sampler.visibility(), @@ -276,7 +278,7 @@ void GrGLSLProgramBuilder::emitSamplersAndImageStorages( } if (int numBuffers = processor.numBuffers()) { - SkASSERT(this->glslCaps()->texelBufferSupport()); + SkASSERT(this->shaderCaps()->texelBufferSupport()); GrShaderFlags texelBufferVisibility = kNone_GrShaderFlags; for (int b = 0; b < numBuffers; ++b) { @@ -287,7 +289,7 @@ void GrGLSLProgramBuilder::emitSamplersAndImageStorages( texelBufferVisibility |= access.visibility(); } - if (const char* extension = this->glslCaps()->texelBufferExtensionString()) { + if (const char* extension = this->shaderCaps()->texelBufferExtensionString()) { this->addFeature(texelBufferVisibility, 1 << GrGLSLShaderBuilder::kTexelBuffer_GLSLPrivateFeature, extension); @@ -316,8 +318,8 @@ void GrGLSLProgramBuilder::emitSampler(GrSLType samplerType, if (visibility & kFragment_GrShaderFlag) { ++fNumFragmentSamplers; } - GrSLPrecision precision = this->glslCaps()->samplerPrecision(config, visibility); - GrSwizzle swizzle = this->glslCaps()->configTextureSwizzle(config); + GrSLPrecision precision = this->shaderCaps()->samplerPrecision(config, visibility); + GrSwizzle swizzle = this->shaderCaps()->configTextureSwizzle(config); outSamplerHandles->emplace_back(this->uniformHandler()->addSampler(visibility, swizzle, samplerType, @@ -362,7 +364,7 @@ void GrGLSLProgramBuilder::emitFSOutputSwizzle(bool hasSecondaryOutput) { } bool GrGLSLProgramBuilder::checkSamplerCounts() { - const GrGLSLCaps& glslCaps = *this->glslCaps(); + const GrShaderCaps& glslCaps = *this->shaderCaps(); if (fNumVertexSamplers > glslCaps.maxVertexSamplers()) { GrCapsDebugf(this->caps(), "Program would use too many vertex samplers\n"); return false; @@ -385,7 +387,7 @@ bool GrGLSLProgramBuilder::checkSamplerCounts() { } bool GrGLSLProgramBuilder::checkImageStorageCounts() { - const GrGLSLCaps& glslCaps = *this->glslCaps(); + const GrShaderCaps& glslCaps = *this->shaderCaps(); if (fNumVertexImageStorages > glslCaps.maxVertexImageStorages()) { GrCapsDebugf(this->caps(), "Program would use too many vertex images\n"); return false; @@ -487,7 +489,7 @@ void GrGLSLProgramBuilder::finalizeShaders() { this->varyingHandler()->finalize(); fVS.finalize(kVertex_GrShaderFlag); if (this->primitiveProcessor().willUseGeoShader()) { - SkASSERT(this->glslCaps()->geometryShaderSupport()); + SkASSERT(this->shaderCaps()->geometryShaderSupport()); fGS.finalize(kGeometry_GrShaderFlag); } fFS.finalize(kFragment_GrShaderFlag); diff --git a/src/gpu/glsl/GrGLSLProgramBuilder.h b/src/gpu/glsl/GrGLSLProgramBuilder.h index 5543537d19..fdb6e11c14 100644 --- a/src/gpu/glsl/GrGLSLProgramBuilder.h +++ b/src/gpu/glsl/GrGLSLProgramBuilder.h @@ -8,6 +8,7 @@ #ifndef GrGLSLProgramBuilder_DEFINED #define GrGLSLProgramBuilder_DEFINED +#include "GrCaps.h" #include "GrGeometryProcessor.h" #include "GrGpu.h" #include "glsl/GrGLSLFragmentProcessor.h" @@ -19,10 +20,10 @@ #include "glsl/GrGLSLVertexShaderBuilder.h" #include "glsl/GrGLSLXferProcessor.h" -class GrGLSLCaps; class GrShaderVar; class GrGLSLVaryingHandler; class GrGLSLExpr4; +class GrShaderCaps; typedef SkSTArray<8, GrGLSLFragmentProcessor*, true> GrGLSLFragProcs; @@ -35,7 +36,7 @@ public: virtual ~GrGLSLProgramBuilder() {} virtual const GrCaps* caps() const = 0; - virtual const GrGLSLCaps* glslCaps() const = 0; + const GrShaderCaps* shaderCaps() const { return this->caps()->shaderCaps(); } const GrPrimitiveProcessor& primitiveProcessor() const { return fPrimProc; } const GrPipeline& pipeline() const { return fPipeline; } diff --git a/src/gpu/glsl/GrGLSLShaderBuilder.cpp b/src/gpu/glsl/GrGLSLShaderBuilder.cpp index 79e977c5be..e2cbdee3ff 100644 --- a/src/gpu/glsl/GrGLSLShaderBuilder.cpp +++ b/src/gpu/glsl/GrGLSLShaderBuilder.cpp @@ -6,9 +6,9 @@ */ #include "GrShaderVar.h" +#include "GrShaderCaps.h" #include "GrSwizzle.h" #include "glsl/GrGLSLShaderBuilder.h" -#include "glsl/GrGLSLCaps.h" #include "glsl/GrGLSLColorSpaceXformHelper.h" #include "glsl/GrGLSLProgramBuilder.h" @@ -31,7 +31,7 @@ GrGLSLShaderBuilder::GrGLSLShaderBuilder(GrGLSLProgramBuilder* program) void GrGLSLShaderBuilder::declAppend(const GrShaderVar& var) { SkString tempDecl; - var.appendDecl(fProgramBuilder->glslCaps(), &tempDecl); + var.appendDecl(fProgramBuilder->shaderCaps(), &tempDecl); this->codeAppendf("%s;", tempDecl.c_str()); } @@ -46,7 +46,7 @@ void GrGLSLShaderBuilder::emitFunction(GrSLType returnType, this->functions().appendf(" %s", outName->c_str()); this->functions().append("("); for (int i = 0; i < argCnt; ++i) { - args[i].appendDecl(fProgramBuilder->glslCaps(), &this->functions()); + args[i].appendDecl(fProgramBuilder->shaderCaps(), &this->functions()); if (i < argCnt - 1) { this->functions().append(", "); } @@ -150,7 +150,7 @@ void GrGLSLShaderBuilder::appendTexelFetch(SkString* out, SamplerHandle samplerHandle, const char* coordExpr) const { const GrShaderVar& sampler = fProgramBuilder->samplerVariable(samplerHandle); - SkASSERT(fProgramBuilder->glslCaps()->texelFetchSupport()); + SkASSERT(fProgramBuilder->shaderCaps()->texelFetchSupport()); SkASSERT(GrSLTypeIsCombinedSamplerType(sampler.getType())); out->appendf("texelFetch(%s, %s)", sampler.c_str(), coordExpr); @@ -183,14 +183,14 @@ bool GrGLSLShaderBuilder::addFeature(uint32_t featureBit, const char* extensionN void GrGLSLShaderBuilder::appendDecls(const VarArray& vars, SkString* out) const { for (int i = 0; i < vars.count(); ++i) { - vars[i].appendDecl(fProgramBuilder->glslCaps(), out); + vars[i].appendDecl(fProgramBuilder->shaderCaps(), out); out->append(";\n"); } } void GrGLSLShaderBuilder::addLayoutQualifier(const char* param, InterfaceQualifier interface) { - SkASSERT(fProgramBuilder->glslCaps()->generation() >= k330_GrGLSLGeneration || - fProgramBuilder->glslCaps()->mustEnableAdvBlendEqs()); + SkASSERT(fProgramBuilder->shaderCaps()->generation() >= k330_GrGLSLGeneration || + fProgramBuilder->shaderCaps()->mustEnableAdvBlendEqs()); fLayoutParams[interface].push_back() = param; } @@ -219,7 +219,7 @@ void GrGLSLShaderBuilder::compileAndAppendLayoutQualifiers() { void GrGLSLShaderBuilder::finalize(uint32_t visibility) { SkASSERT(!fFinalized); - this->versionDecl() = fProgramBuilder->glslCaps()->versionDeclString(); + this->versionDecl() = fProgramBuilder->shaderCaps()->versionDeclString(); this->compileAndAppendLayoutQualifiers(); SkASSERT(visibility); fProgramBuilder->appendUniformDecls((GrShaderFlags) visibility, &this->uniforms()); diff --git a/src/gpu/glsl/GrGLSLVarying.cpp b/src/gpu/glsl/GrGLSLVarying.cpp index f264fc0921..7d841f5417 100644 --- a/src/gpu/glsl/GrGLSLVarying.cpp +++ b/src/gpu/glsl/GrGLSLVarying.cpp @@ -5,8 +5,8 @@ * found in the LICENSE file. */ +#include "GrShaderCaps.h" #include "glsl/GrGLSLVarying.h" -#include "glsl/GrGLSLCaps.h" #include "glsl/GrGLSLProgramBuilder.h" void GrGLSLVaryingHandler::addPassThroughAttribute(const GrGeometryProcessor::Attribute* input, @@ -87,7 +87,7 @@ void GrGLSLVaryingHandler::addAttribute(const GrShaderVar& var) { } void GrGLSLVaryingHandler::setNoPerspective() { - const GrGLSLCaps& caps = *fProgramBuilder->glslCaps(); + const GrShaderCaps& caps = *fProgramBuilder->shaderCaps(); if (!caps.noperspectiveInterpolationSupport()) { return; } @@ -131,7 +131,7 @@ void GrGLSLVaryingHandler::finalize() { void GrGLSLVaryingHandler::appendDecls(const VarArray& vars, SkString* out) const { for (int i = 0; i < vars.count(); ++i) { - vars[i].appendDecl(fProgramBuilder->glslCaps(), out); + vars[i].appendDecl(fProgramBuilder->shaderCaps(), out); out->append(";"); } } @@ -148,7 +148,7 @@ void GrGLSLVaryingHandler::getGeomDecls(SkString* inputDecls, SkString* outputDe void GrGLSLVaryingHandler::getFragDecls(SkString* inputDecls, SkString* outputDecls) const { // We should not have any outputs in the fragment shader when using version 1.10 - SkASSERT(k110_GrGLSLGeneration != fProgramBuilder->glslCaps()->generation() || + SkASSERT(k110_GrGLSLGeneration != fProgramBuilder->shaderCaps()->generation() || fFragOutputs.empty()); this->appendDecls(fFragInputs, inputDecls); this->appendDecls(fFragOutputs, outputDecls); diff --git a/src/gpu/glsl/GrGLSLXferProcessor.cpp b/src/gpu/glsl/GrGLSLXferProcessor.cpp index 1f6db4ca20..0588513040 100644 --- a/src/gpu/glsl/GrGLSLXferProcessor.cpp +++ b/src/gpu/glsl/GrGLSLXferProcessor.cpp @@ -7,8 +7,8 @@ #include "glsl/GrGLSLXferProcessor.h" +#include "GrShaderCaps.h" #include "GrXferProcessor.h" -#include "glsl/GrGLSLCaps.h" #include "glsl/GrGLSLFragmentShaderBuilder.h" #include "glsl/GrGLSLProgramDataManager.h" #include "glsl/GrGLSLUniformHandler.h" diff --git a/src/gpu/glsl/GrGLSLXferProcessor.h b/src/gpu/glsl/GrGLSLXferProcessor.h index 69e00723a8..f3a1c688da 100644 --- a/src/gpu/glsl/GrGLSLXferProcessor.h +++ b/src/gpu/glsl/GrGLSLXferProcessor.h @@ -12,9 +12,9 @@ #include "glsl/GrGLSLUniformHandler.h" class GrXferProcessor; -class GrGLSLCaps; class GrGLSLXPBuilder; class GrGLSLXPFragmentBuilder; +class GrShaderCaps; class GrGLSLXferProcessor { public: @@ -27,7 +27,7 @@ public: struct EmitArgs { EmitArgs(GrGLSLXPFragmentBuilder* fragBuilder, GrGLSLUniformHandler* uniformHandler, - const GrGLSLCaps* caps, + const GrShaderCaps* caps, const GrXferProcessor& xp, const char* inputColor, const char* inputCoverage, @@ -52,7 +52,7 @@ public: GrGLSLXPFragmentBuilder* fXPFragBuilder; GrGLSLUniformHandler* fUniformHandler; - const GrGLSLCaps* fGLSLCaps; + const GrShaderCaps* fGLSLCaps; const GrXferProcessor& fXP; const char* fInputColor; const char* fInputCoverage; diff --git a/src/gpu/instanced/InstanceProcessor.cpp b/src/gpu/instanced/InstanceProcessor.cpp index fd9ddbd5ef..f6213a3c3d 100644 --- a/src/gpu/instanced/InstanceProcessor.cpp +++ b/src/gpu/instanced/InstanceProcessor.cpp @@ -11,7 +11,7 @@ #include "GrRenderTargetPriv.h" #include "GrResourceCache.h" #include "GrResourceProvider.h" -#include "glsl/GrGLSLCaps.h" +#include "GrShaderCaps.h" #include "glsl/GrGLSLGeometryProcessor.h" #include "glsl/GrGLSLFragmentShaderBuilder.h" #include "glsl/GrGLSLProgramBuilder.h" @@ -19,7 +19,7 @@ namespace gr_instanced { -GrCaps::InstancedSupport InstanceProcessor::CheckSupport(const GrGLSLCaps& glslCaps, +GrCaps::InstancedSupport InstanceProcessor::CheckSupport(const GrShaderCaps& glslCaps, const GrCaps& caps) { if (!glslCaps.canUseAnyFunctionInShader() || !glslCaps.flatInterpolationSupport() || @@ -95,7 +95,7 @@ private: typedef GrGLSLGeometryProcessor INHERITED; }; -GrGLSLPrimitiveProcessor* InstanceProcessor::createGLSLInstance(const GrGLSLCaps&) const { +GrGLSLPrimitiveProcessor* InstanceProcessor::createGLSLInstance(const GrShaderCaps&) const { return new GLSLInstanceProcessor(); } diff --git a/src/gpu/instanced/InstanceProcessor.h b/src/gpu/instanced/InstanceProcessor.h index d54ffcd0c1..df96ce3933 100644 --- a/src/gpu/instanced/InstanceProcessor.h +++ b/src/gpu/instanced/InstanceProcessor.h @@ -27,10 +27,10 @@ public: const char* name() const override { return "Instance Processor"; } BatchInfo batchInfo() const { return fBatchInfo; } - void getGLSLProcessorKey(const GrGLSLCaps&, GrProcessorKeyBuilder* b) const override { + void getGLSLProcessorKey(const GrShaderCaps&, GrProcessorKeyBuilder* b) const override { b->add32(fBatchInfo.fData); } - GrGLSLPrimitiveProcessor* createGLSLInstance(const GrGLSLCaps&) const override; + GrGLSLPrimitiveProcessor* createGLSLInstance(const GrShaderCaps&) const override; /** * Returns a buffer of ShapeVertex that defines the canonical instanced geometry. @@ -54,7 +54,7 @@ private: * Called by the platform-specific instanced rendering implementation to determine the level of * support this class can offer on the given GLSL platform. */ - static GrCaps::InstancedSupport CheckSupport(const GrGLSLCaps&, const GrCaps&); + static GrCaps::InstancedSupport CheckSupport(const GrShaderCaps&, const GrCaps&); const BatchInfo fBatchInfo; BufferAccess fParamsAccess; diff --git a/src/gpu/vk/GrVkCaps.cpp b/src/gpu/vk/GrVkCaps.cpp index cb5ea79ff9..4e5e99fd99 100644 --- a/src/gpu/vk/GrVkCaps.cpp +++ b/src/gpu/vk/GrVkCaps.cpp @@ -7,8 +7,8 @@ #include "GrVkCaps.h" +#include "GrShaderCaps.h" #include "GrVkUtil.h" -#include "glsl/GrGLSLCaps.h" #include "vk/GrVkInterface.h" #include "vk/GrVkBackendContext.h" @@ -45,7 +45,7 @@ GrVkCaps::GrVkCaps(const GrContextOptions& contextOptions, const GrVkInterface* fMaxColorSampleCount = 4; // minimum required by spec fMaxStencilSampleCount = 4; // minimum required by spec - fShaderCaps.reset(new GrGLSLCaps(contextOptions)); + fShaderCaps.reset(new GrShaderCaps(contextOptions)); this->init(contextOptions, vkInterface, physDev, featureFlags, extensionFlags); } @@ -80,7 +80,7 @@ void GrVkCaps::init(const GrContextOptions& contextOptions, const GrVkInterface* } this->applyOptionsOverrides(contextOptions); - GrGLSLCaps* glslCaps = static_cast(fShaderCaps.get()); + GrShaderCaps* glslCaps = fShaderCaps.get(); glslCaps->applyOptionsOverrides(contextOptions); } @@ -139,7 +139,7 @@ void GrVkCaps::initGrCaps(const VkPhysicalDeviceProperties& properties, void GrVkCaps::initGLSLCaps(const VkPhysicalDeviceProperties& properties, uint32_t featureFlags) { - GrGLSLCaps* glslCaps = static_cast(fShaderCaps.get()); + GrShaderCaps* glslCaps = fShaderCaps.get(); glslCaps->fVersionDeclString = "#version 330\n"; diff --git a/src/gpu/vk/GrVkCaps.h b/src/gpu/vk/GrVkCaps.h index 7b40e0d9b2..c1fb889268 100644 --- a/src/gpu/vk/GrVkCaps.h +++ b/src/gpu/vk/GrVkCaps.h @@ -13,7 +13,7 @@ #include "vk/GrVkDefines.h" struct GrVkInterface; -class GrGLSLCaps; +class GrShaderCaps; /** * Stores some capabilities of a Vk backend. @@ -83,7 +83,7 @@ public: return fPreferedStencilFormat; } - GrGLSLCaps* glslCaps() const { return reinterpret_cast(fShaderCaps.get()); } + GrShaderCaps* glslCaps() const { return fShaderCaps.get(); } private: enum VkVendor { diff --git a/src/gpu/vk/GrVkCopyManager.cpp b/src/gpu/vk/GrVkCopyManager.cpp index 5e5450355c..4d5be9acd7 100644 --- a/src/gpu/vk/GrVkCopyManager.cpp +++ b/src/gpu/vk/GrVkCopyManager.cpp @@ -7,8 +7,9 @@ #include "GrVkCopyManager.h" -#include "GrSurface.h" #include "GrSamplerParams.h" +#include "GrShaderCaps.h" +#include "GrSurface.h" #include "GrTexturePriv.h" #include "GrVkCommandBuffer.h" #include "GrVkCopyPipeline.h" @@ -21,12 +22,11 @@ #include "GrVkTexture.h" #include "GrVkUniformBuffer.h" #include "GrVkVertexBuffer.h" -#include "glsl/GrGLSLCaps.h" #include "SkPoint.h" #include "SkRect.h" bool GrVkCopyManager::createCopyProgram(GrVkGpu* gpu) { - const GrGLSLCaps* glslCaps = gpu->vkCaps().glslCaps(); + const GrShaderCaps* glslCaps = gpu->vkCaps().glslCaps(); const char* version = glslCaps->versionDeclString(); SkString vertShaderText(version); vertShaderText.append( diff --git a/src/gpu/vk/GrVkPipelineState.cpp b/src/gpu/vk/GrVkPipelineState.cpp index 75b8baaa4f..e5bf7fa9a8 100644 --- a/src/gpu/vk/GrVkPipelineState.cpp +++ b/src/gpu/vk/GrVkPipelineState.cpp @@ -501,7 +501,7 @@ bool GrVkPipelineState::Desc::Build(Desc* desc, const GrPipeline& pipeline, const GrStencilSettings& stencil, GrPrimitiveType primitiveType, - const GrGLSLCaps& caps) { + const GrShaderCaps& caps) { if (!INHERITED::Build(desc, primProc, primitiveType == kPoints_GrPrimitiveType, pipeline, caps)) { return false; diff --git a/src/gpu/vk/GrVkPipelineState.h b/src/gpu/vk/GrVkPipelineState.h index 3b0a6afddd..49a6f9ff62 100644 --- a/src/gpu/vk/GrVkPipelineState.h +++ b/src/gpu/vk/GrVkPipelineState.h @@ -76,7 +76,7 @@ public: const GrPipeline&, const GrStencilSettings&, GrPrimitiveType primitiveType, - const GrGLSLCaps&); + const GrShaderCaps&); private: typedef GrProgramDesc INHERITED; }; diff --git a/src/gpu/vk/GrVkPipelineStateBuilder.cpp b/src/gpu/vk/GrVkPipelineStateBuilder.cpp index 01701b6653..49f5cf8a0c 100644 --- a/src/gpu/vk/GrVkPipelineStateBuilder.cpp +++ b/src/gpu/vk/GrVkPipelineStateBuilder.cpp @@ -7,7 +7,7 @@ #include "vk/GrVkPipelineStateBuilder.h" -#include "glsl/GrGLSLCaps.h" +#include "GrShaderCaps.h" #include "vk/GrVkDescriptorSetManager.h" #include "vk/GrVkGpu.h" #include "vk/GrVkRenderPass.h" @@ -49,9 +49,6 @@ GrVkPipelineStateBuilder::GrVkPipelineStateBuilder(GrVkGpu* gpu, const GrCaps* GrVkPipelineStateBuilder::caps() const { return fGpu->caps(); } -const GrGLSLCaps* GrVkPipelineStateBuilder::glslCaps() const { - return fGpu->vkCaps().glslCaps(); -} void GrVkPipelineStateBuilder::finalizeFragmentOutputColor(GrShaderVar& outputColor) { outputColor.addLayoutQualifier("location = 0, index = 0"); diff --git a/src/gpu/vk/GrVkPipelineStateBuilder.h b/src/gpu/vk/GrVkPipelineStateBuilder.h index 8e3ede9a90..c36f9ac982 100644 --- a/src/gpu/vk/GrVkPipelineStateBuilder.h +++ b/src/gpu/vk/GrVkPipelineStateBuilder.h @@ -38,7 +38,6 @@ public: const GrVkRenderPass& renderPass); const GrCaps* caps() const override; - const GrGLSLCaps* glslCaps() const override; GrVkGpu* gpu() const { return fGpu; } diff --git a/src/gpu/vk/GrVkUniformHandler.cpp b/src/gpu/vk/GrVkUniformHandler.cpp index 8c4f8514b8..c64864b55a 100644 --- a/src/gpu/vk/GrVkUniformHandler.cpp +++ b/src/gpu/vk/GrVkUniformHandler.cpp @@ -208,7 +208,7 @@ void GrVkUniformHandler::appendUniformDecls(GrShaderFlags visibility, SkString* const UniformInfo& sampler = fSamplers[i]; SkASSERT(sampler.fVariable.getType() == kTexture2DSampler_GrSLType); if (visibility == sampler.fVisibility) { - sampler.fVariable.appendDecl(fProgramBuilder->glslCaps(), out); + sampler.fVariable.appendDecl(fProgramBuilder->shaderCaps(), out); out->append(";\n"); } } @@ -218,7 +218,7 @@ void GrVkUniformHandler::appendUniformDecls(GrShaderFlags visibility, SkString* const UniformInfo& localUniform = fUniforms[i]; if (visibility == localUniform.fVisibility) { if (GrSLTypeIsFloatType(localUniform.fVariable.getType())) { - localUniform.fVariable.appendDecl(fProgramBuilder->glslCaps(), &uniformsString); + localUniform.fVariable.appendDecl(fProgramBuilder->shaderCaps(), &uniformsString); uniformsString.append(";\n"); } } diff --git a/src/sksl/SkSLCompiler.cpp b/src/sksl/SkSLCompiler.cpp index 4990dfb9a4..1be0ba988a 100644 --- a/src/sksl/SkSLCompiler.cpp +++ b/src/sksl/SkSLCompiler.cpp @@ -457,7 +457,7 @@ bool Compiler::toSPIRV(Program::Kind kind, const SkString& text, SkString* out) return result; } -static void fill_caps(const GrGLSLCaps& caps, std::unordered_map* capsMap) { +static void fill_caps(const GrShaderCaps& caps, std::unordered_map* capsMap) { #define CAP(name) capsMap->insert(std::make_pair(SkString(#name), CapValue(caps.name()))); CAP(fbFetchSupport); CAP(fbFetchNeedsCustomOutput); @@ -478,7 +478,7 @@ static void fill_caps(const GrGLSLCaps& caps, std::unordered_map capsMap; fill_caps(caps, &capsMap); @@ -491,7 +491,7 @@ bool Compiler::toGLSL(Program::Kind kind, const SkString& text, const GrGLSLCaps return fErrorCount == 0; } -bool Compiler::toGLSL(Program::Kind kind, const SkString& text, const GrGLSLCaps& caps, +bool Compiler::toGLSL(Program::Kind kind, const SkString& text, const GrShaderCaps& caps, SkString* out) { SkDynamicMemoryWStream buffer; bool result = this->toGLSL(kind, text, caps, buffer); diff --git a/src/sksl/SkSLCompiler.h b/src/sksl/SkSLCompiler.h index 5a06bfa264..114f8efeba 100644 --- a/src/sksl/SkSLCompiler.h +++ b/src/sksl/SkSLCompiler.h @@ -45,10 +45,10 @@ public: bool toSPIRV(Program::Kind kind, const SkString& text, SkString* out); - bool toGLSL(Program::Kind kind, const SkString& text, const GrGLSLCaps& caps, + bool toGLSL(Program::Kind kind, const SkString& text, const GrShaderCaps& caps, SkWStream& out); - bool toGLSL(Program::Kind kind, const SkString& text, const GrGLSLCaps& caps, + bool toGLSL(Program::Kind kind, const SkString& text, const GrShaderCaps& caps, SkString* out); void error(Position position, SkString msg) override; diff --git a/src/sksl/SkSLGLSLCodeGenerator.h b/src/sksl/SkSLGLSLCodeGenerator.h index 05c931a0a7..ffc5a4d473 100644 --- a/src/sksl/SkSLGLSLCodeGenerator.h +++ b/src/sksl/SkSLGLSLCodeGenerator.h @@ -12,8 +12,8 @@ #include #include +#include "GrShaderCaps.h" #include "SkStream.h" -#include "glsl/GrGLSLCaps.h" #include "SkSLCodeGenerator.h" #include "ir/SkSLBinaryExpression.h" #include "ir/SkSLBoolLiteral.h" @@ -72,7 +72,7 @@ public: kTopLevel_Precedence = 18 }; - GLSLCodeGenerator(const Context* context, const GrGLSLCaps* caps) + GLSLCodeGenerator(const Context* context, const GrShaderCaps* caps) : fContext(*context) , fCaps(*caps) {} @@ -156,7 +156,7 @@ private: void writeReturnStatement(const ReturnStatement& r); const Context& fContext; - const GrGLSLCaps& fCaps; + const GrShaderCaps& fCaps; SkWStream* fOut = nullptr; SkDynamicMemoryWStream fHeader; SkString fFunctionHeader; diff --git a/src/sksl/SkSLUtil.h b/src/sksl/SkSLUtil.h index fae1c85606..e5fb239a67 100644 --- a/src/sksl/SkSLUtil.h +++ b/src/sksl/SkSLUtil.h @@ -15,65 +15,65 @@ #include "SkStream.h" #include "SkString.h" #include "SkTypes.h" -#include "glsl/GrGLSLCaps.h" #include "GrContextOptions.h" +#include "GrShaderCaps.h" namespace SkSL { // Various sets of caps for use in tests class GLSLCapsFactory { public: - static sk_sp Default() { - sk_sp result = sk_make_sp(GrContextOptions()); + static sk_sp Default() { + sk_sp result = sk_make_sp(GrContextOptions()); result->fVersionDeclString = "#version 400"; result->fShaderDerivativeSupport = true; return result; } - static sk_sp Version450Core() { - sk_sp result = sk_make_sp(GrContextOptions()); + static sk_sp Version450Core() { + sk_sp result = sk_make_sp(GrContextOptions()); result->fVersionDeclString = "#version 450 core"; return result; } - static sk_sp Version110() { - sk_sp result = sk_make_sp(GrContextOptions()); + static sk_sp Version110() { + sk_sp result = sk_make_sp(GrContextOptions()); result->fVersionDeclString = "#version 110"; result->fGLSLGeneration = GrGLSLGeneration::k110_GrGLSLGeneration; return result; } - static sk_sp UsesPrecisionModifiers() { - sk_sp result = sk_make_sp(GrContextOptions()); + static sk_sp UsesPrecisionModifiers() { + sk_sp result = sk_make_sp(GrContextOptions()); result->fVersionDeclString = "#version 400"; result->fUsesPrecisionModifiers = true; return result; } - static sk_sp CannotUseMinAndAbsTogether() { - sk_sp result = sk_make_sp(GrContextOptions()); + static sk_sp CannotUseMinAndAbsTogether() { + sk_sp result = sk_make_sp(GrContextOptions()); result->fVersionDeclString = "#version 400"; result->fCanUseMinAndAbsTogether = false; return result; } - static sk_sp MustForceNegatedAtanParamToFloat() { - sk_sp result = sk_make_sp(GrContextOptions()); + static sk_sp MustForceNegatedAtanParamToFloat() { + sk_sp result = sk_make_sp(GrContextOptions()); result->fVersionDeclString = "#version 400"; result->fMustForceNegatedAtanParamToFloat = true; return result; } - static sk_sp ShaderDerivativeExtensionString() { - sk_sp result = sk_make_sp(GrContextOptions()); + static sk_sp ShaderDerivativeExtensionString() { + sk_sp result = sk_make_sp(GrContextOptions()); result->fVersionDeclString = "#version 400"; result->fShaderDerivativeSupport = true; result->fShaderDerivativeExtensionString = "GL_OES_standard_derivatives"; return result; } - static sk_sp VariousCaps() { - sk_sp result = sk_make_sp(GrContextOptions()); + static sk_sp VariousCaps() { + sk_sp result = sk_make_sp(GrContextOptions()); result->fVersionDeclString = "#version 400"; result->fExternalTextureSupport = true; result->fFBFetchSupport = false; diff --git a/tests/EGLImageTest.cpp b/tests/EGLImageTest.cpp index 8354a8d03a..82293625ef 100644 --- a/tests/EGLImageTest.cpp +++ b/tests/EGLImageTest.cpp @@ -9,10 +9,10 @@ #if SK_SUPPORT_GPU #include "GrContext.h" #include "GrContextFactory.h" +#include "GrShaderCaps.h" #include "gl/GrGLGpu.h" #include "gl/GrGLUtil.h" #include "gl/GLTestContext.h" -#include "glsl/GrGLSLCaps.h" using sk_gpu_test::GLTestContext; diff --git a/tests/GLProgramsTest.cpp b/tests/GLProgramsTest.cpp index 12a5b5cba6..07daa8fea5 100644 --- a/tests/GLProgramsTest.cpp +++ b/tests/GLProgramsTest.cpp @@ -55,7 +55,7 @@ public: } } - static void GenKey(const GrProcessor& processor, const GrGLSLCaps&, GrProcessorKeyBuilder* b) { + static void GenKey(const GrProcessor&, const GrShaderCaps&, GrProcessorKeyBuilder* b) { for (uint32_t i = 0; i < kMaxKeySize; i++) { b->add32(i); } @@ -81,7 +81,7 @@ private: BigKeyProcessor() { this->initClassID(); } - virtual void onGetGLSLProcessorKey(const GrGLSLCaps& caps, + virtual void onGetGLSLProcessorKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const override { GLBigKeyProcessor::GenKey(*this, caps, b); } @@ -127,7 +127,7 @@ private: this->registerChildProcessor(std::move(child)); } - void onGetGLSLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) const override {} + void onGetGLSLProcessorKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const override {} bool onIsEqual(const GrFragmentProcessor&) const override { return true; } diff --git a/tests/ImageStorageTest.cpp b/tests/ImageStorageTest.cpp index 415774aaa2..40681745db 100644 --- a/tests/ImageStorageTest.cpp +++ b/tests/ImageStorageTest.cpp @@ -34,7 +34,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageStorageLoad, reporter, ctxInfo) { this->addImageStorageAccess(&fImageStorageAccess); } - void onGetGLSLProcessorKey(const GrGLSLCaps&, GrProcessorKeyBuilder*) const override {} + void onGetGLSLProcessorKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override {} void onComputeInvariantOutput(GrInvariantOutput* inout) const override { inout->setToUnknown(GrInvariantOutput::kWillNot_ReadInput); diff --git a/tests/PrimitiveProcessorTest.cpp b/tests/PrimitiveProcessorTest.cpp index 4900ed6e84..9a338a8af5 100644 --- a/tests/PrimitiveProcessorTest.cpp +++ b/tests/PrimitiveProcessorTest.cpp @@ -62,7 +62,7 @@ private: } const char* name() const override { return "Dummy GP"; } - GrGLSLPrimitiveProcessor* createGLSLInstance(const GrGLSLCaps&) const override { + GrGLSLPrimitiveProcessor* createGLSLInstance(const GrShaderCaps&) const override { class GLSLGP : public GrGLSLGeometryProcessor { public: void onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) override { @@ -79,7 +79,7 @@ private: }; return new GLSLGP(); } - void getGLSLProcessorKey(const GrGLSLCaps&, + void getGLSLProcessorKey(const GrShaderCaps&, GrProcessorKeyBuilder* builder) const override { builder->add32(this->numAttribs()); } diff --git a/tests/SkSLGLSLTest.cpp b/tests/SkSLGLSLTest.cpp index 490c4379fb..b944bc449f 100644 --- a/tests/SkSLGLSLTest.cpp +++ b/tests/SkSLGLSLTest.cpp @@ -11,7 +11,7 @@ #if SK_SUPPORT_GPU -static void test(skiatest::Reporter* r, const char* src, const GrGLSLCaps& caps, +static void test(skiatest::Reporter* r, const char* src, const GrShaderCaps& caps, const char* expected) { SkSL::Compiler compiler; SkString output; -- 2.34.1