skia2/resources/sksl/runtime_errors/IllegalArrayOps.rts
Brian Osman 552fcb9a1b Remove flexible runtime effects entirely
All internal usage has migrated to MakeFor..., this removes the old
program kind, and updates some tests.

Bug: skia:11813
Change-Id: I56733b071270e1ae3fab5d851e23acf6c02e3361
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/402536
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
2021-04-29 16:02:27 +00:00

39 lines
1.2 KiB
Plaintext

// GLSL ES 1.0 does not allow *any* operators other than subscripting to be used with arrays,
// or with structs containing arrays. SkSL (and later versions of GLSL) allow assignment and
// equality for those types. This file tests operators that would be legal, but should be flagged
// as errors. A related consequence (also tested here) is that functions can not return arrays,
// or structs containing arrays.
// Expect 17 errors
struct S { int x[1]; }; // For "simple" case
struct T { S s; }; // For trickier, nested case
S s1, s2;
T t1, t2;
int a1[1]; int a2[1];
void assign_A() { a1 = a2; }
void assign_S() { s1 = s2; }
void assign_T() { t1 = t2; }
// Note: No way to even write return_A()
S return_S() { return s1; }
T return_T() { return t1; }
bool equals_A() { return a1 == a2; }
bool equals_S() { return s1 == s2; }
bool equals_T() { return t1 == t2; }
bool notequals_A() { return a1 != a2; }
bool notequals_S() { return s1 != s2; }
bool notequals_T() { return t1 != t2; }
void sequence_A() { a1, a2; }
void sequence_S() { s1, s2; }
void sequence_T() { t1, t2; }
int ternary_A(bool b) { return (b ? a1 : a2) [0]; }
int ternary_S(bool b) { return (b ? s1 : s2) .x[0]; }
int ternary_T(bool b) { return (b ? t1 : t2).s.x[0]; }