368166262a
Improved tests caught a longstanding bug in the compile-time optimization logic for round/roundEven. These would *always* round to an even number even when it didn't make sense to do so. (e.g. 3.1 would round to 4.) RoundEven isn't available in lower shader models of Direct3D; SPIRV-Cross throws if it's unavailable. We may need a caps bit for this. Change-Id: I3cc50238a2116b8d4e2c4059730d8b5cfb2bb056 Bug: skia:12022, skia:12352 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/441078 Auto-Submit: John Stiles <johnstiles@google.com> Reviewed-by: Brian Osman <brianosman@google.com> Commit-Queue: John Stiles <johnstiles@google.com>
18 lines
804 B
Plaintext
18 lines
804 B
Plaintext
uniform half4 testInputs; // -1.25, 0, 0.75, 2.25
|
|
uniform half4 colorGreen, colorRed;
|
|
|
|
half4 main(float2 coords) {
|
|
const float4 expectedA = half4(-1.0, 0.0, 1.0, 2.0);
|
|
|
|
const float4 constVal = half4(-6.75, -0.475, 3.5, 2.5);
|
|
const float4 expectedB = half4(-7.0, -0.0, 4.0, 2.0);
|
|
return (roundEven(testInputs.x) == expectedA.x &&
|
|
roundEven(testInputs.xy) == expectedA.xy &&
|
|
roundEven(testInputs.xyz) == expectedA.xyz &&
|
|
roundEven(testInputs.xyzw) == expectedA.xyzw &&
|
|
roundEven(constVal.x) == expectedB.x &&
|
|
roundEven(constVal.xy) == expectedB.xy &&
|
|
roundEven(constVal.xyz) == expectedB.xyz &&
|
|
roundEven(constVal.xyzw) == expectedB.xyzw) ? colorGreen : colorRed;
|
|
}
|