xref: /third_party/skia/resources/sksl/intrinsics/FaceForward.sksl (revision cb93a386)
  • Home
  • History
  • Annotate Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
  • only in /third_party/skia/resources/sksl/intrinsics/
1cb93a386Sopenharmony_ciuniform half4 N, I, NRef;
2cb93a386Sopenharmony_ciuniform half4 colorGreen, colorRed;
3cb93a386Sopenharmony_ci
4cb93a386Sopenharmony_cihalf4 main(float2 xy) {
5cb93a386Sopenharmony_ci
6cb93a386Sopenharmony_ci    const half4 constN    = half4(1, 2, 3, 4);
7cb93a386Sopenharmony_ci    const half4 constI    = half4(1, 1, -100, 1);
8cb93a386Sopenharmony_ci    const half4 constNRef = half4(1);
9cb93a386Sopenharmony_ci
10cb93a386Sopenharmony_ci    half4 expectedPos =  half4(1, 2, 3, 4);
11cb93a386Sopenharmony_ci    half4 expectedNeg = -half4(1, 2, 3, 4);
12cb93a386Sopenharmony_ci
13cb93a386Sopenharmony_ci    return (faceforward(N.x,         I.x,         NRef.x        ) == expectedNeg.x    &&
14cb93a386Sopenharmony_ci            faceforward(N.xy,        I.xy,        NRef.xy       ) == expectedNeg.xy   &&
15cb93a386Sopenharmony_ci            faceforward(N.xyz,       I.xyz,       NRef.xyz      ) == expectedPos.xyz  &&
16cb93a386Sopenharmony_ci            faceforward(N.xyzw,      I.xyzw,      NRef.xyzw     ) == expectedPos.xyzw &&
17cb93a386Sopenharmony_ci            faceforward(constN.x,    constI.x,    constNRef.x   ) == expectedNeg.x    &&
18cb93a386Sopenharmony_ci            faceforward(constN.xy,   constI.xy,   constNRef.xy  ) == expectedNeg.xy   &&
19cb93a386Sopenharmony_ci            faceforward(constN.xyz,  constI.xyz,  constNRef.xyz ) == expectedPos.xyz  &&
20cb93a386Sopenharmony_ci            faceforward(constN.xyzw, constI.xyzw, constNRef.xyzw) == expectedPos.xyzw) ? colorGreen
21cb93a386Sopenharmony_ci                                                                                       : colorRed;
22cb93a386Sopenharmony_ci}
23

Indexes created Thu Nov 07 10:32:03 CST 2024