3ef2c61c50
This one is structured a bit differently; it gets to length() value, then divides the input by its length using a bit of DSL. Since all the inputs are constant, the constant-folder will do the right thing. $genType normalize($genType x); $genHType normalize($genHType x); Change-Id: I51e5c65fa9e33738cbe253fcc97ee2160c48cfdd Bug: skia:12034 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/412340 Commit-Queue: John Stiles <johnstiles@google.com> Auto-Submit: John Stiles <johnstiles@google.com> Reviewed-by: Brian Osman <brianosman@google.com>
17 lines
743 B
Plaintext
17 lines
743 B
Plaintext
uniform half4 input;
|
|
uniform half4 colorGreen, colorRed;
|
|
|
|
half4 main(float2 coords) {
|
|
const half4 constVec = half4(20, 0, 0, 0);
|
|
half4 expectedVec = half4(1, 0, 0, 0);
|
|
|
|
return (normalize(input.x) == expectedVec.x &&
|
|
normalize(input.xy) == expectedVec.xy &&
|
|
normalize(input.xyz) == expectedVec.xyz &&
|
|
normalize(input.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;
|
|
}
|