diff options
author | Ethan Nicholas <ethannicholas@google.com> | 2017-09-20 11:24:15 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-09-22 13:54:38 +0000 |
commit | 8aa4569c139a7a7ac38c62b25e3af40309cc2ee2 (patch) | |
tree | 7a26824983b55df440a1c369798936da7f872351 /src | |
parent | b7d42e3c11a6e1d89e8b1af030511e935ee065ba (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')
57 files changed, 726 insertions, 733 deletions
diff --git a/src/effects/GrAlphaThresholdFragmentProcessor.cpp b/src/effects/GrAlphaThresholdFragmentProcessor.cpp index 3611e16948..34e9cdbb40 100644 --- a/src/effects/GrAlphaThresholdFragmentProcessor.cpp +++ b/src/effects/GrAlphaThresholdFragmentProcessor.cpp @@ -43,11 +43,10 @@ public: SkString sk_TransformedCoords2D_1 = fragBuilder->ensureCoords2D(args.fTransformedCoords[1]); fragBuilder->codeAppendf( "half4 _tmpVar1;half4 color = %stexture(%s, %s).%s%s;\nhalf4 mask_color = " - "texture(%s, %s).%s;\nif (highfloat(mask_color.w) < 0.5) {\n if (color.w > %s) " - "{\n half scale = %s / color.w;\n color.xyz *= scale;\n " - "color.w = %s;\n }\n} else if (color.w < %s) {\n half scale = highfloat(%s) " - "/ max(0.001, highfloat(color.w));\n color.xyz *= scale;\n color.w = " - "%s;\n}\n%s = color;\n", + "texture(%s, %s).%s;\nif (float(mask_color.w) < 0.5) {\n if (color.w > %s) {\n " + " half scale = %s / color.w;\n color.xyz *= scale;\n color.w = " + "%s;\n }\n} else if (color.w < %s) {\n half scale = float(%s) / max(0.001, " + "float(color.w));\n color.xyz *= scale;\n color.w = %s;\n}\n%s = color;\n", fColorSpaceHelper.isValid() ? "(_tmpVar1 = " : "", fragBuilder->getProgramBuilder()->samplerVariable(args.fTexSamplers[0]).c_str(), sk_TransformedCoords2D_0.c_str(), diff --git a/src/effects/GrCircleBlurFragmentProcessor.cpp b/src/effects/GrCircleBlurFragmentProcessor.cpp index b3d28f490a..6d63190391 100644 --- a/src/effects/GrCircleBlurFragmentProcessor.cpp +++ b/src/effects/GrCircleBlurFragmentProcessor.cpp @@ -266,10 +266,10 @@ public: fCircleDataVar = args.fUniformHandler->addUniform(kFragment_GrShaderFlag, kHalf4_GrSLType, kDefault_GrSLPrecision, "circleData"); fragBuilder->codeAppendf( - "half2 vec = half2(half((sk_FragCoord.x - highfloat(%s.x)) * highfloat(%s.w)), " - "half((sk_FragCoord.y - highfloat(%s.y)) * highfloat(%s.w)));\nhalf dist = " - "highfloat(length(vec)) + (0.5 - highfloat(%s.z)) * highfloat(%s.w);\n%s = %s * " - "texture(%s, highfloat2(half2(dist, 0.5))).%s.w;\n", + "half2 vec = half2(half((sk_FragCoord.x - float(%s.x)) * float(%s.w)), " + "half((sk_FragCoord.y - float(%s.y)) * float(%s.w)));\nhalf dist = " + "float(length(vec)) + (0.5 - float(%s.z)) * float(%s.w);\n%s = %s * texture(%s, " + "float2(half2(dist, 0.5))).%s.w;\n", args.fUniformHandler->getUniformCStr(fCircleDataVar), args.fUniformHandler->getUniformCStr(fCircleDataVar), args.fUniformHandler->getUniformCStr(fCircleDataVar), diff --git a/src/effects/SkBlurMaskFilter.cpp b/src/effects/SkBlurMaskFilter.cpp index 861a66d54b..0dc7ea19a7 100644 --- a/src/effects/SkBlurMaskFilter.cpp +++ b/src/effects/SkBlurMaskFilter.cpp @@ -889,10 +889,10 @@ void GrGLRectBlurEffect::emitCode(EmitArgs& args) { const char *rectName; const char *profileSizeName; - const char* floatType = rbe.precision() == kHigh_GrSLPrecision ? "highfloat" : "half"; + const char* floatType = rbe.precision() == kHigh_GrSLPrecision ? "float" : "half"; fProxyRectUniform = uniformHandler->addUniform(kFragment_GrShaderFlag, rbe.precision() == kHigh_GrSLPrecision ? - kHighFloat4_GrSLType : kHalf4_GrSLType, + kFloat4_GrSLType : kHalf4_GrSLType, "proxyRect", &rectName); fProfileSizeUniform = uniformHandler->addUniform(kFragment_GrShaderFlag, diff --git a/src/effects/SkDisplacementMapEffect.cpp b/src/effects/SkDisplacementMapEffect.cpp index 0ba6a296cf..97d18315ca 100644 --- a/src/effects/SkDisplacementMapEffect.cpp +++ b/src/effects/SkDisplacementMapEffect.cpp @@ -573,7 +573,7 @@ void GrGLDisplacementMapEffect::emitCode(EmitArgs& args) { "\t\t%s.rgb = (%s.a < %s) ? half3(0.0) : clamp(%s.rgb / %s.a, 0.0, 1.0);", dColor, dColor, nearZero, dColor, dColor); SkString coords2D = fragBuilder->ensureCoords2D(args.fTransformedCoords[1]); - fragBuilder->codeAppendf("\t\thighfloat2 %s = %s + %s*(%s.", + fragBuilder->codeAppendf("\t\tfloat2 %s = %s + %s*(%s.", cCoords, coords2D.c_str(), scaleUni, dColor); switch (displacementMap.xChannelSelector()) { diff --git a/src/effects/SkLightingImageFilter.cpp b/src/effects/SkLightingImageFilter.cpp index 10056e205d..37f1c7bb05 100644 --- a/src/effects/SkLightingImageFilter.cpp +++ b/src/effects/SkLightingImageFilter.cpp @@ -1880,7 +1880,7 @@ void GrGLLightingEffect::emitCode(EmitArgs& args) { normalBody.c_str(), &normalName); - fragBuilder->codeAppendf("\t\thighfloat2 coord = %s;\n", coords2D.c_str()); + fragBuilder->codeAppendf("\t\tfloat2 coord = %s;\n", coords2D.c_str()); fragBuilder->codeAppend("\t\thalf m[9];\n"); const char* imgInc = uniformHandler->getUniformCStr(fImageIncrementUni); @@ -2060,7 +2060,7 @@ void GrGLSpecularLightingEffect::emitLightFunc(GrGLSLUniformHandler* uniformHand }; SkString lightBody; lightBody.appendf("\thalf3 halfDir = half3(normalize(surfaceToLight + half3(0, 0, 1)));\n"); - lightBody.appendf("\thighfloat colorScale = %s * pow(dot(normal, halfDir), %s);\n", + lightBody.appendf("\tfloat colorScale = %s * pow(dot(normal, halfDir), %s);\n", ks, shininess); lightBody.appendf("\thalf3 color = lightColor * clamp(colorScale, 0.0, 1.0);\n"); lightBody.appendf("\treturn half4(color, max(max(color.r, color.g), color.b));\n"); diff --git a/src/effects/SkMagnifierImageFilter.cpp b/src/effects/SkMagnifierImageFilter.cpp index d989037319..1c529a93ca 100644 --- a/src/effects/SkMagnifierImageFilter.cpp +++ b/src/effects/SkMagnifierImageFilter.cpp @@ -193,13 +193,13 @@ void GrGLMagnifierEffect::emitCode(EmitArgs& args) { GrGLSLFPFragmentBuilder* fragBuilder = args.fFragBuilder; SkString coords2D = fragBuilder->ensureCoords2D(args.fTransformedCoords[0]); - fragBuilder->codeAppendf("\t\thighfloat2 coord = %s;\n", coords2D.c_str()); - fragBuilder->codeAppendf("\t\thighfloat2 zoom_coord = %s + %s * %s;\n", + fragBuilder->codeAppendf("\t\tfloat2 coord = %s;\n", coords2D.c_str()); + fragBuilder->codeAppendf("\t\tfloat2 zoom_coord = %s + %s * %s;\n", uniformHandler->getUniformCStr(fOffsetVar), coords2D.c_str(), uniformHandler->getUniformCStr(fInvZoomVar)); const char* bounds = uniformHandler->getUniformCStr(fBoundsVar); - fragBuilder->codeAppendf("\t\thighfloat2 delta = (coord - %s.xy) * %s.zw;\n", bounds, bounds); + fragBuilder->codeAppendf("\t\tfloat2 delta = (coord - %s.xy) * %s.zw;\n", bounds, bounds); fragBuilder->codeAppendf("\t\tdelta = min(delta, half2(1.0, 1.0) - delta);\n"); fragBuilder->codeAppendf("\t\tdelta = delta * %s;\n", uniformHandler->getUniformCStr(fInvInsetVar)); @@ -211,11 +211,11 @@ void GrGLMagnifierEffect::emitCode(EmitArgs& args) { fragBuilder->codeAppend("\t\t\tdist = max(2.0 - dist, 0.0);\n"); fragBuilder->codeAppend("\t\t\tweight = min(dist * dist, 1.0);\n"); fragBuilder->codeAppend("\t\t} else {\n"); - fragBuilder->codeAppend("\t\t\thighfloat2 delta_squared = delta * delta;\n"); + fragBuilder->codeAppend("\t\t\tfloat2 delta_squared = delta * delta;\n"); fragBuilder->codeAppend("\t\t\tweight = min(min(delta_squared.x, delta_squared.y), 1.0);\n"); fragBuilder->codeAppend("\t\t}\n"); - fragBuilder->codeAppend("\t\thighfloat2 mix_coord = mix(coord, zoom_coord, weight);\n"); + fragBuilder->codeAppend("\t\tfloat2 mix_coord = mix(coord, zoom_coord, weight);\n"); fragBuilder->codeAppend("\t\thalf4 output_color = "); fragBuilder->appendTextureLookup(args.fTexSamplers[0], "mix_coord", kHalf2_GrSLType, &fColorSpaceHelper); diff --git a/src/effects/SkMorphologyImageFilter.cpp b/src/effects/SkMorphologyImageFilter.cpp index a67e45a361..c9b4dc91da 100644 --- a/src/effects/SkMorphologyImageFilter.cpp +++ b/src/effects/SkMorphologyImageFilter.cpp @@ -214,7 +214,7 @@ void GrGLMorphologyEffect::emitCode(EmitArgs& args) { GrGLSLUniformHandler* uniformHandler = args.fUniformHandler; fPixelSizeUni = uniformHandler->addUniform(kFragment_GrShaderFlag, kHalf_GrSLType, "PixelSize"); const char* pixelSizeInc = uniformHandler->getUniformCStr(fPixelSizeUni); - fRangeUni = uniformHandler->addUniform(kFragment_GrShaderFlag, kHighFloat2_GrSLType, "Range"); + fRangeUni = uniformHandler->addUniform(kFragment_GrShaderFlag, kFloat2_GrSLType, "Range"); const char* range = uniformHandler->getUniformCStr(fRangeUni); GrGLSLFPFragmentBuilder* fragBuilder = args.fFragBuilder; @@ -251,12 +251,12 @@ void GrGLMorphologyEffect::emitCode(EmitArgs& args) { int width = me.width(); // float2 coord = coord2D; - fragBuilder->codeAppendf("\t\thighfloat2 coord = %s;\n", coords2D.c_str()); + fragBuilder->codeAppendf("\t\tfloat2 coord = %s;\n", coords2D.c_str()); // coord.x -= radius * pixelSize; fragBuilder->codeAppendf("\t\tcoord.%s -= %d.0 * %s; \n", dir, me.radius(), pixelSizeInc); if (me.useRange()) { // highBound = min(highBound, coord.x + (width-1) * pixelSize); - fragBuilder->codeAppendf("\t\thighfloat highBound = min(%s.y, coord.%s + %f * %s);", + fragBuilder->codeAppendf("\t\tfloat highBound = min(%s.y, coord.%s + %f * %s);", range, dir, float(width - 1), pixelSizeInc); // coord.x = max(lowBound, coord.x); fragBuilder->codeAppendf("\t\tcoord.%s = max(%s.x, coord.%s);", dir, range, dir); 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); diff --git a/src/gpu/effects/GrAtlasedShaderHelpers.h b/src/gpu/effects/GrAtlasedShaderHelpers.h index 57e30a3944..fae42ebbe7 100644 --- a/src/gpu/effects/GrAtlasedShaderHelpers.h +++ b/src/gpu/effects/GrAtlasedShaderHelpers.h @@ -50,12 +50,12 @@ static void append_multitexture_lookup(GrGLSLPrimitiveProcessor::EmitArgs& args, for (int i = 0; i < numTextureSamplers-1; ++i) { args.fFragBuilder->codeAppendf("if (%s == %d) { %s = ", texIdx.fsIn(), i, colorName); args.fFragBuilder->appendTextureLookup(args.fTexSamplers[i], coordName, - kHighFloat2_GrSLType); + kFloat2_GrSLType); args.fFragBuilder->codeAppend("; } else "); } args.fFragBuilder->codeAppendf("{ %s = ", colorName); args.fFragBuilder->appendTextureLookup(args.fTexSamplers[numTextureSamplers-1], coordName, - kHighFloat2_GrSLType); + kFloat2_GrSLType); args.fFragBuilder->codeAppend("; }"); } diff --git a/src/gpu/effects/GrBezierEffect.cpp b/src/gpu/effects/GrBezierEffect.cpp index 5848888208..9f5c8ca0e7 100644 --- a/src/gpu/effects/GrBezierEffect.cpp +++ b/src/gpu/effects/GrBezierEffect.cpp @@ -77,7 +77,7 @@ void GrGLConicEffect::onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) { // emit attributes varyingHandler->emitAttributes(gp); - GrGLSLVertToFrag v(kHighFloat4_GrSLType); + GrGLSLVertToFrag v(kFloat4_GrSLType); varyingHandler->addVarying("ConicCoeffs", &v, kHigh_GrSLPrecision); vertBuilder->codeAppendf("%s = %s;", v.vsOut(), gp.inConicCoeffs()->fName); @@ -106,14 +106,14 @@ void GrGLConicEffect::onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) { // that suffices. Additionally we should assert that the upstream code only lets us get here if // either float or half provides the required number of bits. - GrShaderVar edgeAlpha("edgeAlpha", kHighFloat_GrSLType, 0); - GrShaderVar dklmdx("dklmdx", kHighFloat3_GrSLType, 0); - GrShaderVar dklmdy("dklmdy", kHighFloat3_GrSLType, 0); - GrShaderVar dfdx("dfdx", kHighFloat_GrSLType, 0); - GrShaderVar dfdy("dfdy", kHighFloat_GrSLType, 0); - GrShaderVar gF("gF", kHighFloat2_GrSLType, 0); - GrShaderVar gFM("gFM", kHighFloat_GrSLType, 0); - GrShaderVar func("func", kHighFloat_GrSLType, 0); + GrShaderVar edgeAlpha("edgeAlpha", kFloat_GrSLType, 0); + GrShaderVar dklmdx("dklmdx", kFloat3_GrSLType, 0); + GrShaderVar dklmdy("dklmdy", kFloat3_GrSLType, 0); + GrShaderVar dfdx("dfdx", kFloat_GrSLType, 0); + GrShaderVar dfdy("dfdy", kFloat_GrSLType, 0); + GrShaderVar gF("gF", kFloat2_GrSLType, 0); + GrShaderVar gFM("gFM", kFloat_GrSLType, 0); + GrShaderVar func("func", kFloat_GrSLType, 0); fragBuilder->declAppend(edgeAlpha); fragBuilder->declAppend(dklmdx); @@ -138,7 +138,7 @@ void GrGLConicEffect::onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) { v.fsIn(), dklmdy.c_str(), v.fsIn(), dklmdy.c_str(), v.fsIn(), dklmdy.c_str()); - fragBuilder->codeAppendf("%s = highfloat2(%s, %s);", gF.c_str(), dfdx.c_str(), + fragBuilder->codeAppendf("%s = float2(%s, %s);", gF.c_str(), dfdx.c_str(), dfdy.c_str()); fragBuilder->codeAppendf("%s = sqrt(dot(%s, %s));", gFM.c_str(), gF.c_str(), gF.c_str()); @@ -168,7 +168,7 @@ void GrGLConicEffect::onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) { v.fsIn(), dklmdy.c_str(), v.fsIn(), dklmdy.c_str(), v.fsIn(), dklmdy.c_str()); - fragBuilder->codeAppendf("%s = highfloat2(%s, %s);", gF.c_str(), dfdx.c_str(), + fragBuilder->codeAppendf("%s = float2(%s, %s);", gF.c_str(), dfdx.c_str(), dfdy.c_str()); fragBuilder->codeAppendf("%s = sqrt(dot(%s, %s));", gFM.c_str(), gF.c_str(), gF.c_str()); @@ -185,7 +185,7 @@ void GrGLConicEffect::onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) { case kFillBW_GrProcessorEdgeType: { fragBuilder->codeAppendf("%s = %s.x * %s.x - %s.y * %s.z;", edgeAlpha.c_str(), v.fsIn(), v.fsIn(), v.fsIn(), v.fsIn()); - fragBuilder->codeAppendf("%s = highfloat(%s < 0.0);", + fragBuilder->codeAppendf("%s = float(%s < 0.0);", edgeAlpha.c_str(), edgeAlpha.c_str()); break; } @@ -197,7 +197,7 @@ void GrGLConicEffect::onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) { if (gp.coverageScale() != 0xff) { const char* coverageScale; fCoverageScaleUniform = uniformHandler->addUniform(kFragment_GrShaderFlag, - kHighFloat_GrSLType, + kFloat_GrSLType, "Coverage", &coverageScale); fragBuilder->codeAppendf("%s = half4(%s * %s);", @@ -554,25 +554,25 @@ void GrGLCubicEffect::onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) { // Setup KLM const char* devkLMMatrixName; - fDevKLMUniform = uniformHandler->addUniform(kVertex_GrShaderFlag, kHighFloat3x3_GrSLType, "KLM", + fDevKLMUniform = uniformHandler->addUniform(kVertex_GrShaderFlag, kFloat3x3_GrSLType, "KLM", &devkLMMatrixName); - GrGLSLVertToFrag v(kHighFloat3_GrSLType); + GrGLSLVertToFrag v(kFloat3_GrSLType); varyingHandler->addVarying("CubicCoeffs", &v, kHigh_GrSLPrecision); - vertBuilder->codeAppendf("%s = %s * highfloat3(%s, 1);", + vertBuilder->codeAppendf("%s = %s * float3(%s, 1);", v.vsOut(), devkLMMatrixName, gpArgs->fPositionVar.c_str()); - GrGLSLVertToFrag gradCoeffs(kHighFloat4_GrSLType); + GrGLSLVertToFrag gradCoeffs(kFloat4_GrSLType); if (kFillAA_GrProcessorEdgeType == fEdgeType || kHairlineAA_GrProcessorEdgeType == fEdgeType) { varyingHandler->addVarying("GradCoeffs", &gradCoeffs, kHigh_GrSLPrecision); - vertBuilder->codeAppendf("highfloat k = %s[0], l = %s[1], m = %s[2];", + vertBuilder->codeAppendf("float k = %s[0], l = %s[1], m = %s[2];", v.vsOut(), v.vsOut(), v.vsOut()); - vertBuilder->codeAppendf("highfloat2 gk = highfloat2(%s[0][0], %s[1][0]), " - "gl = highfloat2(%s[0][1], %s[1][1]), " - "gm = highfloat2(%s[0][2], %s[1][2]);", + vertBuilder->codeAppendf("float2 gk = float2(%s[0][0], %s[1][0]), " + "gl = float2(%s[0][1], %s[1][1]), " + "gm = float2(%s[0][2], %s[1][2]);", devkLMMatrixName, devkLMMatrixName, devkLMMatrixName, devkLMMatrixName, devkLMMatrixName, devkLMMatrixName); - vertBuilder->codeAppendf("%s = highfloat4(3 * k * gk, -m * gl - l * gm);", + vertBuilder->codeAppendf("%s = float4(3 * k * gk, -m * gl - l * gm);", gradCoeffs.vsOut()); } @@ -585,9 +585,9 @@ void GrGLCubicEffect::onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) { args.fFPCoordTransformHandler); - GrShaderVar edgeAlpha("edgeAlpha", kHighFloat_GrSLType, 0); - GrShaderVar gF("gF", kHighFloat2_GrSLType, 0); - GrShaderVar func("func", kHighFloat_GrSLType, 0); + GrShaderVar edgeAlpha("edgeAlpha", kFloat_GrSLType, 0); + GrShaderVar gF("gF", kFloat2_GrSLType, 0); + GrShaderVar func("func", kFloat_GrSLType, 0); fragBuilder->declAppend(edgeAlpha); fragBuilder->declAppend(gF); @@ -639,7 +639,7 @@ void GrGLCubicEffect::onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) { } - fragBuilder->codeAppendf("%s = highfloat4(%s);", args.fOutputCoverage, edgeAlpha.c_str()); + fragBuilder->codeAppendf("%s = float4(%s);", args.fOutputCoverage, edgeAlpha.c_str()); } void GrGLCubicEffect::GenKey(const GrGeometryProcessor& gp, diff --git a/src/gpu/effects/GrBicubicEffect.cpp b/src/gpu/effects/GrBicubicEffect.cpp index 743b9e094f..1a93977cf0 100644 --- a/src/gpu/effects/GrBicubicEffect.cpp +++ b/src/gpu/effects/GrBicubicEffect.cpp @@ -75,21 +75,21 @@ void GrGLBicubicEffect::emitCode(EmitArgs& args) { "-9.0 / 18.0, 0.0 / 18.0, 9.0 / 18.0, 0.0 / 18.0," "15.0 / 18.0, -36.0 / 18.0, 27.0 / 18.0, -6.0 / 18.0," "-7.0 / 18.0, 21.0 / 18.0, -21.0 / 18.0, 7.0 / 18.0);"); - fragBuilder->codeAppendf("highfloat2 coord = %s - %s * highfloat2(0.5);", coords2D.c_str(), imgInc); + fragBuilder->codeAppendf("float2 coord = %s - %s * float2(0.5);", coords2D.c_str(), imgInc); // We unnormalize the coord in order to determine our fractional offset (f) within the texel // We then snap coord to a texel center and renormalize. The snap prevents cases where the // starting coords are near a texel boundary and accumulations of imgInc would cause us to skip/ // double hit a texel. fragBuilder->codeAppendf("coord /= %s;", imgInc); - fragBuilder->codeAppend("highfloat2 f = fract(coord);"); - fragBuilder->codeAppendf("coord = (coord - f + highfloat2(0.5)) * %s;", imgInc); + fragBuilder->codeAppend("float2 f = fract(coord);"); + fragBuilder->codeAppendf("coord = (coord - f + float2(0.5)) * %s;", imgInc); fragBuilder->codeAppend("half4 wx = kMitchellCoefficients * half4(1.0, f.x, f.x * f.x, f.x * f.x * f.x);"); fragBuilder->codeAppend("half4 wy = kMitchellCoefficients * half4(1.0, f.y, f.y * f.y, f.y * f.y * f.y);"); fragBuilder->codeAppend("half4 rowColors[4];"); for (int y = 0; y < 4; ++y) { for (int x = 0; x < 4; ++x) { SkString coord; - coord.printf("coord + %s * highfloat2(%d, %d)", imgInc, x - 1, y - 1); + coord.printf("coord + %s * float2(%d, %d)", imgInc, x - 1, y - 1); SkString sampleVar; sampleVar.printf("rowColors[%d]", x); fDomain.sampleTexture(fragBuilder, diff --git a/src/gpu/effects/GrBitmapTextGeoProc.cpp b/src/gpu/effects/GrBitmapTextGeoProc.cpp index ad9695194d..0997b9ed7d 100644 --- a/src/gpu/effects/GrBitmapTextGeoProc.cpp +++ b/src/gpu/effects/GrBitmapTextGeoProc.cpp @@ -32,12 +32,12 @@ public: const char* atlasSizeInvName; fAtlasSizeInvUniform = uniformHandler->addUniform(kVertex_GrShaderFlag, - kHighFloat2_GrSLType, + kFloat2_GrSLType, kHigh_GrSLPrecision, "AtlasSizeInv", &atlasSizeInvName); - GrGLSLVertToFrag uv(kHighFloat2_GrSLType); + GrGLSLVertToFrag uv(kFloat2_GrSLType); GrGLSLVertToFrag texIdx(kHalf_GrSLType); append_index_uv_varyings(args, btgp.inTextureCoords()->fName, atlasSizeInvName, &uv, &texIdx, nullptr); diff --git a/src/gpu/effects/GrBlurredEdgeFragmentProcessor.cpp b/src/gpu/effects/GrBlurredEdgeFragmentProcessor.cpp index ff997cdec4..1f894cca33 100644 --- a/src/gpu/effects/GrBlurredEdgeFragmentProcessor.cpp +++ b/src/gpu/effects/GrBlurredEdgeFragmentProcessor.cpp @@ -25,10 +25,10 @@ public: args.fFp.cast<GrBlurredEdgeFragmentProcessor>(); (void)_outer; fragBuilder->codeAppendf( - "half factor = half(1.0 - highfloat(%s.w));\n@switch (%d) {\n case 0:\n " - "factor = half(exp(highfloat(highfloat(-factor * factor) * 4.0)) - " + "half factor = half(1.0 - float(%s.w));\n@switch (%d) {\n case 0:\n " + "factor = half(exp(float(float(-factor * factor) * 4.0)) - " "0.017999999999999999);\n break;\n case 1:\n factor = " - "half(smoothstep(1.0, 0.0, highfloat(factor)));\n break;\n}\n%s = " + "half(smoothstep(1.0, 0.0, float(factor)));\n break;\n}\n%s = " "half4(factor);\n", args.fInputColor ? args.fInputColor : "half4(1)", _outer.mode(), args.fOutputColor); } diff --git a/src/gpu/effects/GrCircleEffect.cpp b/src/gpu/effects/GrCircleEffect.cpp index 7b4a9f7794..ef4f9137ba 100644 --- a/src/gpu/effects/GrCircleEffect.cpp +++ b/src/gpu/effects/GrCircleEffect.cpp @@ -28,11 +28,11 @@ public: kDefault_GrSLPrecision, "circle"); fragBuilder->codeAppendf( "half2 prevCenter;\nhalf prevRadius = %f;\nhalf d;\n@if (%d == 2 || %d == 3) {\n " - " d = (highfloat(length((%s.xy - half2(sk_FragCoord.xy)) * %s.w)) - 1.0) * " - "%s.z;\n} else {\n d = half((1.0 - highfloat(length((%s.xy - " - "half2(sk_FragCoord.xy)) * %s.w))) * highfloat(%s.z));\n}\n@if ((%d == 1 || %d == " - "3) || %d == 4) {\n d = half(clamp(highfloat(d), 0.0, 1.0));\n} else {\n d = " - "half(highfloat(d) > 0.5 ? 1.0 : 0.0);\n}\n%s = %s * d;\n", + " d = (float(length((%s.xy - half2(sk_FragCoord.xy)) * %s.w)) - 1.0) * %s.z;\n} " + "else {\n d = half((1.0 - float(length((%s.xy - half2(sk_FragCoord.xy)) * " + "%s.w))) * float(%s.z));\n}\n@if ((%d == 1 || %d == 3) || %d == 4) {\n d = " + "half(clamp(float(d), 0.0, 1.0));\n} else {\n d = half(float(d) > 0.5 ? 1.0 : " + "0.0);\n}\n%s = %s * d;\n", prevRadius, _outer.edgeType(), _outer.edgeType(), args.fUniformHandler->getUniformCStr(fCircleVar), args.fUniformHandler->getUniformCStr(fCircleVar), diff --git a/src/gpu/effects/GrDistanceFieldGeoProc.cpp b/src/gpu/effects/GrDistanceFieldGeoProc.cpp index c7cd9bbd8d..44e52735bd 100644 --- a/src/gpu/effects/GrDistanceFieldGeoProc.cpp +++ b/src/gpu/effects/GrDistanceFieldGeoProc.cpp @@ -45,7 +45,7 @@ public: const char* atlasSizeInvName; fAtlasSizeInvUniform = uniformHandler->addUniform(kVertex_GrShaderFlag, - kHighFloat2_GrSLType, + kFloat2_GrSLType, kHigh_GrSLPrecision, "AtlasSizeInv", &atlasSizeInvName); @@ -77,9 +77,9 @@ public: args.fFPCoordTransformHandler); // add varyings - GrGLSLVertToFrag uv(kHighFloat2_GrSLType); + GrGLSLVertToFrag uv(kFloat2_GrSLType); GrGLSLVertToFrag texIdx(kHalf_GrSLType); - GrGLSLVertToFrag st(kHighFloat2_GrSLType); + GrGLSLVertToFrag st(kFloat2_GrSLType); append_index_uv_varyings(args, dfTexEffect.inTextureCoords()->fName, atlasSizeInvName, &uv, &texIdx, &st); @@ -92,7 +92,7 @@ public: SkToBool(dfTexEffect.getFlags() & kAliased_DistanceFieldEffectFlag); // Use highp to work around aliasing issues - fragBuilder->codeAppendf("highfloat2 uv = %s;\n", uv.fsIn()); + fragBuilder->codeAppendf("float2 uv = %s;\n", uv.fsIn()); fragBuilder->codeAppend("half4 texColor;"); append_multitexture_lookup(args, dfTexEffect.numTextureSamplers(), texIdx, "uv", "texColor"); @@ -340,14 +340,14 @@ public: const char* atlasSizeInvName; fAtlasSizeInvUniform = uniformHandler->addUniform(kVertex_GrShaderFlag, - kHighFloat2_GrSLType, + kFloat2_GrSLType, kHigh_GrSLPrecision, "AtlasSizeInv", &atlasSizeInvName); - GrGLSLVertToFrag uv(kHighFloat2_GrSLType); + GrGLSLVertToFrag uv(kFloat2_GrSLType); GrGLSLVertToFrag texIdx(kHalf_GrSLType); - GrGLSLVertToFrag st(kHighFloat2_GrSLType); + GrGLSLVertToFrag st(kFloat2_GrSLType); append_index_uv_varyings(args, dfTexEffect.inTextureCoords()->fName, atlasSizeInvName, &uv, &texIdx, &st); @@ -371,7 +371,7 @@ public: args.fFPCoordTransformHandler); // Use highp to work around aliasing issues - fragBuilder->codeAppendf("highfloat2 uv = %s;", uv.fsIn()); + fragBuilder->codeAppendf("float2 uv = %s;", uv.fsIn()); fragBuilder->codeAppend("half4 texColor;"); append_multitexture_lookup(args, dfTexEffect.numTextureSamplers(), texIdx, "uv", "texColor"); @@ -599,7 +599,7 @@ public: const char* atlasSizeInvName; fAtlasSizeInvUniform = uniformHandler->addUniform(kVertex_GrShaderFlag, - kHighFloat2_GrSLType, + kFloat2_GrSLType, kHigh_GrSLPrecision, "AtlasSizeInv", &atlasSizeInvName); @@ -626,13 +626,13 @@ public: args.fFPCoordTransformHandler); // set up varyings - GrGLSLVertToFrag uv(kHighFloat2_GrSLType); + GrGLSLVertToFrag uv(kFloat2_GrSLType); GrGLSLVertToFrag texIdx(kHalf_GrSLType); - GrGLSLVertToFrag st(kHighFloat2_GrSLType); + GrGLSLVertToFrag st(kFloat2_GrSLType); append_index_uv_varyings(args, dfTexEffect.inTextureCoords()->fName, atlasSizeInvName, &uv, &texIdx, &st); - GrGLSLVertToFrag delta(kHighFloat_GrSLType); + GrGLSLVertToFrag delta(kFloat_GrSLType); varyingHandler->addVarying("Delta", &delta, kHigh_GrSLPrecision); if (dfTexEffect.getFlags() & kBGR_DistanceFieldEffectFlag) { vertBuilder->codeAppendf("%s = -%s.x/3.0;", delta.vsOut(), atlasSizeInvName); @@ -649,7 +649,7 @@ public: // create LCD offset adjusted by inverse of transform // Use highp to work around aliasing issues - fragBuilder->codeAppendf("highfloat2 uv = %s;\n", uv.fsIn()); + fragBuilder->codeAppendf("float2 uv = %s;\n", uv.fsIn()); if (isUniformScale) { #ifdef SK_VULKAN diff --git a/src/gpu/effects/GrDitherEffect.cpp b/src/gpu/effects/GrDitherEffect.cpp index 6f5266e738..158c47e86d 100644 --- a/src/gpu/effects/GrDitherEffect.cpp +++ b/src/gpu/effects/GrDitherEffect.cpp @@ -30,12 +30,12 @@ public: "0.066666666666666666;\n break;\n}\n@if (sk_Caps.integerSupport) {\n " "uint x = uint(sk_FragCoord.x);\n uint y = uint(sk_FragCoord.y);\n uint m = " "(((((y & 1) << 5 | (x & 1) << 4) | (y & 2) << 2) | (x & 2) << 1) | (y & 4) >> 1) " - "| (x & 4) >> 2;\n value = highfloat(highfloat(half(m)) / 64.0) - 0.4921875;\n} " - "else {\n half4 modValues = half4(mod(sk_FragCoord.xyxy, highfloat4(half4(2.0, " - "2.0, 4.0, 4.0))));\n half4 stepValues = half4(step(highfloat4(modValues), " - "highfloat4(half4(1.0, 1.0, 2.0, 2.0))));\n value = highfloat(dot(stepValues, " - "half4(0.5, 0.25, 0.125, 0.0625))) - 0.46875;\n}\n%s = " - "half4(clamp(highfloat3(%s.xyz + value * range), 0.0, highfloat(%s.w)), %s.w);\n", + "| (x & 4) >> 2;\n value = float(float(half(m)) / 64.0) - 0.4921875;\n} else " + "{\n half4 modValues = half4(mod(sk_FragCoord.xyxy, float4(half4(2.0, 2.0, 4.0, " + "4.0))));\n half4 stepValues = half4(step(float4(modValues), float4(half4(1.0, " + "1.0, 2.0, 2.0))));\n value = float(dot(stepValues, half4(0.5, 0.25, 0.125, " + "0.0625))) - 0.46875;\n}\n%s = half4(clamp(float3(%s.xyz + value * range), 0.0, " + "float(%s.w)), %s.w);\n", _outer.rangeType(), args.fOutputColor, args.fInputColor ? args.fInputColor : "half4(1)", args.fInputColor ? args.fInputColor : "half4(1)", diff --git a/src/gpu/effects/GrEllipseEffect.cpp b/src/gpu/effects/GrEllipseEffect.cpp index 3f35311717..0790211e8c 100644 --- a/src/gpu/effects/GrEllipseEffect.cpp +++ b/src/gpu/effects/GrEllipseEffect.cpp @@ -25,7 +25,7 @@ public: (void)_outer; prevRadii = half2(-1.0); useScale = sk_Caps.floatPrecisionVaries; - fEllipseVar = args.fUniformHandler->addUniform(kFragment_GrShaderFlag, kHighFloat4_GrSLType, + fEllipseVar = args.fUniformHandler->addUniform(kFragment_GrShaderFlag, kFloat4_GrSLType, kDefault_GrSLPrecision, "ellipse"); if (useScale) { fScaleVar = args.fUniformHandler->addUniform(kFragment_GrShaderFlag, kHalf2_GrSLType, @@ -35,15 +35,14 @@ public: "half2 prevCenter;\nhalf2 prevRadii = half2(%f, %f);\nbool useScale = %s;\nhalf2 d " "= half2(sk_FragCoord.xy - %s.xy);\n@if (useScale) {\n d *= %s.y;\n}\nhalf2 Z = " "d * half2(%s.zw);\nhalf implicit = dot(Z, d) - 1.0;\nhalf grad_dot = 4.0 * dot(Z, " - "Z);\ngrad_dot = half(max(highfloat(grad_dot), 0.0001));\nhalf approx_dist = " - "highfloat(implicit) * inversesqrt(highfloat(grad_dot));\n@if (useScale) {\n " + "Z);\ngrad_dot = half(max(float(grad_dot), 0.0001));\nhalf approx_dist = " + "float(implicit) * inversesqrt(float(grad_dot));\n@if (useScale) {\n " "approx_dist *= %s.x;\n}\nhalf alpha;\n@switch (%d) {\n case 0:\n alpha " - "= half(highfloat(approx_dist) > 0.0 ? 0.0 : 1.0);\n break;\n case 1:\n " - " alpha = half(clamp(0.5 - highfloat(approx_dist), 0.0, 1.0));\n " - "break;\n case 2:\n alpha = half(highfloat(approx_dist) > 0.0 ? 1.0 : " - "0.0);\n break;\n case 3:\n alpha = half(clamp(0.5 + " - "highfloat(approx_dist), 0.0, 1.0));\n break;\n default:\n " - "discard;\n}\n%s = %s * alpha;\n", + "= half(float(approx_dist) > 0.0 ? 0.0 : 1.0);\n break;\n case 1:\n " + " alpha = half(clamp(0.5 - float(approx_dist), 0.0, 1.0));\n break;\n " + "case 2:\n alpha = half(float(approx_dist) > 0.0 ? 1.0 : 0.0);\n " + "break;\n case 3:\n alpha = half(clamp(0.5 + float(approx_dist), 0.0, " + "1.0));\n break;\n default:\n discard;\n}\n%s = %s * alpha;\n", prevRadii.fX, prevRadii.fY, (useScale ? "true" : "false"), args.fUniformHandler->getUniformCStr(fEllipseVar), fScaleVar.isValid() ? args.fUniformHandler->getUniformCStr(fScaleVar) : "half2(0)", diff --git a/src/gpu/effects/GrEllipseEffect.fp b/src/gpu/effects/GrEllipseEffect.fp index 3663d5622e..71e5d4d600 100644 --- a/src/gpu/effects/GrEllipseEffect.fp +++ b/src/gpu/effects/GrEllipseEffect.fp @@ -13,7 +13,7 @@ half2 prevCenter; half2 prevRadii = half2(-1); // The ellipse uniform is (center.x, center.y, 1 / rx^2, 1 / ry^2) // The last two terms can underflow with halfs, so we use floats. -uniform highfloat4 ellipse; +uniform float4 ellipse; bool useScale = sk_Caps.floatPrecisionVaries; layout(when=useScale) uniform half2 scale; diff --git a/src/gpu/effects/GrGaussianConvolutionFragmentProcessor.cpp b/src/gpu/effects/GrGaussianConvolutionFragmentProcessor.cpp index dfbe17a289..ee27aa82b5 100644 --- a/src/gpu/effects/GrGaussianConvolutionFragmentProcessor.cpp +++ b/src/gpu/effects/GrGaussianConvolutionFragmentProcessor.cpp @@ -64,8 +64,8 @@ void GrGLConvolutionEffect::emitCode(EmitArgs& args) { const GrShaderVar& kernel = uniformHandler->getUniformVariable(fKernelUni); const char* imgInc = uniformHandler->getUniformCStr(fImageIncrementUni); - fragBuilder->codeAppendf("highfloat2 coord = %s - %d.0 * %s;", coords2D.c_str(), ce.radius(), imgInc); - fragBuilder->codeAppend("highfloat2 coordSampled = half2(0, 0);"); + fragBuilder->codeAppendf("float2 coord = %s - %d.0 * %s;", coords2D.c_str(), ce.radius(), imgInc); + fragBuilder->codeAppend("float2 coordSampled = half2(0, 0);"); // Manually unroll loop because some drivers don't; yields 20-30% speedup. const char* kVecSuffix[4] = {".x", ".y", ".z", ".w"}; diff --git a/src/gpu/effects/GrMatrixConvolutionEffect.cpp b/src/gpu/effects/GrMatrixConvolutionEffect.cpp index 063f8f3772..73fce4d630 100644 --- a/src/gpu/effects/GrMatrixConvolutionEffect.cpp +++ b/src/gpu/effects/GrMatrixConvolutionEffect.cpp @@ -66,7 +66,7 @@ void GrGLMatrixConvolutionEffect::emitCode(EmitArgs& args) { GrGLSLFPFragmentBuilder* fragBuilder = args.fFragBuilder; SkString coords2D = fragBuilder->ensureCoords2D(args.fTransformedCoords[0]); fragBuilder->codeAppend("half4 sum = half4(0, 0, 0, 0);"); - fragBuilder->codeAppendf("highfloat2 coord = %s - %s * %s;", coords2D.c_str(), kernelOffset, imgInc); + fragBuilder->codeAppendf("float2 coord = %s - %s * %s;", coords2D.c_str(), kernelOffset, imgInc); fragBuilder->codeAppend("half4 c;"); const char* kVecSuffix[4] = { ".x", ".y", ".z", ".w" }; diff --git a/src/gpu/effects/GrTextureDomain.cpp b/src/gpu/effects/GrTextureDomain.cpp index c297560cea..671bec6012 100644 --- a/src/gpu/effects/GrTextureDomain.cpp +++ b/src/gpu/effects/GrTextureDomain.cpp @@ -87,7 +87,7 @@ void GrTextureDomain::GLDomain::sampleTexture(GrGLSLShaderBuilder* builder, case kIgnore_Mode: { builder->codeAppendf("%s = ", outColor); builder->appendTextureLookupAndModulate(inModulateColor, sampler, inCoords.c_str(), - kHighFloat2_GrSLType, colorXformHelper); + kFloat2_GrSLType, colorXformHelper); builder->codeAppend(";"); break; } @@ -98,7 +98,7 @@ void GrTextureDomain::GLDomain::sampleTexture(GrGLSLShaderBuilder* builder, builder->codeAppendf("%s = ", outColor); builder->appendTextureLookupAndModulate(inModulateColor, sampler, clampedCoords.c_str(), - kHighFloat2_GrSLType, colorXformHelper); + kFloat2_GrSLType, colorXformHelper); builder->codeAppend(";"); break; } @@ -117,11 +117,11 @@ void GrTextureDomain::GLDomain::sampleTexture(GrGLSLShaderBuilder* builder, builder->codeAppend("half4 outside = half4(0.0, 0.0, 0.0, 0.0);"); builder->codeAppend("half4 inside = "); builder->appendTextureLookupAndModulate(inModulateColor, sampler, inCoords.c_str(), - kHighFloat2_GrSLType, colorXformHelper); + kFloat2_GrSLType, colorXformHelper); builder->codeAppend(";"); - builder->codeAppendf("highfloat x = (%s).x;", inCoords.c_str()); - builder->codeAppendf("highfloat y = (%s).y;", inCoords.c_str()); + builder->codeAppendf("float x = (%s).x;", inCoords.c_str()); + builder->codeAppendf("float y = (%s).y;", inCoords.c_str()); builder->codeAppendf("x = abs(2.0*(x - %s.x)/(%s.z - %s.x) - 1.0);", domain, domain, domain); @@ -138,7 +138,7 @@ void GrTextureDomain::GLDomain::sampleTexture(GrGLSLShaderBuilder* builder, builder->codeAppendf("%s = any(outside) ? half4(0.0, 0.0, 0.0, 0.0) : ", outColor); builder->appendTextureLookupAndModulate(inModulateColor, sampler, inCoords.c_str(), - kHighFloat2_GrSLType, colorXformHelper); + kFloat2_GrSLType, colorXformHelper); builder->codeAppend(";"); } break; @@ -151,7 +151,7 @@ void GrTextureDomain::GLDomain::sampleTexture(GrGLSLShaderBuilder* builder, builder->codeAppendf("%s = ", outColor); builder->appendTextureLookupAndModulate(inModulateColor, sampler, clampedCoords.c_str(), - kHighFloat2_GrSLType, colorXformHelper); + kFloat2_GrSLType, colorXformHelper); builder->codeAppend(";"); break; } diff --git a/src/gpu/gl/GrGLGpu.cpp b/src/gpu/gl/GrGLGpu.cpp index 3f66819a77..d37befebb2 100644 --- a/src/gpu/gl/GrGLGpu.cpp +++ b/src/gpu/gl/GrGLGpu.cpp @@ -3748,7 +3748,7 @@ bool GrGLGpu::createStencilClipClearProgram() { vshaderTxt.append( "// Stencil Clip Clear Program VS\n" "void main() {" - " gl_Position = highfloat4(a_vertex.x, a_vertex.y, 0, 1);" + " gl_Position = float4(a_vertex.x, a_vertex.y, 0, 1);" "}"); SkString fshaderTxt(version); diff --git a/src/gpu/gl/GrGLProgramDataManager.cpp b/src/gpu/gl/GrGLProgramDataManager.cpp index a8e3a6345f..ab8dee6306 100644 --- a/src/gpu/gl/GrGLProgramDataManager.cpp +++ b/src/gpu/gl/GrGLProgramDataManager.cpp @@ -94,7 +94,7 @@ void GrGLProgramDataManager::set1iv(UniformHandle u, void GrGLProgramDataManager::set1f(UniformHandle u, float v0) const { const Uniform& uni = fUniforms[u.toIndex()]; - SkASSERT(uni.fType == kHighFloat_GrSLType || uni.fType == kHalf_GrSLType); + SkASSERT(uni.fType == kFloat_GrSLType || uni.fType == kHalf_GrSLType); SkASSERT(GrShaderVar::kNonArray == uni.fArrayCount); if (kUnusedUniform != uni.fLocation) { GR_GL_CALL(fGpu->glInterface(), Uniform1f(uni.fLocation, v0)); @@ -105,7 +105,7 @@ void GrGLProgramDataManager::set1fv(UniformHandle u, int arrayCount, const float v[]) const { const Uniform& uni = fUniforms[u.toIndex()]; - SkASSERT(uni.fType == kHighFloat_GrSLType || uni.fType == kHalf_GrSLType); + SkASSERT(uni.fType == kFloat_GrSLType || uni.fType == kHalf_GrSLType); SkASSERT(arrayCount > 0); ASSERT_ARRAY_UPLOAD_IN_BOUNDS(uni, arrayCount); // This assert fires in some instances of the two-pt gradient for its VSParams. @@ -119,7 +119,7 @@ void GrGLProgramDataManager::set1fv(UniformHandle u, void GrGLProgramDataManager::set2f(UniformHandle u, float v0, float v1) const { const Uniform& uni = fUniforms[u.toIndex()]; - SkASSERT(uni.fType == kHighFloat2_GrSLType || uni.fType == kHalf2_GrSLType); + SkASSERT(uni.fType == kFloat2_GrSLType || uni.fType == kHalf2_GrSLType); SkASSERT(GrShaderVar::kNonArray == uni.fArrayCount); if (kUnusedUniform != uni.fLocation) { GR_GL_CALL(fGpu->glInterface(), Uniform2f(uni.fLocation, v0, v1)); @@ -130,7 +130,7 @@ void GrGLProgramDataManager::set2fv(UniformHandle u, int arrayCount, const float v[]) const { const Uniform& uni = fUniforms[u.toIndex()]; - SkASSERT(uni.fType == kHighFloat2_GrSLType || uni.fType == kHalf2_GrSLType); + SkASSERT(uni.fType == kFloat2_GrSLType || uni.fType == kHalf2_GrSLType); SkASSERT(arrayCount > 0); ASSERT_ARRAY_UPLOAD_IN_BOUNDS(uni, arrayCount); if (kUnusedUniform != uni.fLocation) { @@ -140,7 +140,7 @@ void GrGLProgramDataManager::set2fv(UniformHandle u, void GrGLProgramDataManager::set3f(UniformHandle u, float v0, float v1, float v2) const { const Uniform& uni = fUniforms[u.toIndex()]; - SkASSERT(uni.fType == kHighFloat3_GrSLType || uni.fType == kHalf3_GrSLType); + SkASSERT(uni.fType == kFloat3_GrSLType || uni.fType == kHalf3_GrSLType); SkASSERT(GrShaderVar::kNonArray == uni.fArrayCount); if (kUnusedUniform != uni.fLocation) { GR_GL_CALL(fGpu->glInterface(), Uniform3f(uni.fLocation, v0, v1, v2)); @@ -151,7 +151,7 @@ void GrGLProgramDataManager::set3fv(UniformHandle u, int arrayCount, const float v[]) const { const Uniform& uni = fUniforms[u.toIndex()]; - SkASSERT(uni.fType == kHighFloat3_GrSLType || uni.fType == kHalf3_GrSLType); + SkASSERT(uni.fType == kFloat3_GrSLType || uni.fType == kHalf3_GrSLType); SkASSERT(arrayCount > 0); ASSERT_ARRAY_UPLOAD_IN_BOUNDS(uni, arrayCount); if (kUnusedUniform != uni.fLocation) { @@ -165,7 +165,7 @@ void GrGLProgramDataManager::set4f(UniformHandle u, float v2, float v3) const { const Uniform& uni = fUniforms[u.toIndex()]; - SkASSERT(uni.fType == kHighFloat4_GrSLType || uni.fType == kHalf4_GrSLType); + SkASSERT(uni.fType == kFloat4_GrSLType || uni.fType == kHalf4_GrSLType); SkASSERT(GrShaderVar::kNonArray == uni.fArrayCount); if (kUnusedUniform != uni.fLocation) { GR_GL_CALL(fGpu->glInterface(), Uniform4f(uni.fLocation, v0, v1, v2, v3)); @@ -176,7 +176,7 @@ void GrGLProgramDataManager::set4fv(UniformHandle u, int arrayCount, const float v[]) const { const Uniform& uni = fUniforms[u.toIndex()]; - SkASSERT(uni.fType == kHighFloat4_GrSLType || uni.fType == kHalf4_GrSLType); + SkASSERT(uni.fType == kFloat4_GrSLType || uni.fType == kHalf4_GrSLType); SkASSERT(arrayCount > 0); ASSERT_ARRAY_UPLOAD_IN_BOUNDS(uni, arrayCount); if (kUnusedUniform != uni.fLocation) { @@ -214,7 +214,7 @@ template<int N> inline void GrGLProgramDataManager::setMatrices(UniformHandle u, int arrayCount, const float matrices[]) const { const Uniform& uni = fUniforms[u.toIndex()]; - SkASSERT(uni.fType == kHighFloat2x2_GrSLType + (N - 2) || + SkASSERT(uni.fType == kFloat2x2_GrSLType + (N - 2) || uni.fType == kHalf2x2_GrSLType + (N - 2)); SkASSERT(arrayCount > 0); ASSERT_ARRAY_UPLOAD_IN_BOUNDS(uni, arrayCount); @@ -247,9 +247,9 @@ void GrGLProgramDataManager::setPathFragmentInputTransform(VaryingHandle u, SkASSERT(fGpu->glCaps().shaderCaps()->pathRenderingSupport()); const PathProcVarying& fragmentInput = fPathProcVaryings[u.toIndex()]; - SkASSERT((components == 2 && (fragmentInput.fType == kHighFloat2_GrSLType || + SkASSERT((components == 2 && (fragmentInput.fType == kFloat2_GrSLType || fragmentInput.fType == kHalf2_GrSLType)) || - (components == 3 && (fragmentInput.fType == kHighFloat3_GrSLType || + (components == 3 && (fragmentInput.fType == kFloat3_GrSLType || fragmentInput.fType == kHalf3_GrSLType))); fGpu->glPathRendering()->setProgramPathFragmentInputTransform(fProgramID, diff --git a/src/gpu/glsl/GrGLSL.cpp b/src/gpu/glsl/GrGLSL.cpp index db8b7d6206..6067fa65af 100644 --- a/src/gpu/glsl/GrGLSL.cpp +++ b/src/gpu/glsl/GrGLSL.cpp @@ -38,20 +38,20 @@ const char* GrGLSLTypeString(const GrShaderCaps* shaderCaps, GrSLType t) { return "half3"; case kHalf4_GrSLType: return "half4"; - case kHighFloat_GrSLType: - return "highfloat"; - case kHighFloat2_GrSLType: - return "highfloat2"; - case kHighFloat3_GrSLType: - return "highfloat3"; - case kHighFloat4_GrSLType: - return "highfloat4"; + case kFloat_GrSLType: + return "float"; + case kFloat2_GrSLType: + return "float2"; + case kFloat3_GrSLType: + return "float3"; + case kFloat4_GrSLType: + return "float4"; case kUint2_GrSLType: if (shaderCaps->integerSupport()) { return "uint2"; } else { // uint2 (aka uvec2) isn't supported in GLSL ES 1.00/GLSL 1.20 - return "highfloat2"; + return "float2"; } case kInt2_GrSLType: return "int2"; @@ -59,12 +59,12 @@ const char* GrGLSLTypeString(const GrShaderCaps* shaderCaps, GrSLType t) { return "int3"; case kInt4_GrSLType: return "int4"; - case kHighFloat2x2_GrSLType: - return "highfloat2x2"; - case kHighFloat3x3_GrSLType: - return "highfloat3x3"; - case kHighFloat4x4_GrSLType: - return "highfloat4x4"; + case kFloat2x2_GrSLType: + return "float2x2"; + case kFloat3x3_GrSLType: + return "float3x3"; + case kFloat4x4_GrSLType: + return "float4x4"; case kHalf2x2_GrSLType: return "half2x2"; case kHalf3x3_GrSLType: diff --git a/src/gpu/glsl/GrGLSLBlend.cpp b/src/gpu/glsl/GrGLSLBlend.cpp index 254f4816cb..c08fe36730 100644 --- a/src/gpu/glsl/GrGLSLBlend.cpp +++ b/src/gpu/glsl/GrGLSLBlend.cpp @@ -146,7 +146,7 @@ static void add_lum_function(GrGLSLFragmentBuilder* fsBuilder, SkString* setLumF GrShaderVar getLumArgs[] = { GrShaderVar("color", kHalf3_GrSLType), }; - SkString getLumBody("return dot(highfloat3(0.3, 0.59, 0.11), color);"); + SkString getLumBody("return dot(float3(0.3, 0.59, 0.11), color);"); fsBuilder->emitFunction(kHalf_GrSLType, "luminance", SK_ARRAY_COUNT(getLumArgs), getLumArgs, diff --git a/src/gpu/glsl/GrGLSLFragmentShaderBuilder.cpp b/src/gpu/glsl/GrGLSLFragmentShaderBuilder.cpp index ad39497392..d5b1a8d1d4 100644 --- a/src/gpu/glsl/GrGLSLFragmentShaderBuilder.cpp +++ b/src/gpu/glsl/GrGLSLFragmentShaderBuilder.cpp @@ -112,14 +112,14 @@ bool GrGLSLFragmentShaderBuilder::enableFeature(GLSLFeature feature) { } SkString GrGLSLFragmentShaderBuilder::ensureCoords2D(const GrShaderVar& coords) { - if (kHighFloat3_GrSLType != coords.getType() && kHalf3_GrSLType != coords.getType()) { - SkASSERT(kHighFloat2_GrSLType == coords.getType() || kHalf2_GrSLType == coords.getType()); + if (kFloat3_GrSLType != coords.getType() && kHalf3_GrSLType != coords.getType()) { + SkASSERT(kFloat2_GrSLType == coords.getType() || kHalf2_GrSLType == coords.getType()); return coords.getName(); } SkString coords2D; coords2D.printf("%s_ensure2D", coords.c_str()); - this->codeAppendf("\thighfloat2 %s = %s.xy / %s.z;", coords2D.c_str(), coords.c_str(), + this->codeAppendf("\tfloat2 %s = %s.xy / %s.z;", coords2D.c_str(), coords.c_str(), coords.c_str()); return coords2D; } @@ -298,9 +298,9 @@ void GrGLSLFragmentShaderBuilder::defineSampleOffsetArray(const char* name, cons SkSTArray<16, SkPoint, true> offsets; offsets.push_back_n(specs.fEffectiveSampleCnt); m.mapPoints(offsets.begin(), specs.fSampleLocations, specs.fEffectiveSampleCnt); - this->definitions().appendf("const highfloat2 %s[] = highfloat2[](", name); + this->definitions().appendf("const float2 %s[] = float2[](", name); for (int i = 0; i < specs.fEffectiveSampleCnt; ++i) { - this->definitions().appendf("highfloat2(%f, %f)", offsets[i].x(), offsets[i].y()); + this->definitions().appendf("float2(%f, %f)", offsets[i].x(), offsets[i].y()); this->definitions().append(i + 1 != specs.fEffectiveSampleCnt ? ", " : ");\n"); } } diff --git a/src/gpu/glsl/GrGLSLGeometryProcessor.cpp b/src/gpu/glsl/GrGLSLGeometryProcessor.cpp index 072d62c509..8effbc7d6b 100644 --- a/src/gpu/glsl/GrGLSLGeometryProcessor.cpp +++ b/src/gpu/glsl/GrGLSLGeometryProcessor.cpp @@ -18,7 +18,7 @@ void GrGLSLGeometryProcessor::emitCode(EmitArgs& args) { GrGPArgs gpArgs; this->onEmitCode(args, &gpArgs); vBuilder->transformToNormalizedDeviceSpace(gpArgs.fPositionVar, args.fRTAdjustName); - if (kHighFloat2_GrSLType == gpArgs.fPositionVar.getType() || + if (kFloat2_GrSLType == gpArgs.fPositionVar.getType() || kHalf2_GrSLType == gpArgs.fPositionVar.getType()) { args.fVaryingHandler->setNoPerspective(); } @@ -40,13 +40,13 @@ void GrGLSLGeometryProcessor::emitTransforms(GrGLSLVertexBuilder* vb, uint32_t type = coordTransform->getMatrix().getType(); type |= localMatrix.getType(); - varyingType = SkToBool(SkMatrix::kPerspective_Mask & type) ? kHighFloat3_GrSLType : - kHighFloat2_GrSLType; + varyingType = SkToBool(SkMatrix::kPerspective_Mask & type) ? kFloat3_GrSLType : + kFloat2_GrSLType; const char* uniName; fInstalledTransforms.push_back().fHandle = uniformHandler->addUniform(kVertex_GrShaderFlag, - kHighFloat3x3_GrSLType, + kFloat3x3_GrSLType, strUniName.c_str(), &uniName).toIndex(); SkString strVaryingName; @@ -55,13 +55,13 @@ void GrGLSLGeometryProcessor::emitTransforms(GrGLSLVertexBuilder* vb, GrGLSLVertToFrag v(varyingType); varyingHandler->addVarying(strVaryingName.c_str(), &v, kHigh_GrSLPrecision); - SkASSERT(kHighFloat2_GrSLType == varyingType || kHighFloat3_GrSLType == varyingType); + SkASSERT(kFloat2_GrSLType == varyingType || kFloat3_GrSLType == varyingType); handler->specifyCoordsForCurrCoordTransform(SkString(v.fsIn()), varyingType); - if (kHighFloat2_GrSLType == varyingType) { - vb->codeAppendf("%s = (%s * highfloat3(%s, 1)).xy;", v.vsOut(), uniName, localCoords); + if (kFloat2_GrSLType == varyingType) { + vb->codeAppendf("%s = (%s * float3(%s, 1)).xy;", v.vsOut(), uniName, localCoords); } else { - vb->codeAppendf("%s = %s * highfloat3(%s, 1);", v.vsOut(), uniName, localCoords); + vb->codeAppendf("%s = %s * float3(%s, 1);", v.vsOut(), uniName, localCoords); } ++i; } @@ -85,8 +85,8 @@ void GrGLSLGeometryProcessor::setTransformDataHelper(const SkMatrix& localMatrix void GrGLSLGeometryProcessor::writeOutputPosition(GrGLSLVertexBuilder* vertBuilder, GrGPArgs* gpArgs, const char* posName) { - gpArgs->fPositionVar.set(kHighFloat2_GrSLType, "pos2"); - vertBuilder->codeAppendf("highfloat2 %s = %s;", gpArgs->fPositionVar.c_str(), posName); + gpArgs->fPositionVar.set(kFloat2_GrSLType, "pos2"); + vertBuilder->codeAppendf("float2 %s = %s;", gpArgs->fPositionVar.c_str(), posName); } void GrGLSLGeometryProcessor::writeOutputPosition(GrGLSLVertexBuilder* vertBuilder, @@ -96,21 +96,21 @@ void GrGLSLGeometryProcessor::writeOutputPosition(GrGLSLVertexBuilder* vertBuild const SkMatrix& mat, UniformHandle* viewMatrixUniform) { if (mat.isIdentity()) { - gpArgs->fPositionVar.set(kHighFloat2_GrSLType, "pos2"); - vertBuilder->codeAppendf("highfloat2 %s = %s;", gpArgs->fPositionVar.c_str(), posName); + gpArgs->fPositionVar.set(kFloat2_GrSLType, "pos2"); + vertBuilder->codeAppendf("float2 %s = %s;", gpArgs->fPositionVar.c_str(), posName); } else { const char* viewMatrixName; *viewMatrixUniform = uniformHandler->addUniform(kVertex_GrShaderFlag, - kHighFloat3x3_GrSLType, + kFloat3x3_GrSLType, "uViewM", &viewMatrixName); if (!mat.hasPerspective()) { - gpArgs->fPositionVar.set(kHighFloat2_GrSLType, "pos2"); - vertBuilder->codeAppendf("highfloat2 %s = (%s * highfloat3(%s, 1)).xy;", + gpArgs->fPositionVar.set(kFloat2_GrSLType, "pos2"); + vertBuilder->codeAppendf("float2 %s = (%s * float3(%s, 1)).xy;", gpArgs->fPositionVar.c_str(), viewMatrixName, posName); } else { - gpArgs->fPositionVar.set(kHighFloat3_GrSLType, "pos3"); - vertBuilder->codeAppendf("highfloat3 %s = %s * highfloat3(%s, 1);", + gpArgs->fPositionVar.set(kFloat3_GrSLType, "pos3"); + vertBuilder->codeAppendf("float3 %s = %s * float3(%s, 1);", gpArgs->fPositionVar.c_str(), viewMatrixName, posName); } } diff --git a/src/gpu/glsl/GrGLSLProgramBuilder.cpp b/src/gpu/glsl/GrGLSLProgramBuilder.cpp index c2a0d64e5a..07d6d209a6 100644 --- a/src/gpu/glsl/GrGLSLProgramBuilder.cpp +++ b/src/gpu/glsl/GrGLSLProgramBuilder.cpp @@ -82,7 +82,7 @@ void GrGLSLProgramBuilder::emitAndInstallPrimProc(const GrPrimitiveProcessor& pr rtAdjustVisibility |= kGeometry_GrShaderFlag; } fUniformHandles.fRTAdjustmentUni = this->uniformHandler()->addUniform(rtAdjustVisibility, - kHighFloat4_GrSLType, + kFloat4_GrSLType, "rtAdjustment"); const char* rtAdjustName = this->uniformHandler()->getUniformCStr(fUniformHandles.fRTAdjustmentUni); diff --git a/src/gpu/glsl/GrGLSLVertexShaderBuilder.cpp b/src/gpu/glsl/GrGLSLVertexShaderBuilder.cpp index 4e3b6446f8..e540494064 100644 --- a/src/gpu/glsl/GrGLSLVertexShaderBuilder.cpp +++ b/src/gpu/glsl/GrGLSLVertexShaderBuilder.cpp @@ -18,25 +18,25 @@ void GrGLSLVertexBuilder::transformToNormalizedDeviceSpace(const GrShaderVar& po const char* rtAdjustName) { // setup RT Uniform if (this->getProgramBuilder()->desc()->header().fSnapVerticesToPixelCenters) { - if (kHighFloat3_GrSLType == posVar.getType()) { + if (kFloat3_GrSLType == posVar.getType()) { const char* p = posVar.c_str(); - this->codeAppendf("{highfloat2 _posTmp = highfloat2(%s.x/%s.z, %s.y/%s.z);", p, p, p, p); + this->codeAppendf("{float2 _posTmp = float2(%s.x/%s.z, %s.y/%s.z);", p, p, p, p); } else { - SkASSERT(kHighFloat2_GrSLType == posVar.getType()); - this->codeAppendf("{highfloat2 _posTmp = %s;", posVar.c_str()); + SkASSERT(kFloat2_GrSLType == posVar.getType()); + this->codeAppendf("{float2 _posTmp = %s;", posVar.c_str()); } this->codeAppendf("_posTmp = floor(_posTmp) + half2(0.5, 0.5);" - "gl_Position = highfloat4(_posTmp.x * %s.x + %s.y," + "gl_Position = float4(_posTmp.x * %s.x + %s.y," "_posTmp.y * %s.z + %s.w, 0, 1);}", rtAdjustName, rtAdjustName, rtAdjustName, rtAdjustName); - } else if (kHighFloat3_GrSLType == posVar.getType()) { - this->codeAppendf("gl_Position = highfloat4(dot(%s.xz, %s.xy), dot(%s.yz, %s.zw), 0, %s.z);", + } else if (kFloat3_GrSLType == posVar.getType()) { + this->codeAppendf("gl_Position = float4(dot(%s.xz, %s.xy), dot(%s.yz, %s.zw), 0, %s.z);", posVar.c_str(), rtAdjustName, posVar.c_str(), rtAdjustName, posVar.c_str()); } else { - SkASSERT(kHighFloat2_GrSLType == posVar.getType()); - this->codeAppendf("gl_Position = highfloat4(%s.x * %s.x + %s.y, %s.y * %s.z + %s.w, 0, 1);", + SkASSERT(kFloat2_GrSLType == posVar.getType()); + this->codeAppendf("gl_Position = float4(%s.x * %s.x + %s.y, %s.y * %s.z + %s.w, 0, 1);", posVar.c_str(), rtAdjustName, rtAdjustName, posVar.c_str(), rtAdjustName, rtAdjustName); } diff --git a/src/gpu/instanced/InstanceProcessor.cpp b/src/gpu/instanced/InstanceProcessor.cpp index 75279395c0..3dcc3caf21 100644 --- a/src/gpu/instanced/InstanceProcessor.cpp +++ b/src/gpu/instanced/InstanceProcessor.cpp @@ -115,11 +115,11 @@ public: void fetchNextParam(const GrShaderCaps* shaderCaps, GrSLType type = kHalf4_GrSLType) const { SkASSERT(fParamsBuffer.isValid()); switch (type) { - case kHighFloat2_GrSLType: // fall through - case kHighFloat3_GrSLType: // fall through - case kHighFloat4_GrSLType: // fall through - case kHalf2_GrSLType: // fall through - case kHalf3_GrSLType: // fall through + case kFloat2_GrSLType: // fall through + case kFloat3_GrSLType: // fall through + case kFloat4_GrSLType: // fall through + case kHalf2_GrSLType: // fall through + case kHalf3_GrSLType: // fall through case kHalf4_GrSLType: break; default: @@ -127,15 +127,15 @@ public: } fVertexBuilder->appendTexelFetch(fParamsBuffer, "paramsIdx++"); switch (type) { - case kHighFloat2_GrSLType: // fall through + case kFloat2_GrSLType: // fall through case kHalf2_GrSLType: fVertexBuilder->codeAppend(".xy"); break; - case kHighFloat3_GrSLType: // fall through + case kFloat3_GrSLType: // fall through case kHalf3_GrSLType: fVertexBuilder->codeAppend(".xyz"); break; - case kHighFloat4_GrSLType: // fall through + case kFloat4_GrSLType: // fall through case kHalf4_GrSLType: break; default: @@ -401,8 +401,8 @@ void GLSLInstanceProcessor::onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) { v->codeAppend("}"); } - GrSLType positionType = ip.opInfo().fHasPerspective ? kHighFloat3_GrSLType : kHighFloat2_GrSLType; - v->codeAppendf("%s deviceCoords = highfloat3(%s, 1) * shapeMatrix;", + GrSLType positionType = ip.opInfo().fHasPerspective ? kFloat3_GrSLType : kFloat2_GrSLType; + v->codeAppendf("%s deviceCoords = float3(%s, 1) * shapeMatrix;", GrGLSLTypeString(args.fShaderCaps, positionType), backend->outShapeCoords()); gpArgs->fPositionVar.set(positionType, "deviceCoords"); @@ -1048,11 +1048,11 @@ void GLSLInstanceProcessor::BackendCoverage::emitArc(GrGLSLPPFragmentBuilder* f, ellipseCoords = "ellipseClampedCoords"; } // ellipseCoords are in pixel space and ellipseName is 1 / rx^2, 1 / ry^2. - f->codeAppendf("highfloat2 Z = %s * %s;", ellipseCoords, ellipseName); + f->codeAppendf("float2 Z = %s * %s;", ellipseCoords, ellipseName); // implicit is the evaluation of (x/rx)^2 + (y/ry)^2 - 1. - f->codeAppendf("highfloat implicit = dot(Z, %s) - 1.0;", ellipseCoords); + f->codeAppendf("float implicit = dot(Z, %s) - 1.0;", ellipseCoords); // gradDot is the squared length of the gradient of the implicit. - f->codeAppendf("highfloat gradDot = 4.0 * dot(Z, Z);"); + f->codeAppendf("float gradDot = 4.0 * dot(Z, Z);"); f->codeAppend ("half approxDist = implicit * inversesqrt(gradDot);"); f->codeAppendf("%s = clamp(0.5 - approxDist, 0.0, 1.0);", outCoverage); } @@ -1205,7 +1205,7 @@ void GLSLInstanceProcessor::BackendMultisample::setupRect(GrGLSLVertexBuilder* v } if (fArcTest.vsOut()) { // Pick a value that is not > 0. - v->codeAppendf("%s = highfloat2(0);", fArcTest.vsOut()); + v->codeAppendf("%s = float2(0);", fArcTest.vsOut()); } if (fTriangleIsArc.vsOut()) { v->codeAppendf("%s = 0;", fTriangleIsArc.vsOut()); @@ -1325,7 +1325,7 @@ GLSLInstanceProcessor::BackendMultisample::onInitInnerShape(GrGLSLVaryingHandler if (!fOpInfo.fHasPerspective) { varyingHandler->addFlatVarying("innerShapeInverseMatrix", &fInnerShapeInverseMatrix, kHigh_GrSLPrecision); - v->codeAppendf("%s = shapeInverseMatrix * highfloat2x2(outer2Inner.x, 0, 0, outer2Inner.y);", + v->codeAppendf("%s = shapeInverseMatrix * float2x2(outer2Inner.x, 0, 0, outer2Inner.y);", fInnerShapeInverseMatrix.vsOut()); varyingHandler->addFlatVarying("fragInnerShapeHalfSpan", &fFragInnerShapeHalfSpan, kHigh_GrSLPrecision); @@ -1370,7 +1370,7 @@ void GLSLInstanceProcessor::BackendMultisample::onEmitCode(GrGLSLVertexBuilder*, } if (kRect_ShapeFlag != (fOpInfo.fShapeTypes | fOpInfo.fInnerShapeTypes)) { - GrShaderVar x("x", kHighFloat2_GrSLType, GrShaderVar::kNonArray); + GrShaderVar x("x", kFloat2_GrSLType, GrShaderVar::kNonArray); f->emitFunction(kHalf_GrSLType, "square", 1, &x, "return dot(x, x);", &fSquareFun); } @@ -1393,7 +1393,7 @@ void GLSLInstanceProcessor::BackendMultisample::onEmitCode(GrGLSLVertexBuilder*, if (fOpInfo.fHasPerspective && fOpInfo.fInnerShapeTypes) { // This determines if the fragment should consider the inner shape in its sample mask. // We take the derivative early in case discards may occur before we get to the inner shape. - f->codeAppendf("highfloat2 fragInnerShapeApproxHalfSpan = 0.5 * fwidth(%s);", + f->codeAppendf("float2 fragInnerShapeApproxHalfSpan = 0.5 * fwidth(%s);", fInnerShapeCoords.fsIn()); } @@ -1410,7 +1410,7 @@ void GLSLInstanceProcessor::BackendMultisample::onEmitCode(GrGLSLVertexBuilder*, if (arcTest && fOpInfo.fHasPerspective) { // The non-perspective version accounts for fwidth() in the vertex shader. // We make sure to take the derivative here, before a neighbor pixel may early accept. - f->codeAppendf("highfloat2 arcTest = %s - 0.5 * fwidth(%s);", + f->codeAppendf("float2 arcTest = %s - 0.5 * fwidth(%s);", fArcTest.fsIn(), fArcTest.fsIn()); arcTest = "arcTest"; } @@ -1421,7 +1421,7 @@ void GLSLInstanceProcessor::BackendMultisample::onEmitCode(GrGLSLVertexBuilder*, if (arcTest) { // At this point, if the sample mask is all set it means we are inside an arc triangle. f->codeAppendf("if (gl_SampleMaskIn[0] == SAMPLE_MASK_ALL || " - "all(greaterThan(%s, highfloat2(0)))) {", arcTest); + "all(greaterThan(%s, float2(0)))) {", arcTest); this->emitArc(f, arcCoords, false, clampArcCoords, opts); f->codeAppend ("} else {"); this->emitRect(f, shapeCoords, opts); @@ -1494,10 +1494,10 @@ void GLSLInstanceProcessor::BackendMultisample::emitRect(GrGLSLPPFragmentBuilder } f->codeAppend ("int rectMask = 0;"); f->codeAppend ("for (int i = 0; i < SAMPLE_COUNT; i++) {"); - f->codeAppend ( "highfloat2 pt = "); + f->codeAppend ( "float2 pt = "); this->interpolateAtSample(f, *coords.fVarying, "i", coords.fInverseMatrix); f->codeAppend ( ";"); - f->codeAppend ( "if (all(lessThan(abs(pt), highfloat2(1)))) rectMask |= (1 << i);"); + f->codeAppend ( "if (all(lessThan(abs(pt), float2(1)))) rectMask |= (1 << i);"); f->codeAppend ("}"); this->acceptCoverageMask(f, "rectMask", opts); if (coords.fFragHalfSpan) { @@ -1529,12 +1529,12 @@ void GLSLInstanceProcessor::BackendMultisample::emitArc(GrGLSLPPFragmentBuilder* } f->codeAppend ( "int arcMask = 0;"); f->codeAppend ( "for (int i = 0; i < SAMPLE_COUNT; i++) {"); - f->codeAppend ( "highfloat2 pt = "); + f->codeAppend ( "float2 pt = "); this->interpolateAtSample(f, *coords.fVarying, "i", coords.fInverseMatrix); f->codeAppend ( ";"); if (clampCoords) { SkASSERT(!coordsMayBeNegative); - f->codeAppend ( "pt = max(pt, highfloat2(0));"); + f->codeAppend ( "pt = max(pt, float2(0));"); } f->codeAppendf( "if (%s(pt) < 1.0) arcMask |= (1 << i);", fSquareFun.c_str()); f->codeAppend ( "}"); @@ -1548,31 +1548,31 @@ void GLSLInstanceProcessor::BackendMultisample::emitSimpleRRect(GrGLSLPPFragment const EmitShapeCoords& coords, const char* rrect, const EmitShapeOpts& opts) { - f->codeAppendf("highfloat2 distanceToArcEdge = abs(%s) - %s.xy;", coords.fVarying->fsIn(), + f->codeAppendf("float2 distanceToArcEdge = abs(%s) - %s.xy;", coords.fVarying->fsIn(), rrect); - f->codeAppend ("if (any(lessThan(distanceToArcEdge, highfloat2(0)))) {"); + f->codeAppend ("if (any(lessThan(distanceToArcEdge, float2(0)))) {"); this->emitRect(f, coords, opts); f->codeAppend ("} else {"); if (coords.fInverseMatrix && coords.fFragHalfSpan) { - f->codeAppendf("highfloat2 rrectCoords = distanceToArcEdge * %s.zw;", rrect); - f->codeAppendf("highfloat2 fragRRectHalfSpan = %s * %s.zw;", coords.fFragHalfSpan, rrect); + f->codeAppendf("float2 rrectCoords = distanceToArcEdge * %s.zw;", rrect); + f->codeAppendf("float2 fragRRectHalfSpan = %s * %s.zw;", coords.fFragHalfSpan, rrect); f->codeAppendf("if (%s(rrectCoords + fragRRectHalfSpan) <= 1.0) {", fSquareFun.c_str()); // The entire pixel is inside the round rect. this->acceptOrRejectWholeFragment(f, true, opts); - f->codeAppendf("} else if (%s(max(rrectCoords - fragRRectHalfSpan, highfloat2(0))) >= 1.0) {", + f->codeAppendf("} else if (%s(max(rrectCoords - fragRRectHalfSpan, float2(0))) >= 1.0) {", fSquareFun.c_str()); // The entire pixel is outside the round rect. this->acceptOrRejectWholeFragment(f, false, opts); f->codeAppend ("} else {"); - f->codeAppendf( "highfloat2 s = %s.zw * sign(%s);", rrect, coords.fVarying->fsIn()); - f->codeAppendf( "highfloat2x2 innerRRectInverseMatrix = %s * " - "highfloat2x2(s.x, 0, 0, s.y);", coords.fInverseMatrix); + f->codeAppendf( "float2 s = %s.zw * sign(%s);", rrect, coords.fVarying->fsIn()); + f->codeAppendf( "float2x2 innerRRectInverseMatrix = %s * " + "float2x2(s.x, 0, 0, s.y);", coords.fInverseMatrix); f->codeAppend ( "highp int rrectMask = 0;"); f->codeAppend ( "for (int i = 0; i < SAMPLE_COUNT; i++) {"); - f->codeAppend ( "highfloat2 pt = rrectCoords + "); + f->codeAppend ( "float2 pt = rrectCoords + "); f->appendOffsetToSample("i", GrGLSLFPFragmentBuilder::kSkiaDevice_Coordinates); f->codeAppend ( "* innerRRectInverseMatrix;"); - f->codeAppendf( "if (%s(max(pt, highfloat2(0))) < 1.0) rrectMask |= (1 << i);", + f->codeAppendf( "if (%s(max(pt, float2(0))) < 1.0) rrectMask |= (1 << i);", fSquareFun.c_str()); f->codeAppend ( "}"); this->acceptCoverageMask(f, "rrectMask", opts); @@ -1580,10 +1580,10 @@ void GLSLInstanceProcessor::BackendMultisample::emitSimpleRRect(GrGLSLPPFragment } else { f->codeAppend ("int rrectMask = 0;"); f->codeAppend ("for (int i = 0; i < SAMPLE_COUNT; i++) {"); - f->codeAppend ( "highfloat2 shapePt = "); + f->codeAppend ( "float2 shapePt = "); this->interpolateAtSample(f, *coords.fVarying, "i", nullptr); f->codeAppend ( ";"); - f->codeAppendf( "highfloat2 rrectPt = max(abs(shapePt) - %s.xy, highfloat2(0)) * %s.zw;", + f->codeAppendf( "float2 rrectPt = max(abs(shapePt) - %s.xy, float2(0)) * %s.zw;", rrect, rrect); f->codeAppendf( "if (%s(rrectPt) < 1.0) rrectMask |= (1 << i);", fSquareFun.c_str()); f->codeAppend ("}"); diff --git a/src/gpu/ops/GrDashOp.cpp b/src/gpu/ops/GrDashOp.cpp index 5f886cdcf1..0d8ef94413 100644 --- a/src/gpu/ops/GrDashOp.cpp +++ b/src/gpu/ops/GrDashOp.cpp @@ -1092,13 +1092,13 @@ void GLDashingLineEffect::onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) { varyingHandler->emitAttributes(de); // XY refers to dashPos, Z is the dash interval length - GrGLSLVertToFrag inDashParams(kHighFloat3_GrSLType); + GrGLSLVertToFrag inDashParams(kFloat3_GrSLType); varyingHandler->addVarying("DashParams", &inDashParams, GrSLPrecision::kHigh_GrSLPrecision); 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(kHighFloat4_GrSLType); + GrGLSLVertToFrag inRectParams(kFloat4_GrSLType); varyingHandler->addVarying("RectParams", &inRectParams, GrSLPrecision::kHigh_GrSLPrecision); vertBuilder->codeAppendf("%s = %s;", inRectParams.vsOut(), de.inRectParams()->fName); diff --git a/src/gpu/ops/GrMSAAPathRenderer.cpp b/src/gpu/ops/GrMSAAPathRenderer.cpp index 21e2af8e95..c29fe12a7a 100644 --- a/src/gpu/ops/GrMSAAPathRenderer.cpp +++ b/src/gpu/ops/GrMSAAPathRenderer.cpp @@ -140,7 +140,7 @@ public: varyingHandler->emitAttributes(qp); varyingHandler->addPassThroughAttribute(qp.inColor(), args.fOutputColor); - GrGLSLVertToFrag uv(kHighFloat2_GrSLType); + GrGLSLVertToFrag uv(kFloat2_GrSLType); varyingHandler->addVarying("uv", &uv, kHigh_GrSLPrecision); vsBuilder->codeAppendf("%s = %s;", uv.vsOut(), qp.inUV()->fName); diff --git a/src/gpu/ops/GrOvalOpFactory.cpp b/src/gpu/ops/GrOvalOpFactory.cpp index 5b30c4a191..89e3afb3dd 100644 --- a/src/gpu/ops/GrOvalOpFactory.cpp +++ b/src/gpu/ops/GrOvalOpFactory.cpp @@ -119,7 +119,7 @@ private: // emit attributes varyingHandler->emitAttributes(cgp); - fragBuilder->codeAppend("highfloat4 circleEdge;"); + fragBuilder->codeAppend("float4 circleEdge;"); varyingHandler->addPassThroughAttribute(cgp.fInCircleEdge, "circleEdge", kHigh_GrSLPrecision); if (cgp.fInClipPlane) { @@ -152,7 +152,7 @@ private: cgp.fLocalMatrix, args.fFPCoordTransformHandler); - fragBuilder->codeAppend("highfloat d = length(circleEdge.xy);"); + fragBuilder->codeAppend("float d = length(circleEdge.xy);"); fragBuilder->codeAppend("half distanceToOuterEdge = circleEdge.z * (1.0 - d);"); fragBuilder->codeAppend("half edgeAlpha = clamp(distanceToOuterEdge, 0.0, 1.0);"); if (cgp.fStroke) { diff --git a/src/gpu/ops/GrTextureOp.cpp b/src/gpu/ops/GrTextureOp.cpp index 5dc30f31d2..724d26b981 100644 --- a/src/gpu/ops/GrTextureOp.cpp +++ b/src/gpu/ops/GrTextureOp.cpp @@ -115,7 +115,7 @@ public: args.fVaryingHandler->addPassThroughAttribute(&textureGP.fColors, args.fOutputColor); } - args.fFragBuilder->codeAppend("highfloat2 texCoord;"); + args.fFragBuilder->codeAppend("float2 texCoord;"); args.fVaryingHandler->addPassThroughAttribute(&textureGP.fTextureCoords, "texCoord", kHigh_GrSLPrecision); if (textureGP.numTextureSamplers() > 1) { @@ -134,7 +134,7 @@ public: args.fFragBuilder->appendTextureLookupAndModulate(args.fOutputColor, args.fTexSamplers[i], "texCoord", - kHighFloat2_GrSLType, + kFloat2_GrSLType, &fColorSpaceXformHelper); args.fFragBuilder->codeAppend("; break;"); } @@ -144,11 +144,11 @@ public: args.fFragBuilder->appendTextureLookupAndModulate(args.fOutputColor, args.fTexSamplers[0], "texCoord", - kHighFloat2_GrSLType, + kFloat2_GrSLType, &fColorSpaceXformHelper); } args.fFragBuilder->codeAppend(";"); - args.fFragBuilder->codeAppendf("%s = highfloat4(1);", args.fOutputCoverage); + args.fFragBuilder->codeAppendf("%s = float4(1);", args.fOutputCoverage); } GrGLSLColorSpaceXformHelper fColorSpaceXformHelper; }; diff --git a/src/gpu/vk/GrVkCopyManager.cpp b/src/gpu/vk/GrVkCopyManager.cpp index 7ab47e9cf0..d27997d9dd 100644 --- a/src/gpu/vk/GrVkCopyManager.cpp +++ b/src/gpu/vk/GrVkCopyManager.cpp @@ -47,7 +47,7 @@ bool GrVkCopyManager::createCopyProgram(GrVkGpu* gpu) { "half4 uPosXform;" "half4 uTexCoordXform;" "};" - "layout(location = 0) in highfloat2 inPosition;" + "layout(location = 0) in float2 inPosition;" "layout(location = 1) out half2 vTexCoord;" "// Copy Program VS\n" diff --git a/src/gpu/vk/GrVkPipelineStateDataManager.cpp b/src/gpu/vk/GrVkPipelineStateDataManager.cpp index 378ec0f0d8..d236b5bf60 100644 --- a/src/gpu/vk/GrVkPipelineStateDataManager.cpp +++ b/src/gpu/vk/GrVkPipelineStateDataManager.cpp @@ -85,7 +85,7 @@ void GrVkPipelineStateDataManager::set1iv(UniformHandle u, void GrVkPipelineStateDataManager::set1f(UniformHandle u, float v0) const { const Uniform& uni = fUniforms[u.toIndex()]; - SkASSERT(uni.fType == kHighFloat_GrSLType || uni.fType == kHalf_GrSLType); + SkASSERT(uni.fType == kFloat_GrSLType || uni.fType == kHalf_GrSLType); SkASSERT(GrShaderVar::kNonArray == uni.fArrayCount); void* buffer = this->getBufferPtrAndMarkDirty(uni); SkASSERT(sizeof(float) == 4); @@ -96,7 +96,7 @@ void GrVkPipelineStateDataManager::set1fv(UniformHandle u, int arrayCount, const float v[]) const { const Uniform& uni = fUniforms[u.toIndex()]; - SkASSERT(uni.fType == kHighFloat_GrSLType || uni.fType == kHalf_GrSLType); + SkASSERT(uni.fType == kFloat_GrSLType || uni.fType == kHalf_GrSLType); SkASSERT(arrayCount > 0); SkASSERT(arrayCount <= uni.fArrayCount || (1 == arrayCount && GrShaderVar::kNonArray == uni.fArrayCount)); @@ -112,7 +112,7 @@ void GrVkPipelineStateDataManager::set1fv(UniformHandle u, void GrVkPipelineStateDataManager::set2f(UniformHandle u, float v0, float v1) const { const Uniform& uni = fUniforms[u.toIndex()]; - SkASSERT(uni.fType == kHighFloat2_GrSLType || uni.fType == kHalf2_GrSLType); + SkASSERT(uni.fType == kFloat2_GrSLType || uni.fType == kHalf2_GrSLType); SkASSERT(GrShaderVar::kNonArray == uni.fArrayCount); void* buffer = this->getBufferPtrAndMarkDirty(uni); SkASSERT(sizeof(float) == 4); @@ -124,7 +124,7 @@ void GrVkPipelineStateDataManager::set2fv(UniformHandle u, int arrayCount, const float v[]) const { const Uniform& uni = fUniforms[u.toIndex()]; - SkASSERT(uni.fType == kHighFloat2_GrSLType || uni.fType == kHalf2_GrSLType); + SkASSERT(uni.fType == kFloat2_GrSLType || uni.fType == kHalf2_GrSLType); SkASSERT(arrayCount > 0); SkASSERT(arrayCount <= uni.fArrayCount || (1 == arrayCount && GrShaderVar::kNonArray == uni.fArrayCount)); @@ -140,7 +140,7 @@ void GrVkPipelineStateDataManager::set2fv(UniformHandle u, void GrVkPipelineStateDataManager::set3f(UniformHandle u, float v0, float v1, float v2) const { const Uniform& uni = fUniforms[u.toIndex()]; - SkASSERT(uni.fType == kHighFloat3_GrSLType || uni.fType == kHalf3_GrSLType); + SkASSERT(uni.fType == kFloat3_GrSLType || uni.fType == kHalf3_GrSLType); SkASSERT(GrShaderVar::kNonArray == uni.fArrayCount); void* buffer = this->getBufferPtrAndMarkDirty(uni); SkASSERT(sizeof(float) == 4); @@ -152,7 +152,7 @@ void GrVkPipelineStateDataManager::set3fv(UniformHandle u, int arrayCount, const float v[]) const { const Uniform& uni = fUniforms[u.toIndex()]; - SkASSERT(uni.fType == kHighFloat3_GrSLType || uni.fType == kHalf3_GrSLType); + SkASSERT(uni.fType == kFloat3_GrSLType || uni.fType == kHalf3_GrSLType); SkASSERT(arrayCount > 0); SkASSERT(arrayCount <= uni.fArrayCount || (1 == arrayCount && GrShaderVar::kNonArray == uni.fArrayCount)); @@ -172,7 +172,7 @@ void GrVkPipelineStateDataManager::set4f(UniformHandle u, float v2, float v3) const { const Uniform& uni = fUniforms[u.toIndex()]; - SkASSERT(uni.fType == kHighFloat4_GrSLType || uni.fType == kHalf4_GrSLType); + SkASSERT(uni.fType == kFloat4_GrSLType || uni.fType == kHalf4_GrSLType); SkASSERT(GrShaderVar::kNonArray == uni.fArrayCount); void* buffer = this->getBufferPtrAndMarkDirty(uni); SkASSERT(sizeof(float) == 4); @@ -184,7 +184,7 @@ void GrVkPipelineStateDataManager::set4fv(UniformHandle u, int arrayCount, const float v[]) const { const Uniform& uni = fUniforms[u.toIndex()]; - SkASSERT(uni.fType == kHighFloat4_GrSLType || uni.fType == kHalf4_GrSLType); + SkASSERT(uni.fType == kFloat4_GrSLType || uni.fType == kHalf4_GrSLType); SkASSERT(arrayCount > 0); SkASSERT(arrayCount <= uni.fArrayCount || (1 == arrayCount && GrShaderVar::kNonArray == uni.fArrayCount)); @@ -230,7 +230,7 @@ template<int N> inline void GrVkPipelineStateDataManager::setMatrices(UniformHan int arrayCount, const float matrices[]) const { const Uniform& uni = fUniforms[u.toIndex()]; - SkASSERT(uni.fType == kHighFloat2x2_GrSLType + (N - 2) || + SkASSERT(uni.fType == kFloat2x2_GrSLType + (N - 2) || uni.fType == kHalf2x2_GrSLType + (N - 2)); SkASSERT(arrayCount > 0); SkASSERT(arrayCount <= uni.fArrayCount || diff --git a/src/gpu/vk/GrVkUniformHandler.cpp b/src/gpu/vk/GrVkUniformHandler.cpp index abd4b086ae..8bc024941b 100644 --- a/src/gpu/vk/GrVkUniformHandler.cpp +++ b/src/gpu/vk/GrVkUniformHandler.cpp @@ -23,16 +23,16 @@ uint32_t grsltype_to_alignment_mask(GrSLType type) { case kUint_GrSLType: return 0x3; case kHalf_GrSLType: // fall through - case kHighFloat_GrSLType: + case kFloat_GrSLType: return 0x3; case kHalf2_GrSLType: // fall through - case kHighFloat2_GrSLType: + case kFloat2_GrSLType: return 0x7; case kHalf3_GrSLType: // fall through - case kHighFloat3_GrSLType: + case kFloat3_GrSLType: return 0xF; case kHalf4_GrSLType: // fall through - case kHighFloat4_GrSLType: + case kFloat4_GrSLType: return 0xF; case kUint2_GrSLType: return 0x3; @@ -43,13 +43,13 @@ uint32_t grsltype_to_alignment_mask(GrSLType type) { case kInt4_GrSLType: return 0xF; case kHalf2x2_GrSLType: // fall through - case kHighFloat2x2_GrSLType: + case kFloat2x2_GrSLType: return 0x7; case kHalf3x3_GrSLType: // fall through - case kHighFloat3x3_GrSLType: + case kFloat3x3_GrSLType: return 0xF; case kHalf4x4_GrSLType: // fall through - case kHighFloat4x4_GrSLType: + case kFloat4x4_GrSLType: return 0xF; // This query is only valid for certain types. @@ -82,16 +82,16 @@ static inline uint32_t grsltype_to_vk_size(GrSLType type) { case kUint_GrSLType: return sizeof(int32_t); case kHalf_GrSLType: // fall through - case kHighFloat_GrSLType: + case kFloat_GrSLType: return sizeof(float); case kHalf2_GrSLType: // fall through - case kHighFloat2_GrSLType: + case kFloat2_GrSLType: return 2 * sizeof(float); case kHalf3_GrSLType: // fall through - case kHighFloat3_GrSLType: + case kFloat3_GrSLType: return 3 * sizeof(float); case kHalf4_GrSLType: // fall through - case kHighFloat4_GrSLType: + case kFloat4_GrSLType: return 4 * sizeof(float); case kUint2_GrSLType: return 2 * sizeof(uint16_t); @@ -102,14 +102,14 @@ static inline uint32_t grsltype_to_vk_size(GrSLType type) { case kInt4_GrSLType: return 4 * sizeof(int32_t); case kHalf2x2_GrSLType: // fall through - case kHighFloat2x2_GrSLType: + case kFloat2x2_GrSLType: //TODO: this will be 4 * szof(float) on std430. return 8 * sizeof(float); case kHalf3x3_GrSLType: // fall through - case kHighFloat3x3_GrSLType: + case kFloat3x3_GrSLType: return 12 * sizeof(float); case kHalf4x4_GrSLType: // fall through - case kHighFloat4x4_GrSLType: + case kFloat4x4_GrSLType: return 16 * sizeof(float); // This query is only valid for certain types. @@ -140,7 +140,7 @@ void get_ubo_aligned_offset(uint32_t* uniformOffset, int arrayCount) { uint32_t alignmentMask = grsltype_to_alignment_mask(type); // We want to use the std140 layout here, so we must make arrays align to 16 bytes. - if (arrayCount || type == kHighFloat2x2_GrSLType) { + if (arrayCount || type == kFloat2x2_GrSLType) { alignmentMask = 0xF; } uint32_t offsetDiff = *currentOffset & alignmentMask; diff --git a/src/gpu/vk/GrVkVaryingHandler.cpp b/src/gpu/vk/GrVkVaryingHandler.cpp index 887a422ad1..21c97717b3 100644 --- a/src/gpu/vk/GrVkVaryingHandler.cpp +++ b/src/gpu/vk/GrVkVaryingHandler.cpp @@ -13,16 +13,16 @@ static inline int grsltype_to_location_size(GrSLType type) { switch(type) { case kVoid_GrSLType: return 0; - case kHighFloat_GrSLType: // fall through + case kFloat_GrSLType: // fall through case kHalf_GrSLType: return 1; - case kHighFloat2_GrSLType: // fall through + case kFloat2_GrSLType: // fall through case kHalf2_GrSLType: return 1; - case kHighFloat3_GrSLType: + case kFloat3_GrSLType: case kHalf3_GrSLType: return 1; - case kHighFloat4_GrSLType: + case kFloat4_GrSLType: case kHalf4_GrSLType: return 1; case kUint2_GrSLType: @@ -33,13 +33,13 @@ static inline int grsltype_to_location_size(GrSLType type) { return 1; case kInt4_GrSLType: return 1; - case kHighFloat2x2_GrSLType: + case kFloat2x2_GrSLType: case kHalf2x2_GrSLType: return 2; - case kHighFloat3x3_GrSLType: + case kFloat3x3_GrSLType: case kHalf3x3_GrSLType: return 3; - case kHighFloat4x4_GrSLType: + case kFloat4x4_GrSLType: case kHalf4x4_GrSLType: return 4; case kTexture2DSampler_GrSLType: diff --git a/src/shaders/SkPerlinNoiseShader.cpp b/src/shaders/SkPerlinNoiseShader.cpp index bdbd5bd8a4..1f70d500d5 100644 --- a/src/shaders/SkPerlinNoiseShader.cpp +++ b/src/shaders/SkPerlinNoiseShader.cpp @@ -1258,7 +1258,7 @@ void GrGLImprovedPerlinNoise::emitCode(EmitArgs& args) { SkString permCode("return "); // FIXME even though I'm creating these textures with kRepeat_TileMode, they're clamped. Not // sure why. Using fract() (here and the next texture lookup) as a workaround. - fragBuilder->appendTextureLookup(&permCode, args.fTexSamplers[0], "highfloat2(fract(x / 256.0), 0.0)", + fragBuilder->appendTextureLookup(&permCode, args.fTexSamplers[0], "float2(fract(x / 256.0), 0.0)", kHalf2_GrSLType); permCode.append(".r * 255.0;"); fragBuilder->emitFunction(kHalf_GrSLType, "perm", SK_ARRAY_COUNT(permArgs), permArgs, @@ -1271,9 +1271,9 @@ void GrGLImprovedPerlinNoise::emitCode(EmitArgs& args) { }; SkString gradFuncName; SkString gradCode("return dot("); - fragBuilder->appendTextureLookup(&gradCode, args.fTexSamplers[1], "highfloat2(fract(x / 16.0), 0.0)", + fragBuilder->appendTextureLookup(&gradCode, args.fTexSamplers[1], "float2(fract(x / 16.0), 0.0)", kHalf2_GrSLType); - gradCode.append(".rgb * 255.0 - highfloat3(1.0), p);"); + gradCode.append(".rgb * 255.0 - float3(1.0), p);"); fragBuilder->emitFunction(kHalf_GrSLType, "grad", SK_ARRAY_COUNT(gradArgs), gradArgs, gradCode.c_str(), &gradFuncName); diff --git a/src/shaders/gradients/SkGradientShader.cpp b/src/shaders/gradients/SkGradientShader.cpp index 46d3ef6520..88990c7aaa 100644 --- a/src/shaders/gradients/SkGradientShader.cpp +++ b/src/shaders/gradients/SkGradientShader.cpp @@ -1359,7 +1359,7 @@ void GrGradientEffect::GLSLProcessor::emitUniforms(GrGLSLUniformHandler* uniform "Colors", colorCount); if (kSingleHardStop_ColorType == ge.fColorType || kThree_ColorType == ge.fColorType) { - fExtraStopT = uniformHandler->addUniform(kFragment_GrShaderFlag, kHighFloat4_GrSLType, + fExtraStopT = uniformHandler->addUniform(kFragment_GrShaderFlag, kFloat4_GrSLType, kHigh_GrSLPrecision, "ExtraStopT"); } } else { @@ -1684,7 +1684,7 @@ void GrGradientEffect::GLSLProcessor::emitColor(GrGLSLFPFragmentBuilder* fragBui fragBuilder->codeAppendf("half2 coord = half2(%s, %s);", gradientTValue, fsyuni); fragBuilder->codeAppendf("%s = ", outputColor); fragBuilder->appendTextureLookupAndModulate(inputColor, texSamplers[0], "coord", - kHighFloat2_GrSLType, &fColorSpaceHelper); + kFloat2_GrSLType, &fColorSpaceHelper); fragBuilder->codeAppend(";"); } diff --git a/src/sksl/README b/src/sksl/README index 329fa08ad7..40bdf1e329 100644 --- a/src/sksl/README +++ b/src/sksl/README @@ -13,6 +13,9 @@ before handing it over to the graphics driver. Differences from GLSL ===================== +* Precision modifiers are not used. 'float', 'int', and 'uint' are always high + precision. New types 'half', 'short', and 'ushort' are medium precision (we + do not use low precision). * Vector types are named <base type><columns>, so float2 instead of vec2 and bool4 instead of bvec4 * Matrix types are named <base type><columns>x<rows>, so float2x3 instead of @@ -38,8 +41,6 @@ Differences from GLSL * use sk_VertexID instead of gl_VertexID * the fragment coordinate is sk_FragCoord, and is always relative to the upper left. -* lowp, mediump, and highp are always permitted (but will only be respected if - you run on a device which supports them) * you do not need to include ".0" to make a number a float (meaning that "float2x, y) * 4" is perfectly legal in SkSL, unlike GLSL where it would often have to be expressed "float2x, y) * 4.0". There is no performance penalty for diff --git a/src/sksl/SkSLCPPCodeGenerator.cpp b/src/sksl/SkSLCPPCodeGenerator.cpp index 9d09a87335..b2227c2112 100644 --- a/src/sksl/SkSLCPPCodeGenerator.cpp +++ b/src/sksl/SkSLCPPCodeGenerator.cpp @@ -344,20 +344,20 @@ void CPPCodeGenerator::addUniform(const Variable& var) { } const char* type; if (var.fType == *fContext.fFloat_Type) { - type = "kHighFloat_GrSLType"; + type = "kFloat_GrSLType"; } else if (var.fType == *fContext.fHalf_Type) { type = "kHalf_GrSLType"; } else if (var.fType == *fContext.fFloat2_Type) { - type = "kHighFloat2_GrSLType"; + type = "kFloat2_GrSLType"; } else if (var.fType == *fContext.fHalf2_Type) { type = "kHalf2_GrSLType"; } else if (var.fType == *fContext.fFloat4_Type) { - type = "kHighFloat4_GrSLType"; + type = "kFloat4_GrSLType"; } else if (var.fType == *fContext.fHalf4_Type) { type = "kHalf4_GrSLType"; } else if (var.fType == *fContext.fFloat4x4_Type || var.fType == *fContext.fColorSpaceXform_Type) { - type = "kHighFloat4x4_GrSLType"; + type = "kFloat4x4_GrSLType"; } else if (var.fType == *fContext.fHalf4x4_Type) { type = "kHalf4x4_GrSLType"; } else { diff --git a/src/sksl/SkSLContext.h b/src/sksl/SkSLContext.h index 862a77730a..5061b61fd3 100644 --- a/src/sksl/SkSLContext.h +++ b/src/sksl/SkSLContext.h @@ -25,10 +25,10 @@ public: , fDouble2_Type(new Type("double2", *fDouble_Type, 2)) , fDouble3_Type(new Type("double3", *fDouble_Type, 3)) , fDouble4_Type(new Type("double4", *fDouble_Type, 4)) - , fFloat_Type(new Type("highfloat", Type::kFloat_NumberKind, 3)) - , fFloat2_Type(new Type("highfloat2", *fFloat_Type, 2)) - , fFloat3_Type(new Type("highfloat3", *fFloat_Type, 3)) - , fFloat4_Type(new Type("highfloat4", *fFloat_Type, 4)) + , fFloat_Type(new Type("float", Type::kFloat_NumberKind, 3)) + , fFloat2_Type(new Type("float2", *fFloat_Type, 2)) + , fFloat3_Type(new Type("float3", *fFloat_Type, 3)) + , fFloat4_Type(new Type("float4", *fFloat_Type, 4)) , fHalf_Type(new Type("half", Type::kFloat_NumberKind, 2)) , fHalf2_Type(new Type("half2", *fHalf_Type, 2)) , fHalf3_Type(new Type("half3", *fHalf_Type, 3)) @@ -53,15 +53,15 @@ public: , fBool2_Type(new Type("bool2", *fBool_Type, 2)) , fBool3_Type(new Type("bool3", *fBool_Type, 3)) , fBool4_Type(new Type("bool4", *fBool_Type, 4)) - , fFloat2x2_Type(new Type("highfloat2x2", *fFloat_Type, 2, 2)) - , fFloat2x3_Type(new Type("highfloat2x3", *fFloat_Type, 2, 3)) - , fFloat2x4_Type(new Type("highfloat2x4", *fFloat_Type, 2, 4)) - , fFloat3x2_Type(new Type("highfloat3x2", *fFloat_Type, 3, 2)) - , fFloat3x3_Type(new Type("highfloat3x3", *fFloat_Type, 3, 3)) - , fFloat3x4_Type(new Type("highfloat3x4", *fFloat_Type, 3, 4)) - , fFloat4x2_Type(new Type("highfloat4x2", *fFloat_Type, 4, 2)) - , fFloat4x3_Type(new Type("highfloat4x3", *fFloat_Type, 4, 3)) - , fFloat4x4_Type(new Type("highfloat4x4", *fFloat_Type, 4, 4)) + , fFloat2x2_Type(new Type("float2x2", *fFloat_Type, 2, 2)) + , fFloat2x3_Type(new Type("float2x3", *fFloat_Type, 2, 3)) + , fFloat2x4_Type(new Type("float2x4", *fFloat_Type, 2, 4)) + , fFloat3x2_Type(new Type("float3x2", *fFloat_Type, 3, 2)) + , fFloat3x3_Type(new Type("float3x3", *fFloat_Type, 3, 3)) + , fFloat3x4_Type(new Type("float3x4", *fFloat_Type, 3, 4)) + , fFloat4x2_Type(new Type("float4x2", *fFloat_Type, 4, 2)) + , fFloat4x3_Type(new Type("float4x3", *fFloat_Type, 4, 3)) + , fFloat4x4_Type(new Type("float4x4", *fFloat_Type, 4, 4)) , fHalf2x2_Type(new Type("half2x2", *fHalf_Type, 2, 2)) , fHalf2x3_Type(new Type("half2x3", *fHalf_Type, 2, 3)) , fHalf2x4_Type(new Type("half2x4", *fHalf_Type, 2, 4)) diff --git a/src/sksl/SkSLGLSLCodeGenerator.cpp b/src/sksl/SkSLGLSLCodeGenerator.cpp index c6b4806245..0729ad1e25 100644 --- a/src/sksl/SkSLGLSLCodeGenerator.cpp +++ b/src/sksl/SkSLGLSLCodeGenerator.cpp @@ -136,10 +136,6 @@ String GLSLCodeGenerator::getTypeName(const Type& type) { else if (type == *fContext.fUShort_Type) { return "uint"; } - else if (type == *fContext.fFloat_Type) { - // FIXME: temporary, this goes away when highfloat is renamed back to float - return "float"; - } else { return type.name(); } diff --git a/src/sksl/SkSLHCodeGenerator.cpp b/src/sksl/SkSLHCodeGenerator.cpp index 8203990df2..b06cd0bc06 100644 --- a/src/sksl/SkSLHCodeGenerator.cpp +++ b/src/sksl/SkSLHCodeGenerator.cpp @@ -23,15 +23,15 @@ HCodeGenerator::HCodeGenerator(const Program* program, ErrorReporter* errors, St , fSectionAndParameterHelper(*program, *errors) {} String HCodeGenerator::ParameterType(const Type& type) { - if (type.name() == "highfloat" || type.name() == "half") { + if (type.name() == "float" || type.name() == "half") { return "float"; - } else if (type.name() == "highfloat2" || type.name() == "half2") { + } else if (type.name() == "float2" || type.name() == "half2") { return "SkPoint"; } else if (type.name() == "int4" || type.name() == "short4") { return "SkIRect"; - } else if (type.name() == "highfloat4" || type.name() == "half4") { + } else if (type.name() == "float4" || type.name() == "half4") { return "SkRect"; - } else if (type.name() == "highfloat4x4" || type.name() == "half4x4") { + } else if (type.name() == "float4x4" || type.name() == "half4x4") { return "SkMatrix44"; } else if (type.kind() == Type::kSampler_Kind) { return "sk_sp<GrTextureProxy>"; diff --git a/src/sksl/sksl.include b/src/sksl/sksl.include index aab9930fc9..c8a7b6bd4b 100644 --- a/src/sksl/sksl.include +++ b/src/sksl/sksl.include @@ -43,14 +43,14 @@ $genType ceil($genType x); //$genDType ceil($genDType x); $genType fract($genType x); //$genDType fract($genDType x); -$genType mod($genType x, highfloat y); +$genType mod($genType x, float y); $genType mod($genType x, $genType y); //$genDType mod($genDType x, double y); //$genDType mod($genDType x, $genDType y); $genType modf($genType x, out $genType i); //$genDType modf($genDType x, out $genDType i); $genType min($genType x, $genType y); -$genType min($genType x, highfloat y); +$genType min($genType x, float y); //$genDType min($genDType x, $genDType y); //$genDType min($genDType x, double y); $genIType min($genIType x, $genIType y); @@ -58,7 +58,7 @@ $genIType min($genIType x, int y); //$genUType min($genUType x, $genUType y); //$genUType min($genUType x, uint y); $genType max($genType x, $genType y); -$genType max($genType x, highfloat y); +$genType max($genType x, float y); //$genDType max($genDType x, $genDType y); //$genDType max($genDType x, double y); $genIType max($genIType x, $genIType y); @@ -66,7 +66,7 @@ $genIType max($genIType x, int y); //$genUType max($genUType x, $genUType y); //$genUType max($genUType x, uint y); $genType clamp($genType x, $genType minVal, $genType maxVal); -$genType clamp($genType x, highfloat minVal, highfloat maxVal); +$genType clamp($genType x, float minVal, float maxVal); //$genDType clamp($genDType x, $genDType minVal, $genDType maxVal); //$genDType clamp($genDType x, double minVal, double maxVal); $genIType clamp($genIType x, $genIType minVal, $genIType maxVal); @@ -74,7 +74,7 @@ $genIType clamp($genIType x, int minVal, int maxVal); //$genUType clamp($genUType x, $genUType minVal, $genUType maxVal); //$genUType clamp($genUType x, uint minVal, uint maxVal); $genType mix($genType x, $genType y, $genType a); -$genType mix($genType x, $genType y, highfloat a); +$genType mix($genType x, $genType y, float a); //$genDType mix($genDType x, $genDType y, $genDType a); //$genDType mix($genDType x, $genDType y, double a); $genType mix($genType x, $genType y, $genBType a); @@ -83,21 +83,21 @@ $genIType mix($genIType x, $genIType y, $genBType a); //$genUType mix($genUType x, $genUType y, $genBType a); $genBType mix($genBType x, $genBType y, $genBType a); $genType step($genType edge, $genType x); -$genType step(highfloat edge, $genType x); +$genType step(float edge, $genType x); //$genDType step($genDType edge, $genDType x); //$genDType step(double edge, $genDType x); $genType smoothstep($genType edge0, $genType edge1, $genType x); -$genType smoothstep(highfloat edge0, highfloat edge1, $genType x); +$genType smoothstep(float edge0, float edge1, $genType x); //$genDType smoothstep($genDType edge0, $genDType edge1, $genDType x); //$genDType smoothstep(double edge0, double edge1, $genDType x); $genBType isnan($genType x); $genBType isnan($genDType x); $genBType isinf($genType x); $genBType isinf($genDType x); -$genIType highfloatBitsToInt($genType value); -//$genUType highfloatBitsToUint($genType value); -$genType intBitsTohighfloat($genIType value); -$genType uintBitsTohighfloat($genUType value); +$genIType floatBitsToInt($genType value); +//$genUType floatBitsToUint($genType value); +$genType intBitsTofloat($genIType value); +$genType uintBitsTofloat($genUType value); $genType fma($genType a, $genType b, $genType c); $genHType fma($genHType a, $genHType b, $genHType c); $genDType fma($genDType a, $genDType b, $genDType c); @@ -106,68 +106,68 @@ $genType frexp($genType x, out $genIType exp); //$genDType frexp($genDType x, out $genIType exp); $genType ldexp($genType x, in $genIType exp); //$genDType ldexp($genDType x, in $genIType exp); -uint packUnorm2x16(highfloat2 v); -uint packSnorm2x16(highfloat2 v); -uint packUnorm4x8(highfloat4 v); -uint packSnorm4x8(highfloat4 v); -highfloat2 unpackUnorm2x16(uint p); -highfloat2 unpackSnorm2x16(uint p); -highfloat4 unpackUnorm4x8(uint p); -highfloat4 unpackSnorm4x8(uint p); +uint packUnorm2x16(float2 v); +uint packSnorm2x16(float2 v); +uint packUnorm4x8(float4 v); +uint packSnorm4x8(float4 v); +float2 unpackUnorm2x16(uint p); +float2 unpackSnorm2x16(uint p); +float4 unpackUnorm4x8(uint p); +float4 unpackSnorm4x8(uint p); //double packDouble2x32(uint2 v); uint2 unpackDouble2x32(double v); -uint packHalf2x16(highfloat2 v); -highfloat2 unpackHalf2x16(uint v); -highfloat length($genType x); +uint packHalf2x16(float2 v); +float2 unpackHalf2x16(uint v); +float length($genType x); half length($genHType x); double length($genDType x); -highfloat distance($genType p0, $genType p1); +float distance($genType p0, $genType p1); half distance($genHType p0, $genHType p1); double distance($genDType p0, $genDType p1); -highfloat dot($genType x, $genType y); +float dot($genType x, $genType y); half dot($genHType x, $genHType y); double dot($genDType x, $genDType y); -highfloat3 cross(highfloat3 x, highfloat3 y); +float3 cross(float3 x, float3 y); half3 cross(half3 x, half3 y); double3 cross(double3 x, double3 y); $genType normalize($genType x); $genHType normalize($genHType x); $genDType normalize($genDType x); -highfloat4 ftransform(); +float4 ftransform(); $genType faceforward($genType N, $genType I, $genType Nref); $genHType faceforward($genHType N, $genHType I, $genHType Nref); $genDType faceforward($genDType N, $genDType I, $genDType Nref); $genType reflect($genType I, $genType N); $genHType reflect($genHType I, $genHType N); $genDType reflect($genDType I, $genDType N); -$genType refract($genType I, $genType N, highfloat eta); -$genHType refract($genHType I, $genHType N, highfloat eta); -$genDType refract($genDType I, $genDType N, highfloat eta); +$genType refract($genType I, $genType N, float eta); +$genHType refract($genHType I, $genHType N, float eta); +$genDType refract($genDType I, $genDType N, float eta); $mat matrixCompMult($mat x, $mat y); -highfloat2x2 outerProduct(highfloat2 c, highfloat2 r); -highfloat3x3 outerProduct(highfloat3 c, highfloat3 r); -highfloat4x3 outerProduct(highfloat4 c, highfloat4 r); -highfloat2x3 outerProduct(highfloat3 c, highfloat2 r); -highfloat3x2 outerProduct(highfloat2 c, highfloat3 r); -highfloat2x4 outerProduct(highfloat4 c, highfloat2 r); -highfloat4x2 outerProduct(highfloat2 c, highfloat4 r); -highfloat3x4 outerProduct(highfloat4 c, highfloat3 r); -highfloat4x3 outerProduct(highfloat3 c, highfloat4 r); -highfloat2x2 transpose(highfloat2x2 m); -highfloat3x3 transpose(highfloat3x3 m); -highfloat4x4 transpose(highfloat4x4 m); -highfloat2x3 transpose(highfloat3x2 m); -highfloat3x2 transpose(highfloat2x3 m); -highfloat2x4 transpose(highfloat4x2 m); -highfloat4x2 transpose(highfloat2x4 m); -highfloat3x4 transpose(highfloat4x3 m); -highfloat4x3 transpose(highfloat3x4 m); -highfloat determinant(highfloat2x2 m); -highfloat determinant(highfloat3x3 m); -highfloat determinant(highfloat4x4 m); -highfloat2x2 inverse(highfloat2x2 m); -highfloat3x3 inverse(highfloat3x3 m); -highfloat4x4 inverse(highfloat4x4 m); +float2x2 outerProduct(float2 c, float2 r); +float3x3 outerProduct(float3 c, float3 r); +float4x3 outerProduct(float4 c, float4 r); +float2x3 outerProduct(float3 c, float2 r); +float3x2 outerProduct(float2 c, float3 r); +float2x4 outerProduct(float4 c, float2 r); +float4x2 outerProduct(float2 c, float4 r); +float3x4 outerProduct(float4 c, float3 r); +float4x3 outerProduct(float3 c, float4 r); +float2x2 transpose(float2x2 m); +float3x3 transpose(float3x3 m); +float4x4 transpose(float4x4 m); +float2x3 transpose(float3x2 m); +float3x2 transpose(float2x3 m); +float2x4 transpose(float4x2 m); +float4x2 transpose(float2x4 m); +float3x4 transpose(float4x3 m); +float4x3 transpose(float3x4 m); +float determinant(float2x2 m); +float determinant(float3x3 m); +float determinant(float4x4 m); +float2x2 inverse(float2x2 m); +float3x3 inverse(float3x3 m); +float4x4 inverse(float4x4 m); $bvec lessThan($vec x, $vec y); $bvec lessThan($hvec x, $hvec y); $bvec lessThan($dvec x, $dvec y); @@ -254,19 +254,19 @@ int3 textureSize(sampler2DArrayShadow sampler, int lod); int textureSize($gsamplerBuffer sampler); int2 textureSize($gsampler2DMS sampler); int3 textureSize($gsampler2DMSArray sampler); -highfloat2 textureQueryLod($gsampler1D sampler, highfloat P); -highfloat2 textureQueryLod($gsampler2D sampler, highfloat2 P); -highfloat2 textureQueryLod($gsampler3D sampler, highfloat3 P); -highfloat2 textureQueryLod($gsamplerCube sampler, highfloat3 P); -highfloat2 textureQueryLod($gsampler1DArray sampler, highfloat P); -highfloat2 textureQueryLod($gsampler2DArray sampler, highfloat2 P); -highfloat2 textureQueryLod($gsamplerCubeArray sampler, highfloat3 P); -highfloat2 textureQueryLod(sampler1DShadow sampler, highfloat P); -highfloat2 textureQueryLod(sampler2DShadow sampler, highfloat2 P); -highfloat2 textureQueryLod(samplerCubeShadow sampler, highfloat3 P); -highfloat2 textureQueryLod(sampler1DArrayShadow sampler, highfloat P); -highfloat2 textureQueryLod(sampler2DArrayShadow sampler, highfloat2 P); -highfloat2 textureQueryLod(samplerCubeArrayShadow sampler, highfloat3 P); +float2 textureQueryLod($gsampler1D sampler, float P); +float2 textureQueryLod($gsampler2D sampler, float2 P); +float2 textureQueryLod($gsampler3D sampler, float3 P); +float2 textureQueryLod($gsamplerCube sampler, float3 P); +float2 textureQueryLod($gsampler1DArray sampler, float P); +float2 textureQueryLod($gsampler2DArray sampler, float2 P); +float2 textureQueryLod($gsamplerCubeArray sampler, float3 P); +float2 textureQueryLod(sampler1DShadow sampler, float P); +float2 textureQueryLod(sampler2DShadow sampler, float2 P); +float2 textureQueryLod(samplerCubeShadow sampler, float3 P); +float2 textureQueryLod(sampler1DArrayShadow sampler, float P); +float2 textureQueryLod(sampler2DArrayShadow sampler, float2 P); +float2 textureQueryLod(samplerCubeArrayShadow sampler, float3 P); int textureQueryLevels($gsampler1D sampler); int textureQueryLevels($gsampler2D sampler); int textureQueryLevels($gsampler3D sampler); @@ -282,50 +282,50 @@ int textureQueryLevels(sampler2DArrayShadow sampler); int textureQueryLevels(samplerCubeArrayShadow sampler); */ -half4 texture($gsampler1D sampler, highfloat P); -half4 texture($gsampler1D sampler, highfloat P, highfloat bias); -half4 texture($gsampler2D sampler, highfloat2 P); +half4 texture($gsampler1D sampler, float P); +half4 texture($gsampler1D sampler, float P, float bias); +half4 texture($gsampler2D sampler, float2 P); // The above currently only expand to handle the float/fixed case. So we also declare this integer // version of texture(). -int4 texture(isampler2D sampler, highfloat2 P); -half4 texture(samplerExternalOES sampler, highfloat2 P, highfloat bias); -half4 texture(samplerExternalOES sampler, highfloat2 P); +int4 texture(isampler2D sampler, float2 P); +half4 texture(samplerExternalOES sampler, float2 P, float bias); +half4 texture(samplerExternalOES sampler, float2 P); /* -$gfloat4 texture($gsampler2D sampler, highfloat2 P, highfloat bias); -$gfloat4 texture($gsampler3D sampler, highfloat3 P); -$gfloat4 texture($gsampler3D sampler, highfloat3 P, highfloat bias); -$gfloat4 texture($gsamplerCube sampler, highfloat3 P); -$gfloat4 texture($gsamplerCube sampler, highfloat3 P, highfloat bias); -highfloat texture(sampler1DShadow sampler, highfloat3 P); -highfloat texture(sampler1DShadow sampler, highfloat3 P, highfloat bias); -highfloat texture(sampler2DShadow sampler, highfloat3 P); -highfloat texture(sampler2DShadow sampler, highfloat3 P, highfloat bias); -highfloat texture(samplerCubeShadow sampler, highfloat4 P); -highfloat texture(samplerCubeShadow sampler, highfloat4 P, highfloat bias); -$gfloat4 texture($gsampler1DArray sampler, highfloat2 P); -$gfloat4 texture($gsampler1DArray sampler, highfloat2 P, highfloat bias); -$gfloat4 texture($gsampler2DArray sampler, highfloat3 P); -$gfloat4 texture($gsampler2DArray sampler, highfloat3 P, highfloat bias); -$gfloat4 texture($gsamplerCubeArray sampler, highfloat4 P); -$gfloat4 texture($gsamplerCubeArray sampler, highfloat4 P, highfloat bias); -highfloat texture(sampler1DArrayShadow sampler, highfloat3 P); -highfloat texture(sampler1DArrayShadow sampler, highfloat3 P, highfloat bias); -highfloat texture(sampler2DArrayShadow sampler, highfloat4 P); +$gfloat4 texture($gsampler2D sampler, float2 P, float bias); +$gfloat4 texture($gsampler3D sampler, float3 P); +$gfloat4 texture($gsampler3D sampler, float3 P, float bias); +$gfloat4 texture($gsamplerCube sampler, float3 P); +$gfloat4 texture($gsamplerCube sampler, float3 P, float bias); +float texture(sampler1DShadow sampler, float3 P); +float texture(sampler1DShadow sampler, float3 P, float bias); +float texture(sampler2DShadow sampler, float3 P); +float texture(sampler2DShadow sampler, float3 P, float bias); +float texture(samplerCubeShadow sampler, float4 P); +float texture(samplerCubeShadow sampler, float4 P, float bias); +$gfloat4 texture($gsampler1DArray sampler, float2 P); +$gfloat4 texture($gsampler1DArray sampler, float2 P, float bias); +$gfloat4 texture($gsampler2DArray sampler, float3 P); +$gfloat4 texture($gsampler2DArray sampler, float3 P, float bias); +$gfloat4 texture($gsamplerCubeArray sampler, float4 P); +$gfloat4 texture($gsamplerCubeArray sampler, float4 P, float bias); +float texture(sampler1DArrayShadow sampler, float3 P); +float texture(sampler1DArrayShadow sampler, float3 P, float bias); +float texture(sampler2DArrayShadow sampler, float4 P); */ -half4 texture($gsampler2DRect sampler, highfloat2 P); -half4 texture($gsampler2DRect sampler, highfloat3 P); +half4 texture($gsampler2DRect sampler, float2 P); +half4 texture($gsampler2DRect sampler, float3 P); /* -highfloat texture(sampler2DRectShadow sampler, highfloat3 P); -highfloat texture($gsamplerCubeArrayShadow sampler, highfloat4 P, highfloat compare); +float texture(sampler2DRectShadow sampler, float3 P); +float texture($gsamplerCubeArrayShadow sampler, float4 P, float compare); */ // Currently we do not support the generic types of loading subpassInput so we have some explicit // versions that we currently use -highfloat4 subpassLoad(subpassInput subpass); -highfloat4 subpassLoad(subpassInputMS subpass, int sample); +float4 subpassLoad(subpassInput subpass); +float4 subpassLoad(subpassInputMS subpass, int sample); /* $gfloat4subpassLoad(gsubpassInput subpass); $gfloat4subpassLoad(gsubpassInputMS subpass, int sample); @@ -336,50 +336,50 @@ $gfloat4subpassLoad(gsubpassInputMS subpass, int sample); STRINGIFY( -half4 texture($gsampler1D sampler, highfloat2 P); -half4 texture($gsampler1D sampler, highfloat2 P, highfloat bias); -half4 texture($gsampler2D sampler, highfloat3 P); -half4 texture($gsampler2D sampler, highfloat3 P, highfloat bias); +half4 texture($gsampler1D sampler, float2 P); +half4 texture($gsampler1D sampler, float2 P, float bias); +half4 texture($gsampler2D sampler, float3 P); +half4 texture($gsampler2D sampler, float3 P, float bias); /* -$gfloat4 textureProj($gsampler3D sampler, highfloat4 P); -$gfloat4 textureProj($gsampler3D sampler, highfloat4 P, highfloat bias); -highfloat textureProj(sampler1DShadow sampler, highfloat4 P); -highfloat textureProj(sampler1DShadow sampler, highfloat4 P, highfloat bias); -highfloat textureProj(sampler2DShadow sampler, highfloat4 P); -highfloat textureProj(sampler2DShadow sampler, highfloat4 P, highfloat bias); -$gfloat4 textureProj($gsampler2DRect sampler, highfloat4 P); -highfloat textureProj(sampler2DRectShadow sampler, highfloat4 P); -$gfloat4 textureLod($gsampler1D sampler, highfloat P, highfloat lod); -$gfloat4 textureLod($gsampler2D sampler, highfloat2 P, highfloat lod); -$gfloat4 textureLod($gsampler3D sampler, highfloat3 P, highfloat lod); -$gfloat4 textureLod($gsamplerCube sampler, highfloat3 P, highfloat lod); -highfloat textureLod(sampler1DShadow sampler, highfloat3 P, highfloat lod); -highfloat textureLod(sampler2DShadow sampler, highfloat3 P, highfloat lod); -$gfloat4 textureLod($gsampler1DArray sampler, highfloat2 P, highfloat lod); -$gfloat4 textureLod($gsampler2DArray sampler, highfloat3 P, highfloat lod); -highfloat textureLod(sampler1DArrayShadow sampler, highfloat3 P, highfloat lod); -$gfloat4 textureLod($gsamplerCubeArray sampler, highfloat4 P, highfloat lod); -$gfloat4 textureOffset($gsampler1D sampler, highfloat P, int offset); -$gfloat4 textureOffset($gsampler1D sampler, highfloat P, int offset, highfloat bias); -$gfloat4 textureOffset($gsampler2D sampler, highfloat2 P, int2 offset); -$gfloat4 textureOffset($gsampler2D sampler, highfloat2 P, int2 offset, highfloat bias); -$gfloat4 textureOffset($gsampler3D sampler, highfloat3 P, int3 offset); -$gfloat4 textureOffset($gsampler3D sampler, highfloat3 P, int3 offset, highfloat bias); -$gfloat4 textureOffset($gsampler2DRect sampler, highfloat2 P, int2 offset); -highfloat textureOffset(sampler2DRectShadow sampler, highfloat3 P, int2 offset); -highfloat textureOffset(sampler1DShadow sampler, highfloat3 P, int offset); -highfloat textureOffset(sampler1DShadow sampler, highfloat3 P, int offset, highfloat bias); -highfloat textureOffset(sampler2DShadow sampler, highfloat3 P, int2 offset); -highfloat textureOffset(sampler2DShadow sampler, highfloat3 P, int2 offset, highfloat bias); -$gfloat4 textureOffset($gsampler1DArray sampler, highfloat2 P, int offset); -$gfloat4 textureOffset($gsampler1DArray sampler, highfloat2 P, int offset, highfloat bias); -$gfloat4 textureOffset($gsampler2DArray sampler, highfloat3 P, int2 offset); -$gfloat4 textureOffset($gsampler2DArray sampler, highfloat3 P, int2 offset, highfloat bias); -highfloat textureOffset(sampler1DArrayShadow sampler, highfloat3 P, int offset); -highfloat textureOffset(sampler1DArrayShadow sampler, highfloat3 P, int offset, highfloat bias); -highfloat textureOffset(sampler2DArrayShadow sampler, highfloat4 P, int2 offset); +$gfloat4 textureProj($gsampler3D sampler, float4 P); +$gfloat4 textureProj($gsampler3D sampler, float4 P, float bias); +float textureProj(sampler1DShadow sampler, float4 P); +float textureProj(sampler1DShadow sampler, float4 P, float bias); +float textureProj(sampler2DShadow sampler, float4 P); +float textureProj(sampler2DShadow sampler, float4 P, float bias); +$gfloat4 textureProj($gsampler2DRect sampler, float4 P); +float textureProj(sampler2DRectShadow sampler, float4 P); +$gfloat4 textureLod($gsampler1D sampler, float P, float lod); +$gfloat4 textureLod($gsampler2D sampler, float2 P, float lod); +$gfloat4 textureLod($gsampler3D sampler, float3 P, float lod); +$gfloat4 textureLod($gsamplerCube sampler, float3 P, float lod); +float textureLod(sampler1DShadow sampler, float3 P, float lod); +float textureLod(sampler2DShadow sampler, float3 P, float lod); +$gfloat4 textureLod($gsampler1DArray sampler, float2 P, float lod); +$gfloat4 textureLod($gsampler2DArray sampler, float3 P, float lod); +float textureLod(sampler1DArrayShadow sampler, float3 P, float lod); +$gfloat4 textureLod($gsamplerCubeArray sampler, float4 P, float lod); +$gfloat4 textureOffset($gsampler1D sampler, float P, int offset); +$gfloat4 textureOffset($gsampler1D sampler, float P, int offset, float bias); +$gfloat4 textureOffset($gsampler2D sampler, float2 P, int2 offset); +$gfloat4 textureOffset($gsampler2D sampler, float2 P, int2 offset, float bias); +$gfloat4 textureOffset($gsampler3D sampler, float3 P, int3 offset); +$gfloat4 textureOffset($gsampler3D sampler, float3 P, int3 offset, float bias); +$gfloat4 textureOffset($gsampler2DRect sampler, float2 P, int2 offset); +float textureOffset(sampler2DRectShadow sampler, float3 P, int2 offset); +float textureOffset(sampler1DShadow sampler, float3 P, int offset); +float textureOffset(sampler1DShadow sampler, float3 P, int offset, float bias); +float textureOffset(sampler2DShadow sampler, float3 P, int2 offset); +float textureOffset(sampler2DShadow sampler, float3 P, int2 offset, float bias); +$gfloat4 textureOffset($gsampler1DArray sampler, float2 P, int offset); +$gfloat4 textureOffset($gsampler1DArray sampler, float2 P, int offset, float bias); +$gfloat4 textureOffset($gsampler2DArray sampler, float3 P, int2 offset); +$gfloat4 textureOffset($gsampler2DArray sampler, float3 P, int2 offset, float bias); +float textureOffset(sampler1DArrayShadow sampler, float3 P, int offset); +float textureOffset(sampler1DArrayShadow sampler, float3 P, int offset, float bias); +float textureOffset(sampler2DArrayShadow sampler, float4 P, int2 offset); */ -highfloat4 texelFetch(samplerBuffer sampler, int P); +float4 texelFetch(samplerBuffer sampler, int P); $gfloat4 texelFetch($gsampler1D sampler, int P, int lod); $gfloat4 texelFetch($gsampler2D sampler, int2 P, int lod); @@ -396,123 +396,123 @@ $gfloat4 texelFetchOffset($gsampler3D sampler, int3 P, int lod, int3 offset); $gfloat4 texelFetchOffset($gsampler2DRect sampler, int2 P, int2 offset); $gfloat4 texelFetchOffset($gsampler1DArray sampler, int2 P, int lod, int offset); $gfloat4 texelFetchOffset($gsampler2DArray sampler, int3 P, int lod, int2 offset); -$gfloat4 textureProjOffset($gsampler1D sampler, highfloat2 P, int offset); -$gfloat4 textureProjOffset($gsampler1D sampler, highfloat2 P, int offset, highfloat bias); -$gfloat4 textureProjOffset($gsampler1D sampler, highfloat4 P, int offset); -$gfloat4 textureProjOffset($gsampler1D sampler, highfloat4 P, int offset, highfloat bias); -$gfloat4 textureProjOffset($gsampler2D sampler, highfloat3 P, int2 offset); -$gfloat4 textureProjOffset($gsampler2D sampler, highfloat3 P, int2 offset, highfloat bias); -$gfloat4 textureProjOffset($gsampler2D sampler, highfloat4 P, int2 offset); -$gfloat4 textureProjOffset($gsampler2D sampler, highfloat4 P, int2 offset, highfloat bias); -$gfloat4 textureProjOffset($gsampler3D sampler, highfloat4 P, int3 offset); -$gfloat4 textureProjOffset($gsampler3D sampler, highfloat4 P, int3 offset, highfloat bias); -$gfloat4 textureProjOffset($gsampler2DRect sampler, highfloat3 P, int2 offset); -$gfloat4 textureProjOffset($gsampler2DRect sampler, highfloat4 P, int2 offset); -highfloat textureProjOffset(sampler2DRectShadow sampler, highfloat4 P, int2 offset); -highfloat textureProjOffset(sampler1DShadow sampler, highfloat4 P, int offset); -highfloat textureProjOffset(sampler1DShadow sampler, highfloat4 P, int offset, highfloat bias); -highfloat textureProjOffset(sampler2DShadow sampler, highfloat4 P, int2 offset); -highfloat textureProjOffset(sampler2DShadow sampler, highfloat4 P, int2 offset, highfloat bias); -$gfloat4 textureLodOffset($gsampler1D sampler, highfloat P, highfloat lod, int offset); -$gfloat4 textureLodOffset($gsampler2D sampler, highfloat2 P, highfloat lod, int2 offset); -$gfloat4 textureLodOffset($gsampler3D sampler, highfloat3 P, highfloat lod, int3 offset); -highfloat textureLodOffset(sampler1DShadow sampler, highfloat3 P, highfloat lod, int offset); -highfloat textureLodOffset(sampler2DShadow sampler, highfloat3 P, highfloat lod, int2 offset); -$gfloat4 textureLodOffset($gsampler1DArray sampler, highfloat2 P, highfloat lod, int offset); -$gfloat4 textureLodOffset($gsampler2DArray sampler, highfloat3 P, highfloat lod, int2 offset); -highfloat textureLodOffset(sampler1DArrayShadow sampler, highfloat3 P, highfloat lod, int offset); -$gfloat4 textureProjLod($gsampler1D sampler, highfloat2 P, highfloat lod); -$gfloat4 textureProjLod($gsampler1D sampler, highfloat4 P, highfloat lod); -$gfloat4 textureProjLod($gsampler2D sampler, highfloat3 P, highfloat lod); -$gfloat4 textureProjLod($gsampler2D sampler, highfloat4 P, highfloat lod); -$gfloat4 textureProjLod($gsampler3D sampler, highfloat4 P, highfloat lod); -highfloat textureProjLod(sampler1DShadow sampler, highfloat4 P, highfloat lod); -highfloat textureProjLod(sampler2DShadow sampler, highfloat4 P, highfloat lod); -$gfloat4 textureProjLodOffset($gsampler1D sampler, highfloat2 P, highfloat lod, int offset); -$gfloat4 textureProjLodOffset($gsampler1D sampler, highfloat4 P, highfloat lod, int offset); -$gfloat4 textureProjLodOffset($gsampler2D sampler, highfloat3 P, highfloat lod, int2 offset); -$gfloat4 textureProjLodOffset($gsampler2D sampler, highfloat4 P, highfloat lod, int2 offset); -$gfloat4 textureProjLodOffset($gsampler3D sampler, highfloat4 P, highfloat lod, int3 offset); -highfloat textureProjLodOffset(sampler1DShadow sampler, highfloat4 P, highfloat lod, int offset); -highfloat textureProjLodOffset(sampler2DShadow sampler, highfloat4 P, highfloat lod, int2 offset); -$gfloat4 textureGrad($gsampler1D sampler, highfloat P, highfloat dPdx, highfloat dPdy); -$gfloat4 textureGrad($gsampler2D sampler, highfloat2 P, highfloat2 dPdx, highfloat2 dPdy); -$gfloat4 textureGrad($gsampler3D sampler, highfloat3 P, highfloat3 dPdx, highfloat3 dPdy); -$gfloat4 textureGrad($gsamplerCube sampler, highfloat3 P, highfloat3 dPdx, highfloat3 dPdy); -$gfloat4 textureGrad($gsampler2DRect sampler, highfloat2 P, highfloat2 dPdx, highfloat2 dPdy); -highfloat textureGrad(sampler2DRectShadow sampler, highfloat3 P, highfloat2 dPdx, highfloat2 dPdy); -highfloat textureGrad(sampler1DShadow sampler, highfloat3 P, highfloat dPdx, highfloat dPdy); -highfloat textureGrad(sampler2DShadow sampler, highfloat3 P, highfloat2 dPdx, highfloat2 dPdy); -highfloat textureGrad(samplerCubeShadow sampler, highfloat4 P, highfloat3 dPdx, highfloat3 dPdy); -$gfloat4 textureGrad($gsampler1DArray sampler, highfloat2 P, highfloat dPdx, highfloat dPdy); -$gfloat4 textureGrad($gsampler2DArray sampler, highfloat3 P, highfloat2 dPdx, highfloat2 dPdy); -highfloat textureGrad(sampler1DArrayShadow sampler, highfloat3 P, highfloat dPdx, highfloat dPdy); -highfloat textureGrad(sampler2DArrayShadow sampler, highfloat4 P, highfloat2 dPdx, highfloat2 dPdy); -$gfloat4 textureGrad($gsamplerCubeArray sampler, highfloat4 P, highfloat3 dPdx, highfloat3 dPdy); -$gfloat4 textureGradOffset($gsampler1D sampler, highfloat P, highfloat dPdx, highfloat dPdy, int offset); -$gfloat4 textureGradOffset($gsampler2D sampler, highfloat2 P, highfloat2 dPdx, highfloat2 dPdy, int2 offset); -$gfloat4 textureGradOffset($gsampler3D sampler, highfloat3 P, highfloat3 dPdx, highfloat3 dPdy, int3 offset); -$gfloat4 textureGradOffset($gsampler2DRect sampler, highfloat2 P, highfloat2 dPdx, highfloat2 dPdy, int2 offset); -highfloat textureGradOffset(sampler2DRectShadow sampler, highfloat3 P, highfloat2 dPdx, highfloat2 dPdy, int2 offset); -highfloat textureGradOffset(sampler1DShadow sampler, highfloat3 P, highfloat dPdx, highfloat dPdy, int offset ); -highfloat textureGradOffset(sampler2DShadow sampler, highfloat3 P, highfloat2 dPdx, highfloat2 dPdy, int2 offset); -$gfloat4 textureGradOffset($gsampler1DArray sampler, highfloat2 P, highfloat dPdx, highfloat dPdy, int offset); -$gfloat4 textureGradOffset($gsampler2DArray sampler, highfloat3 P, highfloat2 dPdx, highfloat2 dPdy, int2 offset); -highfloat textureGradOffset(sampler1DArrayShadow sampler, highfloat3 P, highfloat dPdx, highfloat dPdy, int offset); -highfloat textureGradOffset(sampler2DArrayShadow sampler, highfloat4 P, highfloat2 dPdx, highfloat2 dPdy, int2 offset); -$gfloat4 textureProjGrad($gsampler1D sampler, highfloat2 P, highfloat dPdx, highfloat dPdy); -$gfloat4 textureProjGrad($gsampler1D sampler, highfloat4 P, highfloat dPdx, highfloat dPdy); -$gfloat4 textureProjGrad($gsampler2D sampler, highfloat3 P, highfloat2 dPdx, highfloat2 dPdy); -$gfloat4 textureProjGrad($gsampler2D sampler, highfloat4 P, highfloat2 dPdx, highfloat2 dPdy); -$gfloat4 textureProjGrad($gsampler3D sampler, highfloat4 P, highfloat3 dPdx, highfloat3 dPdy); -$gfloat4 textureProjGrad($gsampler2DRect sampler, highfloat3 P, highfloat2 dPdx, highfloat2 dPdy); -$gfloat4 textureProjGrad($gsampler2DRect sampler, highfloat4 P, highfloat2 dPdx, highfloat2 dPdy); -highfloat textureProjGrad(sampler2DRectShadow sampler, highfloat4 P, highfloat2 dPdx, highfloat2 dPdy); -highfloat textureProjGrad(sampler1DShadow sampler, highfloat4 P, highfloat dPdx, highfloat dPdy); -highfloat textureProjGrad(sampler2DShadow sampler, highfloat4 P, highfloat2 dPdx, highfloat2 dPdy); -$gfloat4 textureProjGradOffset($gsampler1D sampler, highfloat2 P, highfloat dPdx, highfloat dPdy, int offset); -$gfloat4 textureProjGradOffset($gsampler1D sampler, highfloat4 P, highfloat dPdx, highfloat dPdy, int offset); -$gfloat4 textureProjGradOffset($gsampler2D sampler, highfloat3 P, highfloat2 dPdx, highfloat2 dPdy, int2 offset); -$gfloat4 textureProjGradOffset($gsampler2D sampler, highfloat4 P, highfloat2 dPdx, highfloat2 dPdy, int2 offset); -$gfloat4 textureProjGradOffset($gsampler2DRect sampler, highfloat3 P, highfloat2 dPdx, highfloat2 dPdy, int2 offset); -$gfloat4 textureProjGradOffset($gsampler2DRect sampler, highfloat4 P, highfloat2 dPdx, highfloat2 dPdy, int2 offset); -highfloat textureProjGradOffset(sampler2DRectShadow sampler, highfloat4 P, highfloat2 dPdx, highfloat2 dPdy, int2 offset); -$gfloat4 textureProjGradOffset($gsampler3D sampler, highfloat4 P, highfloat3 dPdx, highfloat3 dPdy, int3 offset); -highfloat textureProjGradOffset(sampler1DShadow sampler, highfloat4 P, highfloat dPdx, highfloat dPdy, int offset); -highfloat textureProjGradOffset(sampler2DShadow sampler, highfloat4 P, highfloat2 dPdx, highfloat2 dPdy, int2 offset); -$gfloat4 textureGather($gsampler2D sampler, highfloat2 P); -$gfloat4 textureGather($gsampler2D sampler, highfloat2 P, int comp); -$gfloat4 textureGather($gsampler2DArray sampler, highfloat3 P); -$gfloat4 textureGather($gsampler2DArray sampler, highfloat3 P, int comp); -$gfloat4 textureGather($gsamplerCube sampler, highfloat3 P); -$gfloat4 textureGather($gsamplerCube sampler, highfloat3 P, int comp); -$gfloat4 textureGather($gsamplerCubeArray sampler, highfloat4 P); -$gfloat4 textureGather($gsamplerCubeArray sampler, highfloat4 P, int comp); -$gfloat4 textureGather($gsampler2DRect sampler, highfloat2 P); -$gfloat4 textureGather($gsampler2DRect sampler, highfloat2 P, int comp); -highfloat4 textureGather(sampler2DShadow sampler, highfloat2 P, highfloat refZ); -highfloat4 textureGather(sampler2DArrayShadow sampler, highfloat3 P, highfloat refZ); -highfloat4 textureGather(samplerCubeShadow sampler, highfloat3 P, highfloat refZ); -highfloat4 textureGather(samplerCubeArrayShadow sampler, highfloat4 P, highfloat refZ); -highfloat4 textureGather(sampler2DRectShadow sampler, highfloat2 P, highfloat refZ); -$gfloat4 textureGatherOffset($gsampler2D sampler, highfloat2 P, int2 offset); -$gfloat4 textureGatherOffset($gsampler2D sampler, highfloat2 P, int2 offset, int comp); -$gfloat4 textureGatherOffset($gsampler2DArray sampler, highfloat3 P, int2 offset); -$gfloat4 textureGatherOffset($gsampler2DArray sampler, highfloat3 P, int2 offset, int comp); -$gfloat4 textureGatherOffset($gsampler2DRect sampler, highfloat2 P, int2 offset); -$gfloat4 textureGatherOffset($gsampler2DRect sampler, highfloat2 P, int2 offset, int comp); -highfloat4 textureGatherOffset(sampler2DShadow sampler, highfloat2 P, highfloat refZ, int2 offset); -highfloat4 textureGatherOffset(sampler2DArrayShadow sampler, highfloat3 P, highfloat refZ, int2 offset); -highfloat4 textureGatherOffset(sampler2DRectShadow sampler, highfloat2 P, highfloat refZ, int2 offset); -$gfloat4 textureGatherOffsets($gsampler2D sampler, highfloat2 P, int2 offsets[4]); -$gfloat4 textureGatherOffsets($gsampler2D sampler, highfloat2 P, int2 offsets[4], int comp); -$gfloat4 textureGatherOffsets($gsampler2DArray sampler, highfloat3 P, int2 offsets[4]); -$gfloat4 textureGatherOffsets($gsampler2DArray sampler, highfloat3 P, int2 offsets[4], int comp); -$gfloat4 textureGatherOffsets($gsampler2DRect sampler, highfloat2 P, int2 offsets[4]); -$gfloat4 textureGatherOffsets($gsampler2DRect sampler, highfloat2 P, int2 offsets[4], int comp); -highfloat4 textureGatherOffsets(sampler2DShadow sampler, highfloat2 P, highfloat refZ, int2 offsets[4]); -highfloat4 textureGatherOffsets(sampler2DArrayShadow sampler, highfloat3 P, highfloat refZ, int2 offsets[4]); -highfloat4 textureGatherOffsets(sampler2DRectShadow sampler, highfloat2 P, highfloat refZ, int2 offsets[4]); +$gfloat4 textureProjOffset($gsampler1D sampler, float2 P, int offset); +$gfloat4 textureProjOffset($gsampler1D sampler, float2 P, int offset, float bias); +$gfloat4 textureProjOffset($gsampler1D sampler, float4 P, int offset); +$gfloat4 textureProjOffset($gsampler1D sampler, float4 P, int offset, float bias); +$gfloat4 textureProjOffset($gsampler2D sampler, float3 P, int2 offset); +$gfloat4 textureProjOffset($gsampler2D sampler, float3 P, int2 offset, float bias); +$gfloat4 textureProjOffset($gsampler2D sampler, float4 P, int2 offset); +$gfloat4 textureProjOffset($gsampler2D sampler, float4 P, int2 offset, float bias); +$gfloat4 textureProjOffset($gsampler3D sampler, float4 P, int3 offset); +$gfloat4 textureProjOffset($gsampler3D sampler, float4 P, int3 offset, float bias); +$gfloat4 textureProjOffset($gsampler2DRect sampler, float3 P, int2 offset); +$gfloat4 textureProjOffset($gsampler2DRect sampler, float4 P, int2 offset); +float textureProjOffset(sampler2DRectShadow sampler, float4 P, int2 offset); +float textureProjOffset(sampler1DShadow sampler, float4 P, int offset); +float textureProjOffset(sampler1DShadow sampler, float4 P, int offset, float bias); +float textureProjOffset(sampler2DShadow sampler, float4 P, int2 offset); +float textureProjOffset(sampler2DShadow sampler, float4 P, int2 offset, float bias); +$gfloat4 textureLodOffset($gsampler1D sampler, float P, float lod, int offset); +$gfloat4 textureLodOffset($gsampler2D sampler, float2 P, float lod, int2 offset); +$gfloat4 textureLodOffset($gsampler3D sampler, float3 P, float lod, int3 offset); +float textureLodOffset(sampler1DShadow sampler, float3 P, float lod, int offset); +float textureLodOffset(sampler2DShadow sampler, float3 P, float lod, int2 offset); +$gfloat4 textureLodOffset($gsampler1DArray sampler, float2 P, float lod, int offset); +$gfloat4 textureLodOffset($gsampler2DArray sampler, float3 P, float lod, int2 offset); +float textureLodOffset(sampler1DArrayShadow sampler, float3 P, float lod, int offset); +$gfloat4 textureProjLod($gsampler1D sampler, float2 P, float lod); +$gfloat4 textureProjLod($gsampler1D sampler, float4 P, float lod); +$gfloat4 textureProjLod($gsampler2D sampler, float3 P, float lod); +$gfloat4 textureProjLod($gsampler2D sampler, float4 P, float lod); +$gfloat4 textureProjLod($gsampler3D sampler, float4 P, float lod); +float textureProjLod(sampler1DShadow sampler, float4 P, float lod); +float textureProjLod(sampler2DShadow sampler, float4 P, float lod); +$gfloat4 textureProjLodOffset($gsampler1D sampler, float2 P, float lod, int offset); +$gfloat4 textureProjLodOffset($gsampler1D sampler, float4 P, float lod, int offset); +$gfloat4 textureProjLodOffset($gsampler2D sampler, float3 P, float lod, int2 offset); +$gfloat4 textureProjLodOffset($gsampler2D sampler, float4 P, float lod, int2 offset); +$gfloat4 textureProjLodOffset($gsampler3D sampler, float4 P, float lod, int3 offset); +float textureProjLodOffset(sampler1DShadow sampler, float4 P, float lod, int offset); +float textureProjLodOffset(sampler2DShadow sampler, float4 P, float lod, int2 offset); +$gfloat4 textureGrad($gsampler1D sampler, float P, float dPdx, float dPdy); +$gfloat4 textureGrad($gsampler2D sampler, float2 P, float2 dPdx, float2 dPdy); +$gfloat4 textureGrad($gsampler3D sampler, float3 P, float3 dPdx, float3 dPdy); +$gfloat4 textureGrad($gsamplerCube sampler, float3 P, float3 dPdx, float3 dPdy); +$gfloat4 textureGrad($gsampler2DRect sampler, float2 P, float2 dPdx, float2 dPdy); +float textureGrad(sampler2DRectShadow sampler, float3 P, float2 dPdx, float2 dPdy); +float textureGrad(sampler1DShadow sampler, float3 P, float dPdx, float dPdy); +float textureGrad(sampler2DShadow sampler, float3 P, float2 dPdx, float2 dPdy); +float textureGrad(samplerCubeShadow sampler, float4 P, float3 dPdx, float3 dPdy); +$gfloat4 textureGrad($gsampler1DArray sampler, float2 P, float dPdx, float dPdy); +$gfloat4 textureGrad($gsampler2DArray sampler, float3 P, float2 dPdx, float2 dPdy); +float textureGrad(sampler1DArrayShadow sampler, float3 P, float dPdx, float dPdy); +float textureGrad(sampler2DArrayShadow sampler, float4 P, float2 dPdx, float2 dPdy); +$gfloat4 textureGrad($gsamplerCubeArray sampler, float4 P, float3 dPdx, float3 dPdy); +$gfloat4 textureGradOffset($gsampler1D sampler, float P, float dPdx, float dPdy, int offset); +$gfloat4 textureGradOffset($gsampler2D sampler, float2 P, float2 dPdx, float2 dPdy, int2 offset); +$gfloat4 textureGradOffset($gsampler3D sampler, float3 P, float3 dPdx, float3 dPdy, int3 offset); +$gfloat4 textureGradOffset($gsampler2DRect sampler, float2 P, float2 dPdx, float2 dPdy, int2 offset); +float textureGradOffset(sampler2DRectShadow sampler, float3 P, float2 dPdx, float2 dPdy, int2 offset); +float textureGradOffset(sampler1DShadow sampler, float3 P, float dPdx, float dPdy, int offset ); +float textureGradOffset(sampler2DShadow sampler, float3 P, float2 dPdx, float2 dPdy, int2 offset); +$gfloat4 textureGradOffset($gsampler1DArray sampler, float2 P, float dPdx, float dPdy, int offset); +$gfloat4 textureGradOffset($gsampler2DArray sampler, float3 P, float2 dPdx, float2 dPdy, int2 offset); +float textureGradOffset(sampler1DArrayShadow sampler, float3 P, float dPdx, float dPdy, int offset); +float textureGradOffset(sampler2DArrayShadow sampler, float4 P, float2 dPdx, float2 dPdy, int2 offset); +$gfloat4 textureProjGrad($gsampler1D sampler, float2 P, float dPdx, float dPdy); +$gfloat4 textureProjGrad($gsampler1D sampler, float4 P, float dPdx, float dPdy); +$gfloat4 textureProjGrad($gsampler2D sampler, float3 P, float2 dPdx, float2 dPdy); +$gfloat4 textureProjGrad($gsampler2D sampler, float4 P, float2 dPdx, float2 dPdy); +$gfloat4 textureProjGrad($gsampler3D sampler, float4 P, float3 dPdx, float3 dPdy); +$gfloat4 textureProjGrad($gsampler2DRect sampler, float3 P, float2 dPdx, float2 dPdy); +$gfloat4 textureProjGrad($gsampler2DRect sampler, float4 P, float2 dPdx, float2 dPdy); +float textureProjGrad(sampler2DRectShadow sampler, float4 P, float2 dPdx, float2 dPdy); +float textureProjGrad(sampler1DShadow sampler, float4 P, float dPdx, float dPdy); +float textureProjGrad(sampler2DShadow sampler, float4 P, float2 dPdx, float2 dPdy); +$gfloat4 textureProjGradOffset($gsampler1D sampler, float2 P, float dPdx, float dPdy, int offset); +$gfloat4 textureProjGradOffset($gsampler1D sampler, float4 P, float dPdx, float dPdy, int offset); +$gfloat4 textureProjGradOffset($gsampler2D sampler, float3 P, float2 dPdx, float2 dPdy, int2 offset); +$gfloat4 textureProjGradOffset($gsampler2D sampler, float4 P, float2 dPdx, float2 dPdy, int2 offset); +$gfloat4 textureProjGradOffset($gsampler2DRect sampler, float3 P, float2 dPdx, float2 dPdy, int2 offset); +$gfloat4 textureProjGradOffset($gsampler2DRect sampler, float4 P, float2 dPdx, float2 dPdy, int2 offset); +float textureProjGradOffset(sampler2DRectShadow sampler, float4 P, float2 dPdx, float2 dPdy, int2 offset); +$gfloat4 textureProjGradOffset($gsampler3D sampler, float4 P, float3 dPdx, float3 dPdy, int3 offset); +float textureProjGradOffset(sampler1DShadow sampler, float4 P, float dPdx, float dPdy, int offset); +float textureProjGradOffset(sampler2DShadow sampler, float4 P, float2 dPdx, float2 dPdy, int2 offset); +$gfloat4 textureGather($gsampler2D sampler, float2 P); +$gfloat4 textureGather($gsampler2D sampler, float2 P, int comp); +$gfloat4 textureGather($gsampler2DArray sampler, float3 P); +$gfloat4 textureGather($gsampler2DArray sampler, float3 P, int comp); +$gfloat4 textureGather($gsamplerCube sampler, float3 P); +$gfloat4 textureGather($gsamplerCube sampler, float3 P, int comp); +$gfloat4 textureGather($gsamplerCubeArray sampler, float4 P); +$gfloat4 textureGather($gsamplerCubeArray sampler, float4 P, int comp); +$gfloat4 textureGather($gsampler2DRect sampler, float2 P); +$gfloat4 textureGather($gsampler2DRect sampler, float2 P, int comp); +float4 textureGather(sampler2DShadow sampler, float2 P, float refZ); +float4 textureGather(sampler2DArrayShadow sampler, float3 P, float refZ); +float4 textureGather(samplerCubeShadow sampler, float3 P, float refZ); +float4 textureGather(samplerCubeArrayShadow sampler, float4 P, float refZ); +float4 textureGather(sampler2DRectShadow sampler, float2 P, float refZ); +$gfloat4 textureGatherOffset($gsampler2D sampler, float2 P, int2 offset); +$gfloat4 textureGatherOffset($gsampler2D sampler, float2 P, int2 offset, int comp); +$gfloat4 textureGatherOffset($gsampler2DArray sampler, float3 P, int2 offset); +$gfloat4 textureGatherOffset($gsampler2DArray sampler, float3 P, int2 offset, int comp); +$gfloat4 textureGatherOffset($gsampler2DRect sampler, float2 P, int2 offset); +$gfloat4 textureGatherOffset($gsampler2DRect sampler, float2 P, int2 offset, int comp); +float4 textureGatherOffset(sampler2DShadow sampler, float2 P, float refZ, int2 offset); +float4 textureGatherOffset(sampler2DArrayShadow sampler, float3 P, float refZ, int2 offset); +float4 textureGatherOffset(sampler2DRectShadow sampler, float2 P, float refZ, int2 offset); +$gfloat4 textureGatherOffsets($gsampler2D sampler, float2 P, int2 offsets[4]); +$gfloat4 textureGatherOffsets($gsampler2D sampler, float2 P, int2 offsets[4], int comp); +$gfloat4 textureGatherOffsets($gsampler2DArray sampler, float3 P, int2 offsets[4]); +$gfloat4 textureGatherOffsets($gsampler2DArray sampler, float3 P, int2 offsets[4], int comp); +$gfloat4 textureGatherOffsets($gsampler2DRect sampler, float2 P, int2 offsets[4]); +$gfloat4 textureGatherOffsets($gsampler2DRect sampler, float2 P, int2 offsets[4], int comp); +float4 textureGatherOffsets(sampler2DShadow sampler, float2 P, float refZ, int2 offsets[4]); +float4 textureGatherOffsets(sampler2DArrayShadow sampler, float3 P, float refZ, int2 offsets[4]); +float4 textureGatherOffsets(sampler2DRectShadow sampler, float2 P, float refZ, int2 offsets[4]); uint atomicCounterIncrement(atomic_uint c); uint atomicCounter(atomic_uint c); uint atomicAdd(inout uint mem, uint data); @@ -534,18 +534,18 @@ int atomicCompSwap(inout int mem, int compare, int data); */ // section 8.12 Additional Image Functions will go here if and when we add // support for them -highfloat4 imageLoad(image2D image, int2 P); +float4 imageLoad(image2D image, int2 P); int4 imageLoad(iimage2D image, int2 P); $genType dFdx($genType p); $genType dFdy($genType p); -highfloat interpolateAtSample(highfloat interpolant, int sample); -highfloat2 interpolateAtSample(highfloat2 interpolant, int sample); -highfloat3 interpolateAtSample(highfloat3 interpolant, int sample); -highfloat4 interpolateAtSample(highfloat4 interpolant, int sample); -highfloat interpolateAtOffset(highfloat interpolant, highfloat2 offset); -highfloat2 interpolateAtOffset(highfloat2 interpolant, highfloat2 offset); -highfloat3 interpolateAtOffset(highfloat3 interpolant, highfloat2 offset); -highfloat4 interpolateAtOffset(highfloat4 interpolant, highfloat2 offset); +float interpolateAtSample(float interpolant, int sample); +float2 interpolateAtSample(float2 interpolant, int sample); +float3 interpolateAtSample(float3 interpolant, int sample); +float4 interpolateAtSample(float4 interpolant, int sample); +float interpolateAtOffset(float interpolant, float2 offset); +float2 interpolateAtOffset(float2 interpolant, float2 offset); +float3 interpolateAtOffset(float3 interpolant, float2 offset); +float4 interpolateAtOffset(float4 interpolant, float2 offset); /* $genType fwidth($genType p); diff --git a/src/sksl/sksl_fp.include b/src/sksl/sksl_fp.include index 8aed48e634..2cb46f1302 100644 --- a/src/sksl/sksl_fp.include +++ b/src/sksl/sksl_fp.include @@ -2,14 +2,14 @@ STRINGIFY( // defines built-in interfaces supported by SkiaSL fragment shaders -layout(builtin=15) in highfloat4 sk_FragCoord; -layout(builtin=3) highfloat sk_ClipDistance[1]; +layout(builtin=15) in float4 sk_FragCoord; +layout(builtin=3) float sk_ClipDistance[1]; // 9999 is a temporary value that causes us to ignore these declarations beyond // adding them to the symbol table. This works fine in GLSL (where they do not // require any further handling) but will fail in SPIR-V. We'll have a better // solution for this soon. -layout(builtin=9999) highfloat4 gl_LastFragData[1]; +layout(builtin=9999) float4 gl_LastFragData[1]; layout(builtin=9999) half4 gl_LastFragColor; layout(builtin=9999) half4 gl_LastFragColorARM; layout(builtin=9999) int gl_SampleMaskIn[1]; @@ -18,7 +18,7 @@ layout(builtin=9999) half4 gl_SecondaryFragColorEXT; layout(builtin=10003) half4 sk_InColor; layout(builtin=10004) out half4 sk_OutColor; -layout(builtin=10005) highfloat2[] sk_TransformedCoords2D; +layout(builtin=10005) float2[] sk_TransformedCoords2D; layout(builtin=10006) sampler2D[] sk_TextureSamplers; half4 COLORSPACE(half4 color, colorSpaceXform colorSpace); diff --git a/src/sksl/sksl_frag.include b/src/sksl/sksl_frag.include index c5f9ffe647..e96165be1f 100644 --- a/src/sksl/sksl_frag.include +++ b/src/sksl/sksl_frag.include @@ -2,14 +2,14 @@ STRINGIFY( // defines built-in interfaces supported by SkiaSL fragment shaders -layout(builtin=15) in highfloat4 sk_FragCoord; -layout(builtin=3) highfloat sk_ClipDistance[1]; +layout(builtin=15) in float4 sk_FragCoord; +layout(builtin=3) float sk_ClipDistance[1]; // 9999 is a temporary value that causes us to ignore these declarations beyond // adding them to the symbol table. This works fine in GLSL (where they do not // require any further handling) but will fail in SPIR-V. We'll have a better // solution for this soon. -layout(builtin=9999) highfloat4 gl_LastFragData[1]; +layout(builtin=9999) float4 gl_LastFragData[1]; layout(builtin=9999) half4 gl_LastFragColor; layout(builtin=9999) half4 gl_LastFragColorARM; layout(builtin=9999) int gl_SampleMaskIn[1]; diff --git a/src/sksl/sksl_geom.include b/src/sksl/sksl_geom.include index b1c05d1462..f1b3604357 100644 --- a/src/sksl/sksl_geom.include +++ b/src/sksl/sksl_geom.include @@ -3,15 +3,15 @@ STRINGIFY( // defines built-in interfaces supported by SkiaSL geometry shaders layout(builtin=10002) in sk_PerVertex { - layout(builtin=0) highfloat4 gl_Position; - layout(builtin=1) highfloat gl_PointSize; - layout(builtin=3) highfloat sk_ClipDistance[]; + layout(builtin=0) float4 gl_Position; + layout(builtin=1) float gl_PointSize; + layout(builtin=3) float sk_ClipDistance[]; } sk_in[]; out sk_PerVertex { - layout(builtin=0) highfloat4 gl_Position; - layout(builtin=1) highfloat gl_PointSize; - layout(builtin=3) highfloat sk_ClipDistance[]; + layout(builtin=0) float4 gl_Position; + layout(builtin=1) float gl_PointSize; + layout(builtin=3) float sk_ClipDistance[]; }; layout(builtin=8) int sk_InvocationID; diff --git a/src/sksl/sksl_vert.include b/src/sksl/sksl_vert.include index e7f841949c..976877c6e7 100644 --- a/src/sksl/sksl_vert.include +++ b/src/sksl/sksl_vert.include @@ -3,9 +3,9 @@ STRINGIFY( // defines built-in interfaces supported by SkiaSL vertex shaders out sk_PerVertex { - layout(builtin=0) highfloat4 gl_Position; - layout(builtin=1) highfloat gl_PointSize; - layout(builtin=3) highfloat sk_ClipDistance[1]; + layout(builtin=0) float4 gl_Position; + layout(builtin=1) float gl_PointSize; + layout(builtin=3) float sk_ClipDistance[1]; }; layout(builtin=5) in int sk_VertexID; |