Update rive-cpp to 2.0 version
[platform/core/uifw/rive-tizen.git] / submodule / skia / resources / sksl / shared / Assignment.sksl
1 uniform half4 colorGreen;
2
3 struct S {
4     float f;
5     float af[5];
6     half4 h4;
7     half4 ah4[5];
8 };
9
10 half4 globalVar;
11 S globalStruct;
12
13 half4 main(float2 coords) {
14     /* assign to scalar */               int i; i = 0;
15     /* assign to vector */               int4 i4; i4 = int4(1,2,3,4);
16     /* assign to matrix */               float3x3 f3x3; f3x3 = float3x3(1,2,3,4,5,6,7,8,9);
17     /* assign to swizzle */              half4 x; x.w = 0; x.yx = half2(0);
18     /* assign to array of scalar */      int ai[1]; ai[0] = 0;
19     /* assign to array of vector */      int4 ai4[1]; ai4[0] = int4(1,2,3,4);
20     /* assign to array of matrix */      half3x3 ah2x4[1]; ah2x4[0] = half3x3(1,2,3,4,5,6,7,8,9);
21     /* assign to array swizzle */        float4 af4[1]; af4[0].x = 0; af4[0].ywxz = float4(1);
22
23     /* assign to struct variable */      S s; s.f = 0;
24     /* assign to struct array */         s.af[1] = 0;
25     /* assign to struct swizzle */       s.h4.zxy = half3(9);
26     /* assign to struct array swizzle */ s.ah4[2].yw = half2(5);
27
28     /* assign to global var */           globalVar = half4(0);
29     /* assign to global struct */        globalStruct.f = 0;
30
31 // Not allowed in ES2
32 //  /* assign to array idx by lookup */  ai[0] = 0; ai[ai[0]] = 0;
33
34 // Not allowed natively in GLSL, but SkSL will turn these into valid GLSL expressions.
35     /* assign to folded ternary */       half l, r; (true ? l : r) = 0;
36     /* assign to unary plus */           +ai[0] += +ai4[0][0];
37     /* assign to struct unary plus */    +s.f = 1; +s.af[0] = 2;
38                                          +s.h4 = half4(1); +s.ah4[0] = half4(2);
39
40     // Keep these variables alive
41     af4[0] *= float(ah2x4[0][0][0]);
42     i4.y *= i;
43     x.y *= l;
44     s.f *= l;
45
46     return colorGreen;
47 }