baked in a few more precision modifiers
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=5146
Change-Id: If824ddd3551fd50b66e98edc39f10fa60a0560dc
Reviewed-on: https://skia-review.googlesource.com/5146
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
diff --git a/src/gpu/glsl/GrGLSLFragmentShaderBuilder.cpp b/src/gpu/glsl/GrGLSLFragmentShaderBuilder.cpp
index 46b1947..f6e1ad8 100644
--- a/src/gpu/glsl/GrGLSLFragmentShaderBuilder.cpp
+++ b/src/gpu/glsl/GrGLSLFragmentShaderBuilder.cpp
@@ -167,10 +167,9 @@
// depending on the surrounding code, accessing .xy with a uniform involved can
// do the same thing. Copying gl_FragCoord.xy into a temp vec2 beforehand
// (and only accessing .xy) seems to "fix" things.
- const char* precision = glslCaps->usesPrecisionModifiers() ? "highp " : "";
- this->codePrependf("\t%svec4 %s = vec4(%s.x, %s - %s.y, 1.0, 1.0);\n",
- precision, kCoordName, kTempName, rtHeightName, kTempName);
- this->codePrependf("%svec2 %s = gl_FragCoord.xy;", precision, kTempName);
+ this->codePrependf("\thighp vec4 %s = vec4(%s.x, %s - %s.y, 1.0, 1.0);\n", kCoordName,
+ kTempName, rtHeightName, kTempName);
+ this->codePrependf("highp vec2 %s = gl_FragCoord.xy;", kTempName);
fSetupFragPosition = true;
}
SkASSERT(fProgramBuilder->fUniformHandles.fRTHeightUni.isValid());
@@ -359,11 +358,7 @@
SkSTArray<16, SkPoint, true> offsets;
offsets.push_back_n(specs.fEffectiveSampleCnt);
m.mapPoints(offsets.begin(), specs.fSampleLocations, specs.fEffectiveSampleCnt);
- this->definitions().append("const ");
- if (fProgramBuilder->glslCaps()->usesPrecisionModifiers()) {
- this->definitions().append("highp ");
- }
- this->definitions().appendf("vec2 %s[] = vec2[](", name);
+ this->definitions().appendf("const highp vec2 %s[] = vec2[](", name);
for (int i = 0; i < specs.fEffectiveSampleCnt; ++i) {
this->definitions().appendf("vec2(%f, %f)", offsets[i].x(), offsets[i].y());
this->definitions().append(i + 1 != specs.fEffectiveSampleCnt ? ", " : ");\n");
diff --git a/src/gpu/instanced/InstanceProcessor.cpp b/src/gpu/instanced/InstanceProcessor.cpp
index 45a1839..fd9ddbd 100644
--- a/src/gpu/instanced/InstanceProcessor.cpp
+++ b/src/gpu/instanced/InstanceProcessor.cpp
@@ -925,10 +925,7 @@
v->codeAppendf("%s = rectCoverage;", fRectCoverage.vsOut());
}
- SkString coverage("float coverage");
- if (f->getProgramBuilder()->glslCaps()->usesPrecisionModifiers()) {
- coverage.prependf("lowp ");
- }
+ SkString coverage("lowp float coverage");
if (fBatchInfo.fInnerShapeTypes || (!fTweakAlphaForCoverage && fTriangleIsArc.fsIn())) {
f->codeAppendf("%s;", coverage.c_str());
coverage = "coverage";
@@ -955,10 +952,7 @@
if (fBatchInfo.fInnerShapeTypes) {
f->codeAppendf("// Inner shape.\n");
- SkString innerCoverageDecl("float innerCoverage");
- if (f->getProgramBuilder()->glslCaps()->usesPrecisionModifiers()) {
- innerCoverageDecl.prependf("lowp ");
- }
+ SkString innerCoverageDecl("lowp float innerCoverage");
if (kOval_ShapeFlag == fBatchInfo.fInnerShapeTypes) {
this->emitArc(f, fInnerEllipseCoords.fsIn(), fInnerEllipseName.fsIn(),
true /*ellipseCoordsNeedClamp*/, true /*ellipseCoordsMayBeNegative*/,