169c8903be
This is a reland of 22dcb5fd7e
Original change's description:
> Add coords parameter to all .sksl test files used as runtime effects
>
> Convert to use the newer MakeForShader factory, which requires this.
>
> Change-Id: Ifaf6054054027c78f3f3fe15596e435e0f79b877
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/399336
> Commit-Queue: Brian Osman <brianosman@google.com>
> Reviewed-by: John Stiles <johnstiles@google.com>
Bug: skia:11919
Change-Id: I5f745c54b2bc3712f2281db6e067345903e81931
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/401836
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
48 lines
1.7 KiB
Plaintext
48 lines
1.7 KiB
Plaintext
uniform half4 colorGreen;
|
|
|
|
struct S {
|
|
float f;
|
|
float af[5];
|
|
half4 h4;
|
|
half4 ah4[5];
|
|
};
|
|
|
|
half4 globalVar;
|
|
S globalStruct;
|
|
|
|
half4 main(float2 coords) {
|
|
/* assign to scalar */ int i; i = 0;
|
|
/* assign to vector */ int4 i4; i4 = int4(1,2,3,4);
|
|
/* assign to matrix */ float3x3 f3x3; f3x3 = float3x3(1,2,3,4,5,6,7,8,9);
|
|
/* assign to swizzle */ half4 x; x.w = 0; x.yx = half2(0);
|
|
/* assign to array of scalar */ int ai[1]; ai[0] = 0;
|
|
/* assign to array of vector */ int4 ai4[1]; ai4[0] = int4(1,2,3,4);
|
|
/* assign to array of matrix */ half3x3 ah2x4[1]; ah2x4[0] = half3x3(1,2,3,4,5,6,7,8,9);
|
|
/* assign to array swizzle */ float4 af4[1]; af4[0].x = 0; af4[0].ywxz = float4(1);
|
|
|
|
/* assign to struct variable */ S s; s.f = 0;
|
|
/* assign to struct array */ s.af[1] = 0;
|
|
/* assign to struct swizzle */ s.h4.zxy = half3(9);
|
|
/* assign to struct array swizzle */ s.ah4[2].yw = half2(5);
|
|
|
|
/* assign to global var */ globalVar = half4(0);
|
|
/* assign to global struct */ globalStruct.f = 0;
|
|
|
|
// Not allowed in ES2
|
|
// /* assign to array idx by lookup */ ai[0] = 0; ai[ai[0]] = 0;
|
|
|
|
// Not allowed natively in GLSL, but SkSL will turn these into valid GLSL expressions.
|
|
/* assign to folded ternary */ half l, r; (true ? l : r) = 0;
|
|
/* assign to unary plus */ +ai[0] += +ai4[0][0];
|
|
/* assign to struct unary plus */ +s.f = 1; +s.af[0] = 2;
|
|
+s.h4 = half4(1); +s.ah4[0] = half4(2);
|
|
|
|
// Keep these variables alive
|
|
af4[0] *= float(ah2x4[0][0][0]);
|
|
i4.y *= i;
|
|
x.y *= l;
|
|
s.f *= l;
|
|
|
|
return colorGreen;
|
|
}
|