Revert "SkSL is now pickier about type conversions"
This reverts commit 91c1d08bc391c997418512b9599f3acd3b2c985d.
Reason for revert: breaking everything
Original change's description:
> SkSL is now pickier about type conversions
>
> Bug: skia:
> Change-Id: I4e8b8f229f4e4344f160b0dbb41832764d0b75bd
> Reviewed-on: https://skia-review.googlesource.com/c/188311
> 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: I670fa9215d3ca0ce738edc24e832b6d968599cb1
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:
Reviewed-on: https://skia-review.googlesource.com/c/189642
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
diff --git a/src/gpu/gradients/GrTwoPointConicalGradientLayout.cpp b/src/gpu/gradients/GrTwoPointConicalGradientLayout.cpp
index f268e16..418399b 100644
--- a/src/gpu/gradients/GrTwoPointConicalGradientLayout.cpp
+++ b/src/gpu/gradients/GrTwoPointConicalGradientLayout.cpp
@@ -44,24 +44,24 @@
SkString sk_TransformedCoords2D_0 = fragBuilder->ensureCoords2D(args.fTransformedCoords[0]);
fragBuilder->codeAppendf(
"float2 p = %s;\nfloat t = -1.0;\nhalf v = 1.0;\n@switch (%d) {\n case 1:\n "
- " {\n half r0_2 = %s.y;\n t = float(r0_2) - p.y * p.y;\n "
- " if (t >= 0.0) {\n t = p.x + sqrt(t);\n } else "
- "{\n v = -1.0;\n }\n }\n break;\n case "
- "0:\n {\n half r0 = %s.x;\n @if (%s) {\n "
- " t = length(p) - float(r0);\n } else {\n t = "
- "-length(p) - float(r0);\n ",
+ " {\n half r0_2 = %s.y;\n t = float(float(r0_2) - p.y * "
+ "p.y);\n if (t >= 0.0) {\n t = p.x + sqrt(t);\n "
+ " } else {\n v = -1.0;\n }\n }\n break;\n "
+ " case 0:\n {\n half r0 = %s.x;\n @if (%s) {\n "
+ " t = length(p) - float(r0);\n } else {\n t = "
+ "-length(p) - float(r0);\n",
sk_TransformedCoords2D_0.c_str(), (int)_outer.type(),
args.fUniformHandler->getUniformCStr(fFocalParamsVar),
args.fUniformHandler->getUniformCStr(fFocalParamsVar),
(_outer.isRadiusIncreasing() ? "true" : "false"));
fragBuilder->codeAppendf(
- " }\n }\n break;\n case 2:\n {\n half invR1 "
- "= %s.x;\n half fx = %s.y;\n float x_t = -1.0;\n "
- "@if (%s) {\n x_t = dot(p, p) / p.x;\n } else if (%s) "
- "{\n x_t = length(p) - p.x * float(invR1);\n } else {\n "
- " float temp = p.x * p.x - p.y * p.y;\n if (temp >= "
- "0.0) {\n @if (%s || !%s) {\n x_t = "
- "-sqrt(temp) - p.x * float(invR1)",
+ " }\n }\n break;\n case 2:\n {\n "
+ "half invR1 = %s.x;\n half fx = %s.y;\n float x_t = -1.0;\n "
+ " @if (%s) {\n x_t = dot(p, p) / p.x;\n } else "
+ "if (%s) {\n x_t = length(p) - p.x * float(invR1);\n } "
+ "else {\n float temp = p.x * p.x - p.y * p.y;\n if "
+ "(temp >= 0.0) {\n @if (%s || !%s) {\n "
+ "x_t = -sqrt(temp) - p.x * float",
args.fUniformHandler->getUniformCStr(fFocalParamsVar),
args.fUniformHandler->getUniformCStr(fFocalParamsVar),
(_outer.isFocalOnCircle() ? "true" : "false"),
@@ -69,19 +69,19 @@
(_outer.isSwapped() ? "true" : "false"),
(_outer.isRadiusIncreasing() ? "true" : "false"));
fragBuilder->codeAppendf(
- ";\n } else {\n x_t = sqrt(temp) - p.x * "
- "float(invR1);\n }\n }\n }\n "
- " @if (!%s) {\n if (x_t <= 0.0) {\n v = -1.0;\n "
- " }\n }\n @if (%s) {\n @if (%s) "
- "{\n t = x_t;\n } else {\n t "
- "= x_t + float(fx);\n }\n } else {\n @if "
- "(%s) {\n ",
+ "(invR1);\n } else {\n x_t = sqrt(temp) "
+ "- p.x * float(invR1);\n }\n }\n }\n "
+ " @if (!%s) {\n if (x_t <= 0.0) {\n v = "
+ "-1.0;\n }\n }\n @if (%s) {\n "
+ "@if (%s) {\n t = x_t;\n } else {\n "
+ " t = x_t + float(fx);\n }\n } else {\n "
+ " @if (%s) {\n ",
(_outer.isWellBehaved() ? "true" : "false"),
(_outer.isRadiusIncreasing() ? "true" : "false"),
(_outer.isNativelyFocal() ? "true" : "false"),
(_outer.isNativelyFocal() ? "true" : "false"));
fragBuilder->codeAppendf(
- " t = -x_t;\n } else {\n t = -x_t + "
+ " t = -x_t;\n } else {\n t = -x_t + "
"float(fx);\n }\n }\n @if (%s) {\n "
" t = 1.0 - t;\n }\n }\n break;\n}\n%s = "
"half4(half(t), v, 0.0, 0.0);\n",