xref: /third_party/skia/resources/sksl/folding/SelfAssignment.sksl
  • Home
  • History
  • Annotate Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
  • only in /third_party/skia/resources/sksl/folding/
1cb93a386Sopenharmony_ciuniform half4 colorRed, colorGreen;
2cb93a386Sopenharmony_ci
3cb93a386Sopenharmony_cistruct S {
4cb93a386Sopenharmony_ci    half i;
5cb93a386Sopenharmony_ci    half j;
6cb93a386Sopenharmony_ci};
7cb93a386Sopenharmony_ci
8cb93a386Sopenharmony_cihalf4 main(float2 coords) {
9cb93a386Sopenharmony_ci    // All of these assignments can be preserved.
10cb93a386Sopenharmony_ci    half4 x = half4(3, 2, 1, 0);
11cb93a386Sopenharmony_ci    x.xyz = x.zyx;
12cb93a386Sopenharmony_ci
13cb93a386Sopenharmony_ci    S s;
14cb93a386Sopenharmony_ci    s.i = 2;
15cb93a386Sopenharmony_ci    s.j = 2;
16cb93a386Sopenharmony_ci    s.i = s.j;
17cb93a386Sopenharmony_ci    s.j = s.i;
18cb93a386Sopenharmony_ci
19cb93a386Sopenharmony_ci    half a[2];
20cb93a386Sopenharmony_ci    a[0] = 1;
21cb93a386Sopenharmony_ci    a[1] = 0;
22cb93a386Sopenharmony_ci    a[1] = a[0];
23cb93a386Sopenharmony_ci
24cb93a386Sopenharmony_ci    // All of these assignments should be eliminated.
25cb93a386Sopenharmony_ci    x.wy = x.wy;
26cb93a386Sopenharmony_ci    x.xyz = x.xyz;
27cb93a386Sopenharmony_ci    x = x;
28cb93a386Sopenharmony_ci    s.i = s.i;
29cb93a386Sopenharmony_ci    s.j = s.j;
30cb93a386Sopenharmony_ci    a[0] = a[0];
31cb93a386Sopenharmony_ci    a[1] = a[1];
32cb93a386Sopenharmony_ci
33cb93a386Sopenharmony_ci    return half4(x.w, s.i / s.j, a[0] - a[1], a[0] * a[1]);
34cb93a386Sopenharmony_ci}
35

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