Revert "Wrap 'u_rtFlip.y * dfdy()' in parentheses."

This reverts commit 9fc189f1cb.

Reason for revert: shader compile failure on AndroidOne-GPU-Mali400MP2 devices

Original change's description:
> Wrap 'u_rtFlip.y * dfdy()' in parentheses.
>
> This guards against unexpected results when dfdy is used in complex
> expressions. In practice, I'm not aware of this causing any trouble.
>
> Change-Id: I58d4762871481fdb4c173b570e4d5d6edf657af7
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/465077
> Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
> Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
> Auto-Submit: John Stiles <johnstiles@google.com>

Change-Id: Idfaa9316d657717d5ee7117837c9cc9c3d4ee189
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/465377
Auto-Submit: Greg Daniel <egdaniel@google.com>
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
This commit is contained in:
Greg Daniel 2021-10-29 12:50:46 +00:00 committed by SkCQ
parent b3ecd560a2
commit b469c10c85
4 changed files with 6 additions and 8 deletions

View File

@ -495,10 +495,9 @@ void GLSLCodeGenerator::writeFunctionCall(const FunctionCall& c) {
break; break;
case k_dFdy_IntrinsicKind: case k_dFdy_IntrinsicKind:
// Flipping Y also negates the Y derivatives. // Flipping Y also negates the Y derivatives.
this->write("(" SKSL_RTFLIP_NAME ".y * dFdy("); this->write(SKSL_RTFLIP_NAME ".y * dFdy");
this->writeExpression(*arguments[0], Precedence::kSequence); nameWritten = true;
this->write("))"); [[fallthrough]];
return;
case k_dFdx_IntrinsicKind: case k_dFdx_IntrinsicKind:
case k_fwidth_IntrinsicKind: case k_fwidth_IntrinsicKind:
if (!fFoundDerivatives && if (!fFoundDerivatives &&

View File

@ -717,9 +717,8 @@ bool MetalCodeGenerator::writeIntrinsicCall(const FunctionCall& c, IntrinsicKind
return true; return true;
} }
case k_dFdy_IntrinsicKind: { case k_dFdy_IntrinsicKind: {
this->write("(" + fRTFlipName + ".y * dfdy"); this->write(fRTFlipName + ".y*dfdy");
this->writeArgumentList(c.arguments()); this->writeArgumentList(c.arguments());
this->write(")");
return true; return true;
} }
case k_inverse_IntrinsicKind: { case k_inverse_IntrinsicKind: {

View File

@ -6,5 +6,5 @@ uniform vec4 colorGreen;
uniform vec4 colorRed; uniform vec4 colorRed;
vec4 main() { vec4 main() {
vec4 expected = vec4(0.0); vec4 expected = vec4(0.0);
return ((((((u_skRTFlip.y * dFdy(testInputs.x)) == expected.x && (u_skRTFlip.y * dFdy(testInputs.xy)) == expected.xy) && (u_skRTFlip.y * dFdy(testInputs.xyz)) == expected.xyz) && (u_skRTFlip.y * dFdy(testInputs)) == expected) && sign((u_skRTFlip.y * dFdy(coords.xx))) == vec2(0.0, 0.0)) && sign((u_skRTFlip.y * dFdy(coords.yy))) == vec2(1.0, 1.0)) && sign((u_skRTFlip.y * dFdy(coords))) == vec2(0.0, 1.0) ? colorGreen : colorRed; return (((((u_skRTFlip.y * dFdy(testInputs.x) == expected.x && u_skRTFlip.y * dFdy(testInputs.xy) == expected.xy) && u_skRTFlip.y * dFdy(testInputs.xyz) == expected.xyz) && u_skRTFlip.y * dFdy(testInputs) == expected) && sign(u_skRTFlip.y * dFdy(coords.xx)) == vec2(0.0, 0.0)) && sign(u_skRTFlip.y * dFdy(coords.yy)) == vec2(1.0, 1.0)) && sign(u_skRTFlip.y * dFdy(coords)) == vec2(0.0, 1.0) ? colorGreen : colorRed;
} }

View File

@ -18,6 +18,6 @@ fragment Outputs fragmentMain(Inputs _in [[stage_in]], constant Uniforms& _unifo
Outputs _out; Outputs _out;
(void)_out; (void)_out;
float4 expected = float4(0.0); float4 expected = float4(0.0);
_out.sk_FragColor = ((((((_anonInterface0.u_skRTFlip.y * dfdy(_uniforms.testInputs.x)) == expected.x && all((_anonInterface0.u_skRTFlip.y * dfdy(_uniforms.testInputs.xy)) == expected.xy)) && all((_anonInterface0.u_skRTFlip.y * dfdy(_uniforms.testInputs.xyz)) == expected.xyz)) && all((_anonInterface0.u_skRTFlip.y * dfdy(_uniforms.testInputs)) == expected)) && all(sign((_anonInterface0.u_skRTFlip.y * dfdy(coords.xx))) == float2(0.0, 0.0))) && all(sign((_anonInterface0.u_skRTFlip.y * dfdy(coords.yy))) == float2(1.0, 1.0))) && all(sign((_anonInterface0.u_skRTFlip.y * dfdy(coords))) == float2(0.0, 1.0)) ? _uniforms.colorGreen : _uniforms.colorRed; _out.sk_FragColor = (((((_anonInterface0.u_skRTFlip.y*dfdy(_uniforms.testInputs.x) == expected.x && all(_anonInterface0.u_skRTFlip.y*dfdy(_uniforms.testInputs.xy) == expected.xy)) && all(_anonInterface0.u_skRTFlip.y*dfdy(_uniforms.testInputs.xyz) == expected.xyz)) && all(_anonInterface0.u_skRTFlip.y*dfdy(_uniforms.testInputs) == expected)) && all(sign(_anonInterface0.u_skRTFlip.y*dfdy(coords.xx)) == float2(0.0, 0.0))) && all(sign(_anonInterface0.u_skRTFlip.y*dfdy(coords.yy)) == float2(1.0, 1.0))) && all(sign(_anonInterface0.u_skRTFlip.y*dfdy(coords)) == float2(0.0, 1.0)) ? _uniforms.colorGreen : _uniforms.colorRed;
return _out; return _out;
} }