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>
diff --git a/src/gpu/ccpr/GrCCPRPathProcessor.cpp b/src/gpu/ccpr/GrCCPRPathProcessor.cpp
index 1292553..203a0ec 100644
--- a/src/gpu/ccpr/GrCCPRPathProcessor.cpp
+++ b/src/gpu/ccpr/GrCCPRPathProcessor.cpp
@@ -120,12 +120,12 @@
const char* atlasAdjust;
fAtlasAdjustUniform = uniHandler->addUniform(
kVertex_GrShaderFlag,
- kVec2f_GrSLType, kHigh_GrSLPrecision, "atlas_adjust", &atlasAdjust);
+ kHighFloat2_GrSLType, "atlas_adjust", &atlasAdjust);
varyingHandler->emitAttributes(proc);
- GrGLSLVertToFrag texcoord(kVec2f_GrSLType);
- GrGLSLVertToFrag color(kVec4f_GrSLType);
+ GrGLSLVertToFrag texcoord(kHighFloat2_GrSLType);
+ GrGLSLVertToFrag color(kHalf4_GrSLType);
varyingHandler->addVarying("texcoord", &texcoord, kHigh_GrSLPrecision);
varyingHandler->addFlatPassThroughAttribute(&proc.getInstanceAttrib(InstanceAttribs::kColor),
args.fOutputColor, kLow_GrSLPrecision);
@@ -136,41 +136,41 @@
// 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("highp float2x2 N = float2x2(%s);", proc.getEdgeNormsAttrib().fName);
+ v->codeAppendf("highfloat2x2 N = highfloat2x2(%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("highp float2 refpt = (min(N[0].x, N[0].y) < 0) ? %s.xy : %s.zw;",
+ v->codeAppendf("highfloat2 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("highp float2 refpt45 = (N[1].x < 0) ? %s.xy : %s.zw;",
+ v->codeAppendf("highfloat2 refpt45 = (N[1].x < 0) ? %s.xy : %s.zw;",
proc.getInstanceAttrib(InstanceAttribs::kDevBounds45).fName,
proc.getInstanceAttrib(InstanceAttribs::kDevBounds45).fName);
- v->codeAppendf("refpt45 *= float2x2(.5,.5,-.5,.5);"); // transform back to device space.
+ v->codeAppendf("refpt45 *= highfloat2x2(.5,.5,-.5,.5);"); // transform back to device space.
v->codeAppendf("refpt45 += N[1] * %f;", kAABloatRadius); // bloat for AA.
- v->codeAppend ("highp float2 K = float2(dot(N[0], refpt), dot(N[1], refpt45));");
- v->codeAppendf("highp float2 octocoord = K * inverse(N);");
+ v->codeAppend ("highfloat2 K = highfloat2(dot(N[0], refpt), dot(N[1], refpt45));");
+ v->codeAppendf("highfloat2 octocoord = K * inverse(N);");
- gpArgs->fPositionVar.set(kVec2f_GrSLType, "octocoord");
+ gpArgs->fPositionVar.set(kHighFloat2_GrSLType, "octocoord");
// Convert to atlas coordinates in order to do our texture lookup.
- v->codeAppendf("highp float2 atlascoord = octocoord + float2(%s);",
+ v->codeAppendf("highfloat2 atlascoord = octocoord + highfloat2(%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 = float2(atlascoord.x * %s.x, 1 - atlascoord.y * %s.y);",
+ v->codeAppendf("%s = highfloat2(atlascoord.x * %s.x, 1 - atlascoord.y * %s.y);",
texcoord.vsOut(), atlasAdjust, atlasAdjust);
}
// Convert to (local) path cordinates.
- v->codeAppendf("highp float2 pathcoord = inverse(float2x2(%s)) * (octocoord - %s);",
+ v->codeAppendf("highfloat2 pathcoord = inverse(highfloat2x2(%s)) * (octocoord - %s);",
proc.getInstanceAttrib(InstanceAttribs::kViewMatrix).fName,
proc.getInstanceAttrib(InstanceAttribs::kViewTranslate).fName);
@@ -180,16 +180,16 @@
// Fragment shader.
GrGLSLPPFragmentBuilder* f = args.fFragBuilder;
- f->codeAppend ("mediump float coverage_count = ");
- f->appendTextureLookup(args.fTexSamplers[0], texcoord.fsIn(), kVec2f_GrSLType);
+ f->codeAppend ("half coverage_count = ");
+ f->appendTextureLookup(args.fTexSamplers[0], texcoord.fsIn(), kHighFloat2_GrSLType);
f->codeAppend (".a;");
if (SkPath::kWinding_FillType == proc.fillType()) {
- f->codeAppendf("%s = float4(min(abs(coverage_count), 1));", args.fOutputCoverage);
+ f->codeAppendf("%s = half4(min(abs(coverage_count), 1));", args.fOutputCoverage);
} else {
SkASSERT(SkPath::kEvenOdd_FillType == proc.fillType());
- f->codeAppend ("mediump float t = mod(abs(coverage_count), 2);");
- f->codeAppendf("%s = float4(1 - abs(t - 1));", args.fOutputCoverage);
+ f->codeAppend ("half t = mod(abs(coverage_count), 2);");
+ f->codeAppendf("%s = half4(1 - abs(t - 1));", args.fOutputCoverage);
}
}