diff options
author | Brian Salomon <bsalomon@google.com> | 2017-08-17 11:07:59 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-08-17 15:08:17 +0000 |
commit | 1d816b92bb7cf2258007f3f74ffd143b89f25d01 (patch) | |
tree | 07fb1e8e2631208eb007a4abdfe130db91e6cfc2 /src/gpu/effects/GrDistanceFieldGeoProc.cpp | |
parent | 23f92277b916a4bdf11c320799ac9248af60a62e (diff) |
Revert "Switched highp float to highfloat and mediump float to half."
This reverts commit 88d99c63878c2d3d340120f0321676f72afcb4f0.
Reason for revert: Believed to be causing unit test failures in Chrome roll:
https://build.chromium.org/p/tryserver.chromium.android/builders/linux_android_rel_ng/builds/364433
https://luci-logdog.appspot.com/v/?s=chromium%2Fbb%2Ftryserver.chromium.android%2Flinux_android_rel_ng%2F364433%2F%2B%2Frecipes%2Fsteps%2Fcontent_browsertests__with_patch__on_Android%2F0%2Flogs%2FWebRtcCaptureFromElementBrowserTest.VerifyCanvasWebGLCaptureColor%2F0
Original change's description:
> Switched highp float to highfloat and mediump float to half.
>
> The ultimate goal is to end up with "float" and "half", but this
> intermediate step uses "highfloat" so that it is clear if I missed a
> "float" somewhere. Once this lands, a subsequent CL will switch all
> "highfloats" back to "floats".
>
> Bug: skia:
> Change-Id: Ia13225c7a0a0a2901e07665891c473d2500ddcca
> Reviewed-on: https://skia-review.googlesource.com/31000
> Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
> Reviewed-by: Brian Salomon <bsalomon@google.com>
TBR=bsalomon@google.com,csmartdalton@google.com,ethannicholas@google.com
Change-Id: I8bfa97547ac3920d433665f161d27df3f15c83aa
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:
Reviewed-on: https://skia-review.googlesource.com/35705
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Diffstat (limited to 'src/gpu/effects/GrDistanceFieldGeoProc.cpp')
-rw-r--r-- | src/gpu/effects/GrDistanceFieldGeoProc.cpp | 156 |
1 files changed, 80 insertions, 76 deletions
diff --git a/src/gpu/effects/GrDistanceFieldGeoProc.cpp b/src/gpu/effects/GrDistanceFieldGeoProc.cpp index d1d14c9292..8dd2fa617a 100644 --- a/src/gpu/effects/GrDistanceFieldGeoProc.cpp +++ b/src/gpu/effects/GrDistanceFieldGeoProc.cpp @@ -45,7 +45,8 @@ public: // adjust based on gamma const char* distanceAdjustUniName = nullptr; // width, height, 1/(3*width) - fDistanceAdjustUni = uniformHandler->addUniform(kFragment_GrShaderFlag, kHalf_GrSLType, + fDistanceAdjustUni = uniformHandler->addUniform(kFragment_GrShaderFlag, + kFloat_GrSLType, kDefault_GrSLPrecision, "DistanceAdjust", &distanceAdjustUniName); #endif @@ -69,8 +70,8 @@ public: args.fFPCoordTransformHandler); // add varyings - GrGLSLVertToFrag recipScale(kHalf2_GrSLType); - GrGLSLVertToFrag uv(kHighFloat2_GrSLType); + GrGLSLVertToFrag recipScale(kFloat_GrSLType); + GrGLSLVertToFrag uv(kVec2f_GrSLType); bool isUniformScale = (dfTexEffect.getFlags() & kUniformScale_DistanceFieldEffectMask) == kUniformScale_DistanceFieldEffectMask; bool isSimilarity = SkToBool(dfTexEffect.getFlags() & kSimilarity_DistanceFieldEffectFlag); @@ -78,7 +79,7 @@ public: SkToBool(dfTexEffect.getFlags() & kGammaCorrect_DistanceFieldEffectFlag); bool isAliased = SkToBool(dfTexEffect.getFlags() & kAliased_DistanceFieldEffectFlag); - varyingHandler->addVarying("TextureCoords", &uv); + varyingHandler->addVarying("TextureCoords", &uv, kHigh_GrSLPrecision); vertBuilder->codeAppendf("%s = %s;", uv.vsOut(), dfTexEffect.inTextureCoords()->fName); // compute numbers to be hardcoded to convert texture coordinates from float to int @@ -86,28 +87,28 @@ public: GrTexture* atlas = dfTexEffect.textureSampler(0).peekTexture(); SkASSERT(atlas && SkIsPow2(atlas->width()) && SkIsPow2(atlas->height())); - GrGLSLVertToFrag st(kHighFloat2_GrSLType); - varyingHandler->addVarying("IntTextureCoords", &st); - vertBuilder->codeAppendf("%s = highfloat2(%d, %d) * %s;", st.vsOut(), + GrGLSLVertToFrag st(kVec2f_GrSLType); + varyingHandler->addVarying("IntTextureCoords", &st, kHigh_GrSLPrecision); + vertBuilder->codeAppendf("%s = float2(%d, %d) * %s;", st.vsOut(), atlas->width(), atlas->height(), dfTexEffect.inTextureCoords()->fName); // Use highp to work around aliasing issues - fragBuilder->codeAppendf("highfloat2 uv = %s;\n", uv.fsIn()); + fragBuilder->codeAppendf("highp float2 uv = %s;\n", uv.fsIn()); - fragBuilder->codeAppend("\thalf texColor = "); + fragBuilder->codeAppend("\tfloat texColor = "); fragBuilder->appendTextureLookup(args.fTexSamplers[0], "uv", - kHighFloat2_GrSLType); + kVec2f_GrSLType); fragBuilder->codeAppend(".r;\n"); - fragBuilder->codeAppend("\thalf distance = " + fragBuilder->codeAppend("\tfloat distance = " SK_DistanceFieldMultiplier "*(texColor - " SK_DistanceFieldThreshold ");"); #ifdef SK_GAMMA_APPLY_TO_A8 // adjust width based on gamma fragBuilder->codeAppendf("distance -= %s;", distanceAdjustUniName); #endif - fragBuilder->codeAppend("half afwidth;"); + fragBuilder->codeAppend("float afwidth;"); if (isUniformScale) { // For uniform scale, we adjust for the effect of the transformation on the distance // by using the length of the gradient of the t coordinate in the y direction. @@ -130,29 +131,29 @@ public: // this gives us a smooth step across approximately one fragment #ifdef SK_VULKAN - fragBuilder->codeAppendf("half st_grad_len = length(dFdx(%s));", st.fsIn()); + fragBuilder->codeAppendf("float st_grad_len = length(dFdx(%s));", st.fsIn()); #else // We use the y gradient because there is a bug in the Mali 400 in the x direction. - fragBuilder->codeAppendf("half st_grad_len = length(dFdy(%s));", st.fsIn()); + fragBuilder->codeAppendf("float st_grad_len = length(dFdy(%s));", st.fsIn()); #endif fragBuilder->codeAppend("afwidth = abs(" SK_DistanceFieldAAFactor "*st_grad_len);"); } else { // For general transforms, to determine the amount of correction we multiply a unit // vector pointing along the SDF gradient direction by the Jacobian of the st coords // (which is the inverse transform for this fragment) and take the length of the result. - fragBuilder->codeAppend("half2 dist_grad = half2(dFdx(distance), dFdy(distance));"); + fragBuilder->codeAppend("float2 dist_grad = float2(dFdx(distance), dFdy(distance));"); // the length of the gradient may be 0, so we need to check for this // this also compensates for the Adreno, which likes to drop tiles on division by 0 - fragBuilder->codeAppend("half dg_len2 = dot(dist_grad, dist_grad);"); + fragBuilder->codeAppend("float dg_len2 = dot(dist_grad, dist_grad);"); fragBuilder->codeAppend("if (dg_len2 < 0.0001) {"); - fragBuilder->codeAppend("dist_grad = half2(0.7071, 0.7071);"); + fragBuilder->codeAppend("dist_grad = float2(0.7071, 0.7071);"); fragBuilder->codeAppend("} else {"); fragBuilder->codeAppend("dist_grad = dist_grad*inversesqrt(dg_len2);"); fragBuilder->codeAppend("}"); - fragBuilder->codeAppendf("half2 Jdx = dFdx(%s);", st.fsIn()); - fragBuilder->codeAppendf("half2 Jdy = dFdy(%s);", st.fsIn()); - fragBuilder->codeAppend("half2 grad = half2(dist_grad.x*Jdx.x + dist_grad.y*Jdy.x,"); + fragBuilder->codeAppendf("float2 Jdx = dFdx(%s);", st.fsIn()); + fragBuilder->codeAppendf("float2 Jdy = dFdy(%s);", st.fsIn()); + fragBuilder->codeAppend("float2 grad = float2(dist_grad.x*Jdx.x + dist_grad.y*Jdy.x,"); fragBuilder->codeAppend(" dist_grad.x*Jdx.y + dist_grad.y*Jdy.y);"); // this gives us a smooth step across approximately one fragment @@ -160,18 +161,18 @@ public: } if (isAliased) { - fragBuilder->codeAppend("half val = distance > 0 ? 1.0 : 0.0;"); + fragBuilder->codeAppend("float val = distance > 0 ? 1.0 : 0.0;"); } else if (isGammaCorrect) { // The smoothstep falloff compensates for the non-linear sRGB response curve. If we are // doing gamma-correct rendering (to an sRGB or F16 buffer), then we actually want // distance mapped linearly to coverage, so use a linear step: fragBuilder->codeAppend( - "half val = clamp((distance + afwidth) / (2.0 * afwidth), 0.0, 1.0);"); + "float val = clamp((distance + afwidth) / (2.0 * afwidth), 0.0, 1.0);"); } else { - fragBuilder->codeAppend("half val = smoothstep(-afwidth, afwidth, distance);"); + fragBuilder->codeAppend("float val = smoothstep(-afwidth, afwidth, distance);"); } - fragBuilder->codeAppendf("%s = half4(val);", args.fOutputCoverage); + fragBuilder->codeAppendf("%s = float4(val);", args.fOutputCoverage); } void setData(const GrGLSLProgramDataManager& pdman, const GrPrimitiveProcessor& proc, @@ -322,7 +323,7 @@ public: // emit attributes varyingHandler->emitAttributes(dfTexEffect); - GrGLSLVertToFrag v(kHighFloat2_GrSLType); + GrGLSLVertToFrag v(kVec2f_GrSLType); varyingHandler->addVarying("TextureCoords", &v, kHigh_GrSLPrecision); // setup pass through color @@ -346,22 +347,23 @@ public: args.fFPCoordTransformHandler); const char* textureSizeUniName = nullptr; - fTextureSizeUni = uniformHandler->addUniform(kFragment_GrShaderFlag, kHalf2_GrSLType, + fTextureSizeUni = uniformHandler->addUniform(kFragment_GrShaderFlag, + kVec2f_GrSLType, kDefault_GrSLPrecision, "TextureSize", &textureSizeUniName); // Use highp to work around aliasing issues - fragBuilder->codeAppendf("highfloat2 uv = %s;", v.fsIn()); + fragBuilder->codeAppendf("highp float2 uv = %s;", v.fsIn()); - fragBuilder->codeAppend("half texColor = "); + fragBuilder->codeAppend("float texColor = "); fragBuilder->appendTextureLookup(args.fTexSamplers[0], "uv", - kHighFloat2_GrSLType); + kVec2f_GrSLType); fragBuilder->codeAppend(".r;"); - fragBuilder->codeAppend("half distance = " + fragBuilder->codeAppend("float distance = " SK_DistanceFieldMultiplier "*(texColor - " SK_DistanceFieldThreshold ");"); - fragBuilder->codeAppendf("highfloat2 st = uv*%s;", textureSizeUniName); - fragBuilder->codeAppend("half afwidth;"); + fragBuilder->codeAppendf("highp float2 st = uv*%s;", textureSizeUniName); + fragBuilder->codeAppend("float afwidth;"); bool isUniformScale = (dfTexEffect.getFlags() & kUniformScale_DistanceFieldEffectMask) == kUniformScale_DistanceFieldEffectMask; bool isSimilarity = SkToBool(dfTexEffect.getFlags() & kSimilarity_DistanceFieldEffectFlag); @@ -386,29 +388,29 @@ public: // this gives us a smooth step across approximately one fragment #ifdef SK_VULKAN - fragBuilder->codeAppend("half st_grad_len = length(dFdx(st));"); + fragBuilder->codeAppend("float st_grad_len = length(dFdx(st));"); #else // We use the y gradient because there is a bug in the Mali 400 in the x direction. - fragBuilder->codeAppend("half st_grad_len = length(dFdy(st));"); + fragBuilder->codeAppend("float st_grad_len = length(dFdy(st));"); #endif fragBuilder->codeAppend("afwidth = abs(" SK_DistanceFieldAAFactor "*st_grad_len);"); } else { // For general transforms, to determine the amount of correction we multiply a unit // vector pointing along the SDF gradient direction by the Jacobian of the st coords // (which is the inverse transform for this fragment) and take the length of the result. - fragBuilder->codeAppend("half2 dist_grad = half2(dFdx(distance), dFdy(distance));"); + fragBuilder->codeAppend("float2 dist_grad = float2(dFdx(distance), dFdy(distance));"); // the length of the gradient may be 0, so we need to check for this // this also compensates for the Adreno, which likes to drop tiles on division by 0 - fragBuilder->codeAppend("half dg_len2 = dot(dist_grad, dist_grad);"); + fragBuilder->codeAppend("float dg_len2 = dot(dist_grad, dist_grad);"); fragBuilder->codeAppend("if (dg_len2 < 0.0001) {"); - fragBuilder->codeAppend("dist_grad = half2(0.7071, 0.7071);"); + fragBuilder->codeAppend("dist_grad = float2(0.7071, 0.7071);"); fragBuilder->codeAppend("} else {"); fragBuilder->codeAppend("dist_grad = dist_grad*inversesqrt(dg_len2);"); fragBuilder->codeAppend("}"); - fragBuilder->codeAppend("half2 Jdx = dFdx(st);"); - fragBuilder->codeAppend("half2 Jdy = dFdy(st);"); - fragBuilder->codeAppend("half2 grad = half2(dist_grad.x*Jdx.x + dist_grad.y*Jdy.x,"); + fragBuilder->codeAppend("float2 Jdx = dFdx(st);"); + fragBuilder->codeAppend("float2 Jdy = dFdy(st);"); + fragBuilder->codeAppend("float2 grad = float2(dist_grad.x*Jdx.x + dist_grad.y*Jdy.x,"); fragBuilder->codeAppend(" dist_grad.x*Jdx.y + dist_grad.y*Jdy.y);"); // this gives us a smooth step across approximately one fragment @@ -419,12 +421,12 @@ public: // mapped linearly to coverage, so use a linear step: if (isGammaCorrect) { fragBuilder->codeAppend( - "half val = clamp((distance + afwidth) / (2.0 * afwidth), 0.0, 1.0);"); + "float val = clamp((distance + afwidth) / (2.0 * afwidth), 0.0, 1.0);"); } else { - fragBuilder->codeAppend("half val = smoothstep(-afwidth, afwidth, distance);"); + fragBuilder->codeAppend("float val = smoothstep(-afwidth, afwidth, distance);"); } - fragBuilder->codeAppendf("%s = half4(val);", args.fOutputCoverage); + fragBuilder->codeAppendf("%s = float4(val);", args.fOutputCoverage); } void setData(const GrGLSLProgramDataManager& pdman, const GrPrimitiveProcessor& proc, @@ -587,7 +589,8 @@ public: bool isSimilarity = SkToBool(dfTexEffect.getFlags() & kSimilarity_DistanceFieldEffectFlag); bool isGammaCorrect = SkToBool(dfTexEffect.getFlags() & kGammaCorrect_DistanceFieldEffectFlag); - GrGLSLVertToFrag uv(kHighFloat2_GrSLType); + GrGLSLVertToFrag recipScale(kFloat_GrSLType); + GrGLSLVertToFrag uv(kVec2f_GrSLType); varyingHandler->addVarying("TextureCoords", &uv, kHigh_GrSLPrecision); vertBuilder->codeAppendf("%s = %s;", uv.vsOut(), dfTexEffect.inTextureCoords()->fName); @@ -596,9 +599,9 @@ public: GrTexture* atlas = dfTexEffect.textureSampler(0).peekTexture(); SkASSERT(atlas && SkIsPow2(atlas->width()) && SkIsPow2(atlas->height())); - GrGLSLVertToFrag st(kHighFloat2_GrSLType); + GrGLSLVertToFrag st(kVec2f_GrSLType); varyingHandler->addVarying("IntTextureCoords", &st, kHigh_GrSLPrecision); - vertBuilder->codeAppendf("%s = highfloat2(%d, %d) * %s;", st.vsOut(), + vertBuilder->codeAppendf("%s = float2(%d, %d) * %s;", st.vsOut(), atlas->width(), atlas->height(), dfTexEffect.inTextureCoords()->fName); @@ -606,68 +609,69 @@ 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("highp float2 uv = %s;\n", uv.fsIn()); SkScalar lcdDelta = 1.0f / (3.0f * atlas->width()); if (dfTexEffect.getFlags() & kBGR_DistanceFieldEffectFlag) { - fragBuilder->codeAppendf("highfloat delta = -%.*f;\n", SK_FLT_DECIMAL_DIG, lcdDelta); + fragBuilder->codeAppendf("highp float delta = -%.*f;\n", SK_FLT_DECIMAL_DIG, lcdDelta); } else { - fragBuilder->codeAppendf("highfloat delta = %.*f;\n", SK_FLT_DECIMAL_DIG, lcdDelta); + fragBuilder->codeAppendf("highp float delta = %.*f;\n", SK_FLT_DECIMAL_DIG, lcdDelta); } if (isUniformScale) { #ifdef SK_VULKAN - fragBuilder->codeAppendf("half st_grad_len = abs(dFdx(%s.x));", st.fsIn()); + fragBuilder->codeAppendf("float st_grad_len = abs(dFdx(%s.x));", st.fsIn()); #else // We use the y gradient because there is a bug in the Mali 400 in the x direction. - fragBuilder->codeAppendf("half st_grad_len = abs(dFdy(%s.y));", st.fsIn()); + fragBuilder->codeAppendf("float st_grad_len = abs(dFdy(%s.y));", st.fsIn()); #endif - fragBuilder->codeAppend("half2 offset = half2(st_grad_len*delta, 0.0);"); + fragBuilder->codeAppend("float2 offset = float2(st_grad_len*delta, 0.0);"); } else if (isSimilarity) { // For a similarity matrix with rotation, the gradient will not be aligned // with the texel coordinate axes, so we need to calculate it. #ifdef SK_VULKAN - fragBuilder->codeAppendf("half2 st_grad = dFdx(%s);", st.fsIn()); - fragBuilder->codeAppend("half2 offset = delta*st_grad;"); + fragBuilder->codeAppendf("float2 st_grad = dFdx(%s);", st.fsIn()); + fragBuilder->codeAppend("float2 offset = delta*st_grad;"); #else // We use dFdy because of a Mali 400 bug, and rotate -90 degrees to // get the gradient in the x direction. - fragBuilder->codeAppendf("half2 st_grad = dFdy(%s);", st.fsIn()); - fragBuilder->codeAppend("half2 offset = delta*half2(st_grad.y, -st_grad.x);"); + fragBuilder->codeAppendf("float2 st_grad = dFdy(%s);", st.fsIn()); + fragBuilder->codeAppend("float2 offset = delta*float2(st_grad.y, -st_grad.x);"); #endif - fragBuilder->codeAppend("half st_grad_len = length(st_grad);"); + fragBuilder->codeAppend("float st_grad_len = length(st_grad);"); } else { - fragBuilder->codeAppendf("half2 st = %s;\n", st.fsIn()); + fragBuilder->codeAppendf("float2 st = %s;\n", st.fsIn()); - fragBuilder->codeAppend("half2 Jdx = dFdx(st);"); - fragBuilder->codeAppend("half2 Jdy = dFdy(st);"); - fragBuilder->codeAppend("half2 offset = delta*Jdx;"); + fragBuilder->codeAppend("float2 Jdx = dFdx(st);"); + fragBuilder->codeAppend("float2 Jdy = dFdy(st);"); + fragBuilder->codeAppend("float2 offset = delta*Jdx;"); } // green is distance to uv center - fragBuilder->codeAppend("\thalf4 texColor = "); - fragBuilder->appendTextureLookup(args.fTexSamplers[0], "uv", kHighFloat2_GrSLType); + fragBuilder->codeAppend("\tfloat4 texColor = "); + fragBuilder->appendTextureLookup(args.fTexSamplers[0], "uv", kVec2f_GrSLType); fragBuilder->codeAppend(";\n"); - fragBuilder->codeAppend("\thalf3 distance;\n"); + fragBuilder->codeAppend("\tfloat3 distance;\n"); fragBuilder->codeAppend("\tdistance.y = texColor.r;\n"); // red is distance to left offset - fragBuilder->codeAppend("\thighfloat2 uv_adjusted = uv - offset;\n"); + fragBuilder->codeAppend("\tfloat2 uv_adjusted = uv - offset;\n"); fragBuilder->codeAppend("\ttexColor = "); - fragBuilder->appendTextureLookup(args.fTexSamplers[0], "uv_adjusted", kHighFloat2_GrSLType); + fragBuilder->appendTextureLookup(args.fTexSamplers[0], "uv_adjusted", kVec2f_GrSLType); fragBuilder->codeAppend(";\n"); fragBuilder->codeAppend("\tdistance.x = texColor.r;\n"); // blue is distance to right offset fragBuilder->codeAppend("\tuv_adjusted = uv + offset;\n"); fragBuilder->codeAppend("\ttexColor = "); - fragBuilder->appendTextureLookup(args.fTexSamplers[0], "uv_adjusted", kHighFloat2_GrSLType); + fragBuilder->appendTextureLookup(args.fTexSamplers[0], "uv_adjusted", kVec2f_GrSLType); fragBuilder->codeAppend(";\n"); fragBuilder->codeAppend("\tdistance.z = texColor.r;\n"); fragBuilder->codeAppend("\tdistance = " - "half3(" SK_DistanceFieldMultiplier ")*(distance - half3(" SK_DistanceFieldThreshold"));"); + "float3(" SK_DistanceFieldMultiplier ")*(distance - float3(" SK_DistanceFieldThreshold"));"); // adjust width based on gamma const char* distanceAdjustUniName = nullptr; - fDistanceAdjustUni = uniformHandler->addUniform(kFragment_GrShaderFlag, kHalf3_GrSLType, + fDistanceAdjustUni = uniformHandler->addUniform(kFragment_GrShaderFlag, + kVec3f_GrSLType, kDefault_GrSLPrecision, "DistanceAdjust", &distanceAdjustUniName); fragBuilder->codeAppendf("distance -= %s;", distanceAdjustUniName); @@ -675,7 +679,7 @@ public: // for each color component. However, this is only important when using perspective // transformations, and even then using a single factor seems like a reasonable // trade-off between quality and speed. - fragBuilder->codeAppend("half afwidth;"); + fragBuilder->codeAppend("float afwidth;"); if (isSimilarity) { // For similarity transform (uniform scale-only is a subset of this), we adjust for the // effect of the transformation on the distance by using the length of the gradient of @@ -688,16 +692,16 @@ public: // For general transforms, to determine the amount of correction we multiply a unit // vector pointing along the SDF gradient direction by the Jacobian of the st coords // (which is the inverse transform for this fragment) and take the length of the result. - fragBuilder->codeAppend("half2 dist_grad = half2(dFdx(distance.r), dFdy(distance.r));"); + fragBuilder->codeAppend("float2 dist_grad = float2(dFdx(distance.r), dFdy(distance.r));"); // the length of the gradient may be 0, so we need to check for this // this also compensates for the Adreno, which likes to drop tiles on division by 0 - fragBuilder->codeAppend("half dg_len2 = dot(dist_grad, dist_grad);"); + fragBuilder->codeAppend("float dg_len2 = dot(dist_grad, dist_grad);"); fragBuilder->codeAppend("if (dg_len2 < 0.0001) {"); - fragBuilder->codeAppend("dist_grad = half2(0.7071, 0.7071);"); + fragBuilder->codeAppend("dist_grad = float2(0.7071, 0.7071);"); fragBuilder->codeAppend("} else {"); fragBuilder->codeAppend("dist_grad = dist_grad*inversesqrt(dg_len2);"); fragBuilder->codeAppend("}"); - fragBuilder->codeAppend("half2 grad = half2(dist_grad.x*Jdx.x + dist_grad.y*Jdy.x,"); + fragBuilder->codeAppend("float2 grad = float2(dist_grad.x*Jdx.x + dist_grad.y*Jdy.x,"); fragBuilder->codeAppend(" dist_grad.x*Jdx.y + dist_grad.y*Jdy.y);"); // this gives us a smooth step across approximately one fragment @@ -709,11 +713,11 @@ public: // mapped linearly to coverage, so use a linear step: if (isGammaCorrect) { fragBuilder->codeAppendf("%s = " - "half4(clamp((distance + half3(afwidth)) / half3(2.0 * afwidth), 0.0, 1.0), 1.0);", + "float4(clamp((distance + float3(afwidth)) / float3(2.0 * afwidth), 0.0, 1.0), 1.0);", args.fOutputCoverage); } else { fragBuilder->codeAppendf( - "%s = half4(smoothstep(half3(-afwidth), half3(afwidth), distance), 1.0);", + "%s = float4(smoothstep(float3(-afwidth), float3(afwidth), distance), 1.0);", args.fOutputCoverage); } } |