diff options
-rw-r--r-- | gn/gpu.gni | 2 | ||||
-rw-r--r-- | src/effects/imagefilters/SkLightingImageFilter.cpp | 1 | ||||
-rw-r--r-- | src/effects/imagefilters/SkMagnifierImageFilter.cpp | 1 | ||||
-rw-r--r-- | src/effects/imagefilters/SkMorphologyImageFilter.cpp | 1 | ||||
-rw-r--r-- | src/gpu/GrShaderCaps.h | 4 | ||||
-rw-r--r-- | src/gpu/GrShaderVar.cpp | 19 | ||||
-rw-r--r-- | src/gpu/effects/GrBicubicEffect.cpp | 1 | ||||
-rw-r--r-- | src/gpu/effects/GrConvexPolyEffect.cpp | 1 | ||||
-rw-r--r-- | src/gpu/effects/GrGaussianConvolutionFragmentProcessor.cpp | 1 | ||||
-rw-r--r-- | src/gpu/effects/GrMatrixConvolutionEffect.cpp | 1 | ||||
-rw-r--r-- | src/gpu/gl/GrGLCaps.cpp | 2 | ||||
-rw-r--r-- | src/gpu/gl/GrGLCaps.h | 2 | ||||
-rw-r--r-- | src/gpu/gl/GrGLContext.h | 5 | ||||
-rw-r--r-- | src/gpu/gl/GrGLGLSL.cpp | 4 | ||||
-rw-r--r-- | src/gpu/gl/GrGLGLSL.h | 13 | ||||
-rw-r--r-- | src/gpu/gl/GrGLGpu.cpp | 2 | ||||
-rw-r--r-- | src/gpu/glsl/GrGLSL.cpp | 40 | ||||
-rw-r--r-- | src/gpu/glsl/GrGLSL.h (renamed from include/private/GrGLSL.h) | 34 | ||||
-rw-r--r-- | src/gpu/glsl/GrGLSLFragmentShaderBuilder.cpp | 1 |
19 files changed, 33 insertions, 102 deletions
diff --git a/gn/gpu.gni b/gn/gpu.gni index bf448ced0a..ba45a9bc8b 100644 --- a/gn/gpu.gni +++ b/gn/gpu.gni @@ -35,7 +35,6 @@ skia_gpu_sources = [ "$_include/private/GrColor.h", "$_include/private/GrCCClipPath.h", "$_include/private/GrCCPerOpListPaths.h", - "$_include/private/GrGLSL.h", "$_include/private/GrOpList.h", "$_include/private/GrSingleOwner.h", "$_include/private/GrRenderTargetProxy.h", @@ -483,6 +482,7 @@ skia_gpu_sources = [ # GLSL "$_src/gpu/glsl/GrGLSL.cpp", + "$_src/gpu/glsl/GrGLSL.h", "$_src/gpu/glsl/GrGLSLBlend.cpp", "$_src/gpu/glsl/GrGLSLBlend.h", "$_src/gpu/glsl/GrGLSLColorSpaceXformHelper.h", diff --git a/src/effects/imagefilters/SkLightingImageFilter.cpp b/src/effects/imagefilters/SkLightingImageFilter.cpp index 064c16d48a..659dbbca27 100644 --- a/src/effects/imagefilters/SkLightingImageFilter.cpp +++ b/src/effects/imagefilters/SkLightingImageFilter.cpp @@ -32,7 +32,6 @@ #include "glsl/GrGLSLFragmentShaderBuilder.h" #include "glsl/GrGLSLProgramDataManager.h" #include "glsl/GrGLSLUniformHandler.h" -#include "../private/GrGLSL.h" class GrGLDiffuseLightingEffect; class GrGLSpecularLightingEffect; diff --git a/src/effects/imagefilters/SkMagnifierImageFilter.cpp b/src/effects/imagefilters/SkMagnifierImageFilter.cpp index 40624ab05a..88d78624ba 100644 --- a/src/effects/imagefilters/SkMagnifierImageFilter.cpp +++ b/src/effects/imagefilters/SkMagnifierImageFilter.cpp @@ -19,7 +19,6 @@ //////////////////////////////////////////////////////////////////////////////// #if SK_SUPPORT_GPU -#include "../private/GrGLSL.h" #include "GrColorSpaceXform.h" #include "GrContext.h" #include "GrCoordTransform.h" diff --git a/src/effects/imagefilters/SkMorphologyImageFilter.cpp b/src/effects/imagefilters/SkMorphologyImageFilter.cpp index 8b3e76cb5d..6fe4e09949 100644 --- a/src/effects/imagefilters/SkMorphologyImageFilter.cpp +++ b/src/effects/imagefilters/SkMorphologyImageFilter.cpp @@ -19,7 +19,6 @@ #include "SkWriteBuffer.h" #if SK_SUPPORT_GPU -#include "../private/GrGLSL.h" #include "GrContext.h" #include "GrCoordTransform.h" #include "GrFixedClip.h" diff --git a/src/gpu/GrShaderCaps.h b/src/gpu/GrShaderCaps.h index 3e85b6c1aa..914394672a 100644 --- a/src/gpu/GrShaderCaps.h +++ b/src/gpu/GrShaderCaps.h @@ -8,8 +8,10 @@ #ifndef GrShaderCaps_DEFINED #define GrShaderCaps_DEFINED -#include "../private/GrGLSL.h" #include "../private/GrSwizzle.h" +#include "GrTypesPriv.h" +#include "SkRefCnt.h" +#include "glsl/GrGLSL.h" namespace SkSL { class ShaderCapsFactory; diff --git a/src/gpu/GrShaderVar.cpp b/src/gpu/GrShaderVar.cpp index 4d6c6581a1..61cd3c9207 100644 --- a/src/gpu/GrShaderVar.cpp +++ b/src/gpu/GrShaderVar.cpp @@ -35,6 +35,23 @@ void GrShaderVar::setIOType(GrIOType ioType) { SK_ABORT("Unknown io type."); } +// Converts a GrSLPrecision to its corresponding GLSL precision qualifier. TODO: Remove this as we +// shouldn't need it with SkSL. +static inline const char* glsl_precision_string(GrSLPrecision p) { + switch (p) { + case kLow_GrSLPrecision: + return "lowp"; + case kMedium_GrSLPrecision: + return "mediump"; + case kHigh_GrSLPrecision: + return "highp"; + case kDefault_GrSLPrecision: + return ""; + } + SK_ABORT("Unexpected precision type."); + return ""; +} + void GrShaderVar::appendDecl(const GrShaderCaps* shaderCaps, SkString* out) const { SkASSERT(kDefault_GrSLPrecision == fPrecision || GrSLTypeTemporarilyAcceptsPrecision(fType)); SkString layout = fLayoutQualifier; @@ -49,7 +66,7 @@ void GrShaderVar::appendDecl(const GrShaderCaps* shaderCaps, SkString* out) cons GrSLType effectiveType = this->getType(); if (shaderCaps->usesPrecisionModifiers() && GrSLTypeAcceptsPrecision(effectiveType)) { // Desktop GLSL has added precision qualifiers but they don't do anything. - out->appendf("%s ", GrGLSLPrecisionString(fPrecision)); + out->appendf("%s ", glsl_precision_string(fPrecision)); } if (this->isArray()) { if (this->isUnsizedArray()) { diff --git a/src/gpu/effects/GrBicubicEffect.cpp b/src/gpu/effects/GrBicubicEffect.cpp index c2cedf291b..803f2907a6 100644 --- a/src/gpu/effects/GrBicubicEffect.cpp +++ b/src/gpu/effects/GrBicubicEffect.cpp @@ -11,7 +11,6 @@ #include "glsl/GrGLSLFragmentShaderBuilder.h" #include "glsl/GrGLSLProgramDataManager.h" #include "glsl/GrGLSLUniformHandler.h" -#include "../private/GrGLSL.h" class GrGLBicubicEffect : public GrGLSLFragmentProcessor { public: diff --git a/src/gpu/effects/GrConvexPolyEffect.cpp b/src/gpu/effects/GrConvexPolyEffect.cpp index 753d34ee7e..f98ed47849 100644 --- a/src/gpu/effects/GrConvexPolyEffect.cpp +++ b/src/gpu/effects/GrConvexPolyEffect.cpp @@ -13,7 +13,6 @@ #include "glsl/GrGLSLFragmentShaderBuilder.h" #include "glsl/GrGLSLProgramDataManager.h" #include "glsl/GrGLSLUniformHandler.h" -#include "../private/GrGLSL.h" ////////////////////////////////////////////////////////////////////////////// diff --git a/src/gpu/effects/GrGaussianConvolutionFragmentProcessor.cpp b/src/gpu/effects/GrGaussianConvolutionFragmentProcessor.cpp index c546f8c9c8..bfd3f86e41 100644 --- a/src/gpu/effects/GrGaussianConvolutionFragmentProcessor.cpp +++ b/src/gpu/effects/GrGaussianConvolutionFragmentProcessor.cpp @@ -9,7 +9,6 @@ #include "GrTexture.h" #include "GrTextureProxy.h" -#include "../private/GrGLSL.h" #include "glsl/GrGLSLFragmentProcessor.h" #include "glsl/GrGLSLFragmentShaderBuilder.h" #include "glsl/GrGLSLProgramDataManager.h" diff --git a/src/gpu/effects/GrMatrixConvolutionEffect.cpp b/src/gpu/effects/GrMatrixConvolutionEffect.cpp index cd1ef1a623..ec2126d520 100644 --- a/src/gpu/effects/GrMatrixConvolutionEffect.cpp +++ b/src/gpu/effects/GrMatrixConvolutionEffect.cpp @@ -12,7 +12,6 @@ #include "glsl/GrGLSLFragmentShaderBuilder.h" #include "glsl/GrGLSLProgramDataManager.h" #include "glsl/GrGLSLUniformHandler.h" -#include "../private/GrGLSL.h" class GrGLMatrixConvolutionEffect : public GrGLSLFragmentProcessor { public: diff --git a/src/gpu/gl/GrGLCaps.cpp b/src/gpu/gl/GrGLCaps.cpp index 4f9b63fd62..4f33ef4ce4 100644 --- a/src/gpu/gl/GrGLCaps.cpp +++ b/src/gpu/gl/GrGLCaps.cpp @@ -305,7 +305,7 @@ void GrGLCaps::init(const GrContextOptions& contextOptions, if (kGL_GrGLStandard == standard) { shaderCaps->fDualSourceBlendingSupport = (ctxInfo.version() >= GR_GL_VER(3, 3) || ctxInfo.hasExtension("GL_ARB_blend_func_extended")) && - GrGLSLSupportsNamedFragmentShaderOutputs(ctxInfo.glslGeneration()); + ctxInfo.glslGeneration() >= k130_GrGLSLGeneration; shaderCaps->fShaderDerivativeSupport = true; diff --git a/src/gpu/gl/GrGLCaps.h b/src/gpu/gl/GrGLCaps.h index 1596dfd9de..7380146c56 100644 --- a/src/gpu/gl/GrGLCaps.h +++ b/src/gpu/gl/GrGLCaps.h @@ -10,14 +10,12 @@ #define GrGLCaps_DEFINED #include <functional> - #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 GrGLRenderTarget; diff --git a/src/gpu/gl/GrGLContext.h b/src/gpu/gl/GrGLContext.h index 998a5f5194..4ed76e6c69 100644 --- a/src/gpu/gl/GrGLContext.h +++ b/src/gpu/gl/GrGLContext.h @@ -9,10 +9,11 @@ #ifndef GrGLContext_DEFINED #define GrGLContext_DEFINED -#include "gl/GrGLExtensions.h" -#include "gl/GrGLInterface.h" #include "GrGLCaps.h" #include "GrGLUtil.h" +#include "gl/GrGLExtensions.h" +#include "gl/GrGLInterface.h" +#include "glsl/GrGLSL.h" struct GrContextOptions; namespace SkSL { diff --git a/src/gpu/gl/GrGLGLSL.cpp b/src/gpu/gl/GrGLGLSL.cpp index ab92358c13..4050d36be6 100644 --- a/src/gpu/gl/GrGLGLSL.cpp +++ b/src/gpu/gl/GrGLGLSL.cpp @@ -5,10 +5,8 @@ * found in the LICENSE file. */ -#include "GrGLContext.h" +#include "GrGLGLSL.h" #include "GrGLUtil.h" -#include "SkString.h" -#include "../private/GrGLSL.h" bool GrGLGetGLSLGeneration(const GrGLInterface* gl, GrGLSLGeneration* generation) { SkASSERT(generation); diff --git a/src/gpu/gl/GrGLGLSL.h b/src/gpu/gl/GrGLGLSL.h index 88bb273d92..48bea7f847 100644 --- a/src/gpu/gl/GrGLGLSL.h +++ b/src/gpu/gl/GrGLGLSL.h @@ -5,21 +5,16 @@ * found in the LICENSE file. */ -#ifndef GrGLInitGLSL_DEFINED -#define GrGLInitGLSL_DEFINED +#ifndef GrGLGLSL_DEFINED +#define GrGLGLSL_DEFINED -#include "gl/GrGLInterface.h" -#include "GrColor.h" -#include "GrTypesPriv.h" -#include "SkString.h" -#include "../private/GrGLSL.h" +#include "glsl/GrGLSL.h" -class GrGLContextInfo; +struct GrGLInterface; /** * Gets the most recent GLSL Generation compatible with the OpenGL context. */ bool GrGLGetGLSLGeneration(const GrGLInterface* gl, GrGLSLGeneration* generation); - #endif diff --git a/src/gpu/gl/GrGLGpu.cpp b/src/gpu/gl/GrGLGpu.cpp index be53222ee8..40d1c3bbbb 100644 --- a/src/gpu/gl/GrGLGpu.cpp +++ b/src/gpu/gl/GrGLGpu.cpp @@ -6,8 +6,6 @@ */ #include "GrGLGpu.h" - -#include "../private/GrGLSL.h" #include "GrBackendSemaphore.h" #include "GrBackendSurface.h" #include "GrFixedClip.h" diff --git a/src/gpu/glsl/GrGLSL.cpp b/src/gpu/glsl/GrGLSL.cpp index 4791a0ee22..67fe2995fa 100644 --- a/src/gpu/glsl/GrGLSL.cpp +++ b/src/gpu/glsl/GrGLSL.cpp @@ -5,26 +5,8 @@ * found in the LICENSE file. */ +#include "GrGLSL.h" #include "GrShaderCaps.h" -#include "SkString.h" -#include "../private/GrGLSL.h" - -bool GrGLSLSupportsNamedFragmentShaderOutputs(GrGLSLGeneration gen) { - switch (gen) { - case k110_GrGLSLGeneration: - return false; - case k130_GrGLSLGeneration: - case k140_GrGLSLGeneration: - case k150_GrGLSLGeneration: - case k330_GrGLSLGeneration: - case k400_GrGLSLGeneration: - case k420_GrGLSLGeneration: - case k310es_GrGLSLGeneration: - case k320es_GrGLSLGeneration: - return true; - } - return false; -} const char* GrGLSLTypeString(const GrShaderCaps* shaderCaps, GrSLType t) { switch (t) { @@ -111,23 +93,3 @@ const char* GrGLSLTypeString(const GrShaderCaps* shaderCaps, GrSLType t) { SK_ABORT("Unknown shader var type."); return ""; // suppress warning } - -void GrGLSLAppendDefaultFloatPrecisionDeclaration(GrSLPrecision p, - const GrShaderCaps& shaderCaps, - SkString* out) { - if (shaderCaps.usesPrecisionModifiers()) { - switch (p) { - case kHigh_GrSLPrecision: - out->append("precision highp float;\n"); - break; - case kMedium_GrSLPrecision: - out->append("precision mediump float;\n"); - break; - case kLow_GrSLPrecision: - out->append("precision lowp float;\n"); - break; - default: - SK_ABORT("Unknown precision value."); - } - } -} diff --git a/include/private/GrGLSL.h b/src/gpu/glsl/GrGLSL.h index 23a575462c..743eef1514 100644 --- a/include/private/GrGLSL.h +++ b/src/gpu/glsl/GrGLSL.h @@ -9,7 +9,6 @@ #define GrGLSL_DEFINED #include "GrTypesPriv.h" -#include "SkString.h" class GrShaderCaps; @@ -54,37 +53,6 @@ enum GrGLSLGeneration { 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"; - case kDefault_GrSLPrecision: - return ""; - default: - SK_ABORT("Unexpected precision type."); - return ""; - } -} - -/** - * Converts a GrSLType to a string containing the name of the equivalent GLSL type. - */ -const char* GrGLSLTypeString(const GrShaderCaps* shaderCaps, GrSLType t); +const char* GrGLSLTypeString(const GrShaderCaps*, GrSLType); #endif diff --git a/src/gpu/glsl/GrGLSLFragmentShaderBuilder.cpp b/src/gpu/glsl/GrGLSLFragmentShaderBuilder.cpp index 895d344d43..788fd702fe 100644 --- a/src/gpu/glsl/GrGLSLFragmentShaderBuilder.cpp +++ b/src/gpu/glsl/GrGLSLFragmentShaderBuilder.cpp @@ -13,7 +13,6 @@ #include "glsl/GrGLSLProgramBuilder.h" #include "glsl/GrGLSLUniformHandler.h" #include "glsl/GrGLSLVarying.h" -#include "../private/GrGLSL.h" const char* GrGLSLFragmentShaderBuilder::kDstColorName = "_dstColor"; |