blob: f25c6a7bca342892cc766520f67489ab701444a7 [file] [log] [blame]
uniform half4 inputVal;
uniform half4 colorGreen, colorRed;
half4 main(float2 coords) {
// Ensure that normalizing zero doesn't trigger a UBSAN divide-by-zero report.
float normalizeZero = normalize(0);
// Ensure that it is harmless to normalize a gigantic value.
float normalizeHuge = normalize(1E34);
const half4 constVec = half4(20, 0, 0, 0);
half4 expectedVec = half4(1, 0, 0, 0);
return (normalize(inputVal.x) == expectedVec.x &&
normalize(inputVal.xy) == expectedVec.xy &&
normalize(inputVal.xyz) == expectedVec.xyz &&
normalize(inputVal.xyzw) == expectedVec.xyzw &&
normalize(constVec.x) == expectedVec.x &&
normalize(constVec.yx) == expectedVec.yx &&
normalize(constVec.zxy) == expectedVec.zxy &&
normalize(constVec.xyzw) == expectedVec.xyzw) ? colorGreen : colorRed;
}