Remove precision from GrGLSLVaryingHandler
(It's built into the types now.)
Bug: skia:
Change-Id: I44edc6e71098cf74387091903e920b1dd929b103
Reviewed-on: https://skia-review.googlesource.com/59880
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
diff --git a/src/gpu/ccpr/GrCCPRCoverageProcessor.cpp b/src/gpu/ccpr/GrCCPRCoverageProcessor.cpp
index 6fa2987..3c0b149 100644
--- a/src/gpu/ccpr/GrCCPRCoverageProcessor.cpp
+++ b/src/gpu/ccpr/GrCCPRCoverageProcessor.cpp
@@ -47,7 +47,7 @@
WindHandling windHandling = this->onEmitVaryings(varyingHandler, code, position, coverage,
wind);
if (WindHandling::kNotHandled == windHandling) {
- varyingHandler->addFlatVarying("wind", &fWind, kLow_GrSLPrecision);
+ varyingHandler->addFlatVarying("wind", &fWind);
code->appendf("%s = %s;", fWind.gsOut(), wind);
}
}
diff --git a/src/gpu/ccpr/GrCCPRCubicShader.cpp b/src/gpu/ccpr/GrCCPRCubicShader.cpp
index 3a30cee..ea1f734 100644
--- a/src/gpu/ccpr/GrCCPRCubicShader.cpp
+++ b/src/gpu/ccpr/GrCCPRCubicShader.cpp
@@ -115,7 +115,7 @@
GrCCPRCubicShader::onEmitVaryings(GrGLSLVaryingHandler* varyingHandler, SkString* code,
const char* position, const char* /*coverage*/,
const char* /*wind*/) {
- varyingHandler->addVarying("klmd", &fKLMD, kHigh_GrSLPrecision);
+ varyingHandler->addVarying("klmd", &fKLMD);
code->appendf("float3 klm = float3(%s, 1) * %s;", position, fKLMMatrix.c_str());
code->appendf("float d = dot(float3(%s, 1), %s);", position, fEdgeDistanceEquation.c_str());
code->appendf("%s = float4(klm, d);", fKLMD.gsOut());
@@ -133,7 +133,7 @@
void GrCCPRCubicHullShader::onEmitVaryings(GrGLSLVaryingHandler* varyingHandler, SkString* code) {
// "klm" was just defined by the base class.
- varyingHandler->addVarying("grad_matrix", &fGradMatrix, kHigh_GrSLPrecision);
+ varyingHandler->addVarying("grad_matrix", &fGradMatrix);
code->appendf("%s[0] = 3 * klm[0] * %s[0];", fGradMatrix.gsOut(), fKLMDerivatives.c_str());
code->appendf("%s[1] = -klm[1] * %s[2].xy - klm[2] * %s[1].xy;",
fGradMatrix.gsOut(), fKLMDerivatives.c_str(), fKLMDerivatives.c_str());
@@ -161,12 +161,12 @@
}
void GrCCPRCubicCornerShader::onEmitVaryings(GrGLSLVaryingHandler* varyingHandler, SkString* code) {
- varyingHandler->addFlatVarying("dklmddx", &fdKLMDdx, kHigh_GrSLPrecision);
+ varyingHandler->addFlatVarying("dklmddx", &fdKLMDdx);
code->appendf("%s = float4(%s[0].x, %s[1].x, %s[2].x, %s.x);",
fdKLMDdx.gsOut(), fKLMDerivatives.c_str(), fKLMDerivatives.c_str(),
fKLMDerivatives.c_str(), fEdgeDistanceDerivatives.c_str());
- varyingHandler->addFlatVarying("dklmddy", &fdKLMDdy, kHigh_GrSLPrecision);
+ varyingHandler->addFlatVarying("dklmddy", &fdKLMDdy);
code->appendf("%s = float4(%s[0].y, %s[1].y, %s[2].y, %s.y);",
fdKLMDdy.gsOut(), fKLMDerivatives.c_str(), fKLMDerivatives.c_str(),
fKLMDerivatives.c_str(), fEdgeDistanceDerivatives.c_str());
diff --git a/src/gpu/ccpr/GrCCPRPathProcessor.cpp b/src/gpu/ccpr/GrCCPRPathProcessor.cpp
index 585f3be..6608ce81 100644
--- a/src/gpu/ccpr/GrCCPRPathProcessor.cpp
+++ b/src/gpu/ccpr/GrCCPRPathProcessor.cpp
@@ -126,9 +126,9 @@
GrGLSLVertToFrag texcoord(kFloat2_GrSLType);
GrGLSLVertToFrag color(kHalf4_GrSLType);
- varyingHandler->addVarying("texcoord", &texcoord, kHigh_GrSLPrecision);
+ varyingHandler->addVarying("texcoord", &texcoord);
varyingHandler->addFlatPassThroughAttribute(&proc.getInstanceAttrib(InstanceAttribs::kColor),
- args.fOutputColor, kLow_GrSLPrecision);
+ args.fOutputColor);
// Vertex shader.
GrGLSLVertexBuilder* v = args.fVertBuilder;
diff --git a/src/gpu/ccpr/GrCCPRQuadraticShader.cpp b/src/gpu/ccpr/GrCCPRQuadraticShader.cpp
index 9dc0c72..44e9b7e 100644
--- a/src/gpu/ccpr/GrCCPRQuadraticShader.cpp
+++ b/src/gpu/ccpr/GrCCPRQuadraticShader.cpp
@@ -63,7 +63,7 @@
GrCCPRQuadraticShader::onEmitVaryings(GrGLSLVaryingHandler* varyingHandler, SkString* code,
const char* position, const char* /*coverage*/,
const char* /*wind*/) {
- varyingHandler->addVarying("xyd", &fXYD, kHigh_GrSLPrecision);
+ varyingHandler->addVarying("xyd", &fXYD);
code->appendf("%s.xy = (%s * float3(%s, 1)).xy;",
fXYD.gsOut(), fCanonicalMatrix.c_str(), position);
code->appendf("%s.z = dot(%s.xy, %s) + %s.z;",
@@ -95,7 +95,7 @@
void GrCCPRQuadraticHullShader::onEmitVaryings(GrGLSLVaryingHandler* varyingHandler,
SkString* code) {
- varyingHandler->addVarying("grad", &fGrad, kHigh_GrSLPrecision);
+ varyingHandler->addVarying("grad", &fGrad);
code->appendf("%s = float2(2 * %s.x, -1) * %s;",
fGrad.gsOut(), fXYD.gsOut(), fCanonicalDerivatives.c_str());
}
@@ -121,12 +121,12 @@
void GrCCPRQuadraticCornerShader::onEmitVaryings(GrGLSLVaryingHandler* varyingHandler,
SkString* code) {
- varyingHandler->addFlatVarying("dXYDdx", &fdXYDdx, kHigh_GrSLPrecision);
+ varyingHandler->addFlatVarying("dXYDdx", &fdXYDdx);
code->appendf("%s = float3(%s[0].x, %s[0].y, %s.x);",
fdXYDdx.gsOut(), fCanonicalDerivatives.c_str(), fCanonicalDerivatives.c_str(),
fEdgeDistanceDerivatives.c_str());
- varyingHandler->addFlatVarying("dXYDdy", &fdXYDdy, kHigh_GrSLPrecision);
+ varyingHandler->addFlatVarying("dXYDdy", &fdXYDdy);
code->appendf("%s = float3(%s[1].x, %s[1].y, %s.y);",
fdXYDdy.gsOut(), fCanonicalDerivatives.c_str(), fCanonicalDerivatives.c_str(),
fEdgeDistanceDerivatives.c_str());
diff --git a/src/gpu/ccpr/GrCCPRTriangleShader.cpp b/src/gpu/ccpr/GrCCPRTriangleShader.cpp
index 0bb85ac..5c50265 100644
--- a/src/gpu/ccpr/GrCCPRTriangleShader.cpp
+++ b/src/gpu/ccpr/GrCCPRTriangleShader.cpp
@@ -41,7 +41,7 @@
GrCCPRTriangleEdgeShader::onEmitVaryings(GrGLSLVaryingHandler* varyingHandler, SkString* code,
const char* position, const char* coverage,
const char* wind) {
- varyingHandler->addVarying("coverage_times_wind", &fCoverageTimesWind, kLow_GrSLPrecision);
+ varyingHandler->addVarying("coverage_times_wind", &fCoverageTimesWind);
code->appendf("%s = %s * %s;", fCoverageTimesWind.gsOut(), coverage, wind);
return WindHandling::kHandled;
}
diff --git a/src/gpu/effects/GrAtlasedShaderHelpers.h b/src/gpu/effects/GrAtlasedShaderHelpers.h
index fae42eb..5277d31 100644
--- a/src/gpu/effects/GrAtlasedShaderHelpers.h
+++ b/src/gpu/effects/GrAtlasedShaderHelpers.h
@@ -29,14 +29,14 @@
args.fVertBuilder->codeAppend("half texIdx = 2.0*diff.x + diff.y;");
// Multiply by 1/atlasSize to get normalized texture coordinates
- args.fVaryingHandler->addVarying("TextureCoords", uv, kHigh_GrSLPrecision);
+ args.fVaryingHandler->addVarying("TextureCoords", uv);
args.fVertBuilder->codeAppendf("%s = intCoords * %s;", uv->vsOut(), atlasSizeInvName);
args.fVaryingHandler->addVarying("TexIndex", texIdx);
args.fVertBuilder->codeAppendf("%s = texIdx;", texIdx->vsOut());
if (st) {
- args.fVaryingHandler->addVarying("IntTextureCoords", st, kHigh_GrSLPrecision);
+ args.fVaryingHandler->addVarying("IntTextureCoords", st);
args.fVertBuilder->codeAppendf("%s = intCoords;", st->vsOut());
}
}
diff --git a/src/gpu/effects/GrBezierEffect.cpp b/src/gpu/effects/GrBezierEffect.cpp
index 0b4ee07..0eb417a 100644
--- a/src/gpu/effects/GrBezierEffect.cpp
+++ b/src/gpu/effects/GrBezierEffect.cpp
@@ -78,7 +78,7 @@
varyingHandler->emitAttributes(gp);
GrGLSLVertToFrag v(kFloat4_GrSLType);
- varyingHandler->addVarying("ConicCoeffs", &v, kHigh_GrSLPrecision);
+ varyingHandler->addVarying("ConicCoeffs", &v);
vertBuilder->codeAppendf("%s = %s;", v.vsOut(), gp.inConicCoeffs()->fName);
GrGLSLPPFragmentBuilder* fragBuilder = args.fFragBuilder;
@@ -555,14 +555,14 @@
fDevKLMUniform = uniformHandler->addUniform(kVertex_GrShaderFlag, kFloat3x3_GrSLType, "KLM",
&devkLMMatrixName);
GrGLSLVertToFrag v(kFloat3_GrSLType);
- varyingHandler->addVarying("CubicCoeffs", &v, kHigh_GrSLPrecision);
+ varyingHandler->addVarying("CubicCoeffs", &v);
vertBuilder->codeAppendf("%s = %s * float3(%s, 1);",
v.vsOut(), devkLMMatrixName, gpArgs->fPositionVar.c_str());
GrGLSLVertToFrag gradCoeffs(kFloat4_GrSLType);
if (kFillAA_GrProcessorEdgeType == fEdgeType || kHairlineAA_GrProcessorEdgeType == fEdgeType) {
- varyingHandler->addVarying("GradCoeffs", &gradCoeffs, kHigh_GrSLPrecision);
+ varyingHandler->addVarying("GradCoeffs", &gradCoeffs);
vertBuilder->codeAppendf("float k = %s[0], l = %s[1], m = %s[2];",
v.vsOut(), v.vsOut(), v.vsOut());
vertBuilder->codeAppendf("float2 gk = float2(%s[0][0], %s[1][0]), "
diff --git a/src/gpu/effects/GrDistanceFieldGeoProc.cpp b/src/gpu/effects/GrDistanceFieldGeoProc.cpp
index 5ee5715..e1c733d 100644
--- a/src/gpu/effects/GrDistanceFieldGeoProc.cpp
+++ b/src/gpu/effects/GrDistanceFieldGeoProc.cpp
@@ -645,7 +645,7 @@
&uv, &texIdx, &st);
GrGLSLVertToFrag delta(kFloat_GrSLType);
- varyingHandler->addVarying("Delta", &delta, kHigh_GrSLPrecision);
+ varyingHandler->addVarying("Delta", &delta);
if (dfTexEffect.getFlags() & kBGR_DistanceFieldEffectFlag) {
vertBuilder->codeAppendf("%s = -%s.x/3.0;", delta.vsOut(), atlasSizeInvName);
} else {
diff --git a/src/gpu/gl/GrGLVaryingHandler.cpp b/src/gpu/gl/GrGLVaryingHandler.cpp
index b7c8729..950fe3c 100644
--- a/src/gpu/gl/GrGLVaryingHandler.cpp
+++ b/src/gpu/gl/GrGLVaryingHandler.cpp
@@ -13,8 +13,7 @@
GrGLSLVaryingHandler::VaryingHandle GrGLVaryingHandler::addPathProcessingVarying(
const char* name,
- GrGLSLVertToFrag* v,
- GrSLPrecision fsPrecision) {
+ GrGLSLVertToFrag* v) {
#ifdef SK_DEBUG
GrGLProgramBuilder* glPB = (GrGLProgramBuilder*) fProgramBuilder;
// This call is not used for non-NVPR backends.
@@ -23,7 +22,7 @@
!glPB->fPrimProc.willUseGeoShader() &&
glPB->fPrimProc.numAttribs() == 0);
#endif
- this->addVarying(name, v, fsPrecision);
+ this->addVarying(name, v);
auto varyingInfo = fPathProcVaryingInfos.push_back();
varyingInfo.fLocation = fPathProcVaryingInfos.count() - 1;
return VaryingHandle(varyingInfo.fLocation);
diff --git a/src/gpu/gl/GrGLVaryingHandler.h b/src/gpu/gl/GrGLVaryingHandler.h
index e08a6c6..45d0fdd 100644
--- a/src/gpu/gl/GrGLVaryingHandler.h
+++ b/src/gpu/gl/GrGLVaryingHandler.h
@@ -20,8 +20,7 @@
// This function is used by the NVPR PathProcessor to add a varying directly into the fragment
// shader since there is no vertex shader.
- VaryingHandle addPathProcessingVarying(const char* name, GrGLSLVertToFrag*,
- GrSLPrecision fsPrecision = kDefault_GrSLPrecision);
+ VaryingHandle addPathProcessingVarying(const char* name, GrGLSLVertToFrag*);
private:
void onFinalize() override;
diff --git a/src/gpu/glsl/GrGLSLGeometryProcessor.cpp b/src/gpu/glsl/GrGLSLGeometryProcessor.cpp
index 8effbc7..cb421ad 100644
--- a/src/gpu/glsl/GrGLSLGeometryProcessor.cpp
+++ b/src/gpu/glsl/GrGLSLGeometryProcessor.cpp
@@ -53,7 +53,7 @@
strVaryingName.printf("TransformedCoords_%d", i);
GrGLSLVertToFrag v(varyingType);
- varyingHandler->addVarying(strVaryingName.c_str(), &v, kHigh_GrSLPrecision);
+ varyingHandler->addVarying(strVaryingName.c_str(), &v);
SkASSERT(kFloat2_GrSLType == varyingType || kFloat3_GrSLType == varyingType);
handler->specifyCoordsForCurrCoordTransform(SkString(v.fsIn()), varyingType);
diff --git a/src/gpu/glsl/GrGLSLVarying.cpp b/src/gpu/glsl/GrGLSLVarying.cpp
index 1f8ddbd..f87076f 100644
--- a/src/gpu/glsl/GrGLSLVarying.cpp
+++ b/src/gpu/glsl/GrGLSLVarying.cpp
@@ -10,19 +10,18 @@
#include "glsl/GrGLSLProgramBuilder.h"
void GrGLSLVaryingHandler::addPassThroughAttribute(const GrGeometryProcessor::Attribute* input,
- const char* output, GrSLPrecision precision) {
+ const char* output) {
GrSLType type = GrVertexAttribTypeToSLType(input->fType);
GrGLSLVertToFrag v(type);
- this->addVarying(input->fName, &v, precision);
+ this->addVarying(input->fName, &v);
this->writePassThroughAttribute(input, output, v);
}
void GrGLSLVaryingHandler::addFlatPassThroughAttribute(const GrGeometryProcessor::Attribute* input,
- const char* output,
- GrSLPrecision precision) {
+ const char* output) {
GrSLType type = GrVertexAttribTypeToSLType(input->fType);
GrGLSLVertToFrag v(type);
- this->addFlatVarying(input->fName, &v, precision);
+ this->addFlatVarying(input->fName, &v);
this->writePassThroughAttribute(input, output, v);
}
@@ -33,16 +32,12 @@
fProgramBuilder->fFS.codeAppendf("%s = %s;", output, v.fsIn());
}
-void GrGLSLVaryingHandler::internalAddVarying(const char* name,
- GrGLSLVarying* varying,
- GrSLPrecision precision,
- bool flat) {
+void GrGLSLVaryingHandler::internalAddVarying(const char* name, GrGLSLVarying* varying, bool flat) {
bool willUseGeoShader = fProgramBuilder->primitiveProcessor().willUseGeoShader();
VaryingInfo& v = fVaryings.push_back();
SkASSERT(varying);
v.fType = varying->fType;
- v.fPrecision = (kDefault_GrSLPrecision == precision) ? kMedium_GrSLPrecision : precision;
v.fIsFlat = flat;
fProgramBuilder->nameVariable(&v.fVsOut, 'v', name);
v.fVisibility = kNone_GrShaderFlags;
@@ -107,22 +102,22 @@
const char* modifier = v.fIsFlat ? "flat" : fDefaultInterpolationModifier;
if (v.fVisibility & kVertex_GrShaderFlag) {
fVertexOutputs.push_back().set(v.fType, v.fVsOut, GrShaderVar::kOut_TypeModifier,
- v.fPrecision, nullptr, modifier);
+ kDefault_GrSLPrecision, nullptr, modifier);
if (v.fVisibility & kGeometry_GrShaderFlag) {
fGeomInputs.push_back().set(v.fType, v.fVsOut, GrShaderVar::kUnsizedArray,
- GrShaderVar::kIn_TypeModifier, v.fPrecision, nullptr,
- modifier);
+ GrShaderVar::kIn_TypeModifier, kDefault_GrSLPrecision,
+ nullptr, modifier);
}
}
if (v.fVisibility & kFragment_GrShaderFlag) {
const char* fsIn = v.fVsOut.c_str();
if (v.fVisibility & kGeometry_GrShaderFlag) {
fGeomOutputs.push_back().set(v.fType, v.fGsOut, GrShaderVar::kOut_TypeModifier,
- v.fPrecision, nullptr, modifier);
+ kDefault_GrSLPrecision, nullptr, modifier);
fsIn = v.fGsOut.c_str();
}
- fFragInputs.push_back().set(v.fType, fsIn, GrShaderVar::kIn_TypeModifier, v.fPrecision,
- nullptr, modifier);
+ fFragInputs.push_back().set(v.fType, fsIn, GrShaderVar::kIn_TypeModifier,
+ kDefault_GrSLPrecision, nullptr, modifier);
}
}
this->onFinalize();
diff --git a/src/gpu/glsl/GrGLSLVarying.h b/src/gpu/glsl/GrGLSLVarying.h
index e47c858..eb370a7 100644
--- a/src/gpu/glsl/GrGLSLVarying.h
+++ b/src/gpu/glsl/GrGLSLVarying.h
@@ -99,11 +99,9 @@
* addPassThroughAttribute.
* TODO convert most uses of addVarying to addPassThroughAttribute
*/
- void addVarying(const char* name,
- GrGLSLVarying* varying,
- GrSLPrecision precision = kDefault_GrSLPrecision) {
+ void addVarying(const char* name, GrGLSLVarying* varying) {
SkASSERT(GrSLTypeIsFloatType(varying->type())); // Integers must use addFlatVarying.
- this->internalAddVarying(name, varying, precision, false /*flat*/);
+ this->internalAddVarying(name, varying, false /*flat*/);
}
/*
@@ -112,10 +110,8 @@
* Flat interpolation is not always supported and the user must check the caps before using.
* TODO: Some platforms can change the provoking vertex. Should we be resetting this knob?
*/
- void addFlatVarying(const char* name,
- GrGLSLVarying* varying,
- GrSLPrecision precision = kDefault_GrSLPrecision) {
- this->internalAddVarying(name, varying, precision, true /*flat*/);
+ void addFlatVarying(const char* name, GrGLSLVarying* varying) {
+ this->internalAddVarying(name, varying, true /*flat*/);
}
/*
@@ -126,10 +122,8 @@
* that will be set as the output varying for all emitted vertices.
* TODO it might be nicer behavior to have a flag to declare output inside these calls
*/
- void addPassThroughAttribute(const GrGeometryProcessor::Attribute*, const char* output,
- GrSLPrecision = kDefault_GrSLPrecision);
- void addFlatPassThroughAttribute(const GrGeometryProcessor::Attribute*, const char* output,
- GrSLPrecision = kDefault_GrSLPrecision);
+ void addPassThroughAttribute(const GrGeometryProcessor::Attribute*, const char* output);
+ void addFlatPassThroughAttribute(const GrGeometryProcessor::Attribute*, const char* output);
void emitAttributes(const GrGeometryProcessor& gp);
@@ -144,7 +138,6 @@
protected:
struct VaryingInfo {
GrSLType fType;
- GrSLPrecision fPrecision;
bool fIsFlat;
SkString fVsOut;
SkString fGsOut;
@@ -167,7 +160,7 @@
GrGLSLProgramBuilder* fProgramBuilder;
private:
- void internalAddVarying(const char* name, GrGLSLVarying*, GrSLPrecision, bool flat);
+ void internalAddVarying(const char* name, GrGLSLVarying*, bool flat);
void writePassThroughAttribute(const GrGeometryProcessor::Attribute*, const char* output,
const GrGLSLVarying&);
diff --git a/src/gpu/instanced/InstanceProcessor.cpp b/src/gpu/instanced/InstanceProcessor.cpp
index 5332e2d..43dfbef 100644
--- a/src/gpu/instanced/InstanceProcessor.cpp
+++ b/src/gpu/instanced/InstanceProcessor.cpp
@@ -421,7 +421,7 @@
this->onInit(varyingHandler, v);
if (!fColor.vsOut()) {
- varyingHandler->addFlatVarying("color", &fColor, kLow_GrSLPrecision);
+ varyingHandler->addFlatVarying("color", &fColor);
v->codeAppendf("%s = %s;", fColor.vsOut(), fInputs.attr(Attrib::kColor));
}
}
@@ -602,8 +602,8 @@
void GLSLInstanceProcessor::BackendNonAA::onInit(GrGLSLVaryingHandler* varyingHandler,
GrGLSLVertexBuilder*) {
if (kRect_ShapeFlag != fOpInfo.fShapeTypes) {
- varyingHandler->addFlatVarying("triangleIsArc", &fTriangleIsArc, kLow_GrSLPrecision);
- varyingHandler->addVarying("arcCoords", &fArcCoords, kMedium_GrSLPrecision);
+ varyingHandler->addFlatVarying("triangleIsArc", &fTriangleIsArc);
+ varyingHandler->addVarying("arcCoords", &fArcCoords);
}
}
@@ -622,10 +622,10 @@
void GLSLInstanceProcessor::BackendNonAA::onInitInnerShape(GrGLSLVaryingHandler* varyingHandler,
GrGLSLVertexBuilder*) {
- varyingHandler->addVarying("innerShapeCoords", &fInnerShapeCoords, kMedium_GrSLPrecision);
+ varyingHandler->addVarying("innerShapeCoords", &fInnerShapeCoords);
if (kRect_ShapeFlag != fOpInfo.fInnerShapeTypes &&
kOval_ShapeFlag != fOpInfo.fInnerShapeTypes) {
- varyingHandler->addFlatVarying("innerRRect", &fInnerRRect, kMedium_GrSLPrecision);
+ varyingHandler->addFlatVarying("innerRRect", &fInnerRRect);
}
}
@@ -765,24 +765,23 @@
if (kOval_ShapeFlag != fOpInfo.fShapeTypes) {
if (fTweakAlphaForCoverage) {
- varyingHandler->addVarying("colorTimesRectCoverage", &fColorTimesRectCoverage,
- kLow_GrSLPrecision);
+ varyingHandler->addVarying("colorTimesRectCoverage", &fColorTimesRectCoverage);
if (kRect_ShapeFlag == fOpInfo.fShapeTypes) {
fColor = fColorTimesRectCoverage;
}
} else {
- varyingHandler->addVarying("rectCoverage", &fRectCoverage, kLow_GrSLPrecision);
+ varyingHandler->addVarying("rectCoverage", &fRectCoverage);
}
v->codeAppend("half rectCoverage = 0.0;");
}
if (kRect_ShapeFlag != fOpInfo.fShapeTypes) {
- varyingHandler->addFlatVarying("triangleIsArc", &fTriangleIsArc, kLow_GrSLPrecision);
+ varyingHandler->addFlatVarying("triangleIsArc", &fTriangleIsArc);
if (!fShapeIsCircle) {
- varyingHandler->addVarying("ellipseCoords", &fEllipseCoords, kMedium_GrSLPrecision);
- varyingHandler->addFlatVarying("ellipseName", &fEllipseName, kHigh_GrSLPrecision);
+ varyingHandler->addVarying("ellipseCoords", &fEllipseCoords);
+ varyingHandler->addFlatVarying("ellipseName", &fEllipseName);
} else {
- varyingHandler->addVarying("circleCoords", &fEllipseCoords, kHigh_GrSLPrecision);
- varyingHandler->addFlatVarying("bloatedRadius", &fBloatedRadius, kHigh_GrSLPrecision);
+ varyingHandler->addVarying("circleCoords", &fEllipseCoords);
+ varyingHandler->addFlatVarying("bloatedRadius", &fBloatedRadius);
}
}
}
@@ -881,20 +880,15 @@
v->codeAppend("half2 innerShapeHalfSize = shapeHalfSize / outer2Inner.xy;");
if (kOval_ShapeFlag == fOpInfo.fInnerShapeTypes) {
- varyingHandler->addVarying("innerEllipseCoords", &fInnerEllipseCoords,
- kMedium_GrSLPrecision);
- varyingHandler->addFlatVarying("innerEllipseName", &fInnerEllipseName, kHigh_GrSLPrecision);
+ varyingHandler->addVarying("innerEllipseCoords", &fInnerEllipseCoords);
+ varyingHandler->addFlatVarying("innerEllipseName", &fInnerEllipseName);
} else {
- varyingHandler->addVarying("distanceToInnerEdge", &fDistanceToInnerEdge,
- kMedium_GrSLPrecision);
- varyingHandler->addFlatVarying("innerShapeBloatedHalfSize", &fInnerShapeBloatedHalfSize,
- kMedium_GrSLPrecision);
+ varyingHandler->addVarying("distanceToInnerEdge", &fDistanceToInnerEdge);
+ varyingHandler->addFlatVarying("innerShapeBloatedHalfSize", &fInnerShapeBloatedHalfSize);
if (kRect_ShapeFlag != fOpInfo.fInnerShapeTypes) {
- varyingHandler->addVarying("innerShapeCoords", &fInnerShapeCoords,
- kMedium_GrSLPrecision);
- varyingHandler->addFlatVarying("innerEllipseName", &fInnerEllipseName,
- kHigh_GrSLPrecision);
- varyingHandler->addFlatVarying("innerRRect", &fInnerRRect, kMedium_GrSLPrecision);
+ varyingHandler->addVarying("innerShapeCoords", &fInnerShapeCoords);
+ varyingHandler->addFlatVarying("innerEllipseName", &fInnerEllipseName);
+ varyingHandler->addFlatVarying("innerRRect", &fInnerRRect);
}
}
}
@@ -1144,46 +1138,39 @@
GrGLSLVertexBuilder* v) {
if (!this->isMixedSampled()) {
if (kRect_ShapeFlag != fOpInfo.fShapeTypes) {
- varyingHandler->addFlatVarying("triangleIsArc", &fTriangleIsArc, kLow_GrSLPrecision);
- varyingHandler->addVarying("arcCoords", &fArcCoords, kHigh_GrSLPrecision);
+ varyingHandler->addFlatVarying("triangleIsArc", &fTriangleIsArc);
+ varyingHandler->addVarying("arcCoords", &fArcCoords);
if (!fOpInfo.fHasPerspective) {
- varyingHandler->addFlatVarying("arcInverseMatrix", &fArcInverseMatrix,
- kHigh_GrSLPrecision);
- varyingHandler->addFlatVarying("fragArcHalfSpan", &fFragArcHalfSpan,
- kHigh_GrSLPrecision);
+ varyingHandler->addFlatVarying("arcInverseMatrix", &fArcInverseMatrix);
+ varyingHandler->addFlatVarying("fragArcHalfSpan", &fFragArcHalfSpan);
}
} else if (!fOpInfo.fInnerShapeTypes) {
return;
}
} else {
- varyingHandler->addVarying("shapeCoords", &fShapeCoords, kHigh_GrSLPrecision);
+ varyingHandler->addVarying("shapeCoords", &fShapeCoords);
if (!fOpInfo.fHasPerspective) {
- varyingHandler->addFlatVarying("shapeInverseMatrix", &fShapeInverseMatrix,
- kHigh_GrSLPrecision);
- varyingHandler->addFlatVarying("fragShapeHalfSpan", &fFragShapeHalfSpan,
- kHigh_GrSLPrecision);
+ varyingHandler->addFlatVarying("shapeInverseMatrix", &fShapeInverseMatrix);
+ varyingHandler->addFlatVarying("fragShapeHalfSpan", &fFragShapeHalfSpan);
}
if (fOpInfo.fShapeTypes & kRRect_ShapesMask) {
- varyingHandler->addVarying("arcCoords", &fArcCoords, kHigh_GrSLPrecision);
- varyingHandler->addVarying("arcTest", &fArcTest, kHigh_GrSLPrecision);
+ varyingHandler->addVarying("arcCoords", &fArcCoords);
+ varyingHandler->addVarying("arcTest", &fArcTest);
if (!fOpInfo.fHasPerspective) {
- varyingHandler->addFlatVarying("arcInverseMatrix", &fArcInverseMatrix,
- kHigh_GrSLPrecision);
- varyingHandler->addFlatVarying("fragArcHalfSpan", &fFragArcHalfSpan,
- kHigh_GrSLPrecision);
+ varyingHandler->addFlatVarying("arcInverseMatrix", &fArcInverseMatrix);
+ varyingHandler->addFlatVarying("fragArcHalfSpan", &fFragArcHalfSpan);
}
} else if (fOpInfo.fShapeTypes & kOval_ShapeFlag) {
fArcCoords = fShapeCoords;
fArcInverseMatrix = fShapeInverseMatrix;
fFragArcHalfSpan = fFragShapeHalfSpan;
if (fOpInfo.fShapeTypes & kRect_ShapeFlag) {
- varyingHandler->addFlatVarying("triangleIsArc", &fTriangleIsArc,
- kLow_GrSLPrecision);
+ varyingHandler->addFlatVarying("triangleIsArc", &fTriangleIsArc);
}
}
if (kRect_ShapeFlag != fOpInfo.fShapeTypes) {
v->defineConstantf("int", "SAMPLE_MASK_ALL", "0x%x", (1 << fEffectiveSampleCnt) - 1);
- varyingHandler->addFlatVarying("earlyAccept", &fEarlyAccept, kHigh_GrSLPrecision);
+ varyingHandler->addFlatVarying("earlyAccept", &fEarlyAccept);
}
}
if (!fOpInfo.fHasPerspective) {
@@ -1317,18 +1304,16 @@
void
GLSLInstanceProcessor::BackendMultisample::onInitInnerShape(GrGLSLVaryingHandler* varyingHandler,
GrGLSLVertexBuilder* v) {
- varyingHandler->addVarying("innerShapeCoords", &fInnerShapeCoords, kHigh_GrSLPrecision);
+ varyingHandler->addVarying("innerShapeCoords", &fInnerShapeCoords);
if (kOval_ShapeFlag != fOpInfo.fInnerShapeTypes &&
kRect_ShapeFlag != fOpInfo.fInnerShapeTypes) {
- varyingHandler->addFlatVarying("innerRRect", &fInnerRRect, kHigh_GrSLPrecision);
+ varyingHandler->addFlatVarying("innerRRect", &fInnerRRect);
}
if (!fOpInfo.fHasPerspective) {
- varyingHandler->addFlatVarying("innerShapeInverseMatrix", &fInnerShapeInverseMatrix,
- kHigh_GrSLPrecision);
+ varyingHandler->addFlatVarying("innerShapeInverseMatrix", &fInnerShapeInverseMatrix);
v->codeAppendf("%s = shapeInverseMatrix * float2x2(outer2Inner.x, 0, 0, outer2Inner.y);",
fInnerShapeInverseMatrix.vsOut());
- varyingHandler->addFlatVarying("fragInnerShapeHalfSpan", &fFragInnerShapeHalfSpan,
- kHigh_GrSLPrecision);
+ varyingHandler->addFlatVarying("fragInnerShapeHalfSpan", &fFragInnerShapeHalfSpan);
v->codeAppendf("%s = 0.5 * fragShapeSpan * outer2Inner.xy;",
fFragInnerShapeHalfSpan.vsOut());
}
diff --git a/src/gpu/ops/GrDashOp.cpp b/src/gpu/ops/GrDashOp.cpp
index ee87f20..6ff21b7 100644
--- a/src/gpu/ops/GrDashOp.cpp
+++ b/src/gpu/ops/GrDashOp.cpp
@@ -1093,13 +1093,13 @@
// XY refers to dashPos, Z is the dash interval length
GrGLSLVertToFrag inDashParams(kFloat3_GrSLType);
- varyingHandler->addVarying("DashParams", &inDashParams, GrSLPrecision::kHigh_GrSLPrecision);
+ varyingHandler->addVarying("DashParams", &inDashParams);
vertBuilder->codeAppendf("%s = %s;", inDashParams.vsOut(), de.inDashParams()->fName);
// The rect uniform's xyzw refer to (left + 0.5, top + 0.5, right - 0.5, bottom - 0.5),
// respectively.
GrGLSLVertToFrag inRectParams(kFloat4_GrSLType);
- varyingHandler->addVarying("RectParams", &inRectParams, GrSLPrecision::kHigh_GrSLPrecision);
+ varyingHandler->addVarying("RectParams", &inRectParams);
vertBuilder->codeAppendf("%s = %s;", inRectParams.vsOut(), de.inRectParams()->fName);
GrGLSLPPFragmentBuilder* fragBuilder = args.fFragBuilder;
diff --git a/src/gpu/ops/GrMSAAPathRenderer.cpp b/src/gpu/ops/GrMSAAPathRenderer.cpp
index 9021587..2a3235d 100644
--- a/src/gpu/ops/GrMSAAPathRenderer.cpp
+++ b/src/gpu/ops/GrMSAAPathRenderer.cpp
@@ -141,7 +141,7 @@
varyingHandler->addPassThroughAttribute(qp.inColor(), args.fOutputColor);
GrGLSLVertToFrag uv(kFloat2_GrSLType);
- varyingHandler->addVarying("uv", &uv, kHigh_GrSLPrecision);
+ varyingHandler->addVarying("uv", &uv);
vsBuilder->codeAppendf("%s = %s;", uv.vsOut(), qp.inUV()->fName);
// Setup position
diff --git a/src/gpu/ops/GrOvalOpFactory.cpp b/src/gpu/ops/GrOvalOpFactory.cpp
index e55651e..9c20f48 100644
--- a/src/gpu/ops/GrOvalOpFactory.cpp
+++ b/src/gpu/ops/GrOvalOpFactory.cpp
@@ -118,8 +118,7 @@
// emit attributes
varyingHandler->emitAttributes(cgp);
fragBuilder->codeAppend("float4 circleEdge;");
- varyingHandler->addPassThroughAttribute(cgp.fInCircleEdge, "circleEdge",
- kHigh_GrSLPrecision);
+ varyingHandler->addPassThroughAttribute(cgp.fInCircleEdge, "circleEdge");
if (cgp.fInClipPlane) {
fragBuilder->codeAppend("half3 clipPlane;");
varyingHandler->addPassThroughAttribute(cgp.fInClipPlane, "clipPlane");
diff --git a/src/gpu/ops/GrTextureOp.cpp b/src/gpu/ops/GrTextureOp.cpp
index 133c2fd..291b199 100644
--- a/src/gpu/ops/GrTextureOp.cpp
+++ b/src/gpu/ops/GrTextureOp.cpp
@@ -118,8 +118,8 @@
args.fOutputColor);
}
args.fFragBuilder->codeAppend("float2 texCoord;");
- args.fVaryingHandler->addPassThroughAttribute(&textureGP.fTextureCoords, "texCoord",
- kHigh_GrSLPrecision);
+ args.fVaryingHandler->addPassThroughAttribute(&textureGP.fTextureCoords,
+ "texCoord");
if (textureGP.numTextureSamplers() > 1) {
SkASSERT(args.fShaderCaps->integerSupport());
args.fFragBuilder->codeAppend("int texIdx;");