Merge GrGLSLCaps into GrShaderCaps
authorBrian Salomon <bsalomon@google.com>
Tue, 29 Nov 2016 18:43:05 +0000 (13:43 -0500)
committerSkia Commit-Bot <skia-commit-bot@chromium.org>
Tue, 29 Nov 2016 19:32:31 +0000 (19:32 +0000)
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 <ethannicholas@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>

141 files changed:
bench/GLInstancedArraysBench.cpp
bench/GLVec4ScalarBench.cpp
bench/GLVertexAttributesBench.cpp
experimental/SkPerlinNoiseShader2/SkPerlinNoiseShader2.cpp
gn/gpu.gni
include/gpu/GrCaps.h
include/gpu/GrFragmentProcessor.h
include/gpu/GrShaderCaps.h [new file with mode: 0644]
include/gpu/GrShaderVar.h
include/gpu/GrXferProcessor.h
include/gpu/effects/GrConstColorProcessor.h
include/private/GrGLSL.h [new file with mode: 0644]
include/private/GrGLSL_impl.h [new file with mode: 0644]
include/private/GrSwizzle.h [new file with mode: 0644]
src/core/SkColorMatrixFilterRowMajor255.cpp
src/core/SkLightingShader.cpp
src/core/SkNormalBevelSource.cpp
src/core/SkNormalFlatSource.cpp
src/core/SkNormalMapSource.cpp
src/core/SkRadialShadowMapShader.cpp
src/core/SkShadowShader.cpp
src/effects/GrAlphaThresholdFragmentProcessor.cpp
src/effects/GrAlphaThresholdFragmentProcessor.h
src/effects/GrCircleBlurFragmentProcessor.cpp
src/effects/GrCircleBlurFragmentProcessor.h
src/effects/SkArithmeticMode_gpu.cpp
src/effects/SkArithmeticMode_gpu.h
src/effects/SkBlurMaskFilter.cpp
src/effects/SkColorCubeFilter.cpp
src/effects/SkDisplacementMapEffect.cpp
src/effects/SkGaussianEdgeShader.cpp
src/effects/SkLightingImageFilter.cpp
src/effects/SkLumaColorFilter.cpp
src/effects/SkMagnifierImageFilter.cpp
src/effects/SkMorphologyImageFilter.cpp
src/effects/SkOverdrawColorFilter.cpp
src/effects/SkPerlinNoiseShader.cpp
src/effects/SkRRectsGaussianEdgeMaskFilter.cpp
src/effects/SkTableColorFilter.cpp
src/effects/gradients/SkGradientShader.cpp
src/effects/gradients/SkGradientShaderPriv.h
src/effects/gradients/SkLinearGradient.cpp
src/effects/gradients/SkRadialGradient.cpp
src/effects/gradients/SkSweepGradient.cpp
src/effects/gradients/SkTwoPointConicalGradient_gpu.cpp
src/gpu/GrCaps.cpp
src/gpu/GrDefaultGeoProcFactory.cpp
src/gpu/GrFragmentProcessor.cpp
src/gpu/GrOvalRenderer.cpp
src/gpu/GrPathProcessor.cpp
src/gpu/GrPathProcessor.h
src/gpu/GrPathRendererChain.cpp
src/gpu/GrPrimitiveProcessor.h
src/gpu/GrProgramDesc.cpp
src/gpu/GrProgramDesc.h
src/gpu/GrRenderTargetContext.cpp
src/gpu/GrShaderCaps.cpp [new file with mode: 0644]
src/gpu/GrShaderVar.cpp
src/gpu/GrSwizzle.h [deleted file]
src/gpu/GrXferProcessor.cpp
src/gpu/batches/GrAAConvexPathRenderer.cpp
src/gpu/batches/GrAnalyticRectBatch.cpp
src/gpu/batches/GrMSAAPathRenderer.cpp
src/gpu/batches/GrPLSPathRenderer.cpp
src/gpu/effects/GrBezierEffect.cpp
src/gpu/effects/GrBezierEffect.h
src/gpu/effects/GrBicubicEffect.cpp
src/gpu/effects/GrBicubicEffect.h
src/gpu/effects/GrBitmapTextGeoProc.cpp
src/gpu/effects/GrBitmapTextGeoProc.h
src/gpu/effects/GrConfigConversionEffect.cpp
src/gpu/effects/GrConfigConversionEffect.h
src/gpu/effects/GrConstColorProcessor.cpp
src/gpu/effects/GrConvexPolyEffect.cpp
src/gpu/effects/GrConvexPolyEffect.h
src/gpu/effects/GrConvolutionEffect.cpp
src/gpu/effects/GrConvolutionEffect.h
src/gpu/effects/GrCoverageSetOpXP.cpp
src/gpu/effects/GrCustomXfermode.cpp
src/gpu/effects/GrDashingEffect.cpp
src/gpu/effects/GrDisableColorXP.cpp
src/gpu/effects/GrDistanceFieldGeoProc.cpp
src/gpu/effects/GrDistanceFieldGeoProc.h
src/gpu/effects/GrDitherEffect.cpp
src/gpu/effects/GrGammaEffect.cpp
src/gpu/effects/GrGammaEffect.h
src/gpu/effects/GrMatrixConvolutionEffect.cpp
src/gpu/effects/GrMatrixConvolutionEffect.h
src/gpu/effects/GrOvalEffect.cpp
src/gpu/effects/GrPorterDuffXferProcessor.cpp
src/gpu/effects/GrRRectEffect.cpp
src/gpu/effects/GrShadowGeoProc.cpp
src/gpu/effects/GrShadowGeoProc.h
src/gpu/effects/GrSimpleTextureEffect.cpp
src/gpu/effects/GrSimpleTextureEffect.h
src/gpu/effects/GrTextureDomain.cpp
src/gpu/effects/GrTextureDomain.h
src/gpu/effects/GrXfermodeFragmentProcessor.cpp
src/gpu/effects/GrYUVEffect.cpp
src/gpu/gl/GrGLCaps.cpp
src/gpu/gl/GrGLCaps.h
src/gpu/gl/GrGLGLSL.cpp
src/gpu/gl/GrGLGLSL.h
src/gpu/gl/GrGLGpu.cpp
src/gpu/gl/GrGLTexture.cpp
src/gpu/gl/GrGLUniformHandler.cpp
src/gpu/gl/builders/GrGLProgramBuilder.cpp
src/gpu/gl/builders/GrGLProgramBuilder.h
src/gpu/glsl/GrGLSL.cpp
src/gpu/glsl/GrGLSL.h [deleted file]
src/gpu/glsl/GrGLSLCaps.cpp [deleted file]
src/gpu/glsl/GrGLSLCaps.h [deleted file]
src/gpu/glsl/GrGLSLFragmentProcessor.h
src/gpu/glsl/GrGLSLFragmentShaderBuilder.cpp
src/gpu/glsl/GrGLSLPrimitiveProcessor.h
src/gpu/glsl/GrGLSLProgramBuilder.cpp
src/gpu/glsl/GrGLSLProgramBuilder.h
src/gpu/glsl/GrGLSLShaderBuilder.cpp
src/gpu/glsl/GrGLSLVarying.cpp
src/gpu/glsl/GrGLSLXferProcessor.cpp
src/gpu/glsl/GrGLSLXferProcessor.h
src/gpu/glsl/GrGLSL_impl.h [deleted file]
src/gpu/instanced/InstanceProcessor.cpp
src/gpu/instanced/InstanceProcessor.h
src/gpu/vk/GrVkCaps.cpp
src/gpu/vk/GrVkCaps.h
src/gpu/vk/GrVkCopyManager.cpp
src/gpu/vk/GrVkPipelineState.cpp
src/gpu/vk/GrVkPipelineState.h
src/gpu/vk/GrVkPipelineStateBuilder.cpp
src/gpu/vk/GrVkPipelineStateBuilder.h
src/gpu/vk/GrVkUniformHandler.cpp
src/sksl/SkSLCompiler.cpp
src/sksl/SkSLCompiler.h
src/sksl/SkSLGLSLCodeGenerator.h
src/sksl/SkSLUtil.h
tests/EGLImageTest.cpp
tests/GLProgramsTest.cpp
tests/ImageStorageTest.cpp
tests/PrimitiveProcessorTest.cpp
tests/SkSLGLSLTest.cpp

index ca20673988298fae84b35353bb5d3f848145e34e..bb2c9e0990b26598d7473abd809cbf3fa7a0a81b 100644 (file)
 
 #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
index 0da0a0dc0e5320aefb53d18be09f5909520bc13b..3b354f798b26be7614302ebb853d5b7938666378 100644 (file)
 
 #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 <stdio.h>
 
@@ -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
index c588f9b6b88dd7dae7acf52b19feb48a13963d89..dfbcebe074c25fcae9aacbf88af54bb6edfed81e 100644 (file)
 
 #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 <stdio.h>
 
 /*
@@ -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
index 1dcd8de888288f905d9b589f817a2a6146878bd5..f3040673fcc20e9f71828a99366446d97ba400fb 100644 (file)
@@ -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<GrPerlinNoise2Effect>();
 
@@ -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) {
 }
 
index e3b02b8bcbe46655db66c5150fcdefe54b9bd6f3..439443eee6f7417214b7244582f224d538f3d79d 100644 (file)
@@ -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",
index 60d0c705437f01690a77294fd217191522550edf..16a4ca9747eb6d062252dcf2490c1a7611565322 100644 (file)
 #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.
index 30e92f6e8d2fe76c85ff23a48f8bbf0515218ae4..49ccceabae60289cb8c9e74cca5c8b15735a3e7c 100644 (file)
 #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/include/gpu/GrShaderCaps.h b/include/gpu/GrShaderCaps.h
new file mode 100644 (file)
index 0000000..ec5d7ef
--- /dev/null
@@ -0,0 +1,344 @@
+/*
+ * Copyright 2012 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+
+#ifndef GrShaderCaps_DEFINED
+#define GrShaderCaps_DEFINED
+
+#include "../private/GrSwizzle.h"
+#include "../private/GrGLSL.h"
+
+namespace SkSL {
+    class GLSLCapsFactory;
+}
+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;
+    };
+
+    /**
+    * Indicates how GLSL must interact with advanced blend equations. The KHR extension requires
+    * special layout qualifiers in the fragment shader.
+    */
+    enum AdvBlendEqInteraction {
+        kNotSupported_AdvBlendEqInteraction,     //<! No _blend_equation_advanced extension
+        kAutomatic_AdvBlendEqInteraction,        //<! No interaction required
+        kGeneralEnable_AdvBlendEqInteraction,    //<! layout(blend_support_all_equations) out
+        kSpecificEnables_AdvBlendEqInteraction,  //<! Specific layout qualifiers per equation
+
+        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; }
+
+    /**
+     * 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
+    }
+
+    /**
+     * Some helper functions for encapsulating various extensions to read FB Buffer on openglES
+     *
+     * TODO(joshualitt) On desktop opengl 4.2+ we can achieve something similar to this effect
+     */
+    bool fbFetchSupport() const { return fFBFetchSupport; }
+
+    bool fbFetchNeedsCustomOutput() const { return fFBFetchNeedsCustomOutput; }
+
+    bool bindlessTextureSupport() const { return fBindlessTextureSupport; }
+
+    const char* versionDeclString() const { return fVersionDeclString; }
+
+    const char* fbFetchColorName() const { return fFBFetchColorName; }
+
+    const char* fbFetchExtensionString() const { return fFBFetchExtensionString; }
+
+    bool dropsTileOnZeroDivide() const { return fDropsTileOnZeroDivide; }
+
+    bool flatInterpolationSupport() const { return fFlatInterpolationSupport; }
+
+    bool noperspectiveInterpolationSupport() const { return fNoPerspectiveInterpolationSupport; }
+
+    bool multisampleInterpolationSupport() const { return fMultisampleInterpolationSupport; }
+
+    bool sampleVariablesSupport() const { return fSampleVariablesSupport; }
+
+    bool sampleMaskOverrideCoverageSupport() const { return fSampleMaskOverrideCoverageSupport; }
+
+    bool externalTextureSupport() const { return fExternalTextureSupport; }
+
+    bool texelFetchSupport() const { return fTexelFetchSupport; }
+
+    AdvBlendEqInteraction advBlendEqInteraction() const { return fAdvBlendEqInteraction; }
+
+    bool mustEnableAdvBlendEqs() const {
+        return fAdvBlendEqInteraction >= kGeneralEnable_AdvBlendEqInteraction;
+    }
+
+    bool mustEnableSpecificAdvBlendEqs() const {
+        return fAdvBlendEqInteraction == kSpecificEnables_AdvBlendEqInteraction;
+    }
+
+    bool mustDeclareFragmentShaderOutput() const {
+        return fGLSLGeneration > k110_GrGLSLGeneration;
+    }
+
+    bool usesPrecisionModifiers() const { return fUsesPrecisionModifiers; }
+
+    // Returns whether we can use the glsl funciton any() in our shader code.
+    bool canUseAnyFunctionInShader() const { return fCanUseAnyFunctionInShader; }
+
+    bool canUseMinAndAbsTogether() const { return fCanUseMinAndAbsTogether; }
+
+    bool mustForceNegatedAtanParamToFloat() const { return fMustForceNegatedAtanParamToFloat; }
+
+    bool requiresLocalOutputColorForFBFetch() const { return fRequiresLocalOutputColorForFBFetch; }
+
+    // Returns the string of an extension that must be enabled in the shader to support
+    // derivatives. If nullptr is returned then no extension needs to be enabled. Before calling
+    // this function, the caller should check that shaderDerivativeSupport exists.
+    const char* shaderDerivativeExtensionString() const {
+        SkASSERT(this->shaderDerivativeSupport());
+        return fShaderDerivativeExtensionString;
+    }
+
+    // Returns the string of an extension that will do all necessary coord transfomations needed
+    // when reading the fragment position. If such an extension does not exisits, this function
+    // returns a nullptr, and all transforms of the frag position must be done manually in the
+    // shader.
+    const char* fragCoordConventionsExtensionString() const {
+        return fFragCoordConventionsExtensionString;
+    }
+
+    // This returns the name of an extension that must be enabled in the shader, if such a thing is
+    // required in order to use a secondary output in the shader. This returns a nullptr if no such
+    // extension is required. However, the return value of this function does not say whether dual
+    // source blending is supported.
+    const char* secondaryOutputExtensionString() const {
+        return fSecondaryOutputExtensionString;
+    }
+
+    const char* externalTextureExtensionString() const {
+        SkASSERT(this->externalTextureSupport());
+        return fExternalTextureExtensionString;
+    }
+
+    const char* texelBufferExtensionString() const {
+        SkASSERT(this->texelBufferSupport());
+        return fTexelBufferExtensionString;
+    }
+
+    const char* noperspectiveInterpolationExtensionString() const {
+        SkASSERT(this->noperspectiveInterpolationSupport());
+        return fNoPerspectiveInterpolationExtensionString;
+    }
+
+    const char* multisampleInterpolationExtensionString() const {
+        SkASSERT(this->multisampleInterpolationSupport());
+        return fMultisampleInterpolationExtensionString;
+    }
+
+    const char* sampleVariablesExtensionString() const {
+        SkASSERT(this->sampleVariablesSupport());
+        return fSampleVariablesExtensionString;
+    }
+
+    const char* imageLoadStoreExtensionString() const {
+        SkASSERT(this->imageLoadStoreSupport());
+        return fImageLoadStoreExtensionString;
+    }
+
+    int maxVertexSamplers() const { return fMaxVertexSamplers; }
+
+    int maxGeometrySamplers() const { return fMaxGeometrySamplers; }
+
+    int maxFragmentSamplers() const { return fMaxFragmentSamplers; }
+
+    int maxCombinedSamplers() const { return fMaxCombinedSamplers; }
+
+    int maxVertexImageStorages() const { return fMaxVertexImageStorages; }
+
+    int maxGeometryImageStorages() const { return fMaxGeometryImageStorages; }
+
+    int maxFragmentImageStorages() const { return fMaxFragmentImageStorages; }
+
+    int maxCombinedImageStorages() const { return fMaxCombinedImageStorages; }
+
+    /**
+     * Given a texture's config, this determines what swizzle must be appended to accesses to the
+     * texture in generated shader code. Swizzling may be implemented in texture parameters or a
+     * sampler rather than in the shader. In this case the returned swizzle will always be "rgba".
+     */
+    const GrSwizzle& configTextureSwizzle(GrPixelConfig config) const {
+        return fConfigTextureSwizzle[config];
+    }
+
+    /** Swizzle that should occur on the fragment shader outputs for a given config. */
+    const GrSwizzle& configOutputSwizzle(GrPixelConfig config) const {
+        return fConfigOutputSwizzle[config];
+    }
+
+    /** Precision qualifier that should be used with a sampler, given its config and visibility. */
+    GrSLPrecision samplerPrecision(GrPixelConfig config, GrShaderFlags visibility) const {
+        return static_cast<GrSLPrecision>(fSamplerPrecisions[visibility][config]);
+    }
+
+    GrGLSLGeneration generation() const { return fGLSLGeneration; }
+
+private:
+    /** GrCaps subclasses must call this after filling in the shader precision table. */
+    void initSamplerPrecisionTable();
+
+    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;
+    bool fBindlessTextureSupport : 1;
+    bool fUsesPrecisionModifiers : 1;
+    bool fCanUseAnyFunctionInShader : 1;
+    bool fFlatInterpolationSupport : 1;
+    bool fNoPerspectiveInterpolationSupport : 1;
+    bool fMultisampleInterpolationSupport : 1;
+    bool fSampleVariablesSupport : 1;
+    bool fSampleMaskOverrideCoverageSupport : 1;
+    bool fExternalTextureSupport : 1;
+    bool fTexelFetchSupport : 1;
+
+    // Used for specific driver bug work arounds
+    bool fCanUseMinAndAbsTogether : 1;
+    bool fMustForceNegatedAtanParamToFloat : 1;
+    bool fRequiresLocalOutputColorForFBFetch : 1;
+
+    PrecisionInfo fFloatPrecisions[kGrShaderTypeCount][kGrSLPrecisionCount];
+    int fPixelLocalStorageSize;
+
+    const char* fVersionDeclString;
+
+    const char* fShaderDerivativeExtensionString;
+    const char* fFragCoordConventionsExtensionString;
+    const char* fSecondaryOutputExtensionString;
+    const char* fExternalTextureExtensionString;
+    const char* fTexelBufferExtensionString;
+    const char* fNoPerspectiveInterpolationExtensionString;
+    const char* fMultisampleInterpolationExtensionString;
+    const char* fSampleVariablesExtensionString;
+    const char* fImageLoadStoreExtensionString;
+
+    const char* fFBFetchColorName;
+    const char* fFBFetchExtensionString;
+
+    int fMaxVertexSamplers;
+    int fMaxGeometrySamplers;
+    int fMaxFragmentSamplers;
+    int fMaxCombinedSamplers;
+
+    int fMaxVertexImageStorages;
+    int fMaxGeometryImageStorages;
+    int fMaxFragmentImageStorages;
+    int fMaxCombinedImageStorages;
+
+    AdvBlendEqInteraction fAdvBlendEqInteraction;
+
+    GrSwizzle fConfigTextureSwizzle[kGrPixelConfigCnt];
+    GrSwizzle fConfigOutputSwizzle[kGrPixelConfigCnt];
+
+    uint8_t fSamplerPrecisions[(1 << kGrShaderTypeCount)][kGrPixelConfigCnt];
+
+    friend class GrGLCaps;  // For initialization.
+    friend class GrVkCaps;
+    friend class SkSL::GLSLCapsFactory;
+};
+
+#endif
index 1149f84ccea57db9b922b7a8970c8da8fffe450a..7f09f8cbf7075e2cda0bb33d5b2dfa17e97cb137 100644 (file)
@@ -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
index 1e94400f678240c92fcf378266862bc0a077955f..685c266cd926613477754ec9ff4e1435ee42a4f9 100644 (file)
@@ -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
index 1d23fc349e200ac11f403b1afc177c8a8b87068e..73ea9eb196cb1ed4fd358acff641761412f2b2f2 100644 (file)
@@ -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/include/private/GrGLSL.h b/include/private/GrGLSL.h
new file mode 100644 (file)
index 0000000..6d9e403
--- /dev/null
@@ -0,0 +1,374 @@
+/*
+ * Copyright 2011 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef GrGLSL_DEFINED
+#define GrGLSL_DEFINED
+
+#include "GrTypesPriv.h"
+#include "SkString.h"
+
+class GrShaderCaps;
+
+// Limited set of GLSL versions we build shaders for. Caller should round
+// down the GLSL version to one of these enums.
+enum GrGLSLGeneration {
+    /**
+     * Desktop GLSL 1.10 and ES2 shading language (based on desktop GLSL 1.20)
+     */
+    k110_GrGLSLGeneration,
+    /**
+     * Desktop GLSL 1.30
+     */
+    k130_GrGLSLGeneration,
+    /**
+     * Desktop GLSL 1.40
+     */
+    k140_GrGLSLGeneration,
+    /**
+     * Desktop GLSL 1.50
+     */
+    k150_GrGLSLGeneration,
+    /**
+     * Desktop GLSL 3.30, and ES GLSL 3.00
+     */
+    k330_GrGLSLGeneration,
+    /**
+     * Desktop GLSL 4.00
+     */
+    k400_GrGLSLGeneration,
+    /**
+     * Desktop GLSL 4.20
+     */
+    k420_GrGLSLGeneration,
+    /**
+     * ES GLSL 3.10 only TODO Make GLSLCap objects to make this more granular
+     */
+    k310es_GrGLSLGeneration,
+    /**
+     * ES GLSL 3.20
+     */
+    k320es_GrGLSLGeneration,
+};
+
+bool GrGLSLSupportsNamedFragmentShaderOutputs(GrGLSLGeneration);
+
+/**
+ * Adds a line of GLSL code to declare the default precision for float types.
+ */
+void GrGLSLAppendDefaultFloatPrecisionDeclaration(GrSLPrecision,
+                                                  const GrShaderCaps&,
+                                                  SkString* out);
+
+/**
+ * Converts a GrSLPrecision to its corresponding GLSL precision qualifier.
+ */
+static inline const char* GrGLSLPrecisionString(GrSLPrecision p) {
+    switch (p) {
+        case kLow_GrSLPrecision:
+            return "lowp";
+        case kMedium_GrSLPrecision:
+            return "mediump";
+        case kHigh_GrSLPrecision:
+            return "highp";
+        default:
+            SkFAIL("Unexpected precision type.");
+            return "";
+    }
+}
+
+/**
+ * Converts a GrSLType to a string containing the name of the equivalent GLSL type.
+ */
+static inline const char* GrGLSLTypeString(GrSLType t) {
+    switch (t) {
+        case kVoid_GrSLType:
+            return "void";
+        case kFloat_GrSLType:
+            return "float";
+        case kVec2f_GrSLType:
+            return "vec2";
+        case kVec3f_GrSLType:
+            return "vec3";
+        case kVec4f_GrSLType:
+            return "vec4";
+        case kMat22f_GrSLType:
+            return "mat2";
+        case kMat33f_GrSLType:
+            return "mat3";
+        case kMat44f_GrSLType:
+            return "mat4";
+        case kTexture2DSampler_GrSLType:
+            return "sampler2D";
+        case kITexture2DSampler_GrSLType:
+            return "isampler2D";
+        case kTextureExternalSampler_GrSLType:
+            return "samplerExternalOES";
+        case kTexture2DRectSampler_GrSLType:
+            return "sampler2DRect";
+        case kBufferSampler_GrSLType:
+            return "samplerBuffer";
+        case kBool_GrSLType:
+            return "bool";
+        case kInt_GrSLType:
+            return "int";
+        case kUint_GrSLType:
+            return "uint";
+        case kTexture2D_GrSLType:
+            return "texture2D";
+        case kSampler_GrSLType:
+            return "sampler";
+        case kImageStorage2D_GrSLType:
+            return "image2D";
+        case kIImageStorage2D_GrSLType:
+            return "iimage2D";
+    }
+    SkFAIL("Unknown shader var type.");
+    return ""; // suppress warning
+}
+
+/** A generic base-class representing a GLSL expression.
+ * The instance can be a variable name, expression or vecN(0) or vecN(1). Does simple constant
+ * folding with help of 1 and 0.
+ *
+ * Clients should not use this class, rather the specific instantiations defined
+ * later, for example GrGLSLExpr4.
+ */
+template <typename Self>
+class GrGLSLExpr {
+public:
+    bool isOnes() const { return kOnes_ExprType == fType; }
+    bool isZeros() const { return kZeros_ExprType == fType; }
+
+    const char* c_str() const {
+        if (kZeros_ExprType == fType) {
+            return Self::ZerosStr();
+        } else if (kOnes_ExprType == fType) {
+            return Self::OnesStr();
+        }
+        SkASSERT(!fExpr.isEmpty()); // Empty expressions should not be used.
+        return fExpr.c_str();
+    }
+
+    bool isValid() const {
+        return kFullExpr_ExprType != fType || !fExpr.isEmpty();
+    }
+
+protected:
+    /** Constructs an invalid expression.
+     * Useful only as a return value from functions that never actually return
+     * this and instances that will be assigned to later. */
+    GrGLSLExpr()
+        : fType(kFullExpr_ExprType) {
+        // The only constructor that is allowed to build an empty expression.
+        SkASSERT(!this->isValid());
+    }
+
+    /** Constructs an expression with all components as value v */
+    explicit GrGLSLExpr(int v) {
+        if (v == 0) {
+            fType = kZeros_ExprType;
+        } else if (v == 1) {
+            fType = kOnes_ExprType;
+        } else {
+            fType = kFullExpr_ExprType;
+            fExpr.appendf(Self::CastIntStr(), v);
+        }
+    }
+
+    /** Constructs an expression from a string.
+     * Argument expr is a simple expression or a parenthesized expression. */
+    // TODO: make explicit once effects input Exprs.
+    GrGLSLExpr(const char expr[]) {
+        if (nullptr == expr) {  // TODO: remove this once effects input Exprs.
+            fType = kOnes_ExprType;
+        } else {
+            fType = kFullExpr_ExprType;
+            fExpr = expr;
+        }
+        SkASSERT(this->isValid());
+    }
+
+    /** Constructs an expression from a string.
+     * Argument expr is a simple expression or a parenthesized expression. */
+    // TODO: make explicit once effects input Exprs.
+    GrGLSLExpr(const SkString& expr) {
+        if (expr.isEmpty()) {  // TODO: remove this once effects input Exprs.
+            fType = kOnes_ExprType;
+        } else {
+            fType = kFullExpr_ExprType;
+            fExpr = expr;
+        }
+        SkASSERT(this->isValid());
+    }
+
+    /** Constructs an expression from a string with one substitution. */
+    GrGLSLExpr(const char format[], const char in0[])
+        : fType(kFullExpr_ExprType) {
+        fExpr.appendf(format, in0);
+    }
+
+    /** Constructs an expression from a string with two substitutions. */
+    GrGLSLExpr(const char format[], const char in0[], const char in1[])
+        : fType(kFullExpr_ExprType) {
+        fExpr.appendf(format, in0, in1);
+    }
+
+    /** Returns expression casted to another type.
+     * Generic implementation that is called for non-trivial cases of casts. */
+    template <typename T>
+    static Self VectorCastImpl(const T& other);
+
+    /** Returns a GLSL multiplication: component-wise or component-by-scalar.
+     * The multiplication will be component-wise or multiply each component by a scalar.
+     *
+     * The returned expression will compute the value of:
+     *    vecN(in0.x * in1.x, ...) if dim(T0) == dim(T1) (component-wise)
+     *    vecN(in0.x * in1, ...) if dim(T1) == 1 (vector by scalar)
+     *    vecN(in0 * in1.x, ...) if dim(T0) == 1 (scalar by vector)
+     */
+    template <typename T0, typename T1>
+    static Self Mul(T0 in0, T1 in1);
+
+    /** Returns a GLSL addition: component-wise or add a scalar to each component.
+     * Return value computes:
+     *   vecN(in0.x + in1.x, ...) or vecN(in0.x + in1, ...) or vecN(in0 + in1.x, ...).
+     */
+    template <typename T0, typename T1>
+    static Self Add(T0 in0, T1 in1);
+
+    /** Returns a GLSL subtraction: component-wise or subtract compoments by a scalar.
+     * Return value computes
+     *   vecN(in0.x - in1.x, ...) or vecN(in0.x - in1, ...) or vecN(in0 - in1.x, ...).
+     */
+    template <typename T0, typename T1>
+    static Self Sub(T0 in0, T1 in1);
+
+    /** Returns expression that accesses component(s) of the expression.
+     * format should be the form "%s.x" where 'x' is the component(s) to access.
+     * Caller is responsible for making sure the amount of components in the
+     * format string is equal to dim(T).
+     */
+    template <typename T>
+    T extractComponents(const char format[]) const;
+
+private:
+    enum ExprType {
+        kZeros_ExprType,
+        kOnes_ExprType,
+        kFullExpr_ExprType,
+    };
+    ExprType fType;
+    SkString fExpr;
+};
+
+class GrGLSLExpr1;
+class GrGLSLExpr4;
+
+/** Class representing a float GLSL expression. */
+class GrGLSLExpr1 : public GrGLSLExpr<GrGLSLExpr1> {
+public:
+    GrGLSLExpr1()
+        : INHERITED() {
+    }
+    explicit GrGLSLExpr1(int v)
+        : INHERITED(v) {
+    }
+    GrGLSLExpr1(const char* expr)
+        : INHERITED(expr) {
+    }
+    GrGLSLExpr1(const SkString& expr)
+        : INHERITED(expr) {
+    }
+
+    static GrGLSLExpr1 VectorCast(const GrGLSLExpr1& expr);
+
+private:
+    GrGLSLExpr1(const char format[], const char in0[])
+        : INHERITED(format, in0) {
+    }
+    GrGLSLExpr1(const char format[], const char in0[], const char in1[])
+        : INHERITED(format, in0, in1) {
+    }
+
+    static const char* ZerosStr();
+    static const char* OnesStr();
+    static const char* CastStr();
+    static const char* CastIntStr();
+
+    friend GrGLSLExpr1 operator*(const GrGLSLExpr1& in0, const GrGLSLExpr1&in1);
+    friend GrGLSLExpr1 operator+(const GrGLSLExpr1& in0, const GrGLSLExpr1&in1);
+    friend GrGLSLExpr1 operator-(const GrGLSLExpr1& in0, const GrGLSLExpr1&in1);
+
+    friend class GrGLSLExpr<GrGLSLExpr1>;
+    friend class GrGLSLExpr<GrGLSLExpr4>;
+
+    typedef GrGLSLExpr<GrGLSLExpr1> INHERITED;
+};
+
+/** Class representing a float vector (vec4) GLSL expression. */
+class GrGLSLExpr4 : public GrGLSLExpr<GrGLSLExpr4> {
+public:
+    GrGLSLExpr4()
+        : INHERITED() {
+    }
+    explicit GrGLSLExpr4(int v)
+        : INHERITED(v) {
+    }
+    GrGLSLExpr4(const char* expr)
+        : INHERITED(expr) {
+    }
+    GrGLSLExpr4(const SkString& expr)
+        : INHERITED(expr) {
+    }
+
+    typedef GrGLSLExpr1 AExpr;
+    AExpr a() const;
+
+    /** GLSL vec4 cast / constructor, eg vec4(floatv) -> vec4(floatv, floatv, floatv, floatv) */
+    static GrGLSLExpr4 VectorCast(const GrGLSLExpr1& expr);
+    static GrGLSLExpr4 VectorCast(const GrGLSLExpr4& expr);
+
+private:
+    GrGLSLExpr4(const char format[], const char in0[])
+        : INHERITED(format, in0) {
+    }
+    GrGLSLExpr4(const char format[], const char in0[], const char in1[])
+        : INHERITED(format, in0, in1) {
+    }
+
+    static const char* ZerosStr();
+    static const char* OnesStr();
+    static const char* CastStr();
+    static const char* CastIntStr();
+
+    // The vector-by-scalar and scalar-by-vector binary operations.
+    friend GrGLSLExpr4 operator*(const GrGLSLExpr1& in0, const GrGLSLExpr4&in1);
+    friend GrGLSLExpr4 operator+(const GrGLSLExpr1& in0, const GrGLSLExpr4&in1);
+    friend GrGLSLExpr4 operator-(const GrGLSLExpr1& in0, const GrGLSLExpr4&in1);
+    friend GrGLSLExpr4 operator*(const GrGLSLExpr4& in0, const GrGLSLExpr1&in1);
+    friend GrGLSLExpr4 operator+(const GrGLSLExpr4& in0, const GrGLSLExpr1&in1);
+    friend GrGLSLExpr4 operator-(const GrGLSLExpr4& in0, const GrGLSLExpr1&in1);
+
+    // The vector-by-vector, i.e. component-wise, binary operations.
+    friend GrGLSLExpr4 operator*(const GrGLSLExpr4& in0, const GrGLSLExpr4&in1);
+    friend GrGLSLExpr4 operator+(const GrGLSLExpr4& in0, const GrGLSLExpr4&in1);
+    friend GrGLSLExpr4 operator-(const GrGLSLExpr4& in0, const GrGLSLExpr4&in1);
+
+    friend class GrGLSLExpr<GrGLSLExpr4>;
+
+    typedef GrGLSLExpr<GrGLSLExpr4> INHERITED;
+};
+
+/**
+ * Does an inplace mul, *=, of vec4VarName by mulFactor.
+ * A semicolon is added after the assignment.
+ */
+void GrGLSLMulVarBy4f(SkString* outAppend, const char* vec4VarName, const GrGLSLExpr4& mulFactor);
+
+#include "GrGLSL_impl.h"
+
+#endif
diff --git a/include/private/GrGLSL_impl.h b/include/private/GrGLSL_impl.h
new file mode 100644 (file)
index 0000000..bdd69cc
--- /dev/null
@@ -0,0 +1,175 @@
+/*
+ * Copyright 2013 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef GrGLSL_impl_DEFINED
+#define GrGLSL_impl_DEFINED
+
+template<typename Self>
+template<typename T>
+inline Self GrGLSLExpr<Self>::VectorCastImpl(const T& expr) {
+    if (expr.isZeros()) {
+        return Self(0);
+    }
+    if (expr.isOnes()) {
+        return Self(1);
+    }
+    return Self(Self::CastStr(), expr.c_str());
+}
+
+template<typename Self>
+template<typename T0, typename T1>
+inline Self GrGLSLExpr<Self>::Mul(T0 in0, T1 in1) {
+    if (in0.isZeros() || in1.isZeros()) {
+        return Self(0);
+    }
+    if (in0.isOnes()) {
+        return Self::VectorCast(in1);
+    }
+    if (in1.isOnes()) {
+        return Self::VectorCast(in0);
+    }
+    return Self("(%s * %s)", in0.c_str(), in1.c_str());
+}
+
+template<typename Self>
+template<typename T0, typename T1>
+inline Self GrGLSLExpr<Self>::Add(T0 in0, T1 in1) {
+    if (in1.isZeros()) {
+        return Self::VectorCast(in0);
+    }
+    if (in0.isZeros()) {
+        return Self::VectorCast(in1);
+    }
+    if (in0.isOnes() && in1.isOnes()) {
+        return Self(2);
+    }
+    return Self("(%s + %s)", in0.c_str(), in1.c_str());
+}
+
+template<typename Self>
+template<typename T0, typename T1>
+inline Self GrGLSLExpr<Self>::Sub(T0 in0, T1 in1) {
+    if (in1.isZeros()) {
+        return Self::VectorCast(in0);
+    }
+    if (in1.isOnes()) {
+        if (in0.isOnes()) {
+            return Self(0);
+        }
+    }
+
+    return Self("(%s - %s)", in0.c_str(), in1.c_str());
+}
+
+template <typename Self>
+template <typename T>
+T GrGLSLExpr<Self>::extractComponents(const char format[]) const {
+    if (this->isZeros()) {
+        return T(0);
+    }
+    if (this->isOnes()) {
+        return T(1);
+    }
+    return T(format, this->c_str());
+}
+
+inline GrGLSLExpr1 GrGLSLExpr1::VectorCast(const GrGLSLExpr1& expr) {
+    return expr;
+}
+
+inline const char* GrGLSLExpr1::ZerosStr() {
+    return "0";
+}
+
+inline const char* GrGLSLExpr1::OnesStr() {
+    return "1.0";
+}
+
+// GrGLSLExpr1::CastStr() is unimplemented because using them is likely an
+// error. This is now caught compile-time.
+
+inline const char* GrGLSLExpr1::CastIntStr() {
+    return "%d";
+}
+
+inline GrGLSLExpr1 operator*(const GrGLSLExpr1& in0, const GrGLSLExpr1& in1) {
+    return GrGLSLExpr1::Mul(in0, in1);
+}
+
+inline GrGLSLExpr1 operator+(const GrGLSLExpr1& in0, const GrGLSLExpr1& in1) {
+    return GrGLSLExpr1::Add(in0, in1);
+}
+
+inline GrGLSLExpr1 operator-(const GrGLSLExpr1& in0, const GrGLSLExpr1& in1) {
+    return GrGLSLExpr1::Sub(in0, in1);
+}
+
+inline const char* GrGLSLExpr4::ZerosStr() {
+    return "vec4(0)";
+}
+
+inline const char* GrGLSLExpr4::OnesStr() {
+    return "vec4(1)";
+}
+
+inline const char* GrGLSLExpr4::CastStr() {
+    return "vec4(%s)";
+}
+
+inline const char* GrGLSLExpr4::CastIntStr() {
+    return "vec4(%d)";
+}
+
+inline GrGLSLExpr4 GrGLSLExpr4::VectorCast(const GrGLSLExpr1& expr) {
+    return INHERITED::VectorCastImpl(expr);
+}
+
+inline GrGLSLExpr4 GrGLSLExpr4::VectorCast(const GrGLSLExpr4& expr) {
+    return expr;
+}
+
+inline GrGLSLExpr4::AExpr GrGLSLExpr4::a() const {
+    return this->extractComponents<GrGLSLExpr4::AExpr>("%s.a");
+}
+
+inline GrGLSLExpr4 operator*(const GrGLSLExpr1& in0, const GrGLSLExpr4& in1) {
+    return GrGLSLExpr4::Mul(in0, in1);
+}
+
+inline GrGLSLExpr4 operator+(const GrGLSLExpr1& in0, const GrGLSLExpr4& in1) {
+    return GrGLSLExpr4::Add(in0, in1);
+}
+
+inline GrGLSLExpr4 operator-(const GrGLSLExpr1& in0, const GrGLSLExpr4& in1) {
+    return GrGLSLExpr4::Sub(in0, in1);
+}
+
+inline GrGLSLExpr4 operator*(const GrGLSLExpr4& in0, const GrGLSLExpr1& in1) {
+    return GrGLSLExpr4::Mul(in0, in1);
+}
+
+inline GrGLSLExpr4 operator+(const GrGLSLExpr4& in0, const GrGLSLExpr1& in1) {
+    return GrGLSLExpr4::Add(in0, in1);
+}
+
+inline GrGLSLExpr4 operator-(const GrGLSLExpr4& in0, const GrGLSLExpr1& in1) {
+    return GrGLSLExpr4::Sub(in0, in1);
+}
+
+inline GrGLSLExpr4 operator*(const GrGLSLExpr4& in0, const GrGLSLExpr4& in1) {
+    return GrGLSLExpr4::Mul(in0, in1);
+}
+
+inline GrGLSLExpr4 operator+(const GrGLSLExpr4& in0, const GrGLSLExpr4& in1) {
+    return GrGLSLExpr4::Add(in0, in1);
+}
+
+inline GrGLSLExpr4 operator-(const GrGLSLExpr4& in0, const GrGLSLExpr4& in1) {
+    return GrGLSLExpr4::Sub(in0, in1);
+}
+
+#endif
diff --git a/include/private/GrSwizzle.h b/include/private/GrSwizzle.h
new file mode 100644 (file)
index 0000000..5fa39dd
--- /dev/null
@@ -0,0 +1,115 @@
+/*
+ * Copyright 2016 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef GrSwizzle_DEFINED
+#define GrSwizzle_DEFINED
+
+#include "GrColor.h"
+#include "SkRandom.h"
+
+/** Represents a rgba swizzle. It can be converted either into a string or a eight bit int.
+    Currently there is no way to specify an arbitrary swizzle, just some static swizzles and an
+    assignment operator. That could be relaxed. */
+class GrSwizzle {
+private:
+    char fSwiz[5];
+    uint8_t fKey;
+
+    static constexpr int CToI(char c) {
+        return ('r' == c) ? (GrColor_SHIFT_R / 8) :
+               ('g' == c) ? (GrColor_SHIFT_G / 8) :
+               ('b' == c) ? (GrColor_SHIFT_B / 8) :
+               ('a' == c) ? (GrColor_SHIFT_A / 8) : -1;
+    }
+
+    static constexpr char IToC(int idx) {
+        return (8 * idx) == GrColor_SHIFT_R ? 'r' :
+               (8 * idx) == GrColor_SHIFT_G ? 'g' :
+               (8 * idx) == GrColor_SHIFT_B ? 'b' :
+               (8 * idx) == GrColor_SHIFT_A ? 'a' : 'x';
+    }
+
+    constexpr GrSwizzle(const char c[4])
+        : fSwiz{c[0], c[1], c[2], c[3], 0}
+        , fKey((CToI(c[0]) << 0) | (CToI(c[1]) << 2) | (CToI(c[2]) << 4) | (CToI(c[3]) << 6)) {}
+
+    GR_STATIC_ASSERT(sizeof(char[4]) == sizeof(uint32_t));
+    uint32_t* asUIntPtr() { return SkTCast<uint32_t*>(fSwiz); }
+    uint32_t asUInt() const { return *SkTCast<const uint32_t*>(fSwiz); }
+
+public:
+    GrSwizzle() { *this = RGBA(); }
+
+    GrSwizzle(const GrSwizzle& that) { *this = that; }
+
+    GrSwizzle& operator=(const GrSwizzle& that) {
+        memcpy(this, &that, sizeof(GrSwizzle));
+        return *this;
+    }
+
+    /** Recreates a GrSwizzle from the output of asKey() */
+    void setFromKey(uint8_t key) {
+        fKey = key;
+        for (int i = 0; i < 4; ++i) {
+            fSwiz[i] = IToC(key & 3);
+            key >>= 2;
+        }
+        SkASSERT(fSwiz[4] == 0);
+    }
+
+    bool operator==(const GrSwizzle& that) const { return this->asUInt() == that.asUInt(); }
+
+    bool operator!=(const GrSwizzle& that) const { return !(*this == that); }
+
+    /** Compact representation of the swizzle suitable for a key. */
+    uint8_t asKey() const { return fKey; }
+
+    /** 4 char null terminated string consisting only of chars 'r', 'g', 'b', 'a'. */
+    const char* c_str() const { return fSwiz; }
+
+    /** Applies this swizzle to the input color and returns the swizzled color. */
+    GrColor applyTo(GrColor color) const {
+        int idx;
+        uint32_t key = fKey;
+        // Index of the input color that should be mapped to output r.
+        idx = (key & 3);
+        uint32_t outR = (color >> idx * 8)  & 0xFF;
+        key >>= 2;
+        idx = (key & 3);
+        uint32_t outG = (color >> idx * 8)  & 0xFF;
+        key >>= 2;
+        idx = (key & 3);
+        uint32_t outB = (color >> idx * 8)  & 0xFF;
+        key >>= 2;
+        idx = (key & 3);
+        uint32_t outA = (color >> idx * 8)  & 0xFF;
+        return GrColorPackRGBA(outR, outG, outB, outA);
+    }
+
+    static GrSwizzle RGBA() { return GrSwizzle("rgba"); }
+    static GrSwizzle AAAA() { return GrSwizzle("aaaa"); }
+    static GrSwizzle RRRR() { return GrSwizzle("rrrr"); }
+    static GrSwizzle BGRA() { return GrSwizzle("bgra"); }
+
+    static GrSwizzle CreateRandom(SkRandom* random) {
+        switch (random->nextU() % 4) {
+            case 0:
+                return RGBA();
+            case 1:
+                return BGRA();
+            case 2:
+                return RRRR();
+            case 3:
+                return AAAA();
+            default:
+                SkFAIL("Mod is broken?!?");
+                return RGBA();
+        }
+    }
+};
+
+#endif
index c234025e82d714853cf9845821294f75f67e0ad4..e17f73a5611add6f058ce334c80d5e631b8f19c6 100644 (file)
@@ -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);
     }
index 51549f59a0eb97e7150d687e54f360667bdf1315..bb2828a13e17c7be7b861686455fa477a074d4a4 100644 (file)
@@ -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<LightingFP>();
             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);
     }
 
index 4a08728a9819bf6616d73e02c21a52722bdaf425..86206b3f4e3768390e3284db60b8fc3aed0259b3 100644 (file)
@@ -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<NormalBevelFP>();
             b->add32(static_cast<int>(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);
     }
 
index c30cca14d10ee8dba3f60b2cc451ab54f4dbad33..4ecd86174f57a5b50d1d6c2d17bad4c67c652754 100644 (file)
@@ -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);
     }
 
index 70d6c4300ef3538114ee477db89a48d3ce35a3cc..04f6d5a651e9b5ff9772abf20025d13c6c7bbac3 100644 (file)
@@ -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);
     }
 
index 29773a63b513f3aaa6eb8fc6be87f92b708f6cb2..b56d61e19d99289f370ae995a77955bc2a489141 100644 (file)
@@ -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);
     }
 
index 2d67ecb13bed67b2334e106e37836d8cbb4eceac..80794daab899f64e7fd4f7df04ba905923608503 100644 (file)
@@ -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<ShadowFP>();
             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);
     }
 
index ed633b0294d8926ce1f658cfb4510663da42bc7f..afafe08279c19f06a28bee7e797c78138ad6fae3 100644 (file)
 #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<GrFragmentProcessor> 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<GrAlphaThresholdFragmentProcessor>();
@@ -187,7 +187,7 @@ sk_sp<GrFragmentProcessor> GrAlphaThresholdFragmentProcessor::TestCreate(GrProce
 
 ///////////////////////////////////////////////////////////////////////////////
 
-void GrAlphaThresholdFragmentProcessor::onGetGLSLProcessorKey(const GrGLSLCaps& caps,
+void GrAlphaThresholdFragmentProcessor::onGetGLSLProcessorKey(const GrShaderCaps& caps,
                                                               GrProcessorKeyBuilder* b) const {
     GrGLAlphaThresholdFragmentProcessor::GenKey(*this, caps, b);
 }
index 9805a221286edaffdf8c8ee4d53d5c8e7ee02e35..f7a2491aee584eb5650534f6d592c698c94dd047 100644 (file)
@@ -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;
 
index 8afd009e853b206def5ac9cf020cc97089d718da..329529dbbd0ba7c7666112612e679b980366115e 100644 (file)
@@ -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;
index 73e5d04b0519a2180dda0a93b5edee714ba47d0c..4e7ed130200ac1060c21a807a291ce8d86955a9c 100644 (file)
@@ -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<GrCircleBlurFragmentProcessor>();
index d20ebbe42b1e1a7422b0b7824e2ae09973fcdf4a..f9a443d235774c070f62cf26bc22d615db69e530 100644 (file)
@@ -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<GrArithmeticFP>();
         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<ArithmeticXP>();
@@ -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<ArithmeticXP>();
         uint32_t key = arith.enforcePMColor() ? 1 : 0;
@@ -240,7 +241,7 @@ ArithmeticXP::ArithmeticXP(const DstTexture* dstTexture, bool hasMixedSamples,
     this->initClassID<ArithmeticXP>();
 }
 
-void ArithmeticXP::onGetGLSLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) const {
+void ArithmeticXP::onGetGLSLProcessorKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const {
     GLArithmeticXP::GenKey(*this, caps, b);
 }
 
index 28351fc5b5f58a70452396ce797c29ca329d0691..8effc8a82d9e0795fa9ec9e757016bad7f25c5c4 100644 (file)
@@ -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;
 
index b237b14b2f2a395475e4eeb7253e516596314ca6..dc8e26945c8f3882165b812301673f0aaf74a5d3 100644 (file)
@@ -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<GrRectBlurEffect>();
 
@@ -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);
 }
index 6a15c557c8864293e03b5458e7cf88a6880fd7d2..6907f030d05d25ef504ecac7aab4f9f26cc2f28a 100644 (file)
@@ -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<GrFragmentProcessor> SkColorCubeFilter::asFragmentProcessor(GrContext* context,
index 6a8084c1d79a21ef0af3b415c7baa2d4adbcf2d6..0e50bcc6404c7024d338c52497c92892691faa8c 100644 (file)
@@ -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<GrDisplacementMapEffect>();
 
     uint32_t xKey = displacementMap.xChannelSelector();
index ddc5d96fc8b442631c1141280619da850f1b7687..e1c30c8fbf08b20c8e6340619bfd400413dbcd66 100644 (file)
@@ -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);
     }
 
index 6b479e985dc4c9abf33e010769c2fb6bf888e458..6ad061806c53a5075e2c043691f4eee24e5cfe36 100644 (file)
 #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<GrLightingEffect>();
     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);
 }
index 94d800a4ff538eae9b6f4f15b3ebeef9dd38dd39..6845c50ff0dafe6a2eb57b8738727cabb14636df 100644 (file)
@@ -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);
     }
index 5b5525c3b6ca43ae2e2f76480063a014968180f0..916bd950a684524b5ab0873a68728d35f0c73dca 100644 (file)
 #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);
 }
index 4ececb4dfb6ba83d4f358740cdb298124b42a3a4..2fa67a4aeb72f48b20f717c5db52a842551b9c08 100644 (file)
 #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<SkImageFilter> 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<GrMorphologyEffect>();
     uint32_t key = static_cast<uint32_t>(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);
 }
index c3bcd0e616ca71c437a8f3e22b6b7ad166c6ca7e..7d95e3a7f112a5242608eeb92913ca1ec89a3a03 100644 (file)
@@ -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;
 
index 529a4fa13aab574a5f9bd8adb11531cac5463e8a..3f7f721fd366a7963a73ffcd38a2f1fd71eb6d7a 100644 (file)
@@ -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<GrPerlinNoiseEffect>();
 
index 61933bedbb4f26b91792bf00f0491bd41673ed94..978dbff7eb7c67c7c7208dc4dc988bc91c6a6aa7 100644 (file)
@@ -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<RRectsGaussianEdgeFP>();
 
             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);
     }
 
index 68fd13fdaa3d337a5175edd30220299c0ba02ef0..c2683b5406ef550d5da284dba8fe4acd7ce0b4a2 100644 (file)
@@ -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);
 }
index 92c6fd958a9c96aa72e184e9de6190662b94134f..4651cc238bf2f364affeb7749db94a6296588b91 100644 (file)
@@ -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,
index 120832f33c6d91c3b47a3479f11f9deda26e7128..47831705c1a010f3d148bc63ae9dc7300cab6824 100644 (file)
@@ -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,
index 66accd8aa829f541beb30fbbea1be44a7b12a6b8..4e7da61fc412bbd9982294edcfc164a8d1dc2149 100644 (file)
@@ -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);
 }
index 8ad588013b5c8b86de13eb5031f46a13a0abbbdc..5c4aabdb6d278b161c0a428c2d1de2d58bb189fb 100644 (file)
@@ -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);
 }
index b791f988f33bece8da3d19cd1fdcc702ca42b0ba..5b4df9f0ede079a8ca7f2c3724a8edcfaceab51c 100644 (file)
@@ -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);
 }
index cf2a827cfe5685580ea959400aa5c1faf8ba97f8..3e9ee25c6ebd8bf6190875b596aba7c20692e277 100644 (file)
@@ -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<Edge2PtConicalEffect>();
@@ -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<FocalOutside2PtConicalEffect>();
@@ -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<FocalOutside2PtConicalEffect>().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<FocalInside2PtConicalEffect>();
@@ -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<CircleOutside2PtConicalEffect>();
@@ -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<CircleOutside2PtConicalEffect>().isFlipped();
index 7b092145c567ad4053385fea628f819de520ef90..0cc33462ebbfc2614287e4b27943f7d72a35522e 100644 (file)
@@ -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<GrShaderType>(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<GrSLPrecision>(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;
index 7d89f2727b858bcc2ba3006b49a72e80b404f849..406fe6ae39be20f71d61448917e6b6ad5bb39cfa 100644 (file)
@@ -132,7 +132,7 @@ public:
         }
 
         static inline void GenKey(const GrGeometryProcessor& gp,
-                                  const GrGLSLCaps&,
+                                  const GrShaderCaps&,
                                   GrProcessorKeyBuilder* b) {
             const DefaultGeoProc& def = gp.cast<DefaultGeoProc>();
             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();
     }
 
index de4ab9e860d64f458b5e66c56de300c70be38799..75b6af7ca777cf913efe063915b91ff48930ac3a 100644 (file)
@@ -132,7 +132,7 @@ sk_sp<GrFragmentProcessor> GrFragmentProcessor::PremulInput(sk_sp<GrFragmentProc
             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; }
 
@@ -174,7 +174,7 @@ sk_sp<GrFragmentProcessor> 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> GrFragmentProcessor::OverrideInput(sk_sp<GrFragmentPr
         }
 
     private:
-        void onGetGLSLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) const override
+        void onGetGLSLProcessorKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const override
         {}
 
         bool onIsEqual(const GrFragmentProcessor& that) const override {
@@ -324,7 +324,7 @@ sk_sp<GrFragmentProcessor> GrFragmentProcessor::RunInSeries(sk_sp<GrFragmentProc
         }
 
     private:
-        void onGetGLSLProcessorKey(const GrGLSLCaps&, GrProcessorKeyBuilder*) const override {}
+        void onGetGLSLProcessorKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override {}
 
         bool onIsEqual(const GrFragmentProcessor&) const override { return true; }
 
index a0ed3834584685ddea3e5dd13a657a02fd7d7a3e..fd1d30bd8400a851c83d9f0dec425c875de08a54 100644 (file)
 #include "GrInvariantOutput.h"
 #include "GrProcessor.h"
 #include "GrResourceProvider.h"
+#include "GrShaderCaps.h"
 #include "GrStyle.h"
 #include "SkRRect.h"
 #include "SkStrokeRec.h"
 #include "batches/GrVertexBatch.h"
-#include "glsl/GrGLSLCaps.h"
 #include "glsl/GrGLSLFragmentShaderBuilder.h"
 #include "glsl/GrGLSLGeometryProcessor.h"
 #include "glsl/GrGLSLProgramDataManager.h"
@@ -110,11 +110,11 @@ public:
 
     const char* name() const override { return "CircleEdge"; }
 
-    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();
     }
 
@@ -198,7 +198,7 @@ private:
         }
 
         static void GenKey(const GrGeometryProcessor& gp,
-                           const GrGLSLCaps&,
+                           const GrShaderCaps&,
                            GrProcessorKeyBuilder* b) {
             const CircleGeometryProcessor& cgp = gp.cast<CircleGeometryProcessor>();
             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<EllipseGeometryProcessor>();
             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<DIEllipseGeometryProcessor>();
             uint16_t key = static_cast<uint16_t>(diegp.fStyle);
index c90481b8da8cbc86bfb07687ec01d95c355f159b..5d7c0e1cc8fa424fca50b4774388803274909858 100644 (file)
@@ -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<GrPathProcessor>();
 }
 
-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();
 }
index 8c9e0d6be2b532cd90aa1b83154018c7f6136b33..b5966b04a7afc8af22f7be4bf89fc12ef2fda0ff 100644 (file)
@@ -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; }
 
index 95105ba079bf42176ebfc364886872934d69b7fa..05f47fdc7a719b4675e544fff0b38b4b35f596ea 100644 (file)
@@ -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"
 
index 561f54be035e1aaeaeadd03de6a507f03938521a..cb23897fb6442333872a83a95eb0e10a83b113a9 100644 (file)
@@ -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; }
 
index 9f3278c927021a6ca899dd57cf6116f8c43d4651..0390df01c0c9a4dcaa3af191261e981be3f333d2 100644 (file)
@@ -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
index f304ec53e14acaac59476c7292c71487f22aa5f8..5bb43f958bcbe834c978bf35810b7e91cee70411 100644 (file)
@@ -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 {
index 8cc6dd9c4909e52c966f5db95ecfb826704f57a3..4cba6b9a70955a0acea7b14e92df5d5f13ed7094 100644 (file)
@@ -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<GrDrawBatch> 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<GrDrawBatch> 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<GrDrawBatch> 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<GrDrawBatch> 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<GrDrawBatch> batch(GrOvalRenderer::CreateOvalBatch(paint.getColor(),
                                                                      viewMatrix,
                                                                      ovalRect,
diff --git a/src/gpu/GrShaderCaps.cpp b/src/gpu/GrShaderCaps.cpp
new file mode 100644 (file)
index 0000000..3e6323f
--- /dev/null
@@ -0,0 +1,227 @@
+/*
+ * Copyright 2012 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+
+#include "GrShaderCaps.h"
+
+#include "GrContextOptions.h"
+
+////////////////////////////////////////////////////////////////////////////////////////////
+
+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;
+    fBindlessTextureSupport = false;
+    fUsesPrecisionModifiers = false;
+    fCanUseAnyFunctionInShader = true;
+    fCanUseMinAndAbsTogether = true;
+    fMustForceNegatedAtanParamToFloat = false;
+    fRequiresLocalOutputColorForFBFetch = false;
+    fFlatInterpolationSupport = false;
+    fNoPerspectiveInterpolationSupport = false;
+    fMultisampleInterpolationSupport = false;
+    fSampleVariablesSupport = false;
+    fSampleMaskOverrideCoverageSupport = false;
+    fExternalTextureSupport = false;
+    fTexelFetchSupport = false;
+
+    fPixelLocalStorageSize = 0;
+
+    fVersionDeclString = nullptr;
+    fShaderDerivativeExtensionString = nullptr;
+    fFragCoordConventionsExtensionString = nullptr;
+    fSecondaryOutputExtensionString = nullptr;
+    fExternalTextureExtensionString = nullptr;
+    fTexelBufferExtensionString = nullptr;
+    fNoPerspectiveInterpolationExtensionString = nullptr;
+    fMultisampleInterpolationExtensionString = nullptr;
+    fSampleVariablesExtensionString = nullptr;
+    fFBFetchColorName = nullptr;
+    fFBFetchExtensionString = nullptr;
+    fImageLoadStoreExtensionString = nullptr;
+    fMaxVertexSamplers = 0;
+    fMaxGeometrySamplers = 0;
+    fMaxFragmentSamplers = 0;
+    fMaxCombinedSamplers = 0;
+    fMaxVertexImageStorages = 0;
+    fMaxGeometryImageStorages = 0;
+    fMaxFragmentImageStorages = 0;
+    fMaxCombinedImageStorages   = 0;
+    fAdvBlendEqInteraction = kNotSupported_AdvBlendEqInteraction;
+}
+
+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<GrShaderType>(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<GrSLPrecision>(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",
+        "Automatic",
+        "General Enable",
+        "Specific Enables",
+    };
+    GR_STATIC_ASSERT(0 == kNotSupported_AdvBlendEqInteraction);
+    GR_STATIC_ASSERT(1 == kAutomatic_AdvBlendEqInteraction);
+    GR_STATIC_ASSERT(2 == kGeneralEnable_AdvBlendEqInteraction);
+    GR_STATIC_ASSERT(3 == kSpecificEnables_AdvBlendEqInteraction);
+    GR_STATIC_ASSERT(SK_ARRAY_COUNT(kAdvBlendEqInteractionStr) == kLast_AdvBlendEqInteraction + 1);
+
+    r.appendf("--- GLSL-Specific ---\n");
+
+    r.appendf("FB Fetch Support: %s\n", (fFBFetchSupport ? "YES" : "NO"));
+    r.appendf("Drops tile on zero divide: %s\n", (fDropsTileOnZeroDivide ? "YES" : "NO"));
+    r.appendf("Bindless texture support: %s\n", (fBindlessTextureSupport ? "YES" : "NO"));
+    r.appendf("Uses precision modifiers: %s\n", (fUsesPrecisionModifiers ? "YES" : "NO"));
+    r.appendf("Can use any() function: %s\n", (fCanUseAnyFunctionInShader ? "YES" : "NO"));
+    r.appendf("Can use min() and abs() together: %s\n", (fCanUseMinAndAbsTogether ? "YES" : "NO"));
+    r.appendf("Must force negated atan param to float: %s\n", (fMustForceNegatedAtanParamToFloat ?
+                                                               "YES" : "NO"));
+    r.appendf("Must use local out color for FBFetch: %s\n", (fRequiresLocalOutputColorForFBFetch ?
+                                                             "YES" : "NO"));
+    r.appendf("Flat interpolation support: %s\n", (fFlatInterpolationSupport ?  "YES" : "NO"));
+    r.appendf("No perspective interpolation support: %s\n", (fNoPerspectiveInterpolationSupport ?
+                                                             "YES" : "NO"));
+    r.appendf("Multisample interpolation support: %s\n", (fMultisampleInterpolationSupport ?
+                                                          "YES" : "NO"));
+    r.appendf("Sample variables support: %s\n", (fSampleVariablesSupport ? "YES" : "NO"));
+    r.appendf("Sample mask override coverage support: %s\n", (fSampleMaskOverrideCoverageSupport ?
+                                                              "YES" : "NO"));
+    r.appendf("External texture support: %s\n", (fExternalTextureSupport ? "YES" : "NO"));
+    r.appendf("texelFetch support: %s\n", (fTexelFetchSupport ? "YES" : "NO"));
+    r.appendf("Max VS Samplers: %d\n", fMaxVertexSamplers);
+    r.appendf("Max GS Samplers: %d\n", fMaxGeometrySamplers);
+    r.appendf("Max FS Samplers: %d\n", fMaxFragmentSamplers);
+    r.appendf("Max Combined Samplers: %d\n", fMaxFragmentSamplers);
+    r.appendf("Max VS Image Storages: %d\n", fMaxVertexImageStorages);
+    r.appendf("Max GS Image Storages: %d\n", fMaxGeometryImageStorages);
+    r.appendf("Max FS Image Storages: %d\n", fMaxFragmentImageStorages);
+    r.appendf("Max Combined Image Storages: %d\n", fMaxFragmentImageStorages);
+    r.appendf("Advanced blend equation interaction: %s\n",
+              kAdvBlendEqInteractionStr[fAdvBlendEqInteraction]);
+    return r;
+}
+
+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];
+    GrSLPrecision effectiveLowP[kGrShaderTypeCount];
+    for (int s = 0; s < kGrShaderTypeCount; ++s) {
+        const PrecisionInfo* info = fFloatPrecisions[s];
+        effectiveMediumP[s] = info[kHigh_GrSLPrecision] == info[kMedium_GrSLPrecision] ?
+                                  kHigh_GrSLPrecision : kMedium_GrSLPrecision;
+        effectiveLowP[s] = info[kMedium_GrSLPrecision] == info[kLow_GrSLPrecision] ?
+                               effectiveMediumP[s] : kLow_GrSLPrecision;
+    }
+
+    // Determine which precision qualifiers should be used with samplers.
+    for (int visibility = 0; visibility < (1 << kGrShaderTypeCount); ++visibility) {
+        GrSLPrecision mediump = kHigh_GrSLPrecision;
+        GrSLPrecision lowp = kHigh_GrSLPrecision;
+        for (int s = 0; s < kGrShaderTypeCount; ++s) {
+            if (visibility & (1 << s)) {
+                mediump = SkTMin(mediump, effectiveMediumP[s]);
+                lowp = SkTMin(lowp, effectiveLowP[s]);
+            }
+
+            GR_STATIC_ASSERT(0 == kLow_GrSLPrecision);
+            GR_STATIC_ASSERT(1 == kMedium_GrSLPrecision);
+            GR_STATIC_ASSERT(2 == kHigh_GrSLPrecision);
+
+            GR_STATIC_ASSERT((1 << kVertex_GrShaderType) == kVertex_GrShaderFlag);
+            GR_STATIC_ASSERT((1 << kGeometry_GrShaderType) == kGeometry_GrShaderFlag);
+            GR_STATIC_ASSERT((1 << kFragment_GrShaderType) == kFragment_GrShaderFlag);
+            GR_STATIC_ASSERT(3 == kGrShaderTypeCount);
+        }
+
+        uint8_t* table = fSamplerPrecisions[visibility];
+        table[kUnknown_GrPixelConfig]        = kDefault_GrSLPrecision;
+        table[kAlpha_8_GrPixelConfig]        = lowp;
+        table[kIndex_8_GrPixelConfig]        = lowp;
+        table[kRGB_565_GrPixelConfig]        = lowp;
+        table[kRGBA_4444_GrPixelConfig]      = lowp;
+        table[kRGBA_8888_GrPixelConfig]      = lowp;
+        table[kBGRA_8888_GrPixelConfig]      = lowp;
+        table[kSRGBA_8888_GrPixelConfig]     = lowp;
+        table[kSBGRA_8888_GrPixelConfig]     = lowp;
+        table[kRGBA_8888_sint_GrPixelConfig] = lowp;
+        table[kETC1_GrPixelConfig]           = lowp;
+        table[kLATC_GrPixelConfig]           = lowp;
+        table[kR11_EAC_GrPixelConfig]        = lowp;
+        table[kASTC_12x12_GrPixelConfig]     = lowp;
+        table[kRGBA_float_GrPixelConfig]     = kHigh_GrSLPrecision;
+        table[kAlpha_half_GrPixelConfig]     = mediump;
+        table[kRGBA_half_GrPixelConfig]      = mediump;
+
+        GR_STATIC_ASSERT(17 == kGrPixelConfigCnt);
+    }
+}
+
+void GrShaderCaps::applyOptionsOverrides(const GrContextOptions& options) {
+    fDualSourceBlendingSupport = fDualSourceBlendingSupport && !options.fSuppressDualSourceBlending;
+}
index 75142cab7f67cd15f9b383e12d85d7d85960e051..da8bc7a934520bb1bf141cfcaadae09f9524657f 100644 (file)
@@ -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/GrSwizzle.h b/src/gpu/GrSwizzle.h
deleted file mode 100644 (file)
index 5fa39dd..0000000
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- * Copyright 2016 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#ifndef GrSwizzle_DEFINED
-#define GrSwizzle_DEFINED
-
-#include "GrColor.h"
-#include "SkRandom.h"
-
-/** Represents a rgba swizzle. It can be converted either into a string or a eight bit int.
-    Currently there is no way to specify an arbitrary swizzle, just some static swizzles and an
-    assignment operator. That could be relaxed. */
-class GrSwizzle {
-private:
-    char fSwiz[5];
-    uint8_t fKey;
-
-    static constexpr int CToI(char c) {
-        return ('r' == c) ? (GrColor_SHIFT_R / 8) :
-               ('g' == c) ? (GrColor_SHIFT_G / 8) :
-               ('b' == c) ? (GrColor_SHIFT_B / 8) :
-               ('a' == c) ? (GrColor_SHIFT_A / 8) : -1;
-    }
-
-    static constexpr char IToC(int idx) {
-        return (8 * idx) == GrColor_SHIFT_R ? 'r' :
-               (8 * idx) == GrColor_SHIFT_G ? 'g' :
-               (8 * idx) == GrColor_SHIFT_B ? 'b' :
-               (8 * idx) == GrColor_SHIFT_A ? 'a' : 'x';
-    }
-
-    constexpr GrSwizzle(const char c[4])
-        : fSwiz{c[0], c[1], c[2], c[3], 0}
-        , fKey((CToI(c[0]) << 0) | (CToI(c[1]) << 2) | (CToI(c[2]) << 4) | (CToI(c[3]) << 6)) {}
-
-    GR_STATIC_ASSERT(sizeof(char[4]) == sizeof(uint32_t));
-    uint32_t* asUIntPtr() { return SkTCast<uint32_t*>(fSwiz); }
-    uint32_t asUInt() const { return *SkTCast<const uint32_t*>(fSwiz); }
-
-public:
-    GrSwizzle() { *this = RGBA(); }
-
-    GrSwizzle(const GrSwizzle& that) { *this = that; }
-
-    GrSwizzle& operator=(const GrSwizzle& that) {
-        memcpy(this, &that, sizeof(GrSwizzle));
-        return *this;
-    }
-
-    /** Recreates a GrSwizzle from the output of asKey() */
-    void setFromKey(uint8_t key) {
-        fKey = key;
-        for (int i = 0; i < 4; ++i) {
-            fSwiz[i] = IToC(key & 3);
-            key >>= 2;
-        }
-        SkASSERT(fSwiz[4] == 0);
-    }
-
-    bool operator==(const GrSwizzle& that) const { return this->asUInt() == that.asUInt(); }
-
-    bool operator!=(const GrSwizzle& that) const { return !(*this == that); }
-
-    /** Compact representation of the swizzle suitable for a key. */
-    uint8_t asKey() const { return fKey; }
-
-    /** 4 char null terminated string consisting only of chars 'r', 'g', 'b', 'a'. */
-    const char* c_str() const { return fSwiz; }
-
-    /** Applies this swizzle to the input color and returns the swizzled color. */
-    GrColor applyTo(GrColor color) const {
-        int idx;
-        uint32_t key = fKey;
-        // Index of the input color that should be mapped to output r.
-        idx = (key & 3);
-        uint32_t outR = (color >> idx * 8)  & 0xFF;
-        key >>= 2;
-        idx = (key & 3);
-        uint32_t outG = (color >> idx * 8)  & 0xFF;
-        key >>= 2;
-        idx = (key & 3);
-        uint32_t outB = (color >> idx * 8)  & 0xFF;
-        key >>= 2;
-        idx = (key & 3);
-        uint32_t outA = (color >> idx * 8)  & 0xFF;
-        return GrColorPackRGBA(outR, outG, outB, outA);
-    }
-
-    static GrSwizzle RGBA() { return GrSwizzle("rgba"); }
-    static GrSwizzle AAAA() { return GrSwizzle("aaaa"); }
-    static GrSwizzle RRRR() { return GrSwizzle("rrrr"); }
-    static GrSwizzle BGRA() { return GrSwizzle("bgra"); }
-
-    static GrSwizzle CreateRandom(SkRandom* random) {
-        switch (random->nextU() % 4) {
-            case 0:
-                return RGBA();
-            case 1:
-                return BGRA();
-            case 2:
-                return RRRR();
-            case 3:
-                return AAAA();
-            default:
-                SkFAIL("Mod is broken?!?");
-                return RGBA();
-        }
-    }
-};
-
-#endif
index 2769c1810ee3ff62bfd5674eb5235f8c4f823259..ebf949285bd11b19ad20a1b3a75d990f97053fc5 100644 (file)
@@ -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()) {
index 4683aa148491fc03881cd8b61a6ca282ef724eef..bec774c281745b629e3036483d29338dd491fd5b 100644 (file)
@@ -601,7 +601,7 @@ public:
         }
 
         static inline void GenKey(const GrGeometryProcessor& gp,
-                                  const GrGLSLCaps&,
+                                  const GrShaderCaps&,
                                   GrProcessorKeyBuilder* b) {
             const QuadEdgeEffect& qee = gp.cast<QuadEdgeEffect>();
             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();
     }
 
index 1ddcbdbef735ce5219faa5569127f2ebd1fd30a5..fb343df602cf0d76391aefa93bb4442b761e2400 100644 (file)
@@ -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();
     }
 
index 0945c63faa0f1901345fae765d62c9b922980590..a1fc635c611f4edd27e121dc1306443300d8aea9 100644 (file)
@@ -158,7 +158,7 @@ public:
         }
 
         static inline void GenKey(const GrGeometryProcessor& gp,
-                                  const GrGLSLCaps&,
+                                  const GrShaderCaps&,
                                   GrProcessorKeyBuilder* b) {
             const MSAAQuadProcessor& qp = gp.cast<MSAAQuadProcessor>();
             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);
     }
 
index 1aedccb5f91e53e08077dac8c780b9e018cf2f3f..a41e1401ca82e6eb3e3016741299cd312d12079e 100644 (file)
@@ -381,7 +381,7 @@ public:
         }
 
         static inline void GenKey(const GrGeometryProcessor& gp,
-                                  const GrGLSLCaps&,
+                                  const GrShaderCaps&,
                                   GrProcessorKeyBuilder* b) {
             const PLSAATriangleEffect& te = gp.cast<PLSAATriangleEffect>();
             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<PLSQuadEdgeEffect>();
             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<PLSFinishEffect>();
             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);
     }
 
index cd7f763148a35fa3a66538fe0d184e92897ba493..1465fbb54e71eafdf39863a30f16bf4f6e96803c 100644 (file)
@@ -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<GrConicEffect>();
     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<GrQuadEffect>();
     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<GrCubicEffect>();
     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);
 }
 
index 50dca99242d2d3da7a45d69b92e29203b61d5df7..edb14080d4165ba1db7bc7c3c82bd7c23a763873 100644 (file)
@@ -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);
index ce7f344c17044e70b713647006de7b197e7b64d6..d109ef14a9b1f3e2216479b7856e590128d355e7 100644 (file)
@@ -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<GrBicubicEffect>();
         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);
 }
index 61ce7eb08a55338be0193c42c0d5306dc9bb9b71..0c6c43335c1684814ca0b563f0c2e9cab378a58e 100644 (file)
@@ -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;
 
index 76dc123275af953465812989219d59e666e74ac3..8be4c2951a2b837d67c8dadc125b7a8a6752872e 100644 (file)
@@ -98,7 +98,7 @@ public:
     }
 
     static inline void GenKey(const GrGeometryProcessor& proc,
-                              const GrGLSLCaps&,
+                              const GrShaderCaps&,
                               GrProcessorKeyBuilder* b) {
         const GrBitmapTextGeoProc& gp = proc.cast<GrBitmapTextGeoProc>();
         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();
 }
 
index c8fc99b0203c0f0bd862b6fa1e18cda7dfdd1262..bf7f08febddff59767cf5651c02cab8457432007 100644 (file)
@@ -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,
index 6f67838270dac4966187d66a3097cd87ef7e6ede..becd84aea13795b5553ad78c871c2974a7c9a953 100644 (file)
@@ -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<GrConfigConversionEffect>();
         uint32_t key = (cce.swizzle().asKey()) | (cce.pmConversion() << 16);
@@ -150,7 +150,7 @@ sk_sp<GrFragmentProcessor> GrConfigConversionEffect::TestCreate(GrProcessorTestD
 
 ///////////////////////////////////////////////////////////////////////////////
 
-void GrConfigConversionEffect::onGetGLSLProcessorKey(const GrGLSLCaps& caps,
+void GrConfigConversionEffect::onGetGLSLProcessorKey(const GrShaderCaps& caps,
                                                      GrProcessorKeyBuilder* b) const {
     GrGLConfigConversionEffect::GenKey(*this, caps, b);
 }
index 93b49aa6560a30e38ff723467aef0dc49a995765..27361f403c1606cac7d26af4da9aa1dfc234b385 100644 (file)
@@ -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;
 
index 019d6991c2e455135cb0e60e07ce74ff0cde5cad..0efe997f78f1b0e989f4c89a544bd5cffa53a6bc 100644 (file)
@@ -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);
 }
index fc28ec7fe39e5a94e5bf9caa760309214df4925e..a64e5cb49036840de8f91f09bd7bf9d4b0b817b0 100644 (file)
@@ -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<AARectEffect>();
     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<GrConvexPolyEffect>();
     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);
 }
index 8fc76feb5b0384ce0df8bc3b972bfc54a5388a81..2d9d20fc7f396055315063a5a247e4af8d28856d 100644 (file)
@@ -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;
 
index fbca64668d76d6b4a1cb454c5d0740c43e9fff96..b4e1ec3e4c170478af849d65295210b04461b2e7 100644 (file)
@@ -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<GrConvolutionEffect>();
     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);
 }
index c353542d030a05f1c48635739841b4c2abcbba6c..c9a029ace92ef4d11d1dd87fcc6fb22b22c8ed27 100644 (file)
@@ -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;
 
index 78192c8b9be87d53f5db0737d407007d171e826d..a824c89b7af5fcac2a90ca3c1da1d67fa3cf3262 100644 (file)
@@ -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<CoverageSetOpXP>();
         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<ShaderCSOXferProcessor>();
@@ -226,7 +226,7 @@ private:
 
 ///////////////////////////////////////////////////////////////////////////////
 
-void ShaderCSOXferProcessor::onGetGLSLProcessorKey(const GrGLSLCaps&,
+void ShaderCSOXferProcessor::onGetGLSLProcessorKey(const GrShaderCaps&,
                                                    GrProcessorKeyBuilder* b) const {
     GLShaderCSOXferProcessor::GenKey(*this, b);
 }
index 7303fd49e5287dca64dcf67af00abdae6b4e2151..f5962c2a6fb88e2b58d6a66c93cd34d2c8feef98 100644 (file)
@@ -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<CustomXP>();
         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);
 }
 
index 9ce725b7e65eb686aebfb11a32768c42bbacb91f..669e604725d9f41cca1199c925ae89bc871a1548 100644 (file)
@@ -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<DashingCircleEffect>();
     uint32_t key = 0;
@@ -925,12 +925,12 @@ sk_sp<GrGeometryProcessor> 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<DashingLineEffect>();
     uint32_t key = 0;
@@ -1152,12 +1152,12 @@ sk_sp<GrGeometryProcessor> 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();
 }
 
index 35009e1a07a1c95ce8f06a28df0ac89f578ebad0..fc3d4bbdd033896fafb68835fa2e4462bd6e087d 100644 (file)
@@ -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<DisableColorXP>();
 }
 
-void DisableColorXP::onGetGLSLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) const {
+void DisableColorXP::onGetGLSLProcessorKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const {
     GLDisableColorXP::GenKey(*this, caps, b);
 }
 
index b77a8f438b90b7aa7e64c298831b37f1ad022865..9d90ac9986899bee16b8e3e3bd9a33ef1478d1fd 100644 (file)
@@ -197,7 +197,7 @@ public:
     }
 
     static inline void GenKey(const GrGeometryProcessor& gp,
-                              const GrGLSLCaps&,
+                              const GrShaderCaps&,
                               GrProcessorKeyBuilder* b) {
         const GrDistanceFieldA8TextGeoProc& dfTexEffect = gp.cast<GrDistanceFieldA8TextGeoProc>();
         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<GrDistanceFieldPathGeoProc>();
 
@@ -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<GrDistanceFieldLCDTextGeoProc>();
 
@@ -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();
 }
 
index 880c4e18dc1506407d0cb5c2468f5551d27dd029..a0bfdd9dde30112b596eea6d52df73f6ffb432f9 100644 (file)
@@ -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,
index c00284b23d8f10c6090de6999f0b0cbda542e112..eb7fe6280a7a84dbace35cdf9bda753fc597c6e5 100644 (file)
@@ -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);
 }
index 9e98b7ec9d6352ae7a227e2a81934fb8321b5c86..765612052c6043fc9ada3c4f2dfe4b5d58761b8e 100644 (file)
@@ -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<GrGammaEffect>();
         uint32_t key = static_cast<uint32_t>(ge.mode());
@@ -125,8 +125,8 @@ sk_sp<GrFragmentProcessor> 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);
 }
 
index 3f84ac91e0febd3ae0b4481b6539d523f244f36b..a3e4b0e5e3ae9a198ac61a037dfd8060de5c3e19 100644 (file)
@@ -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;
 
index 0194eab3f652ac0c9488593aadb9307f15c9e05d..5e4dc26c9788d5b8e90a3f45eb4e8f658eb958b9 100644 (file)
@@ -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<GrMatrixConvolutionEffect>();
     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<float>(kernelOffset.y());
 }
 
-void GrMatrixConvolutionEffect::onGetGLSLProcessorKey(const GrGLSLCaps& caps,
+void GrMatrixConvolutionEffect::onGetGLSLProcessorKey(const GrShaderCaps& caps,
                                                       GrProcessorKeyBuilder* b) const {
     GrGLMatrixConvolutionEffect::GenKey(*this, caps, b);
 }
index b8df437681252ba42f8324f8c693fb595667601f..7cc88b651b207bc84d3ce0a1a901b6ea48cd5e4e 100644 (file)
@@ -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;
 
index 425d767c2b42f0653143022e9a6755cee29568cf..993f269bf9621735b909ee982e84648de7155ac1 100644 (file)
 #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<CircleEffect>();
     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<EllipseEffect>();
     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);
 }
index ff95dac72367b78fbc59f02cb0151b68cd0df627..3987db29b982c0ae886f617d3a91c2cb7a808399 100644 (file)
@@ -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<ShaderPDXferProcessor>();
@@ -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);
 }
index 36570c9e9c47305b1f86ea7912fec61d3a7d5e05..adf7bfd7aecad5dd7a8ac14fb744cb7d6fc6b067 100644 (file)
@@ -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<CircularRRectEffect>();
     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<EllipticalRRectEffect>();
     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);
 }
index 8544a05e35f89a6254c7a21ae5e08e52be4d381d..cb4c834aeac5dcd458d5be21b4612576e0661e37 100755 (executable)
@@ -62,7 +62,7 @@ public:
     }
 
     static inline void GenKey(const GrGeometryProcessor& gp,
-                              const GrGLSLCaps&,
+                              const GrShaderCaps&,
                               GrProcessorKeyBuilder* b) {
         const GrRRectShadowGeoProc& rsgp = gp.cast<GrRRectShadowGeoProc>();
         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();
 }
 
index 29e2bde84d985baa17b7f24c202b2a2b125bef44..dc6872e701b51a6081ba2a72a9b24d631634b894 100755 (executable)
@@ -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);
index 1c213a759d519f1831a0960ed9a88c1e5f1cf904..682539ff3bab0a17bb29d43eb6dc98e6c354b9b0 100644 (file)
@@ -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<GrSimpleTextureEffect>();
         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);
 }
index ccb590e297dc28376e30a347bd2ea09fedab570f..90f39acba035536aae5e965f5e3544e084f8f2f3 100644 (file)
@@ -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; }
 
index f22d09675b8bc58f8f4b58fdc8772f7da4cb7a63..78be8fe59cfca59334a117cf193fe31199205970 100644 (file)
@@ -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<GrTextureDomainEffect>();
 }
 
-void GrTextureDomainEffect::onGetGLSLProcessorKey(const GrGLSLCaps& caps,
+void GrTextureDomainEffect::onGetGLSLProcessorKey(const GrShaderCaps& caps,
                                                   GrProcessorKeyBuilder* b) const {
     b->add32(GrTextureDomain::GLDomain::DomainKey(fTextureDomain));
 }
index 3ba6ee849fa4181c5f4e73cc2ebe4ab4fdb246db..7e7ec74912bc92c26c67cf810ab60cd557218bc0 100644 (file)
@@ -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;
index 0e8e16c0e91ded85d15684d19cb49b566d8a4cf8..2954170e205a1e3f959eef2bea1eb68f907cca5d 100644 (file)
@@ -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));
     }
index 297835773af4de730eb03fb802c2e36812b9405c..6d1fac2f32a35b82901d3649631f0cf768db2296 100644 (file)
@@ -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);
index c4f7560be44bc7c0457a5f54abb9757b25821c85..c47763583cd7447baaa6527c83ccd21948c178c5 100644 (file)
@@ -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<GrGLSLCaps*>(fShaderCaps.get());
+    GrShaderCaps* glslCaps = static_cast<GrShaderCaps*>(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<GrGLSLCaps*>(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<GrGLSLCaps*>(fShaderCaps.get());
+    GrShaderCaps* glslCaps = static_cast<GrShaderCaps*>(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:
index 63843a5fc2d616f1b75273306d48081f2fe8d593..155388dd6166f95a075cf62d7cff66792652d2f0 100644 (file)
 
 #include <functional>
 
-#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<GrGLSLCaps*>(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;
 
index 7813eabfb881ae0c1af1ed8b5cbd595208dc6e85..7ceb639ee017bffd918dd50fbc38e0a0cb1725f1 100644 (file)
@@ -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);
index 31e2de7d7403f5ca5dde8e54c0810998f9efb293..88bb273d92925f21dcb073df50bc49ce6c2d9d9e 100644 (file)
@@ -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;
 
index 8f81ccc8261ebad81d43ed6dc30b4483c5782208..7ec2029f9924add11664c07a8a19fff511f15e01 100644 (file)
@@ -7,7 +7,6 @@
 
 #include "GrGLGpu.h"
 #include "GrGLBuffer.h"
-#include "GrGLGLSL.h"
 #include "GrGLGpuCommandBuffer.h"
 #include "GrGLStencilAttachment.h"
 #include "GrGLTextureRenderTarget.h"
 #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());
index 4a4f00bc0bac2a46d42760f628f6234c0f9ab334..196ec866283b10a7643b2b05d261f755da135b8e 100644 (file)
@@ -7,7 +7,7 @@
 
 #include "GrGLTexture.h"
 #include "GrGLGpu.h"
-#include "glsl/GrGLSLCaps.h"
+#include "GrShaderCaps.h"
 #include "SkTraceMemoryDump.h"
 
 #define GPUGL static_cast<GrGLGpu*>(this->getGpu())
index 81755d552a487daa503a241b50cc3636f4244878..021a86535827351d1303dfaa54a9c5af351a464c 100644 (file)
@@ -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(";");
         }
     }
index a774570b68327cae6ab04b201ea462b5ea4af46f..63e0aeb78de66f695f3db21b8e1014c27082db4a 100644 (file)
@@ -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,
index 253f9e632812f621111175bbe7ebaa976c161d1b..a88f278b9336fd7ccfd259e96e51b4668ba3f43e 100644 (file)
@@ -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; }
 
index 69f046cb82750d502c5243e828a54e0ed238d835..2f69a3c5a215e2788060401e27ce29308accfe4e 100644 (file)
@@ -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/GrGLSL.h b/src/gpu/glsl/GrGLSL.h
deleted file mode 100644 (file)
index 417f6d7..0000000
+++ /dev/null
@@ -1,374 +0,0 @@
-/*
- * Copyright 2011 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#ifndef GrGLSL_DEFINED
-#define GrGLSL_DEFINED
-
-#include "GrTypesPriv.h"
-#include "SkString.h"
-
-class GrGLSLCaps;
-
-// Limited set of GLSL versions we build shaders for. Caller should round
-// down the GLSL version to one of these enums.
-enum GrGLSLGeneration {
-    /**
-     * Desktop GLSL 1.10 and ES2 shading language (based on desktop GLSL 1.20)
-     */
-    k110_GrGLSLGeneration,
-    /**
-     * Desktop GLSL 1.30
-     */
-    k130_GrGLSLGeneration,
-    /**
-     * Desktop GLSL 1.40
-     */
-    k140_GrGLSLGeneration,
-    /**
-     * Desktop GLSL 1.50
-     */
-    k150_GrGLSLGeneration,
-    /**
-     * Desktop GLSL 3.30, and ES GLSL 3.00
-     */
-    k330_GrGLSLGeneration,
-    /**
-     * Desktop GLSL 4.00
-     */
-    k400_GrGLSLGeneration,
-    /**
-     * Desktop GLSL 4.20
-     */
-    k420_GrGLSLGeneration,
-    /**
-     * ES GLSL 3.10 only TODO Make GLSLCap objects to make this more granular
-     */
-    k310es_GrGLSLGeneration,
-    /**
-     * ES GLSL 3.20
-     */
-    k320es_GrGLSLGeneration,
-};
-
-bool GrGLSLSupportsNamedFragmentShaderOutputs(GrGLSLGeneration);
-
-/**
- * Adds a line of GLSL code to declare the default precision for float types.
- */
-void GrGLSLAppendDefaultFloatPrecisionDeclaration(GrSLPrecision,
-                                                  const GrGLSLCaps& glslCaps,
-                                                  SkString* out);
-
-/**
- * Converts a GrSLPrecision to its corresponding GLSL precision qualifier.
- */
-static inline const char* GrGLSLPrecisionString(GrSLPrecision p) {
-    switch (p) {
-        case kLow_GrSLPrecision:
-            return "lowp";
-        case kMedium_GrSLPrecision:
-            return "mediump";
-        case kHigh_GrSLPrecision:
-            return "highp";
-        default:
-            SkFAIL("Unexpected precision type.");
-            return "";
-    }
-}
-
-/**
- * Converts a GrSLType to a string containing the name of the equivalent GLSL type.
- */
-static inline const char* GrGLSLTypeString(GrSLType t) {
-    switch (t) {
-        case kVoid_GrSLType:
-            return "void";
-        case kFloat_GrSLType:
-            return "float";
-        case kVec2f_GrSLType:
-            return "vec2";
-        case kVec3f_GrSLType:
-            return "vec3";
-        case kVec4f_GrSLType:
-            return "vec4";
-        case kMat22f_GrSLType:
-            return "mat2";
-        case kMat33f_GrSLType:
-            return "mat3";
-        case kMat44f_GrSLType:
-            return "mat4";
-        case kTexture2DSampler_GrSLType:
-            return "sampler2D";
-        case kITexture2DSampler_GrSLType:
-            return "isampler2D";
-        case kTextureExternalSampler_GrSLType:
-            return "samplerExternalOES";
-        case kTexture2DRectSampler_GrSLType:
-            return "sampler2DRect";
-        case kBufferSampler_GrSLType:
-            return "samplerBuffer";
-        case kBool_GrSLType:
-            return "bool";
-        case kInt_GrSLType:
-            return "int";
-        case kUint_GrSLType:
-            return "uint";
-        case kTexture2D_GrSLType:
-            return "texture2D";
-        case kSampler_GrSLType:
-            return "sampler";
-        case kImageStorage2D_GrSLType:
-            return "image2D";
-        case kIImageStorage2D_GrSLType:
-            return "iimage2D";
-    }
-    SkFAIL("Unknown shader var type.");
-    return ""; // suppress warning
-}
-
-/** A generic base-class representing a GLSL expression.
- * The instance can be a variable name, expression or vecN(0) or vecN(1). Does simple constant
- * folding with help of 1 and 0.
- *
- * Clients should not use this class, rather the specific instantiations defined
- * later, for example GrGLSLExpr4.
- */
-template <typename Self>
-class GrGLSLExpr {
-public:
-    bool isOnes() const { return kOnes_ExprType == fType; }
-    bool isZeros() const { return kZeros_ExprType == fType; }
-
-    const char* c_str() const {
-        if (kZeros_ExprType == fType) {
-            return Self::ZerosStr();
-        } else if (kOnes_ExprType == fType) {
-            return Self::OnesStr();
-        }
-        SkASSERT(!fExpr.isEmpty()); // Empty expressions should not be used.
-        return fExpr.c_str();
-    }
-
-    bool isValid() const {
-        return kFullExpr_ExprType != fType || !fExpr.isEmpty();
-    }
-
-protected:
-    /** Constructs an invalid expression.
-     * Useful only as a return value from functions that never actually return
-     * this and instances that will be assigned to later. */
-    GrGLSLExpr()
-        : fType(kFullExpr_ExprType) {
-        // The only constructor that is allowed to build an empty expression.
-        SkASSERT(!this->isValid());
-    }
-
-    /** Constructs an expression with all components as value v */
-    explicit GrGLSLExpr(int v) {
-        if (v == 0) {
-            fType = kZeros_ExprType;
-        } else if (v == 1) {
-            fType = kOnes_ExprType;
-        } else {
-            fType = kFullExpr_ExprType;
-            fExpr.appendf(Self::CastIntStr(), v);
-        }
-    }
-
-    /** Constructs an expression from a string.
-     * Argument expr is a simple expression or a parenthesized expression. */
-    // TODO: make explicit once effects input Exprs.
-    GrGLSLExpr(const char expr[]) {
-        if (nullptr == expr) {  // TODO: remove this once effects input Exprs.
-            fType = kOnes_ExprType;
-        } else {
-            fType = kFullExpr_ExprType;
-            fExpr = expr;
-        }
-        SkASSERT(this->isValid());
-    }
-
-    /** Constructs an expression from a string.
-     * Argument expr is a simple expression or a parenthesized expression. */
-    // TODO: make explicit once effects input Exprs.
-    GrGLSLExpr(const SkString& expr) {
-        if (expr.isEmpty()) {  // TODO: remove this once effects input Exprs.
-            fType = kOnes_ExprType;
-        } else {
-            fType = kFullExpr_ExprType;
-            fExpr = expr;
-        }
-        SkASSERT(this->isValid());
-    }
-
-    /** Constructs an expression from a string with one substitution. */
-    GrGLSLExpr(const char format[], const char in0[])
-        : fType(kFullExpr_ExprType) {
-        fExpr.appendf(format, in0);
-    }
-
-    /** Constructs an expression from a string with two substitutions. */
-    GrGLSLExpr(const char format[], const char in0[], const char in1[])
-        : fType(kFullExpr_ExprType) {
-        fExpr.appendf(format, in0, in1);
-    }
-
-    /** Returns expression casted to another type.
-     * Generic implementation that is called for non-trivial cases of casts. */
-    template <typename T>
-    static Self VectorCastImpl(const T& other);
-
-    /** Returns a GLSL multiplication: component-wise or component-by-scalar.
-     * The multiplication will be component-wise or multiply each component by a scalar.
-     *
-     * The returned expression will compute the value of:
-     *    vecN(in0.x * in1.x, ...) if dim(T0) == dim(T1) (component-wise)
-     *    vecN(in0.x * in1, ...) if dim(T1) == 1 (vector by scalar)
-     *    vecN(in0 * in1.x, ...) if dim(T0) == 1 (scalar by vector)
-     */
-    template <typename T0, typename T1>
-    static Self Mul(T0 in0, T1 in1);
-
-    /** Returns a GLSL addition: component-wise or add a scalar to each component.
-     * Return value computes:
-     *   vecN(in0.x + in1.x, ...) or vecN(in0.x + in1, ...) or vecN(in0 + in1.x, ...).
-     */
-    template <typename T0, typename T1>
-    static Self Add(T0 in0, T1 in1);
-
-    /** Returns a GLSL subtraction: component-wise or subtract compoments by a scalar.
-     * Return value computes
-     *   vecN(in0.x - in1.x, ...) or vecN(in0.x - in1, ...) or vecN(in0 - in1.x, ...).
-     */
-    template <typename T0, typename T1>
-    static Self Sub(T0 in0, T1 in1);
-
-    /** Returns expression that accesses component(s) of the expression.
-     * format should be the form "%s.x" where 'x' is the component(s) to access.
-     * Caller is responsible for making sure the amount of components in the
-     * format string is equal to dim(T).
-     */
-    template <typename T>
-    T extractComponents(const char format[]) const;
-
-private:
-    enum ExprType {
-        kZeros_ExprType,
-        kOnes_ExprType,
-        kFullExpr_ExprType,
-    };
-    ExprType fType;
-    SkString fExpr;
-};
-
-class GrGLSLExpr1;
-class GrGLSLExpr4;
-
-/** Class representing a float GLSL expression. */
-class GrGLSLExpr1 : public GrGLSLExpr<GrGLSLExpr1> {
-public:
-    GrGLSLExpr1()
-        : INHERITED() {
-    }
-    explicit GrGLSLExpr1(int v)
-        : INHERITED(v) {
-    }
-    GrGLSLExpr1(const char* expr)
-        : INHERITED(expr) {
-    }
-    GrGLSLExpr1(const SkString& expr)
-        : INHERITED(expr) {
-    }
-
-    static GrGLSLExpr1 VectorCast(const GrGLSLExpr1& expr);
-
-private:
-    GrGLSLExpr1(const char format[], const char in0[])
-        : INHERITED(format, in0) {
-    }
-    GrGLSLExpr1(const char format[], const char in0[], const char in1[])
-        : INHERITED(format, in0, in1) {
-    }
-
-    static const char* ZerosStr();
-    static const char* OnesStr();
-    static const char* CastStr();
-    static const char* CastIntStr();
-
-    friend GrGLSLExpr1 operator*(const GrGLSLExpr1& in0, const GrGLSLExpr1&in1);
-    friend GrGLSLExpr1 operator+(const GrGLSLExpr1& in0, const GrGLSLExpr1&in1);
-    friend GrGLSLExpr1 operator-(const GrGLSLExpr1& in0, const GrGLSLExpr1&in1);
-
-    friend class GrGLSLExpr<GrGLSLExpr1>;
-    friend class GrGLSLExpr<GrGLSLExpr4>;
-
-    typedef GrGLSLExpr<GrGLSLExpr1> INHERITED;
-};
-
-/** Class representing a float vector (vec4) GLSL expression. */
-class GrGLSLExpr4 : public GrGLSLExpr<GrGLSLExpr4> {
-public:
-    GrGLSLExpr4()
-        : INHERITED() {
-    }
-    explicit GrGLSLExpr4(int v)
-        : INHERITED(v) {
-    }
-    GrGLSLExpr4(const char* expr)
-        : INHERITED(expr) {
-    }
-    GrGLSLExpr4(const SkString& expr)
-        : INHERITED(expr) {
-    }
-
-    typedef GrGLSLExpr1 AExpr;
-    AExpr a() const;
-
-    /** GLSL vec4 cast / constructor, eg vec4(floatv) -> vec4(floatv, floatv, floatv, floatv) */
-    static GrGLSLExpr4 VectorCast(const GrGLSLExpr1& expr);
-    static GrGLSLExpr4 VectorCast(const GrGLSLExpr4& expr);
-
-private:
-    GrGLSLExpr4(const char format[], const char in0[])
-        : INHERITED(format, in0) {
-    }
-    GrGLSLExpr4(const char format[], const char in0[], const char in1[])
-        : INHERITED(format, in0, in1) {
-    }
-
-    static const char* ZerosStr();
-    static const char* OnesStr();
-    static const char* CastStr();
-    static const char* CastIntStr();
-
-    // The vector-by-scalar and scalar-by-vector binary operations.
-    friend GrGLSLExpr4 operator*(const GrGLSLExpr1& in0, const GrGLSLExpr4&in1);
-    friend GrGLSLExpr4 operator+(const GrGLSLExpr1& in0, const GrGLSLExpr4&in1);
-    friend GrGLSLExpr4 operator-(const GrGLSLExpr1& in0, const GrGLSLExpr4&in1);
-    friend GrGLSLExpr4 operator*(const GrGLSLExpr4& in0, const GrGLSLExpr1&in1);
-    friend GrGLSLExpr4 operator+(const GrGLSLExpr4& in0, const GrGLSLExpr1&in1);
-    friend GrGLSLExpr4 operator-(const GrGLSLExpr4& in0, const GrGLSLExpr1&in1);
-
-    // The vector-by-vector, i.e. component-wise, binary operations.
-    friend GrGLSLExpr4 operator*(const GrGLSLExpr4& in0, const GrGLSLExpr4&in1);
-    friend GrGLSLExpr4 operator+(const GrGLSLExpr4& in0, const GrGLSLExpr4&in1);
-    friend GrGLSLExpr4 operator-(const GrGLSLExpr4& in0, const GrGLSLExpr4&in1);
-
-    friend class GrGLSLExpr<GrGLSLExpr4>;
-
-    typedef GrGLSLExpr<GrGLSLExpr4> INHERITED;
-};
-
-/**
- * Does an inplace mul, *=, of vec4VarName by mulFactor.
- * A semicolon is added after the assignment.
- */
-void GrGLSLMulVarBy4f(SkString* outAppend, const char* vec4VarName, const GrGLSLExpr4& mulFactor);
-
-#include "GrGLSL_impl.h"
-
-#endif
diff --git a/src/gpu/glsl/GrGLSLCaps.cpp b/src/gpu/glsl/GrGLSLCaps.cpp
deleted file mode 100644 (file)
index 57e5a0c..0000000
+++ /dev/null
@@ -1,164 +0,0 @@
-/*
- * Copyright 2012 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-
-#include "GrGLSLCaps.h"
-
-#include "GrContextOptions.h"
-
-////////////////////////////////////////////////////////////////////////////////////////////
-
-GrGLSLCaps::GrGLSLCaps(const GrContextOptions& options) {
-    fGLSLGeneration = k330_GrGLSLGeneration;
-
-    fDropsTileOnZeroDivide = false;
-    fFBFetchSupport = false;
-    fFBFetchNeedsCustomOutput = false;
-    fBindlessTextureSupport = false;
-    fUsesPrecisionModifiers = false;
-    fCanUseAnyFunctionInShader = true;
-    fCanUseMinAndAbsTogether = true;
-    fMustForceNegatedAtanParamToFloat = false;
-    fRequiresLocalOutputColorForFBFetch = false;
-    fFlatInterpolationSupport = false;
-    fNoPerspectiveInterpolationSupport = false;
-    fMultisampleInterpolationSupport = false;
-    fSampleVariablesSupport = false;
-    fSampleMaskOverrideCoverageSupport = false;
-    fExternalTextureSupport = false;
-    fTexelFetchSupport = false;
-    fVersionDeclString = nullptr;
-    fShaderDerivativeExtensionString = nullptr;
-    fFragCoordConventionsExtensionString = nullptr;
-    fSecondaryOutputExtensionString = nullptr;
-    fExternalTextureExtensionString = nullptr;
-    fTexelBufferExtensionString = nullptr;
-    fNoPerspectiveInterpolationExtensionString = nullptr;
-    fMultisampleInterpolationExtensionString = nullptr;
-    fSampleVariablesExtensionString = nullptr;
-    fFBFetchColorName = nullptr;
-    fFBFetchExtensionString = nullptr;
-    fImageLoadStoreExtensionString = nullptr;
-    fMaxVertexSamplers = 0;
-    fMaxGeometrySamplers = 0;
-    fMaxFragmentSamplers = 0;
-    fMaxCombinedSamplers = 0;
-    fMaxVertexImageStorages = 0;
-    fMaxGeometryImageStorages = 0;
-    fMaxFragmentImageStorages = 0;
-    fMaxCombinedImageStorages   = 0;
-    fAdvBlendEqInteraction = kNotSupported_AdvBlendEqInteraction;
-}
-
-SkString GrGLSLCaps::dump() const {
-    SkString r = INHERITED::dump();
-
-    static const char* kAdvBlendEqInteractionStr[] = {
-        "Not Supported",
-        "Automatic",
-        "General Enable",
-        "Specific Enables",
-    };
-    GR_STATIC_ASSERT(0 == kNotSupported_AdvBlendEqInteraction);
-    GR_STATIC_ASSERT(1 == kAutomatic_AdvBlendEqInteraction);
-    GR_STATIC_ASSERT(2 == kGeneralEnable_AdvBlendEqInteraction);
-    GR_STATIC_ASSERT(3 == kSpecificEnables_AdvBlendEqInteraction);
-    GR_STATIC_ASSERT(SK_ARRAY_COUNT(kAdvBlendEqInteractionStr) == kLast_AdvBlendEqInteraction + 1);
-
-    r.appendf("--- GLSL-Specific ---\n");
-
-    r.appendf("FB Fetch Support: %s\n", (fFBFetchSupport ? "YES" : "NO"));
-    r.appendf("Drops tile on zero divide: %s\n", (fDropsTileOnZeroDivide ? "YES" : "NO"));
-    r.appendf("Bindless texture support: %s\n", (fBindlessTextureSupport ? "YES" : "NO"));
-    r.appendf("Uses precision modifiers: %s\n", (fUsesPrecisionModifiers ? "YES" : "NO"));
-    r.appendf("Can use any() function: %s\n", (fCanUseAnyFunctionInShader ? "YES" : "NO"));
-    r.appendf("Can use min() and abs() together: %s\n", (fCanUseMinAndAbsTogether ? "YES" : "NO"));
-    r.appendf("Must force negated atan param to float: %s\n", (fMustForceNegatedAtanParamToFloat ?
-                                                               "YES" : "NO"));
-    r.appendf("Must use local out color for FBFetch: %s\n", (fRequiresLocalOutputColorForFBFetch ?
-                                                             "YES" : "NO"));
-    r.appendf("Flat interpolation support: %s\n", (fFlatInterpolationSupport ?  "YES" : "NO"));
-    r.appendf("No perspective interpolation support: %s\n", (fNoPerspectiveInterpolationSupport ?
-                                                             "YES" : "NO"));
-    r.appendf("Multisample interpolation support: %s\n", (fMultisampleInterpolationSupport ?
-                                                          "YES" : "NO"));
-    r.appendf("Sample variables support: %s\n", (fSampleVariablesSupport ? "YES" : "NO"));
-    r.appendf("Sample mask override coverage support: %s\n", (fSampleMaskOverrideCoverageSupport ?
-                                                              "YES" : "NO"));
-    r.appendf("External texture support: %s\n", (fExternalTextureSupport ? "YES" : "NO"));
-    r.appendf("texelFetch support: %s\n", (fTexelFetchSupport ? "YES" : "NO"));
-    r.appendf("Max VS Samplers: %d\n", fMaxVertexSamplers);
-    r.appendf("Max GS Samplers: %d\n", fMaxGeometrySamplers);
-    r.appendf("Max FS Samplers: %d\n", fMaxFragmentSamplers);
-    r.appendf("Max Combined Samplers: %d\n", fMaxFragmentSamplers);
-    r.appendf("Max VS Image Storages: %d\n", fMaxVertexImageStorages);
-    r.appendf("Max GS Image Storages: %d\n", fMaxGeometryImageStorages);
-    r.appendf("Max FS Image Storages: %d\n", fMaxFragmentImageStorages);
-    r.appendf("Max Combined Image Storages: %d\n", fMaxFragmentImageStorages);
-    r.appendf("Advanced blend equation interaction: %s\n",
-              kAdvBlendEqInteractionStr[fAdvBlendEqInteraction]);
-    return r;
-}
-
-void GrGLSLCaps::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];
-    GrSLPrecision effectiveLowP[kGrShaderTypeCount];
-    for (int s = 0; s < kGrShaderTypeCount; ++s) {
-        const PrecisionInfo* info = fFloatPrecisions[s];
-        effectiveMediumP[s] = info[kHigh_GrSLPrecision] == info[kMedium_GrSLPrecision] ?
-                                  kHigh_GrSLPrecision : kMedium_GrSLPrecision;
-        effectiveLowP[s] = info[kMedium_GrSLPrecision] == info[kLow_GrSLPrecision] ?
-                               effectiveMediumP[s] : kLow_GrSLPrecision;
-    }
-
-    // Determine which precision qualifiers should be used with samplers.
-    for (int visibility = 0; visibility < (1 << kGrShaderTypeCount); ++visibility) {
-        GrSLPrecision mediump = kHigh_GrSLPrecision;
-        GrSLPrecision lowp = kHigh_GrSLPrecision;
-        for (int s = 0; s < kGrShaderTypeCount; ++s) {
-            if (visibility & (1 << s)) {
-                mediump = SkTMin(mediump, effectiveMediumP[s]);
-                lowp = SkTMin(lowp, effectiveLowP[s]);
-            }
-
-            GR_STATIC_ASSERT(0 == kLow_GrSLPrecision);
-            GR_STATIC_ASSERT(1 == kMedium_GrSLPrecision);
-            GR_STATIC_ASSERT(2 == kHigh_GrSLPrecision);
-
-            GR_STATIC_ASSERT((1 << kVertex_GrShaderType) == kVertex_GrShaderFlag);
-            GR_STATIC_ASSERT((1 << kGeometry_GrShaderType) == kGeometry_GrShaderFlag);
-            GR_STATIC_ASSERT((1 << kFragment_GrShaderType) == kFragment_GrShaderFlag);
-            GR_STATIC_ASSERT(3 == kGrShaderTypeCount);
-        }
-
-        uint8_t* table = fSamplerPrecisions[visibility];
-        table[kUnknown_GrPixelConfig]        = kDefault_GrSLPrecision;
-        table[kAlpha_8_GrPixelConfig]        = lowp;
-        table[kIndex_8_GrPixelConfig]        = lowp;
-        table[kRGB_565_GrPixelConfig]        = lowp;
-        table[kRGBA_4444_GrPixelConfig]      = lowp;
-        table[kRGBA_8888_GrPixelConfig]      = lowp;
-        table[kBGRA_8888_GrPixelConfig]      = lowp;
-        table[kSRGBA_8888_GrPixelConfig]     = lowp;
-        table[kSBGRA_8888_GrPixelConfig]     = lowp;
-        table[kRGBA_8888_sint_GrPixelConfig] = lowp;
-        table[kETC1_GrPixelConfig]           = lowp;
-        table[kLATC_GrPixelConfig]           = lowp;
-        table[kR11_EAC_GrPixelConfig]        = lowp;
-        table[kASTC_12x12_GrPixelConfig]     = lowp;
-        table[kRGBA_float_GrPixelConfig]     = kHigh_GrSLPrecision;
-        table[kAlpha_half_GrPixelConfig]     = mediump;
-        table[kRGBA_half_GrPixelConfig]      = mediump;
-
-        GR_STATIC_ASSERT(17 == kGrPixelConfigCnt);
-    }
-}
-
-void GrGLSLCaps::onApplyOptionsOverrides(const GrContextOptions& options) {
-}
diff --git a/src/gpu/glsl/GrGLSLCaps.h b/src/gpu/glsl/GrGLSLCaps.h
deleted file mode 100644 (file)
index 11ce754..0000000
+++ /dev/null
@@ -1,260 +0,0 @@
-/*
- * Copyright 2012 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-
-#ifndef GrGLSLCaps_DEFINED
-#define GrGLSLCaps_DEFINED
-
-#include "GrCaps.h"
-#include "GrGLSL.h"
-#include "GrSwizzle.h"
-
-namespace SkSL {
-    class GLSLCapsFactory;
-}
-
-class GrGLSLCaps : public GrShaderCaps {
-public:
-    /**
-    * Indicates how GLSL must interact with advanced blend equations. The KHR extension requires
-    * special layout qualifiers in the fragment shader.
-    */
-    enum AdvBlendEqInteraction {
-        kNotSupported_AdvBlendEqInteraction,     //<! No _blend_equation_advanced extension
-        kAutomatic_AdvBlendEqInteraction,        //<! No interaction required
-        kGeneralEnable_AdvBlendEqInteraction,    //<! layout(blend_support_all_equations) out
-        kSpecificEnables_AdvBlendEqInteraction,  //<! Specific layout qualifiers per equation
-
-        kLast_AdvBlendEqInteraction = kSpecificEnables_AdvBlendEqInteraction
-    };
-
-    /**
-     * Initializes the GrGLSLCaps to a default set of features
-     */
-    GrGLSLCaps(const GrContextOptions&);
-
-    /**
-     * Some helper functions for encapsulating various extensions to read FB Buffer on openglES
-     *
-     * TODO(joshualitt) On desktop opengl 4.2+ we can achieve something similar to this effect
-     */
-    bool fbFetchSupport() const { return fFBFetchSupport; }
-
-    bool fbFetchNeedsCustomOutput() const { return fFBFetchNeedsCustomOutput; }
-
-    bool bindlessTextureSupport() const { return fBindlessTextureSupport; }
-
-    const char* versionDeclString() const { return fVersionDeclString; }
-
-    const char* fbFetchColorName() const { return fFBFetchColorName; }
-
-    const char* fbFetchExtensionString() const { return fFBFetchExtensionString; }
-
-    bool dropsTileOnZeroDivide() const { return fDropsTileOnZeroDivide; }
-
-    bool flatInterpolationSupport() const { return fFlatInterpolationSupport; }
-
-    bool noperspectiveInterpolationSupport() const { return fNoPerspectiveInterpolationSupport; }
-
-    bool multisampleInterpolationSupport() const { return fMultisampleInterpolationSupport; }
-
-    bool sampleVariablesSupport() const { return fSampleVariablesSupport; }
-
-    bool sampleMaskOverrideCoverageSupport() const { return fSampleMaskOverrideCoverageSupport; }
-
-    bool externalTextureSupport() const { return fExternalTextureSupport; }
-
-    bool texelFetchSupport() const { return fTexelFetchSupport; }
-
-    AdvBlendEqInteraction advBlendEqInteraction() const { return fAdvBlendEqInteraction; }
-
-    bool mustEnableAdvBlendEqs() const {
-        return fAdvBlendEqInteraction >= kGeneralEnable_AdvBlendEqInteraction;
-    }
-
-    bool mustEnableSpecificAdvBlendEqs() const {
-        return fAdvBlendEqInteraction == kSpecificEnables_AdvBlendEqInteraction;
-    }
-
-    bool mustDeclareFragmentShaderOutput() const {
-        return fGLSLGeneration > k110_GrGLSLGeneration;
-    }
-
-    bool usesPrecisionModifiers() const { return fUsesPrecisionModifiers; }
-
-    // Returns whether we can use the glsl funciton any() in our shader code.
-    bool canUseAnyFunctionInShader() const { return fCanUseAnyFunctionInShader; }
-
-    bool canUseMinAndAbsTogether() const { return fCanUseMinAndAbsTogether; }
-
-    bool mustForceNegatedAtanParamToFloat() const { return fMustForceNegatedAtanParamToFloat; }
-
-    bool requiresLocalOutputColorForFBFetch() const { return fRequiresLocalOutputColorForFBFetch; }
-
-    // Returns the string of an extension that must be enabled in the shader to support
-    // derivatives. If nullptr is returned then no extension needs to be enabled. Before calling
-    // this function, the caller should check that shaderDerivativeSupport exists.
-    const char* shaderDerivativeExtensionString() const {
-        SkASSERT(this->shaderDerivativeSupport());
-        return fShaderDerivativeExtensionString;
-    }
-
-    // Returns the string of an extension that will do all necessary coord transfomations needed
-    // when reading the fragment position. If such an extension does not exisits, this function
-    // returns a nullptr, and all transforms of the frag position must be done manually in the
-    // shader.
-    const char* fragCoordConventionsExtensionString() const {
-        return fFragCoordConventionsExtensionString;
-    }
-
-    // This returns the name of an extension that must be enabled in the shader, if such a thing is
-    // required in order to use a secondary output in the shader. This returns a nullptr if no such
-    // extension is required. However, the return value of this function does not say whether dual
-    // source blending is supported.
-    const char* secondaryOutputExtensionString() const {
-        return fSecondaryOutputExtensionString;
-    }
-
-    const char* externalTextureExtensionString() const {
-        SkASSERT(this->externalTextureSupport());
-        return fExternalTextureExtensionString;
-    }
-
-    const char* texelBufferExtensionString() const {
-        SkASSERT(this->texelBufferSupport());
-        return fTexelBufferExtensionString;
-    }
-
-    const char* noperspectiveInterpolationExtensionString() const {
-        SkASSERT(this->noperspectiveInterpolationSupport());
-        return fNoPerspectiveInterpolationExtensionString;
-    }
-
-    const char* multisampleInterpolationExtensionString() const {
-        SkASSERT(this->multisampleInterpolationSupport());
-        return fMultisampleInterpolationExtensionString;
-    }
-
-    const char* sampleVariablesExtensionString() const {
-        SkASSERT(this->sampleVariablesSupport());
-        return fSampleVariablesExtensionString;
-    }
-
-    const char* imageLoadStoreExtensionString() const {
-        SkASSERT(this->imageLoadStoreSupport());
-        return fImageLoadStoreExtensionString;
-    }
-
-    int maxVertexSamplers() const { return fMaxVertexSamplers; }
-
-    int maxGeometrySamplers() const { return fMaxGeometrySamplers; }
-
-    int maxFragmentSamplers() const { return fMaxFragmentSamplers; }
-
-    int maxCombinedSamplers() const { return fMaxCombinedSamplers; }
-
-    int maxVertexImageStorages() const { return fMaxVertexImageStorages; }
-
-    int maxGeometryImageStorages() const { return fMaxGeometryImageStorages; }
-
-    int maxFragmentImageStorages() const { return fMaxFragmentImageStorages; }
-
-    int maxCombinedImageStorages() const { return fMaxCombinedImageStorages; }
-
-    /**
-     * Given a texture's config, this determines what swizzle must be appended to accesses to the
-     * texture in generated shader code. Swizzling may be implemented in texture parameters or a
-     * sampler rather than in the shader. In this case the returned swizzle will always be "rgba".
-     */
-    const GrSwizzle& configTextureSwizzle(GrPixelConfig config) const {
-        return fConfigTextureSwizzle[config];
-    }
-
-    /** Swizzle that should occur on the fragment shader outputs for a given config. */
-    const GrSwizzle& configOutputSwizzle(GrPixelConfig config) const {
-        return fConfigOutputSwizzle[config];
-    }
-
-    /** Precision qualifier that should be used with a sampler, given its config and visibility. */
-    GrSLPrecision samplerPrecision(GrPixelConfig config, GrShaderFlags visibility) const {
-        return static_cast<GrSLPrecision>(fSamplerPrecisions[visibility][config]);
-    }
-
-    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;
-
-    GrGLSLGeneration fGLSLGeneration;
-
-    bool fDropsTileOnZeroDivide : 1;
-    bool fFBFetchSupport : 1;
-    bool fFBFetchNeedsCustomOutput : 1;
-    bool fBindlessTextureSupport : 1;
-    bool fUsesPrecisionModifiers : 1;
-    bool fCanUseAnyFunctionInShader : 1;
-    bool fFlatInterpolationSupport : 1;
-    bool fNoPerspectiveInterpolationSupport : 1;
-    bool fMultisampleInterpolationSupport : 1;
-    bool fSampleVariablesSupport : 1;
-    bool fSampleMaskOverrideCoverageSupport : 1;
-    bool fExternalTextureSupport : 1;
-    bool fTexelFetchSupport : 1;
-
-    // Used for specific driver bug work arounds
-    bool fCanUseMinAndAbsTogether : 1;
-    bool fMustForceNegatedAtanParamToFloat : 1;
-    bool fRequiresLocalOutputColorForFBFetch : 1;
-
-    const char* fVersionDeclString;
-
-    const char* fShaderDerivativeExtensionString;
-    const char* fFragCoordConventionsExtensionString;
-    const char* fSecondaryOutputExtensionString;
-    const char* fExternalTextureExtensionString;
-    const char* fTexelBufferExtensionString;
-    const char* fNoPerspectiveInterpolationExtensionString;
-    const char* fMultisampleInterpolationExtensionString;
-    const char* fSampleVariablesExtensionString;
-    const char* fImageLoadStoreExtensionString;
-
-    const char* fFBFetchColorName;
-    const char* fFBFetchExtensionString;
-
-    int fMaxVertexSamplers;
-    int fMaxGeometrySamplers;
-    int fMaxFragmentSamplers;
-    int fMaxCombinedSamplers;
-
-    int fMaxVertexImageStorages;
-    int fMaxGeometryImageStorages;
-    int fMaxFragmentImageStorages;
-    int fMaxCombinedImageStorages;
-
-    AdvBlendEqInteraction fAdvBlendEqInteraction;
-
-    GrSwizzle fConfigTextureSwizzle[kGrPixelConfigCnt];
-    GrSwizzle fConfigOutputSwizzle[kGrPixelConfigCnt];
-
-    uint8_t fSamplerPrecisions[(1 << kGrShaderTypeCount)][kGrPixelConfigCnt];
-
-    friend class GrGLCaps;  // For initialization.
-    friend class GrVkCaps;
-    friend class SkSL::GLSLCapsFactory;
-
-    typedef GrShaderCaps INHERITED;
-};
-
-#endif
index c8154231b5d68c021f01cc08a90640e33277613e..c9230e4c92599468e97bfd335234db435f3d6932 100644 (file)
@@ -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(); }
 
index f6e1ad81d79d5a8c74e7395b9410b566d44efbd8..3d9802a720b068d16d6b3833c0c7ab61c8635529 100644 (file)
@@ -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),
index b398cfd5c7cb81f00d7b3caf2ae14df3d6917b9a..6c3d3a89632a19ec4504297fa5f6d3de37c4ced3 100644 (file)
 
 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;
index 0c1661d3b779b90330bf6de2bd1b51cd4b058e21..40e5a43dedeeae8abe398cf45c2640dfbbbb25ca 100644 (file)
@@ -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);
index 5543537d199dfa0b2726be60c3acee2606ed6c5f..fdb6e11c14e9fa64d3a055d8fbe8d30248ec1f04 100644 (file)
@@ -8,6 +8,7 @@
 #ifndef GrGLSLProgramBuilder_DEFINED
 #define GrGLSLProgramBuilder_DEFINED
 
+#include "GrCaps.h"
 #include "GrGeometryProcessor.h"
 #include "GrGpu.h"
 #include "glsl/GrGLSLFragmentProcessor.h"
 #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; }
index 79e977c5be9f4b285f94df597699f42d90af9ac4..e2cbdee3ff93db159f4456c88a19f4cb744dcf23 100644 (file)
@@ -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());
index f264fc0921272c4a0c3f051261510ea70057f319..7d841f54173f1cf5bd76b81a5cd1af46bcbf0ae0 100644 (file)
@@ -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);
index 1f6db4ca200bccab6cda10ba708b074fbda08a52..0588513040f37956972e613cba5e28c86785d0bf 100644 (file)
@@ -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"
index 69e00723a8bfbadd95b6e7b03d377aec0df80de9..f3a1c688daddb67436cf7d5a8375300ffc852aff 100644 (file)
@@ -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/glsl/GrGLSL_impl.h b/src/gpu/glsl/GrGLSL_impl.h
deleted file mode 100644 (file)
index bdd69cc..0000000
+++ /dev/null
@@ -1,175 +0,0 @@
-/*
- * Copyright 2013 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#ifndef GrGLSL_impl_DEFINED
-#define GrGLSL_impl_DEFINED
-
-template<typename Self>
-template<typename T>
-inline Self GrGLSLExpr<Self>::VectorCastImpl(const T& expr) {
-    if (expr.isZeros()) {
-        return Self(0);
-    }
-    if (expr.isOnes()) {
-        return Self(1);
-    }
-    return Self(Self::CastStr(), expr.c_str());
-}
-
-template<typename Self>
-template<typename T0, typename T1>
-inline Self GrGLSLExpr<Self>::Mul(T0 in0, T1 in1) {
-    if (in0.isZeros() || in1.isZeros()) {
-        return Self(0);
-    }
-    if (in0.isOnes()) {
-        return Self::VectorCast(in1);
-    }
-    if (in1.isOnes()) {
-        return Self::VectorCast(in0);
-    }
-    return Self("(%s * %s)", in0.c_str(), in1.c_str());
-}
-
-template<typename Self>
-template<typename T0, typename T1>
-inline Self GrGLSLExpr<Self>::Add(T0 in0, T1 in1) {
-    if (in1.isZeros()) {
-        return Self::VectorCast(in0);
-    }
-    if (in0.isZeros()) {
-        return Self::VectorCast(in1);
-    }
-    if (in0.isOnes() && in1.isOnes()) {
-        return Self(2);
-    }
-    return Self("(%s + %s)", in0.c_str(), in1.c_str());
-}
-
-template<typename Self>
-template<typename T0, typename T1>
-inline Self GrGLSLExpr<Self>::Sub(T0 in0, T1 in1) {
-    if (in1.isZeros()) {
-        return Self::VectorCast(in0);
-    }
-    if (in1.isOnes()) {
-        if (in0.isOnes()) {
-            return Self(0);
-        }
-    }
-
-    return Self("(%s - %s)", in0.c_str(), in1.c_str());
-}
-
-template <typename Self>
-template <typename T>
-T GrGLSLExpr<Self>::extractComponents(const char format[]) const {
-    if (this->isZeros()) {
-        return T(0);
-    }
-    if (this->isOnes()) {
-        return T(1);
-    }
-    return T(format, this->c_str());
-}
-
-inline GrGLSLExpr1 GrGLSLExpr1::VectorCast(const GrGLSLExpr1& expr) {
-    return expr;
-}
-
-inline const char* GrGLSLExpr1::ZerosStr() {
-    return "0";
-}
-
-inline const char* GrGLSLExpr1::OnesStr() {
-    return "1.0";
-}
-
-// GrGLSLExpr1::CastStr() is unimplemented because using them is likely an
-// error. This is now caught compile-time.
-
-inline const char* GrGLSLExpr1::CastIntStr() {
-    return "%d";
-}
-
-inline GrGLSLExpr1 operator*(const GrGLSLExpr1& in0, const GrGLSLExpr1& in1) {
-    return GrGLSLExpr1::Mul(in0, in1);
-}
-
-inline GrGLSLExpr1 operator+(const GrGLSLExpr1& in0, const GrGLSLExpr1& in1) {
-    return GrGLSLExpr1::Add(in0, in1);
-}
-
-inline GrGLSLExpr1 operator-(const GrGLSLExpr1& in0, const GrGLSLExpr1& in1) {
-    return GrGLSLExpr1::Sub(in0, in1);
-}
-
-inline const char* GrGLSLExpr4::ZerosStr() {
-    return "vec4(0)";
-}
-
-inline const char* GrGLSLExpr4::OnesStr() {
-    return "vec4(1)";
-}
-
-inline const char* GrGLSLExpr4::CastStr() {
-    return "vec4(%s)";
-}
-
-inline const char* GrGLSLExpr4::CastIntStr() {
-    return "vec4(%d)";
-}
-
-inline GrGLSLExpr4 GrGLSLExpr4::VectorCast(const GrGLSLExpr1& expr) {
-    return INHERITED::VectorCastImpl(expr);
-}
-
-inline GrGLSLExpr4 GrGLSLExpr4::VectorCast(const GrGLSLExpr4& expr) {
-    return expr;
-}
-
-inline GrGLSLExpr4::AExpr GrGLSLExpr4::a() const {
-    return this->extractComponents<GrGLSLExpr4::AExpr>("%s.a");
-}
-
-inline GrGLSLExpr4 operator*(const GrGLSLExpr1& in0, const GrGLSLExpr4& in1) {
-    return GrGLSLExpr4::Mul(in0, in1);
-}
-
-inline GrGLSLExpr4 operator+(const GrGLSLExpr1& in0, const GrGLSLExpr4& in1) {
-    return GrGLSLExpr4::Add(in0, in1);
-}
-
-inline GrGLSLExpr4 operator-(const GrGLSLExpr1& in0, const GrGLSLExpr4& in1) {
-    return GrGLSLExpr4::Sub(in0, in1);
-}
-
-inline GrGLSLExpr4 operator*(const GrGLSLExpr4& in0, const GrGLSLExpr1& in1) {
-    return GrGLSLExpr4::Mul(in0, in1);
-}
-
-inline GrGLSLExpr4 operator+(const GrGLSLExpr4& in0, const GrGLSLExpr1& in1) {
-    return GrGLSLExpr4::Add(in0, in1);
-}
-
-inline GrGLSLExpr4 operator-(const GrGLSLExpr4& in0, const GrGLSLExpr1& in1) {
-    return GrGLSLExpr4::Sub(in0, in1);
-}
-
-inline GrGLSLExpr4 operator*(const GrGLSLExpr4& in0, const GrGLSLExpr4& in1) {
-    return GrGLSLExpr4::Mul(in0, in1);
-}
-
-inline GrGLSLExpr4 operator+(const GrGLSLExpr4& in0, const GrGLSLExpr4& in1) {
-    return GrGLSLExpr4::Add(in0, in1);
-}
-
-inline GrGLSLExpr4 operator-(const GrGLSLExpr4& in0, const GrGLSLExpr4& in1) {
-    return GrGLSLExpr4::Sub(in0, in1);
-}
-
-#endif
index fd9ddbd5ef4ce76e59c7a2550fcdc8d053ed0cd7..f6213a3c3d97ed21e3e682f8a2690c1710cd7606 100644 (file)
@@ -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();
 }
 
index d54ffcd0c1f02ca20bfc0fe8a4f84c1a4c006fbf..df96ce393320e007c042cf9d84436f3f859754da 100644 (file)
@@ -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;
index cb5ea79ff9fb9867b7eca1be2b40b2f0c234de9d..4e5e99fd994c5c7898c7838863fccc0f6b138dc2 100644 (file)
@@ -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<GrGLSLCaps*>(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<GrGLSLCaps*>(fShaderCaps.get());
+    GrShaderCaps* glslCaps = fShaderCaps.get();
     glslCaps->fVersionDeclString = "#version 330\n";
 
 
index 7b40e0d9b287e3b280860eb8c17b1af4dbf9b5a4..c1fb88926888d36a19c9647380bb0a8252ef42ac 100644 (file)
@@ -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<GrGLSLCaps*>(fShaderCaps.get()); }
+    GrShaderCaps* glslCaps() const { return fShaderCaps.get(); }
 
 private:
     enum VkVendor {
index 5e5450355cd6ebd104530b65a432502359f0670f..4d5be9acd789277841608d01d696a956185ed398 100644 (file)
@@ -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"
 #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(
index 75b8baaa4f33b08659cbe3acbcdeaf447e6d9f1f..e5bf7fa9a813618cd3885d3c195fced11385e38f 100644 (file)
@@ -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;
index 3b0a6afddddbee494c0aaf229f3b501abe98be83..49a6f9ff6228f592d16a5ea6a11c43ac84b39d3e 100644 (file)
@@ -76,7 +76,7 @@ public:
                           const GrPipeline&,
                           const GrStencilSettings&,
                           GrPrimitiveType primitiveType,
-                          const GrGLSLCaps&);
+                          const GrShaderCaps&);
     private:
         typedef GrProgramDesc INHERITED;
     };
index 01701b66538af1b9fc6b975e03b2077d019cab2c..49f5cf8a0cee43683c1acb2d6a8b7ec2881ac3e9 100644 (file)
@@ -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");
index 8e3ede9a9019a7bbe71375de3b62c83882633337..c36f9ac9825d24c99d307900b0e607bd8f07ffb7 100644 (file)
@@ -38,7 +38,6 @@ public:
                                                   const GrVkRenderPass& renderPass);
 
     const GrCaps* caps() const override;
-    const GrGLSLCaps* glslCaps() const override;
 
     GrVkGpu* gpu() const { return fGpu; }
 
index 8c4f8514b8287c137e44ed760deef78874c26b8e..c64864b55aca0dbe38e047bf89c72b9f7f330944 100644 (file)
@@ -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");
             }
         }
index 4990dfb9a45c1fa3dad3ff8592055ebceede0ac1..1be0ba988a87929ac95f847e4c29d0aa745fe1ec 100644 (file)
@@ -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<SkString, CapValue>* capsMap) {
+static void fill_caps(const GrShaderCaps& caps, std::unordered_map<SkString, CapValue>* 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<SkString, CapVa
 #undef CAP
 }
 
-bool Compiler::toGLSL(Program::Kind kind, const SkString& text, const GrGLSLCaps& caps,
+bool Compiler::toGLSL(Program::Kind kind, const SkString& text, const GrShaderCaps& caps,
                       SkWStream& out) {
     std::unordered_map<SkString, CapValue> 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);
index 5a06bfa264d4ab3f9fece9f965aee9c9202c4861..114f8efeba8bcef24a26319599fe08bb7c783b24 100644 (file)
@@ -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;
index 05c931a0a74852bdad1128c5a38496eb179c2647..ffc5a4d4739151e0ec5d5c04e753e9e768f439eb 100644 (file)
@@ -12,8 +12,8 @@
 #include <tuple>
 #include <unordered_map>
 
+#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;
index fae1c8560631be9abc5a4b2dfcf09d412930d05c..e5fb239a67ecb54be87da5afac4dd4f34cd3b1a2 100644 (file)
 #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<GrGLSLCaps> Default() {
-        sk_sp<GrGLSLCaps> result = sk_make_sp<GrGLSLCaps>(GrContextOptions());
+    static sk_sp<GrShaderCaps> Default() {
+        sk_sp<GrShaderCaps> result = sk_make_sp<GrShaderCaps>(GrContextOptions());
         result->fVersionDeclString = "#version 400";
         result->fShaderDerivativeSupport = true;
         return result;
     }
 
-    static sk_sp<GrGLSLCaps> Version450Core() {
-        sk_sp<GrGLSLCaps> result = sk_make_sp<GrGLSLCaps>(GrContextOptions());
+    static sk_sp<GrShaderCaps> Version450Core() {
+        sk_sp<GrShaderCaps> result = sk_make_sp<GrShaderCaps>(GrContextOptions());
         result->fVersionDeclString = "#version 450 core";
         return result;
     }
 
-    static sk_sp<GrGLSLCaps> Version110() {
-        sk_sp<GrGLSLCaps> result = sk_make_sp<GrGLSLCaps>(GrContextOptions());
+    static sk_sp<GrShaderCaps> Version110() {
+        sk_sp<GrShaderCaps> result = sk_make_sp<GrShaderCaps>(GrContextOptions());
         result->fVersionDeclString = "#version 110";
         result->fGLSLGeneration = GrGLSLGeneration::k110_GrGLSLGeneration;
         return result;
     }
 
-    static sk_sp<GrGLSLCaps> UsesPrecisionModifiers() {
-        sk_sp<GrGLSLCaps> result = sk_make_sp<GrGLSLCaps>(GrContextOptions());
+    static sk_sp<GrShaderCaps> UsesPrecisionModifiers() {
+        sk_sp<GrShaderCaps> result = sk_make_sp<GrShaderCaps>(GrContextOptions());
         result->fVersionDeclString = "#version 400";
         result->fUsesPrecisionModifiers = true;
         return result;
     }
 
-    static sk_sp<GrGLSLCaps> CannotUseMinAndAbsTogether() {
-        sk_sp<GrGLSLCaps> result = sk_make_sp<GrGLSLCaps>(GrContextOptions());
+    static sk_sp<GrShaderCaps> CannotUseMinAndAbsTogether() {
+        sk_sp<GrShaderCaps> result = sk_make_sp<GrShaderCaps>(GrContextOptions());
         result->fVersionDeclString = "#version 400";
         result->fCanUseMinAndAbsTogether = false;
         return result;
     }
 
-    static sk_sp<GrGLSLCaps> MustForceNegatedAtanParamToFloat() {
-        sk_sp<GrGLSLCaps> result = sk_make_sp<GrGLSLCaps>(GrContextOptions());
+    static sk_sp<GrShaderCaps> MustForceNegatedAtanParamToFloat() {
+        sk_sp<GrShaderCaps> result = sk_make_sp<GrShaderCaps>(GrContextOptions());
         result->fVersionDeclString = "#version 400";
         result->fMustForceNegatedAtanParamToFloat = true;
         return result;
     }
 
-    static sk_sp<GrGLSLCaps> ShaderDerivativeExtensionString() {
-        sk_sp<GrGLSLCaps> result = sk_make_sp<GrGLSLCaps>(GrContextOptions());
+    static sk_sp<GrShaderCaps> ShaderDerivativeExtensionString() {
+        sk_sp<GrShaderCaps> result = sk_make_sp<GrShaderCaps>(GrContextOptions());
         result->fVersionDeclString = "#version 400";
         result->fShaderDerivativeSupport = true;
         result->fShaderDerivativeExtensionString = "GL_OES_standard_derivatives";
         return result;
     }
 
-    static sk_sp<GrGLSLCaps> VariousCaps() {
-        sk_sp<GrGLSLCaps> result = sk_make_sp<GrGLSLCaps>(GrContextOptions());
+    static sk_sp<GrShaderCaps> VariousCaps() {
+        sk_sp<GrShaderCaps> result = sk_make_sp<GrShaderCaps>(GrContextOptions());
         result->fVersionDeclString = "#version 400";
         result->fExternalTextureSupport = true;
         result->fFBFetchSupport = false;
index 8354a8d03a63c9c0da79f2cd047598d11fca801b..82293625ef6b0d9cc92a615be100ccd1ec71be59 100644 (file)
@@ -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;
 
index 12a5b5cba65c043a69ff6434b743b5fa4e946987..07daa8fea5bf5c9cb66bce91c85a5e7c951d4d79 100644 (file)
@@ -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<BigKeyProcessor>();
     }
-    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; }
 
index 415774aaa206fd23c30b701ca1a1f1e931ea96ed..40681745db9bb138ffabadbf514b3786fbd0c1a6 100644 (file)
@@ -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);
index 4900ed6e84ecc066b2ad08d4ffbfcd6e63e0a450..9a338a8af5094b67ad495d301fc212c075286461 100644 (file)
@@ -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());
             }
index 490c4379fb11443b10f55edd6bf5f41c970182c6..b944bc449f30179e2295d392c93d05ccf01b10aa 100644 (file)
@@ -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;