From: bsalomon Date: Tue, 9 Dec 2014 18:04:14 +0000 (-0800) Subject: Move shader precision out of GrShaderVar X-Git-Tag: accepted/tizen/5.0/unified/20181102.025319~4542 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c0bd6484f621e4a1033be318b1947a5d32157c13;p=platform%2Fupstream%2FlibSkiaSharp.git Move shader precision out of GrShaderVar Review URL: https://codereview.chromium.org/777443003 --- diff --git a/include/gpu/GrCoordTransform.h b/include/gpu/GrCoordTransform.h index b00c8a4..775089c 100644 --- a/include/gpu/GrCoordTransform.h +++ b/include/gpu/GrCoordTransform.h @@ -72,7 +72,7 @@ public: * Create a transformation that applies the matrix to a coord set. */ GrCoordTransform(GrCoordSet sourceCoords, const SkMatrix& m, - GrShaderVar::Precision precision = GrShaderVar::kDefault_Precision) { + GrSLPrecision precision = kDefault_GrSLPrecision) { SkDEBUGCODE(fInProcessor = false); this->reset(sourceCoords, m, precision); } @@ -85,7 +85,7 @@ public: void reset(GrCoordSet, const SkMatrix&, const GrTexture*); void reset(GrCoordSet sourceCoords, const SkMatrix& m, - GrShaderVar::Precision precision = GrShaderVar::kDefault_Precision); + GrSLPrecision precision = kDefault_GrSLPrecision); GrCoordTransform& operator= (const GrCoordTransform& that) { SkASSERT(!fInProcessor); @@ -117,7 +117,7 @@ public: GrCoordSet sourceCoords() const { return fSourceCoords; } const SkMatrix& getMatrix() const { return fMatrix; } bool reverseY() const { return fReverseY; } - GrShaderVar::Precision precision() const { return fPrecision; } + GrSLPrecision precision() const { return fPrecision; } /** Useful for effects that want to insert a texture matrix that is implied by the texture dimensions */ @@ -132,7 +132,7 @@ private: GrCoordSet fSourceCoords; SkMatrix fMatrix; bool fReverseY; - GrShaderVar::Precision fPrecision; + GrSLPrecision fPrecision; typedef SkNoncopyable INHERITED; #ifdef SK_DEBUG diff --git a/include/gpu/GrShaderVar.h b/include/gpu/GrShaderVar.h index 05ae36a..3ef24b0 100644 --- a/include/gpu/GrShaderVar.h +++ b/include/gpu/GrShaderVar.h @@ -34,19 +34,6 @@ public: kVaryingOut_TypeModifier }; - enum Precision { - kLow_Precision, - kMedium_Precision, - kHigh_Precision, - - // Default precision is medium. This is because on OpenGL ES 2 highp support is not - // guaranteed. On (non-ES) OpenGL the specifiers have no effect on precision. - kDefault_Precision = kMedium_Precision, - - kLast_Precision = kHigh_Precision - }; - static const int kPrecisionCount = kLast_Precision + 1; - /** * Defaults to a float with no precision specifier */ @@ -54,11 +41,11 @@ public: : fType(kFloat_GrSLType) , fTypeModifier(kNone_TypeModifier) , fCount(kNonArray) - , fPrecision(kDefault_Precision) { + , fPrecision(kDefault_GrSLPrecision) { } GrShaderVar(const SkString& name, GrSLType type, int arrayCount = kNonArray, - Precision precision = kDefault_Precision) + GrSLPrecision precision = kDefault_GrSLPrecision) : fType(type) , fTypeModifier(kNone_TypeModifier) , fName(name) @@ -68,7 +55,7 @@ public: } GrShaderVar(const char* name, GrSLType type, int arrayCount = kNonArray, - Precision precision = kDefault_Precision) + GrSLPrecision precision = kDefault_GrSLPrecision) : fType(type) , fTypeModifier(kNone_TypeModifier) , fName(name) @@ -78,7 +65,7 @@ public: } GrShaderVar(const char* name, GrSLType type, TypeModifier typeModifier, - int arrayCount = kNonArray, Precision precision = kDefault_Precision) + int arrayCount = kNonArray, GrSLPrecision precision = kDefault_GrSLPrecision) : fType(type) , fTypeModifier(typeModifier) , fName(name) @@ -101,7 +88,7 @@ public: void set(GrSLType type, TypeModifier typeModifier, const SkString& name, - Precision precision = kDefault_Precision) { + GrSLPrecision precision = kDefault_GrSLPrecision) { SkASSERT(kVoid_GrSLType != type); fType = type; fTypeModifier = typeModifier; @@ -116,7 +103,7 @@ public: void set(GrSLType type, TypeModifier typeModifier, const char* name, - Precision precision = kDefault_Precision) { + GrSLPrecision precision = kDefault_GrSLPrecision) { SkASSERT(kVoid_GrSLType != type); fType = type; fTypeModifier = typeModifier; @@ -132,7 +119,7 @@ public: TypeModifier typeModifier, const SkString& name, int count, - Precision precision = kDefault_Precision) { + GrSLPrecision precision = kDefault_GrSLPrecision) { SkASSERT(kVoid_GrSLType != type); fType = type; fTypeModifier = typeModifier; @@ -148,7 +135,7 @@ public: TypeModifier typeModifier, const char* name, int count, - Precision precision = kDefault_Precision) { + GrSLPrecision precision = kDefault_GrSLPrecision) { SkASSERT(kVoid_GrSLType != type); fType = type; fTypeModifier = typeModifier; @@ -217,19 +204,19 @@ public: /** * Get the precision of the var */ - Precision getPrecision() const { return fPrecision; } + GrSLPrecision getPrecision() const { return fPrecision; } /** * Set the precision of the var */ - void setPrecision(Precision p) { fPrecision = p; } + void setPrecision(GrSLPrecision p) { fPrecision = p; } protected: GrSLType fType; TypeModifier fTypeModifier; SkString fName; int fCount; - Precision fPrecision; + GrSLPrecision fPrecision; }; #endif diff --git a/include/gpu/GrTypesPriv.h b/include/gpu/GrTypesPriv.h index 83d8561..2a8d4c3 100644 --- a/include/gpu/GrTypesPriv.h +++ b/include/gpu/GrTypesPriv.h @@ -39,6 +39,24 @@ enum GrShaderType { static const int kGrShaderTypeCount = kLastkFragment_GrShaderType + 1; /** + * Precisions of shader language variables. Not all shading languages support precisions or actually + * vary the internal precision based on the qualifiers. + */ +enum GrSLPrecision { + kLow_GrSLPrecision, + kMedium_GrSLPrecision, + kHigh_GrSLPrecision, + + // Default precision is medium. This is because on OpenGL ES 2 highp support is not + // guaranteed. On (non-ES) OpenGL the specifiers have no effect on precision. + kDefault_GrSLPrecision = kMedium_GrSLPrecision, + + kLast_GrSLPrecision = kHigh_GrSLPrecision +}; + +static const int kGrSLPrecisionCount = kLast_GrSLPrecision + 1; + +/** * Gets the vector size of the SLType. Returns -1 for void, matrices, and samplers. */ static inline int GrSLTypeVectorCount(GrSLType type) { diff --git a/src/gpu/GrCoordTransform.cpp b/src/gpu/GrCoordTransform.cpp index 53285a2..5bb36fc 100644 --- a/src/gpu/GrCoordTransform.cpp +++ b/src/gpu/GrCoordTransform.cpp @@ -22,7 +22,7 @@ void GrCoordTransform::reset(GrCoordSet sourceCoords, const SkMatrix& m, const G // increased. Our rule is that we want at least 4 subpixel values in the representation for // coords between 0 to 1. Note that this still might not be enough when drawing with repeat // or mirror-repeat modes but that case can be arbitrarily bad. - fPrecision = GrShaderVar::kDefault_Precision; + fPrecision = kDefault_GrSLPrecision; if (texture->getContext()) { const GrDrawTargetCaps* caps = texture->getContext()->getGpu()->caps(); if (caps->floatPrecisionVaries()) { @@ -36,10 +36,10 @@ void GrCoordTransform::reset(GrCoordSet sourceCoords, const SkMatrix& m, const G if ((2 << info->fBits) / maxD > 4) { break; } - if (GrShaderVar::kHigh_Precision == fPrecision) { + if (kHigh_GrSLPrecision == fPrecision) { break; } - GrShaderVar::Precision nextP = static_cast(fPrecision + 1); + GrSLPrecision nextP = static_cast(fPrecision + 1); info = &caps->getFloatShaderPrecisionInfo(kFragment_GrShaderType, nextP); if (!info->supported()) { break; @@ -52,7 +52,7 @@ void GrCoordTransform::reset(GrCoordSet sourceCoords, const SkMatrix& m, const G void GrCoordTransform::reset(GrCoordSet sourceCoords, const SkMatrix& m, - GrShaderVar::Precision precision) { + GrSLPrecision precision) { SkASSERT(!fInProcessor); fSourceCoords = sourceCoords; fMatrix = m; diff --git a/src/gpu/GrDrawTarget.cpp b/src/gpu/GrDrawTarget.cpp index ed54bf9..0d6a388 100644 --- a/src/gpu/GrDrawTarget.cpp +++ b/src/gpu/GrDrawTarget.cpp @@ -1046,7 +1046,7 @@ GrDrawTargetCaps& GrDrawTargetCaps::operator=(const GrDrawTargetCaps& other) { fShaderPrecisionVaries = other.fShaderPrecisionVaries; for (int s = 0; s < kGrShaderTypeCount; ++s) { - for (int p = 0; p < GrShaderVar::kPrecisionCount; ++p) { + for (int p = 0; p < kGrSLPrecisionCount; ++p) { fFloatPrecisions[s][p] = other.fFloatPrecisions[s][p]; } } @@ -1085,13 +1085,13 @@ static const char* shader_type_to_string(GrShaderType type) { return ""; } -static const char* precision_to_string(GrShaderVar::Precision p) { +static const char* precision_to_string(GrSLPrecision p) { switch (p) { - case GrShaderVar::kLow_Precision: + case kLow_GrSLPrecision: return "low"; - case GrShaderVar::kMedium_Precision: + case kMedium_GrSLPrecision: return "medium"; - case GrShaderVar::kHigh_Precision: + case kHigh_GrSLPrecision: return "high"; } return ""; @@ -1177,9 +1177,9 @@ SkString GrDrawTargetCaps::dump() const { for (int s = 0; s < kGrShaderTypeCount; ++s) { GrShaderType shaderType = static_cast(s); r.appendf("\t%s:\n", shader_type_to_string(shaderType)); - for (int p = 0; p < GrShaderVar::kPrecisionCount; ++p) { + for (int p = 0; p < kGrSLPrecisionCount; ++p) { if (fFloatPrecisions[s][p].supported()) { - GrShaderVar::Precision precision = static_cast(p); + GrSLPrecision precision = static_cast(p); r.appendf("\t\t%s: log_low: %d log_high: %d bits: %d\n", precision_to_string(precision), fFloatPrecisions[s][p].fLogRangeLow, diff --git a/src/gpu/GrDrawTargetCaps.h b/src/gpu/GrDrawTargetCaps.h index ae6a9ed..1bd18b0 100644 --- a/src/gpu/GrDrawTargetCaps.h +++ b/src/gpu/GrDrawTargetCaps.h @@ -22,7 +22,7 @@ public: SK_DECLARE_INST_COUNT(GrDrawTargetCaps) /** 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 GrShaderVar::Precision + 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() { @@ -127,7 +127,7 @@ public: * called. */ const PrecisionInfo& getFloatShaderPrecisionInfo(GrShaderType shaderType, - GrShaderVar::Precision precision) const { + GrSLPrecision precision) const { return fFloatPrecisions[shaderType][precision]; }; @@ -175,7 +175,7 @@ protected: bool fConfigTextureSupport[kGrPixelConfigCnt]; bool fShaderPrecisionVaries; - PrecisionInfo fFloatPrecisions[kGrShaderTypeCount][GrShaderVar::kPrecisionCount]; + PrecisionInfo fFloatPrecisions[kGrShaderTypeCount][kGrSLPrecisionCount]; private: static uint32_t CreateUniqueID(); diff --git a/src/gpu/effects/GrBezierEffect.cpp b/src/gpu/effects/GrBezierEffect.cpp index ebbb8d7..5abd293 100644 --- a/src/gpu/effects/GrBezierEffect.cpp +++ b/src/gpu/effects/GrBezierEffect.cpp @@ -353,7 +353,7 @@ void GrGLCubicEffect::emitCode(const EmitArgs& args) { const GrCubicEffect& gp = args.fGP.cast(); GrGLVertToFrag v(kVec4f_GrSLType); - args.fPB->addVarying("CubicCoeffs", &v, GrGLShaderVar::kHigh_Precision); + args.fPB->addVarying("CubicCoeffs", &v, kHigh_GrSLPrecision); vsBuilder->codeAppendf("%s = %s;", v.vsOut(), gp.inCubicCoeffs()->fName); // setup coord outputs @@ -366,14 +366,14 @@ void GrGLCubicEffect::emitCode(const EmitArgs& args) { GrGLGPFragmentBuilder* fsBuilder = args.fPB->getFragmentShaderBuilder(); - GrGLShaderVar edgeAlpha("edgeAlpha", kFloat_GrSLType, 0, GrGLShaderVar::kHigh_Precision); - GrGLShaderVar dklmdx("dklmdx", kVec3f_GrSLType, 0, GrGLShaderVar::kHigh_Precision); - GrGLShaderVar dklmdy("dklmdy", kVec3f_GrSLType, 0, GrGLShaderVar::kHigh_Precision); - GrGLShaderVar dfdx("dfdx", kFloat_GrSLType, 0, GrGLShaderVar::kHigh_Precision); - GrGLShaderVar dfdy("dfdy", kFloat_GrSLType, 0, GrGLShaderVar::kHigh_Precision); - GrGLShaderVar gF("gF", kVec2f_GrSLType, 0, GrGLShaderVar::kHigh_Precision); - GrGLShaderVar gFM("gFM", kFloat_GrSLType, 0, GrGLShaderVar::kHigh_Precision); - GrGLShaderVar func("func", kFloat_GrSLType, 0, GrGLShaderVar::kHigh_Precision); + GrGLShaderVar edgeAlpha("edgeAlpha", kFloat_GrSLType, 0, kHigh_GrSLPrecision); + GrGLShaderVar dklmdx("dklmdx", kVec3f_GrSLType, 0, kHigh_GrSLPrecision); + GrGLShaderVar dklmdy("dklmdy", kVec3f_GrSLType, 0, kHigh_GrSLPrecision); + GrGLShaderVar dfdx("dfdx", kFloat_GrSLType, 0, kHigh_GrSLPrecision); + GrGLShaderVar dfdy("dfdy", kFloat_GrSLType, 0, kHigh_GrSLPrecision); + GrGLShaderVar gF("gF", kVec2f_GrSLType, 0, kHigh_GrSLPrecision); + GrGLShaderVar gFM("gFM", kFloat_GrSLType, 0, kHigh_GrSLPrecision); + GrGLShaderVar func("func", kFloat_GrSLType, 0, kHigh_GrSLPrecision); fsBuilder->declAppend(edgeAlpha); fsBuilder->declAppend(dklmdx); diff --git a/src/gpu/effects/GrConfigConversionEffect.cpp b/src/gpu/effects/GrConfigConversionEffect.cpp index e146411..55ae54e 100644 --- a/src/gpu/effects/GrConfigConversionEffect.cpp +++ b/src/gpu/effects/GrConfigConversionEffect.cpp @@ -29,7 +29,7 @@ public: const TransformedCoordsArray& coords, const TextureSamplerArray& samplers) SK_OVERRIDE { // Using highp for GLES here in order to avoid some precision issues on specific GPUs. - GrGLShaderVar tmpVar("tmpColor", kVec4f_GrSLType, 0, GrGLShaderVar::kHigh_Precision); + GrGLShaderVar tmpVar("tmpColor", kVec4f_GrSLType, 0, kHigh_GrSLPrecision); SkString tmpDecl; tmpVar.appendDecl(builder->ctxInfo(), &tmpDecl); diff --git a/src/gpu/gl/GrGLCaps.cpp b/src/gpu/gl/GrGLCaps.cpp index a510cb4..79c99c2 100644 --- a/src/gpu/gl/GrGLCaps.cpp +++ b/src/gpu/gl/GrGLCaps.cpp @@ -776,13 +776,13 @@ void GrGLCaps::initStencilFormats(const GrGLContextInfo& ctxInfo) { fStencilVerifiedColorConfigs.push_back_n(fStencilFormats.count()); } -static GrGLenum precision_to_gl_float_type(GrShaderVar::Precision p) { +static GrGLenum precision_to_gl_float_type(GrSLPrecision p) { switch (p) { - case GrShaderVar::kLow_Precision: + case kLow_GrSLPrecision: return GR_GL_LOW_FLOAT; - case GrShaderVar::kMedium_Precision: + case kMedium_GrSLPrecision: return GR_GL_MEDIUM_FLOAT; - case GrShaderVar::kHigh_Precision: + case kHigh_GrSLPrecision: return GR_GL_HIGH_FLOAT; } SkFAIL("Unknown precision."); @@ -811,8 +811,8 @@ void GrGLCaps::initShaderPrecisionTable(const GrGLContextInfo& ctxInfo, const Gr GrGLenum glShader = shader_type_to_gl_shader(shaderType); PrecisionInfo* first = NULL; fShaderPrecisionVaries = false; - for (int p = 0; p < GrShaderVar::kPrecisionCount; ++p) { - GrShaderVar::Precision precision = static_cast(p); + for (int p = 0; p < kGrSLPrecisionCount; ++p) { + GrSLPrecision precision = static_cast(p); GrGLenum glPrecision = precision_to_gl_float_type(precision); GrGLint range[2]; GrGLint bits; @@ -835,7 +835,7 @@ void GrGLCaps::initShaderPrecisionTable(const GrGLContextInfo& ctxInfo, const Gr fShaderPrecisionVaries = false; for (int s = 0; s < kGrShaderTypeCount; ++s) { if (kGeometry_GrShaderType != s || fGeometryShaderSupport) { - for (int p = 0; p < GrShaderVar::kPrecisionCount; ++p) { + for (int p = 0; p < kGrSLPrecisionCount; ++p) { fFloatPrecisions[s][p].fLogRangeLow = 127; fFloatPrecisions[s][p].fLogRangeHigh = 127; fFloatPrecisions[s][p].fBits = 23; diff --git a/src/gpu/gl/GrGLProgramDesc.cpp b/src/gpu/gl/GrGLProgramDesc.cpp index 16de1ea..068386c 100644 --- a/src/gpu/gl/GrGLProgramDesc.cpp +++ b/src/gpu/gl/GrGLProgramDesc.cpp @@ -69,7 +69,7 @@ enum { kTransformKeyBits = kMatrixTypeKeyBits + kPrecisionBits + 1, }; -GR_STATIC_ASSERT(GrShaderVar::kHigh_Precision < (1 << kPrecisionBits)); +GR_STATIC_ASSERT(kHigh_GrSLPrecision < (1 << kPrecisionBits)); /** * We specialize the vertex code for each of these matrix types. @@ -95,7 +95,7 @@ static uint32_t gen_transform_key(const GrPendingFragmentStage& stage, bool useE key |= kPositionCoords_Flag; } - GR_STATIC_ASSERT(GrShaderVar::kPrecisionCount <= (1 << kPrecisionBits)); + GR_STATIC_ASSERT(kGrSLPrecisionCount <= (1 << kPrecisionBits)); key |= (coordTransform.precision() << kPrecisionShift); key <<= kTransformKeyBits * t; diff --git a/src/gpu/gl/GrGLShaderVar.h b/src/gpu/gl/GrGLShaderVar.h index 7705c30..5d4d700 100644 --- a/src/gpu/gl/GrGLShaderVar.h +++ b/src/gpu/gl/GrGLShaderVar.h @@ -37,7 +37,7 @@ public: } GrGLShaderVar(const char* name, GrSLType type, int arrayCount = kNonArray, - Precision precision = kDefault_Precision) + GrSLPrecision precision = kDefault_GrSLPrecision) : GrShaderVar(name, type, arrayCount, precision) , fOrigin(kDefault_Origin) , fUseUniformFloatArrays(USE_UNIFORM_FLOAT_ARRAYS) { @@ -47,7 +47,7 @@ public: } GrGLShaderVar(const char* name, GrSLType type, TypeModifier typeModifier, - int arrayCount = kNonArray, Precision precision = kDefault_Precision) + int arrayCount = kNonArray, GrSLPrecision precision = kDefault_GrSLPrecision) : GrShaderVar(name, type, typeModifier, arrayCount, precision) , fOrigin(kDefault_Origin) , fUseUniformFloatArrays(USE_UNIFORM_FLOAT_ARRAYS) { @@ -83,7 +83,7 @@ public: void set(GrSLType type, TypeModifier typeModifier, const SkString& name, - Precision precision = kDefault_Precision, + GrSLPrecision precision = kDefault_GrSLPrecision, Origin origin = kDefault_Origin, bool useUniformFloatArrays = USE_UNIFORM_FLOAT_ARRAYS) { SkASSERT(kVoid_GrSLType != type); @@ -98,7 +98,7 @@ public: void set(GrSLType type, TypeModifier typeModifier, const char* name, - Precision precision = kDefault_Precision, + GrSLPrecision precision = kDefault_GrSLPrecision, Origin origin = kDefault_Origin, bool useUniformFloatArrays = USE_UNIFORM_FLOAT_ARRAYS) { SkASSERT(kVoid_GrSLType != type); @@ -114,7 +114,7 @@ public: TypeModifier typeModifier, const SkString& name, int count, - Precision precision = kDefault_Precision, + GrSLPrecision precision = kDefault_GrSLPrecision, Origin origin = kDefault_Origin, bool useUniformFloatArrays = USE_UNIFORM_FLOAT_ARRAYS) { SkASSERT(kVoid_GrSLType != type); @@ -130,7 +130,7 @@ public: TypeModifier typeModifier, const char* name, int count, - Precision precision = kDefault_Precision, + GrSLPrecision precision = kDefault_GrSLPrecision, Origin origin = kDefault_Origin, bool useUniformFloatArrays = USE_UNIFORM_FLOAT_ARRAYS) { SkASSERT(kVoid_GrSLType != type); @@ -197,15 +197,15 @@ public: fUseUniformFloatArrays ? "" : ".x"); } - static const char* PrecisionString(Precision p, GrGLStandard standard) { + static const char* PrecisionString(GrSLPrecision p, GrGLStandard standard) { // Desktop GLSL has added precision qualifiers but they don't do anything. if (kGLES_GrGLStandard == standard) { switch (p) { - case kLow_Precision: + case kLow_GrSLPrecision: return "lowp "; - case kMedium_Precision: + case kMedium_GrSLPrecision: return "mediump "; - case kHigh_Precision: + case kHigh_GrSLPrecision: return "highp "; default: SkFAIL("Unexpected precision type."); diff --git a/src/gpu/gl/builders/GrGLFragmentShaderBuilder.cpp b/src/gpu/gl/builders/GrGLFragmentShaderBuilder.cpp index 56bc496..6de5f69 100644 --- a/src/gpu/gl/builders/GrGLFragmentShaderBuilder.cpp +++ b/src/gpu/gl/builders/GrGLFragmentShaderBuilder.cpp @@ -16,19 +16,19 @@ const char* GrGLFragmentShaderBuilder::kDstCopyColorName = "_dstColor"; static const char* declared_color_output_name() { return "fsColorOut"; } static const char* dual_source_output_name() { return "dualSourceOut"; } -static void append_default_precision_qualifier(GrGLShaderVar::Precision p, +static void append_default_precision_qualifier(GrSLPrecision p, GrGLStandard standard, SkString* str) { // Desktop GLSL has added precision qualifiers but they don't do anything. if (kGLES_GrGLStandard == standard) { switch (p) { - case GrGLShaderVar::kHigh_Precision: + case kHigh_GrSLPrecision: str->append("precision highp float;\n"); break; - case GrGLShaderVar::kMedium_Precision: + case kMedium_GrSLPrecision: str->append("precision mediump float;\n"); break; - case GrGLShaderVar::kLow_Precision: + case kLow_GrSLPrecision: str->append("precision lowp float;\n"); break; default: @@ -131,7 +131,7 @@ const char* GrGLFragmentShaderBuilder::fragmentPosition() { fInputs.push_back().set(kVec4f_GrSLType, GrGLShaderVar::kIn_TypeModifier, "gl_FragCoord", - GrGLShaderVar::kDefault_Precision, + kDefault_GrSLPrecision, GrGLShaderVar::kUpperLeft_Origin); fSetupFragPosition = true; } @@ -306,7 +306,7 @@ bool GrGLFragmentShaderBuilder::compileAndAttachShaders(GrGLuint programId, GrGpuGL* gpu = fProgramBuilder->gpu(); SkString fragShaderSrc(GrGetGLSLVersionDecl(gpu->ctxInfo())); fragShaderSrc.append(fExtensions); - append_default_precision_qualifier(GrShaderVar::kDefault_Precision, + append_default_precision_qualifier(kDefault_GrSLPrecision, gpu->glStandard(), &fragShaderSrc); fProgramBuilder->appendUniformDecls(GrGLProgramBuilder::kFragment_Visibility, &fragShaderSrc); @@ -342,7 +342,7 @@ void GrGLFragmentShaderBuilder::bindFragmentShaderLocations(GrGLuint programID) } } -void GrGLFragmentShaderBuilder::addVarying(GrGLVarying* v, GrGLShaderVar::Precision fsPrec) { +void GrGLFragmentShaderBuilder::addVarying(GrGLVarying* v, GrSLPrecision fsPrec) { v->fFsIn = v->fVsOut; if (v->fGsOut) { v->fFsIn = v->fGsOut; diff --git a/src/gpu/gl/builders/GrGLFragmentShaderBuilder.h b/src/gpu/gl/builders/GrGLFragmentShaderBuilder.h index 226be51..03f0e7f 100644 --- a/src/gpu/gl/builders/GrGLFragmentShaderBuilder.h +++ b/src/gpu/gl/builders/GrGLFragmentShaderBuilder.h @@ -117,7 +117,7 @@ private: /* * An internal call for GrGLProgramBuilder to use to add varyings to the vertex shader */ - void addVarying(GrGLVarying*, GrGLShaderVar::Precision); + void addVarying(GrGLVarying*, GrSLPrecision); /** * Features that should only be enabled by GrGLFragmentShaderBuilder itself. diff --git a/src/gpu/gl/builders/GrGLProgramBuilder.cpp b/src/gpu/gl/builders/GrGLProgramBuilder.cpp index 5ed566f..9ce3bb2 100644 --- a/src/gpu/gl/builders/GrGLProgramBuilder.cpp +++ b/src/gpu/gl/builders/GrGLProgramBuilder.cpp @@ -103,7 +103,7 @@ GrGLProgramBuilder::GrGLProgramBuilder(GrGpuGL* gpu, const GrOptDrawState& optSt void GrGLProgramBuilder::addVarying(const char* name, GrGLVarying* varying, - GrGLShaderVar::Precision fsPrecision) { + GrSLPrecision fsPrecision) { SkASSERT(varying); if (varying->vsVarying()) { fVS.addVarying(name, varying); @@ -172,7 +172,7 @@ GrGLProgramDataManager::UniformHandle GrGLProgramBuilder::addUniformArray(uint32 // to use the default FS precision. if ((kVertex_Visibility | kFragment_Visibility) == visibility) { // the fragment and vertex precisions must match - uni.fVariable.setPrecision(GrShaderVar::kDefault_Precision); + uni.fVariable.setPrecision(kDefault_GrSLPrecision); } if (outName) { diff --git a/src/gpu/gl/builders/GrGLProgramBuilder.h b/src/gpu/gl/builders/GrGLProgramBuilder.h index b7458b3..7288b94 100644 --- a/src/gpu/gl/builders/GrGLProgramBuilder.h +++ b/src/gpu/gl/builders/GrGLProgramBuilder.h @@ -134,7 +134,7 @@ public: */ virtual void addVarying(const char* name, GrGLVarying*, - GrGLShaderVar::Precision fsPrecision=GrGLShaderVar::kDefault_Precision) = 0; + GrSLPrecision fsPrecision = kDefault_GrSLPrecision) = 0; /* * This call can be used by GP to pass an attribute through all shaders directly to 'output' in @@ -218,7 +218,7 @@ public: virtual void addVarying( const char* name, GrGLVarying*, - GrGLShaderVar::Precision fsPrecision=GrGLShaderVar::kDefault_Precision) SK_OVERRIDE; + GrSLPrecision fsPrecision = kDefault_GrSLPrecision) SK_OVERRIDE; virtual void addPassThroughAttribute(const GrGeometryProcessor::GrAttribute*, const char* output) SK_OVERRIDE;