aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/ccpr
diff options
context:
space:
mode:
authorGravatar Ethan Nicholas <ethannicholas@google.com>2017-09-20 11:24:15 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-09-22 13:54:38 +0000
commit8aa4569c139a7a7ac38c62b25e3af40309cc2ee2 (patch)
tree7a26824983b55df440a1c369798936da7f872351 /src/gpu/ccpr
parentb7d42e3c11a6e1d89e8b1af030511e935ee065ba (diff)
switched SkSL's temporary 'highfloat' type back to 'float'
Bug: skia: Change-Id: If0debae7318b6b5b4a7cb85d458996a09931127e Reviewed-on: https://skia-review.googlesource.com/48760 Commit-Queue: Ethan Nicholas <ethannicholas@google.com> Reviewed-by: Brian Salomon <bsalomon@google.com>
Diffstat (limited to 'src/gpu/ccpr')
-rw-r--r--src/gpu/ccpr/GrCCPRCoverageProcessor.cpp78
-rw-r--r--src/gpu/ccpr/GrCCPRCubicProcessor.cpp92
-rw-r--r--src/gpu/ccpr/GrCCPRCubicProcessor.h16
-rw-r--r--src/gpu/ccpr/GrCCPRPathProcessor.cpp26
-rw-r--r--src/gpu/ccpr/GrCCPRQuadraticProcessor.cpp77
-rw-r--r--src/gpu/ccpr/GrCCPRQuadraticProcessor.h16
-rw-r--r--src/gpu/ccpr/GrCCPRTriangleProcessor.cpp43
-rw-r--r--src/gpu/ccpr/GrCCPRTriangleProcessor.h10
8 files changed, 178 insertions, 180 deletions
diff --git a/src/gpu/ccpr/GrCCPRCoverageProcessor.cpp b/src/gpu/ccpr/GrCCPRCoverageProcessor.cpp
index 4aac3d3d02..2d69c00188 100644
--- a/src/gpu/ccpr/GrCCPRCoverageProcessor.cpp
+++ b/src/gpu/ccpr/GrCCPRCoverageProcessor.cpp
@@ -122,7 +122,7 @@ void PrimitiveProcessor::emitVertexShader(const GrCCPRCoverageProcessor& proc,
const TexelBufferHandle& pointsBuffer,
const char* rtAdjust, GrGPArgs* gpArgs) const {
v->codeAppendf("int packedoffset = %s[%i];", proc.instanceAttrib(), proc.atlasOffsetIdx());
- v->codeAppend ("highfloat2 atlasoffset = highfloat2((packedoffset<<16) >> 16, "
+ v->codeAppend ("float2 atlasoffset = float2((packedoffset<<16) >> 16, "
"packedoffset >> 16);");
this->onEmitVertexShader(proc, v, pointsBuffer, "atlasoffset", rtAdjust, gpArgs);
@@ -135,9 +135,9 @@ void PrimitiveProcessor::emitGeometryShader(const GrCCPRCoverageProcessor& proc,
SkString emitVertexFn;
SkSTArray<2, GrShaderVar> emitArgs;
- const char* position = emitArgs.emplace_back("position", kHighFloat2_GrSLType,
+ const char* position = emitArgs.emplace_back("position", kFloat2_GrSLType,
GrShaderVar::kNonArray).c_str();
- const char* coverage = emitArgs.emplace_back("coverage", kHighFloat_GrSLType,
+ const char* coverage = emitArgs.emplace_back("coverage", kFloat_GrSLType,
GrShaderVar::kNonArray).c_str();
g->emitFunction(kVoid_GrSLType, "emitVertex", emitArgs.count(), emitArgs.begin(), [&]() {
SkString fnBody;
@@ -149,12 +149,12 @@ void PrimitiveProcessor::emitGeometryShader(const GrCCPRCoverageProcessor& proc,
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("float2 bloat = %f * abs(%s.xz);", kAABloatRadius, rtAdjust);
#ifdef SK_DEBUG
if (proc.debugVisualizationsEnabled()) {
@@ -171,7 +171,7 @@ int PrimitiveProcessor::emitHullGeometry(GrGLSLGeometryBuilder* g, const char* e
SkASSERT(numSides >= 3);
if (!midpoint) {
- g->codeAppendf("highfloat2 midpoint = %s * highfloat%i(%f);",
+ g->codeAppendf("float2 midpoint = %s * float%i(%f);",
polygonPts, numSides, 1.0 / numSides);
midpoint = "midpoint";
}
@@ -180,42 +180,42 @@ int PrimitiveProcessor::emitHullGeometry(GrGLSLGeometryBuilder* g, const char* e
"nextidx = (%s + 1) %% %i;",
wedgeIdx, numSides - 1, numSides, wedgeIdx, numSides);
- g->codeAppendf("highfloat2 self = %s[%s];"
+ g->codeAppendf("float2 self = %s[%s];"
"int leftidx = %s > 0 ? previdx : nextidx;"
"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("float2 right = %s[rightidx];", polygonPts);
if (3 == numSides) {
// TODO: evaluate perf gains.
- g->codeAppend ("highfloat2 qsr = sign(right - self);");
+ g->codeAppend ("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("float2 diag = %s[(%s + 2) %% 4];", polygonPts, wedgeIdx);
+ g->codeAppend ("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("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, "
+ g->codeAppend ("float2 dr = float2(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, "
+ g->codeAppend ("float2 dr2 = float2(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, "
+ g->codeAppend ("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, "
+ g->codeAppend ("float2 dr = float2(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 ("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);
@@ -228,7 +228,7 @@ int PrimitiveProcessor::emitHullGeometry(GrGLSLGeometryBuilder* g, const char* e
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();");
@@ -239,18 +239,18 @@ int PrimitiveProcessor::emitEdgeGeometry(GrGLSLGeometryBuilder* g, const char* e
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, "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("float2x2 endpts = float2x2(%s - bloat * qlr, %s + bloat * qlr);",
leftPt, rightPt);
g->codeAppendf("half2 endpts_coverage = %s.xy * endpts + %s.z;",
distanceEquation, distanceEquation);
// d1 is defined in emitEdgeDistanceEquation.
- g->codeAppend ("highfloat2 d2 = d1;");
+ g->codeAppend ("float2 d2 = d1;");
g->codeAppend ("bool aligned = qlr.x == 0 || qlr.y == 0;");
g->codeAppend ("if (aligned) {");
g->codeAppend ( "d1 -= qlr;");
@@ -279,25 +279,25 @@ void PrimitiveProcessor::emitEdgeDistanceEquation(GrGLSLGeometryBuilder* g,
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("float2 qlr = sign(%s - %s);", rightPt, leftPt);
+ g->codeAppend ("float2 d1 = float2(qlr.y, -qlr.x);");
- g->codeAppendf("highfloat2 n = highfloat2(%s.y - %s.y, %s.x - %s.x);",
+ g->codeAppendf("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("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("float scale = 1 / max(kk[0] - kk[1], 1e-30);");
g->codeAppendf("%s = half3(-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;
@@ -332,17 +332,17 @@ int PrimitiveProcessor::defineSoftSampleLocations(GrGLSLFragmentBuilder* f,
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("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("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
diff --git a/src/gpu/ccpr/GrCCPRCubicProcessor.cpp b/src/gpu/ccpr/GrCCPRCubicProcessor.cpp
index 1fc2a29342..6070527401 100644
--- a/src/gpu/ccpr/GrCCPRCubicProcessor.cpp
+++ b/src/gpu/ccpr/GrCCPRCubicProcessor.cpp
@@ -16,18 +16,18 @@ void GrCCPRCubicProcessor::onEmitVertexShader(const GrCCPRCoverageProcessor& pro
const TexelBufferHandle& pointsBuffer,
const char* atlasOffset, const char* rtAdjust,
GrGPArgs* gpArgs) const {
- v->codeAppend ("highfloat2 self = ");
+ v->codeAppend ("float2 self = ");
v->appendTexelFetch(pointsBuffer,
SkStringPrintf("%s.x + sk_VertexID", proc.instanceAttrib()).c_str());
v->codeAppendf(".xy + %s;", atlasOffset);
- gpArgs->fPositionVar.set(kHighFloat2_GrSLType, "self");
+ gpArgs->fPositionVar.set(kFloat2_GrSLType, "self");
}
void GrCCPRCubicProcessor::emitWind(GrGLSLGeometryBuilder* g, const char* rtAdjust,
const char* outputWind) const {
// We will define bezierpts in onEmitGeometryShader.
- g->codeAppend ("highfloat area_times_2 = "
- "determinant(highfloat3x3(1, bezierpts[0], "
+ g->codeAppend ("float area_times_2 = "
+ "determinant(float3x3(1, bezierpts[0], "
"1, bezierpts[2], "
"0, bezierpts[3] - bezierpts[1]));");
// Drop curves that are nearly flat. The KLM math becomes unstable in this case.
@@ -46,59 +46,59 @@ void GrCCPRCubicProcessor::emitWind(GrGLSLGeometryBuilder* g, const char* rtAdju
void GrCCPRCubicProcessor::onEmitGeometryShader(GrGLSLGeometryBuilder* g, const char* emitVertexFn,
const char* wind, const char* rtAdjust) const {
// Prepend bezierpts at the start of the shader.
- g->codePrependf("highfloat4x2 bezierpts = highfloat4x2(sk_in[0].gl_Position.xy, "
+ g->codePrependf("float4x2 bezierpts = float4x2(sk_in[0].gl_Position.xy, "
"sk_in[1].gl_Position.xy, "
"sk_in[2].gl_Position.xy, "
"sk_in[3].gl_Position.xy);");
// Evaluate the cubic at T=.5 for an mid-ish point.
- g->codeAppendf("highfloat2 midpoint = bezierpts * highfloat4(.125, .375, .375, .125);");
+ g->codeAppendf("float2 midpoint = bezierpts * float4(.125, .375, .375, .125);");
// Find the cubic's power basis coefficients.
- g->codeAppend ("highfloat2x4 C = highfloat4x4(-1, 3, -3, 1, "
+ g->codeAppend ("float2x4 C = float4x4(-1, 3, -3, 1, "
" 3, -6, 3, 0, "
"-3, 3, 0, 0, "
" 1, 0, 0, 0) * transpose(bezierpts);");
// Find the cubic's inflection function.
- g->codeAppend ("highfloat D3 = +determinant(highfloat2x2(C[0].yz, C[1].yz));");
- g->codeAppend ("highfloat D2 = -determinant(highfloat2x2(C[0].xz, C[1].xz));");
- g->codeAppend ("highfloat D1 = +determinant(highfloat2x2(C));");
+ g->codeAppend ("float D3 = +determinant(float2x2(C[0].yz, C[1].yz));");
+ g->codeAppend ("float D2 = -determinant(float2x2(C[0].xz, C[1].xz));");
+ g->codeAppend ("float D1 = +determinant(float2x2(C));");
// Calculate the KLM matrix.
g->declareGlobal(fKLMMatrix);
- g->codeAppend ("highfloat4 K, L, M;");
- g->codeAppend ("highfloat2 l, m;");
- g->codeAppend ("highfloat discr = 3*D2*D2 - 4*D1*D3;");
+ g->codeAppend ("float4 K, L, M;");
+ g->codeAppend ("float2 l, m;");
+ g->codeAppend ("float discr = 3*D2*D2 - 4*D1*D3;");
if (CubicType::kSerpentine == fCubicType) {
// This math also works out for the "cusp" and "cusp at infinity" cases.
- g->codeAppend ("highfloat q = 3*D2 + sign(D2) * sqrt(max(3*discr, 0));");
- g->codeAppend ("l.ts = normalize(highfloat2(q, 6*D1));");
- g->codeAppend ("m.ts = discr <= 0 ? l.ts : normalize(highfloat2(2*D3, q));");
- g->codeAppend ("K = highfloat4(0, l.s * m.s, -l.t * m.s - m.t * l.s, l.t * m.t);");
- g->codeAppend ("L = highfloat4(-1,3,-3,1) * l.ssst * l.sstt * l.sttt;");
- g->codeAppend ("M = highfloat4(-1,3,-3,1) * m.ssst * m.sstt * m.sttt;");
+ g->codeAppend ("float q = 3*D2 + sign(D2) * sqrt(max(3*discr, 0));");
+ g->codeAppend ("l.ts = normalize(float2(q, 6*D1));");
+ g->codeAppend ("m.ts = discr <= 0 ? l.ts : normalize(float2(2*D3, q));");
+ g->codeAppend ("K = float4(0, l.s * m.s, -l.t * m.s - m.t * l.s, l.t * m.t);");
+ g->codeAppend ("L = float4(-1,3,-3,1) * l.ssst * l.sstt * l.sttt;");
+ g->codeAppend ("M = float4(-1,3,-3,1) * m.ssst * m.sstt * m.sttt;");
} else {
- g->codeAppend ("highfloat q = D2 + sign(D2) * sqrt(max(-discr, 0));");
- g->codeAppend ("l.ts = normalize(highfloat2(q, 2*D1));");
- g->codeAppend ("m.ts = discr >= 0 ? l.ts : normalize(highfloat2(2 * (D2*D2 - D3*D1), D1*q));");
- g->codeAppend ("highfloat4 lxm = highfloat4(l.s * m.s, l.s * m.t, l.t * m.s, l.t * m.t);");
- g->codeAppend ("K = highfloat4(0, lxm.x, -lxm.y - lxm.z, lxm.w);");
- g->codeAppend ("L = highfloat4(-1,1,-1,1) * l.sstt * (lxm.xyzw + highfloat4(0, 2*lxm.zy, 0));");
- g->codeAppend ("M = highfloat4(-1,1,-1,1) * m.sstt * (lxm.xzyw + highfloat4(0, 2*lxm.yz, 0));");
+ g->codeAppend ("float q = D2 + sign(D2) * sqrt(max(-discr, 0));");
+ g->codeAppend ("l.ts = normalize(float2(q, 2*D1));");
+ g->codeAppend ("m.ts = discr >= 0 ? l.ts : normalize(float2(2 * (D2*D2 - D3*D1), D1*q));");
+ g->codeAppend ("float4 lxm = float4(l.s * m.s, l.s * m.t, l.t * m.s, l.t * m.t);");
+ g->codeAppend ("K = float4(0, lxm.x, -lxm.y - lxm.z, lxm.w);");
+ g->codeAppend ("L = float4(-1,1,-1,1) * l.sstt * (lxm.xyzw + float4(0, 2*lxm.zy, 0));");
+ g->codeAppend ("M = float4(-1,1,-1,1) * m.sstt * (lxm.xzyw + float4(0, 2*lxm.yz, 0));");
}
g->codeAppend ("short middlerow = abs(D2) > abs(D1) ? 2 : 1;");
- g->codeAppend ("highfloat3x3 CI = inverse(highfloat3x3(C[0][0], C[0][middlerow], C[0][3], "
+ g->codeAppend ("float3x3 CI = inverse(float3x3(C[0][0], C[0][middlerow], C[0][3], "
"C[1][0], C[1][middlerow], C[1][3], "
" 0, 0, 1));");
- g->codeAppendf("%s = CI * highfloat3x3(K[0], K[middlerow], K[3], "
+ g->codeAppendf("%s = CI * float3x3(K[0], K[middlerow], K[3], "
"L[0], L[middlerow], L[3], "
"M[0], M[middlerow], M[3]);", fKLMMatrix.c_str());
// Orient the KLM matrix so we fill the correct side of the curve.
g->codeAppendf("half2 orientation = sign(half3(midpoint, 1) * half2x3(%s[1], %s[2]));",
fKLMMatrix.c_str(), fKLMMatrix.c_str());
- g->codeAppendf("%s *= highfloat3x3(orientation[0] * orientation[1], 0, 0, "
+ g->codeAppendf("%s *= float3x3(orientation[0] * orientation[1], 0, 0, "
"0, orientation[0], 0, "
"0, 0, orientation[1]);", fKLMMatrix.c_str());
@@ -113,8 +113,8 @@ void GrCCPRCubicProcessor::onEmitGeometryShader(GrGLSLGeometryBuilder* g, const
// Determine the amount of additional coverage to subtract out for the flat edge (P3 -> P0).
g->declareGlobal(fEdgeDistanceEquation);
g->codeAppendf("short edgeidx0 = %s > 0 ? 3 : 0;", wind);
- g->codeAppendf("highfloat2 edgept0 = bezierpts[edgeidx0];");
- g->codeAppendf("highfloat2 edgept1 = bezierpts[3 - edgeidx0];");
+ g->codeAppendf("float2 edgept0 = bezierpts[edgeidx0];");
+ g->codeAppendf("float2 edgept1 = bezierpts[3 - edgeidx0];");
this->emitEdgeDistanceEquation(g, "edgept0", "edgept1", fEdgeDistanceEquation.c_str());
this->emitCubicGeometry(g, emitVertexFn, wind, rtAdjust);
@@ -123,10 +123,10 @@ void GrCCPRCubicProcessor::onEmitGeometryShader(GrGLSLGeometryBuilder* g, const
void GrCCPRCubicProcessor::emitPerVertexGeometryCode(SkString* fnBody, const char* position,
const char* /*coverage*/,
const char* /*wind*/) const {
- fnBody->appendf("highfloat3 klm = highfloat3(%s, 1) * %s;", position, fKLMMatrix.c_str());
- fnBody->appendf("highfloat d = dot(highfloat3(%s, 1), %s);",
+ fnBody->appendf("float3 klm = float3(%s, 1) * %s;", position, fKLMMatrix.c_str());
+ fnBody->appendf("float d = dot(float3(%s, 1), %s);",
position, fEdgeDistanceEquation.c_str());
- fnBody->appendf("%s = highfloat4(klm, d);", fKLMD.gsOut());
+ fnBody->appendf("%s = float4(klm, d);", fKLMD.gsOut());
this->onEmitPerVertexGeometryCode(fnBody);
}
@@ -150,10 +150,10 @@ void GrCCPRCubicHullProcessor::onEmitPerVertexGeometryCode(SkString* fnBody) con
void GrCCPRCubicHullProcessor::emitShaderCoverage(GrGLSLFragmentBuilder* f,
const char* outputCoverage) const {
- f->codeAppendf("highfloat k = %s.x, l = %s.y, m = %s.z, d = %s.w;",
+ f->codeAppendf("float k = %s.x, l = %s.y, m = %s.z, d = %s.w;",
fKLMD.fsIn(), fKLMD.fsIn(), fKLMD.fsIn(), fKLMD.fsIn());
- f->codeAppend ("highfloat f = k*k*k - l*m;");
- f->codeAppendf("highfloat2 grad_f = %s * highfloat2(k, 1);", fGradMatrix.fsIn());
+ f->codeAppend ("float f = k*k*k - l*m;");
+ f->codeAppendf("float2 grad_f = %s * float2(k, 1);", fGradMatrix.fsIn());
f->codeAppendf("%s = clamp(0.5 - f * inversesqrt(dot(grad_f, grad_f)), 0, 1);", outputCoverage);
f->codeAppendf("%s += min(d, 0);", outputCoverage); // Flat closing edge.
}
@@ -166,7 +166,7 @@ void GrCCPRCubicCornerProcessor::emitCubicGeometry(GrGLSLGeometryBuilder* g,
g->codeAppendf("%s = %s.xy * %s.xz;",
fEdgeDistanceDerivatives.c_str(), fEdgeDistanceEquation.c_str(), rtAdjust);
- g->codeAppendf("highfloat2 corner = bezierpts[sk_InvocationID * 3];");
+ g->codeAppendf("float2 corner = bezierpts[sk_InvocationID * 3];");
int numVertices = this->emitCornerGeometry(g, emitVertexFn, "corner");
g->configure(GrGLSLGeometryBuilder::InputType::kLinesAdjacency,
@@ -174,10 +174,10 @@ void GrCCPRCubicCornerProcessor::emitCubicGeometry(GrGLSLGeometryBuilder* g,
}
void GrCCPRCubicCornerProcessor::onEmitPerVertexGeometryCode(SkString* fnBody) const {
- fnBody->appendf("%s = highfloat4(%s[0].x, %s[1].x, %s[2].x, %s.x);",
+ fnBody->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());
- fnBody->appendf("%s = highfloat4(%s[0].y, %s[1].y, %s[2].y, %s.y);",
+ fnBody->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());
@@ -187,25 +187,25 @@ void GrCCPRCubicCornerProcessor::onEmitPerVertexGeometryCode(SkString* fnBody) c
void GrCCPRCubicCornerProcessor::emitShaderCoverage(GrGLSLFragmentBuilder* f,
const char* outputCoverage) const {
- f->codeAppendf("highfloat2x4 grad_klmd = highfloat2x4(%s, %s);",
+ f->codeAppendf("float2x4 grad_klmd = float2x4(%s, %s);",
fdKLMDdx.fsIn(), fdKLMDdy.fsIn());
// Erase what the previous hull shader wrote. We don't worry about the two corners falling on
// the same pixel because those cases should have been weeded out by this point.
- f->codeAppendf("highfloat k = %s.x, l = %s.y, m = %s.z, d = %s.w;",
+ f->codeAppendf("float k = %s.x, l = %s.y, m = %s.z, d = %s.w;",
fKLMD.fsIn(), fKLMD.fsIn(), fKLMD.fsIn(), fKLMD.fsIn());
- f->codeAppend ("highfloat f = k*k*k - l*m;");
- f->codeAppend ("highfloat2 grad_f = highfloat3(3*k*k, -m, -l) * highfloat2x3(grad_klmd);");
+ f->codeAppend ("float f = k*k*k - l*m;");
+ f->codeAppend ("float2 grad_f = float3(3*k*k, -m, -l) * float2x3(grad_klmd);");
f->codeAppendf("%s = -clamp(0.5 - f * inversesqrt(dot(grad_f, grad_f)), 0, 1);",
outputCoverage);
f->codeAppendf("%s -= d;", outputCoverage);
// Use software msaa to estimate actual coverage at the corner pixels.
const int sampleCount = this->defineSoftSampleLocations(f, "samples");
- f->codeAppendf("highfloat4 klmd_center = highfloat4(%s.xyz, %s.w + 0.5);",
+ f->codeAppendf("float4 klmd_center = float4(%s.xyz, %s.w + 0.5);",
fKLMD.fsIn(), fKLMD.fsIn());
f->codeAppendf("for (int i = 0; i < %i; ++i) {", sampleCount);
- f->codeAppend ( "highfloat4 klmd = grad_klmd * samples[i] + klmd_center;");
+ f->codeAppend ( "float4 klmd = grad_klmd * samples[i] + klmd_center;");
f->codeAppend ( "half f = klmd.y * klmd.z - klmd.x * klmd.x * klmd.x;");
f->codeAppendf( "%s += all(greaterThan(half4(f, klmd.y, klmd.z, klmd.w), "
"half4(0))) ? %f : 0;",
diff --git a/src/gpu/ccpr/GrCCPRCubicProcessor.h b/src/gpu/ccpr/GrCCPRCubicProcessor.h
index 20ca3f2547..e44d8fb4b9 100644
--- a/src/gpu/ccpr/GrCCPRCubicProcessor.h
+++ b/src/gpu/ccpr/GrCCPRCubicProcessor.h
@@ -33,12 +33,12 @@ public:
GrCCPRCubicProcessor(CubicType cubicType)
: INHERITED(CoverageType::kShader)
, fCubicType(cubicType)
- , fKLMMatrix("klm_matrix", kHighFloat3x3_GrSLType, GrShaderVar::kNonArray,
+ , fKLMMatrix("klm_matrix", kFloat3x3_GrSLType, GrShaderVar::kNonArray,
kHigh_GrSLPrecision)
- , fKLMDerivatives("klm_derivatives", kHighFloat2_GrSLType, 3, kHigh_GrSLPrecision)
- , fEdgeDistanceEquation("edge_distance_equation", kHighFloat3_GrSLType,
+ , fKLMDerivatives("klm_derivatives", kFloat2_GrSLType, 3, kHigh_GrSLPrecision)
+ , fEdgeDistanceEquation("edge_distance_equation", kFloat3_GrSLType,
GrShaderVar::kNonArray, kHigh_GrSLPrecision)
- , fKLMD(kHighFloat4_GrSLType) {}
+ , fKLMD(kFloat4_GrSLType) {}
void resetVaryings(GrGLSLVaryingHandler* varyingHandler) override {
varyingHandler->addVarying("klmd", &fKLMD, kHigh_GrSLPrecision);
@@ -71,7 +71,7 @@ class GrCCPRCubicHullProcessor : public GrCCPRCubicProcessor {
public:
GrCCPRCubicHullProcessor(CubicType cubicType)
: INHERITED(cubicType)
- , fGradMatrix(kHighFloat2x2_GrSLType) {}
+ , fGradMatrix(kFloat2x2_GrSLType) {}
void resetVaryings(GrGLSLVaryingHandler* varyingHandler) override {
this->INHERITED::resetVaryings(varyingHandler);
@@ -93,10 +93,10 @@ class GrCCPRCubicCornerProcessor : public GrCCPRCubicProcessor {
public:
GrCCPRCubicCornerProcessor(CubicType cubicType)
: INHERITED(cubicType)
- , fEdgeDistanceDerivatives("edge_distance_derivatives", kHighFloat2_GrSLType,
+ , fEdgeDistanceDerivatives("edge_distance_derivatives", kFloat2_GrSLType,
GrShaderVar::kNonArray, kHigh_GrSLPrecision)
- , fdKLMDdx(kHighFloat4_GrSLType)
- , fdKLMDdy(kHighFloat4_GrSLType) {}
+ , fdKLMDdx(kFloat4_GrSLType)
+ , fdKLMDdy(kFloat4_GrSLType) {}
void resetVaryings(GrGLSLVaryingHandler* varyingHandler) override {
this->INHERITED::resetVaryings(varyingHandler);
diff --git a/src/gpu/ccpr/GrCCPRPathProcessor.cpp b/src/gpu/ccpr/GrCCPRPathProcessor.cpp
index bb0ecc9e22..78baa368da 100644
--- a/src/gpu/ccpr/GrCCPRPathProcessor.cpp
+++ b/src/gpu/ccpr/GrCCPRPathProcessor.cpp
@@ -121,11 +121,11 @@ void GLSLPathProcessor::onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) {
const char* atlasAdjust;
fAtlasAdjustUniform = uniHandler->addUniform(
kVertex_GrShaderFlag,
- kHighFloat2_GrSLType, "atlas_adjust", &atlasAdjust);
+ kFloat2_GrSLType, "atlas_adjust", &atlasAdjust);
varyingHandler->emitAttributes(proc);
- GrGLSLVertToFrag texcoord(kHighFloat2_GrSLType);
+ GrGLSLVertToFrag texcoord(kFloat2_GrSLType);
GrGLSLVertToFrag color(kHalf4_GrSLType);
varyingHandler->addVarying("texcoord", &texcoord, kHigh_GrSLPrecision);
varyingHandler->addFlatPassThroughAttribute(&proc.getInstanceAttrib(InstanceAttribs::kColor),
@@ -137,41 +137,41 @@ void GLSLPathProcessor::onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) {
// Find the intersections of (bloated) devBounds and devBounds45 in order to come up with an
// octagon that circumscribes the (bloated) path. A vertex is the intersection of two lines:
// one edge from the path's bounding box and one edge from its 45-degree bounding box.
- v->codeAppendf("highfloat2x2 N = highfloat2x2(%s);", proc.getEdgeNormsAttrib().fName);
+ v->codeAppendf("float2x2 N = float2x2(%s);", proc.getEdgeNormsAttrib().fName);
// N[0] is the normal for the edge we are intersecting from the regular bounding box, pointing
// out of the octagon.
- v->codeAppendf("highfloat2 refpt = (min(N[0].x, N[0].y) < 0) ? %s.xy : %s.zw;",
+ v->codeAppendf("float2 refpt = (min(N[0].x, N[0].y) < 0) ? %s.xy : %s.zw;",
proc.getInstanceAttrib(InstanceAttribs::kDevBounds).fName,
proc.getInstanceAttrib(InstanceAttribs::kDevBounds).fName);
v->codeAppendf("refpt += N[0] * %f;", kAABloatRadius); // bloat for AA.
// N[1] is the normal for the edge we are intersecting from the 45-degree bounding box, pointing
// out of the octagon.
- v->codeAppendf("highfloat2 refpt45 = (N[1].x < 0) ? %s.xy : %s.zw;",
+ v->codeAppendf("float2 refpt45 = (N[1].x < 0) ? %s.xy : %s.zw;",
proc.getInstanceAttrib(InstanceAttribs::kDevBounds45).fName,
proc.getInstanceAttrib(InstanceAttribs::kDevBounds45).fName);
- v->codeAppendf("refpt45 *= highfloat2x2(.5,.5,-.5,.5);"); // transform back to device space.
+ v->codeAppendf("refpt45 *= float2x2(.5,.5,-.5,.5);"); // transform back to device space.
v->codeAppendf("refpt45 += N[1] * %f;", kAABloatRadius); // bloat for AA.
- v->codeAppend ("highfloat2 K = highfloat2(dot(N[0], refpt), dot(N[1], refpt45));");
- v->codeAppendf("highfloat2 octocoord = K * inverse(N);");
+ v->codeAppend ("float2 K = float2(dot(N[0], refpt), dot(N[1], refpt45));");
+ v->codeAppendf("float2 octocoord = K * inverse(N);");
- gpArgs->fPositionVar.set(kHighFloat2_GrSLType, "octocoord");
+ gpArgs->fPositionVar.set(kFloat2_GrSLType, "octocoord");
// Convert to atlas coordinates in order to do our texture lookup.
- v->codeAppendf("highfloat2 atlascoord = octocoord + highfloat2(%s);",
+ v->codeAppendf("float2 atlascoord = octocoord + float2(%s);",
proc.getInstanceAttrib(InstanceAttribs::kAtlasOffset).fName);
if (kTopLeft_GrSurfaceOrigin == proc.atlasProxy()->origin()) {
v->codeAppendf("%s = atlascoord * %s;", texcoord.vsOut(), atlasAdjust);
} else {
SkASSERT(kBottomLeft_GrSurfaceOrigin == proc.atlasProxy()->origin());
- v->codeAppendf("%s = highfloat2(atlascoord.x * %s.x, 1 - atlascoord.y * %s.y);",
+ v->codeAppendf("%s = float2(atlascoord.x * %s.x, 1 - atlascoord.y * %s.y);",
texcoord.vsOut(), atlasAdjust, atlasAdjust);
}
// Convert to (local) path cordinates.
- v->codeAppendf("highfloat2 pathcoord = inverse(highfloat2x2(%s)) * (octocoord - %s);",
+ v->codeAppendf("float2 pathcoord = inverse(float2x2(%s)) * (octocoord - %s);",
proc.getInstanceAttrib(InstanceAttribs::kViewMatrix).fName,
proc.getInstanceAttrib(InstanceAttribs::kViewTranslate).fName);
@@ -182,7 +182,7 @@ void GLSLPathProcessor::onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) {
GrGLSLPPFragmentBuilder* f = args.fFragBuilder;
f->codeAppend ("half coverage_count = ");
- f->appendTextureLookup(args.fTexSamplers[0], texcoord.fsIn(), kHighFloat2_GrSLType);
+ f->appendTextureLookup(args.fTexSamplers[0], texcoord.fsIn(), kFloat2_GrSLType);
f->codeAppend (".a;");
if (SkPath::kWinding_FillType == proc.fillType()) {
diff --git a/src/gpu/ccpr/GrCCPRQuadraticProcessor.cpp b/src/gpu/ccpr/GrCCPRQuadraticProcessor.cpp
index ced5be1f70..9b85783afd 100644
--- a/src/gpu/ccpr/GrCCPRQuadraticProcessor.cpp
+++ b/src/gpu/ccpr/GrCCPRQuadraticProcessor.cpp
@@ -16,19 +16,18 @@ void GrCCPRQuadraticProcessor::onEmitVertexShader(const GrCCPRCoverageProcessor&
const TexelBufferHandle& pointsBuffer,
const char* atlasOffset, const char* rtAdjust,
GrGPArgs* gpArgs) const {
- v->codeAppend ("highfloat2 self = ");
+ v->codeAppend ("float2 self = ");
v->appendTexelFetch(pointsBuffer,
SkStringPrintf("%s.x + sk_VertexID", proc.instanceAttrib()).c_str());
v->codeAppendf(".xy + %s;", atlasOffset);
- gpArgs->fPositionVar.set(kHighFloat2_GrSLType, "self");
+ gpArgs->fPositionVar.set(kFloat2_GrSLType, "self");
}
void GrCCPRQuadraticProcessor::emitWind(GrGLSLGeometryBuilder* g, const char* rtAdjust,
const char* outputWind) const {
// We will define bezierpts in onEmitGeometryShader.
- g->codeAppend ("highfloat area_times_2 = "
- "determinant(highfloat2x2(bezierpts[1] - bezierpts[0], "
- "bezierpts[2] - bezierpts[0]));");
+ g->codeAppend ("float area_times_2 = determinant(float2x2(bezierpts[1] - bezierpts[0], "
+ "bezierpts[2] - bezierpts[0]));");
// Drop curves that are nearly flat, in favor of the higher quality triangle antialiasing.
g->codeAppendf("if (2 * abs(area_times_2) < length((bezierpts[2] - bezierpts[0]) * %s.zx)) {",
rtAdjust);
@@ -46,26 +45,26 @@ void GrCCPRQuadraticProcessor::onEmitGeometryShader(GrGLSLGeometryBuilder* g,
const char* emitVertexFn, const char* wind,
const char* rtAdjust) const {
// Prepend bezierpts at the start of the shader.
- g->codePrependf("highfloat3x2 bezierpts = highfloat3x2(sk_in[0].gl_Position.xy, "
- "sk_in[1].gl_Position.xy, "
- "sk_in[2].gl_Position.xy);");
+ g->codePrependf("float3x2 bezierpts = float3x2(sk_in[0].gl_Position.xy, "
+ "sk_in[1].gl_Position.xy, "
+ "sk_in[2].gl_Position.xy);");
g->declareGlobal(fCanonicalMatrix);
- g->codeAppendf("%s = highfloat3x3(0.0, 0, 1, "
- "0.5, 0, 1, "
- "1.0, 1, 1) * "
- "inverse(highfloat3x3(bezierpts[0], 1, "
- "bezierpts[1], 1, "
- "bezierpts[2], 1));",
+ g->codeAppendf("%s = float3x3(0.0, 0, 1, "
+ "0.5, 0, 1, "
+ "1.0, 1, 1) * "
+ "inverse(float3x3(bezierpts[0], 1, "
+ "bezierpts[1], 1, "
+ "bezierpts[2], 1));",
fCanonicalMatrix.c_str());
g->declareGlobal(fCanonicalDerivatives);
- g->codeAppendf("%s = highfloat2x2(%s) * highfloat2x2(%s.x, 0, 0, %s.z);",
+ g->codeAppendf("%s = float2x2(%s) * float2x2(%s.x, 0, 0, %s.z);",
fCanonicalDerivatives.c_str(), fCanonicalMatrix.c_str(), rtAdjust, rtAdjust);
g->declareGlobal(fEdgeDistanceEquation);
- g->codeAppendf("highfloat2 edgept0 = bezierpts[%s > 0 ? 2 : 0];", wind);
- g->codeAppendf("highfloat2 edgept1 = bezierpts[%s > 0 ? 0 : 2];", wind);
+ g->codeAppendf("float2 edgept0 = bezierpts[%s > 0 ? 2 : 0];", wind);
+ g->codeAppendf("float2 edgept1 = bezierpts[%s > 0 ? 0 : 2];", wind);
this->emitEdgeDistanceEquation(g, "edgept0", "edgept1", fEdgeDistanceEquation.c_str());
this->emitQuadraticGeometry(g, emitVertexFn, rtAdjust);
@@ -74,7 +73,7 @@ void GrCCPRQuadraticProcessor::onEmitGeometryShader(GrGLSLGeometryBuilder* g,
void GrCCPRQuadraticProcessor::emitPerVertexGeometryCode(SkString* fnBody, const char* position,
const char* /*coverage*/,
const char* /*wind*/) const {
- fnBody->appendf("%s.xy = (%s * highfloat3(%s, 1)).xy;",
+ fnBody->appendf("%s.xy = (%s * float3(%s, 1)).xy;",
fXYD.gsOut(), fCanonicalMatrix.c_str(), position);
fnBody->appendf("%s.z = dot(%s.xy, %s) + %s.z;",
fXYD.gsOut(), fEdgeDistanceEquation.c_str(), position,
@@ -87,18 +86,18 @@ void GrCCPRQuadraticHullProcessor::emitQuadraticGeometry(GrGLSLGeometryBuilder*
const char* /*rtAdjust*/) const {
// Find the t value whose tangent is halfway between the tangents at the endpionts.
// (We defined bezierpts in onEmitGeometryShader.)
- g->codeAppend ("highfloat2 tan0 = bezierpts[1] - bezierpts[0];");
- g->codeAppend ("highfloat2 tan1 = bezierpts[2] - bezierpts[1];");
- g->codeAppend ("highfloat2 midnorm = normalize(tan0) - normalize(tan1);");
- g->codeAppend ("highfloat2 T = midnorm * highfloat2x2(tan0 - tan1, tan0);");
- g->codeAppend ("highfloat t = clamp(T.t / T.s, 0, 1);"); // T.s=0 is weeded out by this point.
+ g->codeAppend ("float2 tan0 = bezierpts[1] - bezierpts[0];");
+ g->codeAppend ("float2 tan1 = bezierpts[2] - bezierpts[1];");
+ g->codeAppend ("float2 midnorm = normalize(tan0) - normalize(tan1);");
+ g->codeAppend ("float2 T = midnorm * float2x2(tan0 - tan1, tan0);");
+ g->codeAppend ("float t = clamp(T.t / T.s, 0, 1);"); // T.s=0 is weeded out by this point.
// Clip the bezier triangle by the tangent at our new t value. This is a simple application for
// De Casteljau's algorithm.
- g->codeAppendf("highfloat4x2 quadratic_hull = highfloat4x2(bezierpts[0], "
- "bezierpts[0] + tan0 * t, "
- "bezierpts[1] + tan1 * t, "
- "bezierpts[2]);");
+ g->codeAppendf("float4x2 quadratic_hull = float4x2(bezierpts[0], "
+ "bezierpts[0] + tan0 * t, "
+ "bezierpts[1] + tan1 * t, "
+ "bezierpts[2]);");
int maxVerts = this->emitHullGeometry(g, emitVertexFn, "quadratic_hull", 4, "sk_InvocationID");
@@ -108,13 +107,13 @@ void GrCCPRQuadraticHullProcessor::emitQuadraticGeometry(GrGLSLGeometryBuilder*
}
void GrCCPRQuadraticHullProcessor::onEmitPerVertexGeometryCode(SkString* fnBody) const {
- fnBody->appendf("%s = highfloat2(2 * %s.x, -1) * %s;",
+ fnBody->appendf("%s = float2(2 * %s.x, -1) * %s;",
fGradXY.gsOut(), fXYD.gsOut(), fCanonicalDerivatives.c_str());
}
void GrCCPRQuadraticHullProcessor::emitShaderCoverage(GrGLSLFragmentBuilder* f,
const char* outputCoverage) const {
- f->codeAppendf("highfloat d = (%s.x * %s.x - %s.y) * inversesqrt(dot(%s, %s));",
+ f->codeAppendf("float d = (%s.x * %s.x - %s.y) * inversesqrt(dot(%s, %s));",
fXYD.fsIn(), fXYD.fsIn(), fXYD.fsIn(), fGradXY.fsIn(), fGradXY.fsIn());
f->codeAppendf("%s = clamp(0.5 - d, 0, 1);", outputCoverage);
f->codeAppendf("%s += min(%s.z, 0);", outputCoverage, fXYD.fsIn()); // Flat closing edge.
@@ -127,7 +126,7 @@ void GrCCPRQuadraticCornerProcessor::emitQuadraticGeometry(GrGLSLGeometryBuilder
g->codeAppendf("%s = %s.xy * %s.xz;",
fEdgeDistanceDerivatives.c_str(), fEdgeDistanceEquation.c_str(), rtAdjust);
- g->codeAppendf("highfloat2 corner = bezierpts[sk_InvocationID * 2];");
+ g->codeAppendf("float2 corner = bezierpts[sk_InvocationID * 2];");
int numVertices = this->emitCornerGeometry(g, emitVertexFn, "corner");
g->configure(GrGLSLGeometryBuilder::InputType::kTriangles,
@@ -135,35 +134,35 @@ void GrCCPRQuadraticCornerProcessor::emitQuadraticGeometry(GrGLSLGeometryBuilder
}
void GrCCPRQuadraticCornerProcessor::onEmitPerVertexGeometryCode(SkString* fnBody) const {
- fnBody->appendf("%s = highfloat3(%s[0].x, %s[0].y, %s.x);",
+ fnBody->appendf("%s = float3(%s[0].x, %s[0].y, %s.x);",
fdXYDdx.gsOut(), fCanonicalDerivatives.c_str(), fCanonicalDerivatives.c_str(),
fEdgeDistanceDerivatives.c_str());
- fnBody->appendf("%s = highfloat3(%s[1].x, %s[1].y, %s.y);",
+ fnBody->appendf("%s = float3(%s[1].x, %s[1].y, %s.y);",
fdXYDdy.gsOut(), fCanonicalDerivatives.c_str(), fCanonicalDerivatives.c_str(),
fEdgeDistanceDerivatives.c_str());
}
void GrCCPRQuadraticCornerProcessor::emitShaderCoverage(GrGLSLFragmentBuilder* f,
const char* outputCoverage) const {
- f->codeAppendf("highfloat x = %s.x, y = %s.y, d = %s.z;",
+ f->codeAppendf("float x = %s.x, y = %s.y, d = %s.z;",
fXYD.fsIn(), fXYD.fsIn(), fXYD.fsIn());
- f->codeAppendf("highfloat2x3 grad_xyd = highfloat2x3(%s, %s);", fdXYDdx.fsIn(), fdXYDdy.fsIn());
+ f->codeAppendf("float2x3 grad_xyd = float2x3(%s, %s);", fdXYDdx.fsIn(), fdXYDdy.fsIn());
// Erase what the previous hull shader wrote. We don't worry about the two corners falling on
// the same pixel because those cases should have been weeded out by this point.
- f->codeAppend ("highfloat f = x*x - y;");
- f->codeAppend ("highfloat2 grad_f = highfloat2(2*x, -1) * highfloat2x2(grad_xyd);");
+ f->codeAppend ("float f = x*x - y;");
+ f->codeAppend ("float2 grad_f = float2(2*x, -1) * float2x2(grad_xyd);");
f->codeAppendf("%s = -(0.5 - f * inversesqrt(dot(grad_f, grad_f)));", outputCoverage);
f->codeAppendf("%s -= d;", outputCoverage);
// Use software msaa to approximate coverage at the corner pixels.
int sampleCount = this->defineSoftSampleLocations(f, "samples");
- f->codeAppendf("highfloat3 xyd_center = highfloat3(%s.xy, %s.z + 0.5);",
+ f->codeAppendf("float3 xyd_center = float3(%s.xy, %s.z + 0.5);",
fXYD.fsIn(), fXYD.fsIn());
f->codeAppendf("for (int i = 0; i < %i; ++i) {", sampleCount);
- f->codeAppend ( "highfloat3 xyd = grad_xyd * samples[i] + xyd_center;");
+ f->codeAppend ( "float3 xyd = grad_xyd * samples[i] + xyd_center;");
f->codeAppend ( "half f = xyd.y - xyd.x * xyd.x;"); // f > 0 -> inside curve.
- f->codeAppendf( "%s += all(greaterThan(highfloat2(f,xyd.z), highfloat2(0))) ? %f : 0;",
+ f->codeAppendf( "%s += all(greaterThan(float2(f,xyd.z), float2(0))) ? %f : 0;",
outputCoverage, 1.0 / sampleCount);
f->codeAppendf("}");
}
diff --git a/src/gpu/ccpr/GrCCPRQuadraticProcessor.h b/src/gpu/ccpr/GrCCPRQuadraticProcessor.h
index 80237b62b4..8975923c95 100644
--- a/src/gpu/ccpr/GrCCPRQuadraticProcessor.h
+++ b/src/gpu/ccpr/GrCCPRQuadraticProcessor.h
@@ -24,12 +24,12 @@ class GrCCPRQuadraticProcessor : public GrCCPRCoverageProcessor::PrimitiveProces
public:
GrCCPRQuadraticProcessor()
: INHERITED(CoverageType::kShader)
- , fCanonicalMatrix("canonical_matrix", kHighFloat3x3_GrSLType, GrShaderVar::kNonArray)
- , fCanonicalDerivatives("canonical_derivatives", kHighFloat2x2_GrSLType,
+ , fCanonicalMatrix("canonical_matrix", kFloat3x3_GrSLType, GrShaderVar::kNonArray)
+ , fCanonicalDerivatives("canonical_derivatives", kFloat2x2_GrSLType,
GrShaderVar::kNonArray)
- , fEdgeDistanceEquation("edge_distance_equation", kHighFloat3_GrSLType,
+ , fEdgeDistanceEquation("edge_distance_equation", kFloat3_GrSLType,
GrShaderVar::kNonArray)
- , fXYD(kHighFloat3_GrSLType) {}
+ , fXYD(kFloat3_GrSLType) {}
void resetVaryings(GrGLSLVaryingHandler* varyingHandler) override {
varyingHandler->addVarying("xyd", &fXYD, kHigh_GrSLPrecision);
@@ -66,7 +66,7 @@ protected:
class GrCCPRQuadraticHullProcessor : public GrCCPRQuadraticProcessor {
public:
GrCCPRQuadraticHullProcessor()
- : fGradXY(kHighFloat2_GrSLType) {}
+ : fGradXY(kFloat2_GrSLType) {}
void resetVaryings(GrGLSLVaryingHandler* varyingHandler) override {
this->INHERITED::resetVaryings(varyingHandler);
@@ -90,10 +90,10 @@ private:
class GrCCPRQuadraticCornerProcessor : public GrCCPRQuadraticProcessor {
public:
GrCCPRQuadraticCornerProcessor()
- : fEdgeDistanceDerivatives("edge_distance_derivatives", kHighFloat2_GrSLType,
+ : fEdgeDistanceDerivatives("edge_distance_derivatives", kFloat2_GrSLType,
GrShaderVar::kNonArray)
- , fdXYDdx(kHighFloat3_GrSLType)
- , fdXYDdy(kHighFloat3_GrSLType) {}
+ , fdXYDdx(kFloat3_GrSLType)
+ , fdXYDdy(kFloat3_GrSLType) {}
void resetVaryings(GrGLSLVaryingHandler* varyingHandler) override {
this->INHERITED::resetVaryings(varyingHandler);
diff --git a/src/gpu/ccpr/GrCCPRTriangleProcessor.cpp b/src/gpu/ccpr/GrCCPRTriangleProcessor.cpp
index ef43f03cb8..489138ecbd 100644
--- a/src/gpu/ccpr/GrCCPRTriangleProcessor.cpp
+++ b/src/gpu/ccpr/GrCCPRTriangleProcessor.cpp
@@ -16,25 +16,25 @@ void GrCCPRTriangleProcessor::onEmitVertexShader(const GrCCPRCoverageProcessor&
const TexelBufferHandle& pointsBuffer,
const char* atlasOffset, const char* rtAdjust,
GrGPArgs* gpArgs) const {
- v->codeAppend ("highfloat2 self = ");
+ v->codeAppend ("float2 self = ");
v->appendTexelFetch(pointsBuffer,
SkStringPrintf("%s[sk_VertexID]", proc.instanceAttrib()).c_str());
v->codeAppendf(".xy + %s;", atlasOffset);
- gpArgs->fPositionVar.set(kHighFloat2_GrSLType, "self");
+ gpArgs->fPositionVar.set(kFloat2_GrSLType, "self");
}
void GrCCPRTriangleProcessor::defineInputVertices(GrGLSLGeometryBuilder* g) const {
// Prepend in_vertices at the start of the shader.
- g->codePrependf("highfloat3x2 in_vertices = highfloat3x2(sk_in[0].gl_Position.xy, "
- "sk_in[1].gl_Position.xy, "
- "sk_in[2].gl_Position.xy);");
+ g->codePrependf("float3x2 in_vertices = float3x2(sk_in[0].gl_Position.xy, "
+ "sk_in[1].gl_Position.xy, "
+ "sk_in[2].gl_Position.xy);");
}
void GrCCPRTriangleProcessor::emitWind(GrGLSLGeometryBuilder* g, const char* /*rtAdjust*/,
const char* outputWind) const {
// We will define in_vertices in defineInputVertices.
- g->codeAppendf("%s = sign(determinant(highfloat2x2(in_vertices[1] - in_vertices[0], "
- "in_vertices[2] - in_vertices[0])));",
+ g->codeAppendf("%s = sign(determinant(float2x2(in_vertices[1] - in_vertices[0], "
+ "in_vertices[2] - in_vertices[0])));",
outputWind);
}
@@ -53,8 +53,8 @@ void GrCCPRTriangleHullAndEdgeProcessor::onEmitGeometryShader(GrGLSLGeometryBuil
if (GeometryType::kHulls != fGeometryType) {
g->codeAppend ("int edgeidx0 = sk_InvocationID, "
"edgeidx1 = (edgeidx0 + 1) % 3;");
- g->codeAppendf("highfloat2 edgept0 = in_vertices[%s > 0 ? edgeidx0 : edgeidx1];", wind);
- g->codeAppendf("highfloat2 edgept1 = in_vertices[%s > 0 ? edgeidx1 : edgeidx0];", wind);
+ g->codeAppendf("float2 edgept0 = in_vertices[%s > 0 ? edgeidx0 : edgeidx1];", wind);
+ g->codeAppendf("float2 edgept1 = in_vertices[%s > 0 ? edgeidx1 : edgeidx0];", wind);
maxOutputVertices += this->emitEdgeGeometry(g, emitVertexFn, "edgept0", "edgept1");
}
@@ -69,24 +69,23 @@ void GrCCPRTriangleCornerProcessor::onEmitGeometryShader(GrGLSLGeometryBuilder*
const char* rtAdjust) const {
this->defineInputVertices(g);
- g->codeAppend ("highfloat2 corner = in_vertices[sk_InvocationID];");
- g->codeAppend ("highfloat2x2 vectors = highfloat2x2("
- "corner - in_vertices[(sk_InvocationID + 2) % 3], "
- "corner - in_vertices[(sk_InvocationID + 1) % 3]);");
+ g->codeAppend ("float2 corner = in_vertices[sk_InvocationID];");
+ g->codeAppend ("float2x2 vectors = float2x2(corner - in_vertices[(sk_InvocationID + 2) % 3], "
+ "corner - in_vertices[(sk_InvocationID + 1) % 3]);");
// Make sure neither vector is 0 in order to avoid a divide-by-zero. Wind will be zero anyway if
// this is the case, so whatever we output won't have any effect as long it isn't NaN or Inf.
g->codeAppendf("for (int i = 0; i < 2; ++i) {");
- g->codeAppendf( "vectors[i] = any(notEqual(vectors[i], highfloat2(0))) ? "
- "vectors[i] : highfloat2(1);");
+ g->codeAppendf( "vectors[i] = any(notEqual(vectors[i], float2(0))) ? "
+ "vectors[i] : float2(1);");
g->codeAppendf("}");
// Find the vector that bisects the region outside the incoming edges. Each edge is responsible
// to subtract the outside region on its own the side of the bisector.
- g->codeAppendf("highfloat2 leftdir = normalize(vectors[%s > 0 ? 0 : 1]);", wind);
- g->codeAppendf("highfloat2 rightdir = normalize(vectors[%s > 0 ? 1 : 0]);", wind);
- g->codeAppendf("highfloat2 bisect = dot(leftdir, rightdir) >= 0 ? leftdir + rightdir : "
- "highfloat2(leftdir.y - rightdir.y, rightdir.x - leftdir.x);");
+ g->codeAppendf("float2 leftdir = normalize(vectors[%s > 0 ? 0 : 1]);", wind);
+ g->codeAppendf("float2 rightdir = normalize(vectors[%s > 0 ? 1 : 0]);", wind);
+ g->codeAppendf("float2 bisect = dot(leftdir, rightdir) >= 0 ? leftdir + rightdir : "
+ "float2(leftdir.y - rightdir.y, rightdir.x - leftdir.x);");
// In ccpr we don't calculate exact geometric pixel coverage. What the distance-to-edge method
// actually finds is coverage inside a logical "AA box", one that is rotated inline with the
@@ -98,8 +97,8 @@ void GrCCPRTriangleCornerProcessor::onEmitGeometryShader(GrGLSLGeometryBuilder*
g->declareGlobal(fGeoShaderBisects);
g->codeAppendf("for (int i = 0; i < 2; ++i) {");
// The X component runs parallel to the edge (i.e. distance to the corner).
- g->codeAppendf( "highfloat2 n = -vectors[%s > 0 ? i : 1 - i];", wind);
- g->codeAppendf( "highfloat nwidth = dot(abs(n), bloat) * 2;");
+ g->codeAppendf( "float2 n = -vectors[%s > 0 ? i : 1 - i];", wind);
+ g->codeAppendf( "float nwidth = dot(abs(n), bloat) * 2;");
g->codeAppendf( "n /= nwidth;"); // nwidth != 0 because both vectors != 0.
g->codeAppendf( "%s[i][0] = n;", fAABoxMatrices.c_str());
g->codeAppendf( "%s[i][0] = -dot(n, corner) + .5;", fAABoxTranslates.c_str());
@@ -107,7 +106,7 @@ void GrCCPRTriangleCornerProcessor::onEmitGeometryShader(GrGLSLGeometryBuilder*
// The Y component runs perpendicular to the edge (i.e. distance-to-edge).
// NOTE: once we are back in device space and bloat.x == bloat.y, we will not need to find and
// divide by nwidth a second time.
- g->codeAppendf( "n = (i == 0) ? highfloat2(-n.y, n.x) : highfloat2(n.y, -n.x);");
+ g->codeAppendf( "n = (i == 0) ? float2(-n.y, n.x) : float2(n.y, -n.x);");
g->codeAppendf( "nwidth = dot(abs(n), bloat) * 2;");
g->codeAppendf( "n /= nwidth;");
g->codeAppendf( "%s[i][1] = n;", fAABoxMatrices.c_str());
diff --git a/src/gpu/ccpr/GrCCPRTriangleProcessor.h b/src/gpu/ccpr/GrCCPRTriangleProcessor.h
index 74e714cb5f..ca143d1edb 100644
--- a/src/gpu/ccpr/GrCCPRTriangleProcessor.h
+++ b/src/gpu/ccpr/GrCCPRTriangleProcessor.h
@@ -72,11 +72,11 @@ class GrCCPRTriangleCornerProcessor : public GrCCPRTriangleProcessor {
public:
GrCCPRTriangleCornerProcessor()
: INHERITED(CoverageType::kShader)
- , fAABoxMatrices("aa_box_matrices", kHighFloat2x2_GrSLType, 2)
- , fAABoxTranslates("aa_box_translates", kHighFloat2_GrSLType, 2)
- , fGeoShaderBisects("bisects", kHighFloat2_GrSLType, 2)
- , fCornerLocationInAABoxes(kHighFloat2x2_GrSLType)
- , fBisectInAABoxes(kHighFloat2x2_GrSLType) {}
+ , fAABoxMatrices("aa_box_matrices", kFloat2x2_GrSLType, 2)
+ , fAABoxTranslates("aa_box_translates", kFloat2_GrSLType, 2)
+ , fGeoShaderBisects("bisects", kFloat2_GrSLType, 2)
+ , fCornerLocationInAABoxes(kFloat2x2_GrSLType)
+ , fBisectInAABoxes(kFloat2x2_GrSLType) {}
void resetVaryings(GrGLSLVaryingHandler* varyingHandler) override {
this->INHERITED::resetVaryings(varyingHandler);