Revert "Switched highp float to highfloat and mediump float to half."
This reverts commit 88d99c63878c2d3d340120f0321676f72afcb4f0.
Reason for revert: Believed to be causing unit test failures in Chrome roll:
https://build.chromium.org/p/tryserver.chromium.android/builders/linux_android_rel_ng/builds/364433
https://luci-logdog.appspot.com/v/?s=chromium%2Fbb%2Ftryserver.chromium.android%2Flinux_android_rel_ng%2F364433%2F%2B%2Frecipes%2Fsteps%2Fcontent_browsertests__with_patch__on_Android%2F0%2Flogs%2FWebRtcCaptureFromElementBrowserTest.VerifyCanvasWebGLCaptureColor%2F0
Original change's description:
> Switched highp float to highfloat and mediump float to half.
>
> The ultimate goal is to end up with "float" and "half", but this
> intermediate step uses "highfloat" so that it is clear if I missed a
> "float" somewhere. Once this lands, a subsequent CL will switch all
> "highfloats" back to "floats".
>
> Bug: skia:
> Change-Id: Ia13225c7a0a0a2901e07665891c473d2500ddcca
> Reviewed-on: https://skia-review.googlesource.com/31000
> Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
> Reviewed-by: Brian Salomon <bsalomon@google.com>
TBR=bsalomon@google.com,csmartdalton@google.com,ethannicholas@google.com
Change-Id: I8bfa97547ac3920d433665f161d27df3f15c83aa
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:
Reviewed-on: https://skia-review.googlesource.com/35705
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
diff --git a/src/gpu/ccpr/GrCCPRCoverageProcessor.cpp b/src/gpu/ccpr/GrCCPRCoverageProcessor.cpp
index d192ff7..e4e59ff 100644
--- a/src/gpu/ccpr/GrCCPRCoverageProcessor.cpp
+++ b/src/gpu/ccpr/GrCCPRCoverageProcessor.cpp
@@ -122,8 +122,8 @@
const TexelBufferHandle& pointsBuffer,
const char* rtAdjust, GrGPArgs* gpArgs) const {
v->codeAppendf("int packedoffset = %s.w;", proc.instanceAttrib());
- v->codeAppend ("highfloat2 atlasoffset = highfloat2((packedoffset<<16) >> 16, "
- "packedoffset >> 16);");
+ v->codeAppend ("highp float2 atlasoffset = float2((packedoffset<<16) >> 16, "
+ "packedoffset >> 16);");
this->onEmitVertexShader(proc, v, pointsBuffer, "atlasoffset", rtAdjust, gpArgs);
}
@@ -135,10 +135,12 @@
SkString emitVertexFn;
SkSTArray<2, GrShaderVar> emitArgs;
- const char* position = emitArgs.emplace_back("position", kHighFloat2_GrSLType,
- GrShaderVar::kNonArray).c_str();
- const char* coverage = emitArgs.emplace_back("coverage", kHighFloat_GrSLType,
- GrShaderVar::kNonArray).c_str();
+ const char* position = emitArgs.emplace_back("position", kVec2f_GrSLType,
+ GrShaderVar::kNonArray,
+ kHigh_GrSLPrecision).c_str();
+ const char* coverage = emitArgs.emplace_back("coverage", kFloat_GrSLType,
+ GrShaderVar::kNonArray,
+ kHigh_GrSLPrecision).c_str();
g->emitFunction(kVoid_GrSLType, "emitVertex", emitArgs.count(), emitArgs.begin(), [&]() {
SkString fnBody;
this->emitPerVertexGeometryCode(&fnBody, position, coverage, fGeomWind.c_str());
@@ -149,12 +151,12 @@
fnBody.appendf("%s = %s * %s;",
fFragCoverageTimesWind.gsOut(), coverage, fGeomWind.c_str());
}
- fnBody.append ("gl_Position = highfloat4(position, 0, 1);");
+ fnBody.append ("gl_Position = float4(position, 0, 1);");
fnBody.append ("EmitVertex();");
return fnBody;
}().c_str(), &emitVertexFn);
- g->codeAppendf("highfloat2 bloat = %f * abs(%s.xz);", kAABloatRadius, rtAdjust);
+ g->codeAppendf("highp float2 bloat = %f * abs(%s.xz);", kAABloatRadius, rtAdjust);
#ifdef SK_DEBUG
if (proc.debugVisualizations()) {
@@ -171,7 +173,7 @@
SkASSERT(numSides >= 3);
if (!insetPts) {
- g->codeAppendf("highfloat2 centroidpt = %s * highfloat%i(%f);",
+ g->codeAppendf("highp float2 centroidpt = %s * float%i(%f);",
polygonPts, numSides, 1.0 / numSides);
}
@@ -179,42 +181,42 @@
"nextidx = (%s + 1) %% %i;",
wedgeIdx, numSides - 1, numSides, wedgeIdx, numSides);
- g->codeAppendf("highfloat2 self = %s[%s];"
- "int leftidx = %s > 0 ? previdx : nextidx;"
- "int rightidx = %s > 0 ? nextidx : previdx;",
+ g->codeAppendf("highp float2 self = %s[%s];"
+ "highp int leftidx = %s > 0 ? previdx : nextidx;"
+ "highp int rightidx = %s > 0 ? nextidx : previdx;",
polygonPts, wedgeIdx, fGeomWind.c_str(), fGeomWind.c_str());
// Which quadrant does the vector from self -> right fall into?
- g->codeAppendf("highfloat2 right = %s[rightidx];", polygonPts);
+ g->codeAppendf("highp float2 right = %s[rightidx];", polygonPts);
if (3 == numSides) {
// TODO: evaluate perf gains.
- g->codeAppend ("highfloat2 qsr = sign(right - self);");
+ g->codeAppend ("highp float2 qsr = sign(right - self);");
} else {
SkASSERT(4 == numSides);
- g->codeAppendf("highfloat2 diag = %s[(%s + 2) %% 4];", polygonPts, wedgeIdx);
- g->codeAppend ("highfloat2 qsr = sign((right != self ? right : diag) - self);");
+ g->codeAppendf("highp float2 diag = %s[(%s + 2) %% 4];", polygonPts, wedgeIdx);
+ g->codeAppend ("highp float2 qsr = sign((right != self ? right : diag) - self);");
}
// Which quadrant does the vector from left -> self fall into?
- g->codeAppendf("highfloat2 qls = sign(self - %s[leftidx]);", polygonPts);
+ g->codeAppendf("highp float2 qls = sign(self - %s[leftidx]);", polygonPts);
// d2 just helps us reduce triangle counts with orthogonal, axis-aligned lines.
// TODO: evaluate perf gains.
const char* dr2 = "dr";
if (3 == numSides) {
// TODO: evaluate perf gains.
- g->codeAppend ("highfloat2 dr = highfloat2(qsr.y != 0 ? +qsr.y : +qsr.x, "
- "qsr.x != 0 ? -qsr.x : +qsr.y);");
- g->codeAppend ("highfloat2 dr2 = highfloat2(qsr.y != 0 ? +qsr.y : -qsr.x, "
- "qsr.x != 0 ? -qsr.x : -qsr.y);");
- g->codeAppend ("highfloat2 dl = highfloat2(qls.y != 0 ? +qls.y : +qls.x, "
- "qls.x != 0 ? -qls.x : +qls.y);");
+ g->codeAppend ("highp float2 dr = float2(qsr.y != 0 ? +qsr.y : +qsr.x, "
+ "qsr.x != 0 ? -qsr.x : +qsr.y);");
+ g->codeAppend ("highp float2 dr2 = float2(qsr.y != 0 ? +qsr.y : -qsr.x, "
+ "qsr.x != 0 ? -qsr.x : -qsr.y);");
+ g->codeAppend ("highp float2 dl = float2(qls.y != 0 ? +qls.y : +qls.x, "
+ "qls.x != 0 ? -qls.x : +qls.y);");
dr2 = "dr2";
} else {
- g->codeAppend ("highfloat2 dr = highfloat2(qsr.y != 0 ? +qsr.y : 1, "
- "qsr.x != 0 ? -qsr.x : 1);");
- g->codeAppend ("highfloat2 dl = (qls == highfloat2(0)) ? dr : "
- "highfloat2(qls.y != 0 ? +qls.y : 1, qls.x != 0 ? -qls.x : 1);");
+ g->codeAppend ("highp float2 dr = float2(qsr.y != 0 ? +qsr.y : 1, "
+ "qsr.x != 0 ? -qsr.x : 1);");
+ g->codeAppend ("highp float2 dl = (qls == float2(0)) ? dr : "
+ "float2(qls.y != 0 ? +qls.y : 1, qls.x != 0 ? -qls.x : 1);");
}
g->codeAppendf("bool2 dnotequal = notEqual(%s, dl);", dr2);
@@ -234,7 +236,7 @@
g->codeAppendf( "%s(self + bloat * dl, 1);", emitVertexFn);
g->codeAppend ("}");
g->codeAppend ("if (all(dnotequal)) {");
- g->codeAppendf( "%s(self + bloat * highfloat2(-dl.y, dl.x), 1);", emitVertexFn);
+ g->codeAppendf( "%s(self + bloat * float2(-dl.y, dl.x), 1);", emitVertexFn);
g->codeAppend ("}");
g->codeAppend ("EndPrimitive();");
@@ -245,18 +247,18 @@
const char* leftPt, const char* rightPt,
const char* distanceEquation) const {
if (!distanceEquation) {
- this->emitEdgeDistanceEquation(g, leftPt, rightPt, "highfloat3 edge_distance_equation");
+ this->emitEdgeDistanceEquation(g, leftPt, rightPt, "highp float3 edge_distance_equation");
distanceEquation = "edge_distance_equation";
}
// qlr is defined in emitEdgeDistanceEquation.
- g->codeAppendf("highfloat2x2 endpts = highfloat2x2(%s - bloat * qlr, %s + bloat * qlr);",
+ g->codeAppendf("highp float2x2 endpts = float2x2(%s - bloat * qlr, %s + bloat * qlr);",
leftPt, rightPt);
- g->codeAppendf("half2 endpts_coverage = %s.xy * endpts + %s.z;",
+ g->codeAppendf("mediump float2 endpts_coverage = %s.xy * endpts + %s.z;",
distanceEquation, distanceEquation);
// d1 is defined in emitEdgeDistanceEquation.
- g->codeAppend ("highfloat2 d2 = d1;");
+ g->codeAppend ("highp float2 d2 = d1;");
g->codeAppend ("bool aligned = qlr.x == 0 || qlr.y == 0;");
g->codeAppend ("if (aligned) {");
g->codeAppend ( "d1 -= qlr;");
@@ -285,25 +287,25 @@
const char* leftPt, const char* rightPt,
const char* outputDistanceEquation) const {
// Which quadrant does the vector from left -> right fall into?
- g->codeAppendf("highfloat2 qlr = sign(%s - %s);", rightPt, leftPt);
- g->codeAppend ("highfloat2 d1 = highfloat2(qlr.y, -qlr.x);");
+ g->codeAppendf("highp float2 qlr = sign(%s - %s);", rightPt, leftPt);
+ g->codeAppend ("highp float2 d1 = float2(qlr.y, -qlr.x);");
- g->codeAppendf("highfloat2 n = highfloat2(%s.y - %s.y, %s.x - %s.x);",
+ g->codeAppendf("highp float2 n = float2(%s.y - %s.y, %s.x - %s.x);",
rightPt, leftPt, leftPt, rightPt);
- g->codeAppendf("highfloat2 kk = n * highfloat2x2(%s + bloat * d1, %s - bloat * d1);",
+ g->codeAppendf("highp float2 kk = n * float2x2(%s + bloat * d1, %s - bloat * d1);",
leftPt, leftPt);
// Clamp for when n=0. wind=0 when n=0 so as long as we don't get Inf or NaN we are fine.
- g->codeAppendf("highfloat scale = 1 / max(kk[0] - kk[1], 1e-30);");
+ g->codeAppendf("highp float scale = 1 / max(kk[0] - kk[1], 1e-30);");
- g->codeAppendf("%s = half3(-n, kk[1]) * scale;", outputDistanceEquation);
+ g->codeAppendf("%s = float3(-n, kk[1]) * scale;", outputDistanceEquation);
}
int PrimitiveProcessor::emitCornerGeometry(GrGLSLGeometryBuilder* g, const char* emitVertexFn,
const char* pt) const {
- g->codeAppendf("%s(%s + highfloat2(-bloat.x, -bloat.y), 1);", emitVertexFn, pt);
- g->codeAppendf("%s(%s + highfloat2(-bloat.x, +bloat.y), 1);", emitVertexFn, pt);
- g->codeAppendf("%s(%s + highfloat2(+bloat.x, -bloat.y), 1);", emitVertexFn, pt);
- g->codeAppendf("%s(%s + highfloat2(+bloat.x, +bloat.y), 1);", emitVertexFn, pt);
+ g->codeAppendf("%s(%s + float2(-bloat.x, -bloat.y), 1);", emitVertexFn, pt);
+ g->codeAppendf("%s(%s + float2(-bloat.x, +bloat.y), 1);", emitVertexFn, pt);
+ g->codeAppendf("%s(%s + float2(+bloat.x, -bloat.y), 1);", emitVertexFn, pt);
+ g->codeAppendf("%s(%s + float2(+bloat.x, +bloat.y), 1);", emitVertexFn, pt);
g->codeAppend ("EndPrimitive();");
return 4;
@@ -319,17 +321,17 @@
f->codeAppendf("%s.a = %s;", outputColor, fFragCoverageTimesWind.fsIn());
break;
case CoverageType::kShader:
- f->codeAppendf("half coverage = 0;");
+ f->codeAppendf("mediump float coverage = 0;");
this->emitShaderCoverage(f, "coverage");
f->codeAppendf("%s.a = coverage * %s;", outputColor, fFragWind.fsIn());
break;
}
- f->codeAppendf("%s = half4(1);", outputCoverage);
+ f->codeAppendf("%s = float4(1);", outputCoverage);
#ifdef SK_DEBUG
if (proc.debugVisualizations()) {
- f->codeAppendf("%s = half4(-%s.a, %s.a, 0, 1);", outputColor, outputColor, outputColor);
+ f->codeAppendf("%s = float4(-%s.a, %s.a, 0, 1);", outputColor, outputColor, outputColor);
}
#endif
}
@@ -338,17 +340,17 @@
const char* samplesName) const {
// Standard DX11 sample locations.
#if defined(SK_BUILD_FOR_ANDROID) || defined(SK_BUILD_FOR_IOS)
- f->defineConstant("highfloat2[8]", samplesName, "highfloat2[8]("
- "highfloat2(+1, -3)/16, highfloat2(-1, +3)/16, highfloat2(+5, +1)/16, highfloat2(-3, -5)/16, "
- "highfloat2(-5, +5)/16, highfloat2(-7, -1)/16, highfloat2(+3, +7)/16, highfloat2(+7, -7)/16."
+ f->defineConstant("highp float2[8]", samplesName, "float2[8]("
+ "float2(+1, -3)/16, float2(-1, +3)/16, float2(+5, +1)/16, float2(-3, -5)/16, "
+ "float2(-5, +5)/16, float2(-7, -1)/16, float2(+3, +7)/16, float2(+7, -7)/16."
")");
return 8;
#else
- f->defineConstant("highfloat2[16]", samplesName, "highfloat2[16]("
- "highfloat2(+1, +1)/16, highfloat2(-1, -3)/16, highfloat2(-3, +2)/16, highfloat2(+4, -1)/16, "
- "highfloat2(-5, -2)/16, highfloat2(+2, +5)/16, highfloat2(+5, +3)/16, highfloat2(+3, -5)/16, "
- "highfloat2(-2, +6)/16, highfloat2( 0, -7)/16, highfloat2(-4, -6)/16, highfloat2(-6, +4)/16, "
- "highfloat2(-8, 0)/16, highfloat2(+7, -4)/16, highfloat2(+6, +7)/16, highfloat2(-7, -8)/16."
+ f->defineConstant("highp float2[16]", samplesName, "float2[16]("
+ "float2(+1, +1)/16, float2(-1, -3)/16, float2(-3, +2)/16, float2(+4, -1)/16, "
+ "float2(-5, -2)/16, float2(+2, +5)/16, float2(+5, +3)/16, float2(+3, -5)/16, "
+ "float2(-2, +6)/16, float2( 0, -7)/16, float2(-4, -6)/16, float2(-6, +4)/16, "
+ "float2(-8, 0)/16, float2(+7, -4)/16, float2(+6, +7)/16, float2(-7, -8)/16."
")");
return 16;
#endif