1// GLSL ES 1.0 does not allow *any* operators other than subscripting to be used with arrays, 2// or with structs containing arrays. SkSL (and later versions of GLSL) allow assignment and 3// equality for those types. This file tests operators that would be legal, but should be flagged 4// as errors. A related consequence (also tested here) is that functions can not return arrays, 5// or structs containing arrays. 6 7// Expect 17 errors 8 9struct S { int x[1]; }; // For "simple" case 10struct T { S s; }; // For trickier, nested case 11 12S s1, s2; 13T t1, t2; 14int a1[1]; int a2[1]; 15 16void assign_A() { a1 = a2; } 17void assign_S() { s1 = s2; } 18void assign_T() { t1 = t2; } 19 20void vardecl_A() { int local_a[1] = a1; } 21void vardecl_S() { S local_s = s1; } 22void vardecl_T() { T local_t = t1; } 23 24// Note: No way to even write return_A() 25S return_S() { return s1; } 26T return_T() { return t1; } 27 28bool equals_A() { return a1 == a2; } 29bool equals_S() { return s1 == s2; } 30bool equals_T() { return t1 == t2; } 31 32bool notequals_A() { return a1 != a2; } 33bool notequals_S() { return s1 != s2; } 34bool notequals_T() { return t1 != t2; } 35 36void sequence_A() { a1, a2; } 37void sequence_S() { s1, s2; } 38void sequence_T() { t1, t2; } 39 40int ternary_A(bool b) { return (b ? a1 : a2) [0]; } 41int ternary_S(bool b) { return (b ? s1 : s2) .x[0]; } 42int ternary_T(bool b) { return (b ? t1 : t2).s.x[0]; } 43 44/*%%* 45operator '=' can not operate on arrays (or structs containing arrays) 46operator '=' can not operate on arrays (or structs containing arrays) 47operator '=' can not operate on arrays (or structs containing arrays) 48initializers are not permitted on arrays (or structs containing arrays) 49initializers are not permitted on arrays (or structs containing arrays) 50initializers are not permitted on arrays (or structs containing arrays) 51functions may not return structs containing arrays 52functions may not return structs containing arrays 53operator '==' can not operate on arrays (or structs containing arrays) 54operator '==' can not operate on arrays (or structs containing arrays) 55operator '==' can not operate on arrays (or structs containing arrays) 56operator '!=' can not operate on arrays (or structs containing arrays) 57operator '!=' can not operate on arrays (or structs containing arrays) 58operator '!=' can not operate on arrays (or structs containing arrays) 59operator ',' can not operate on arrays (or structs containing arrays) 60operator ',' can not operate on arrays (or structs containing arrays) 61operator ',' can not operate on arrays (or structs containing arrays) 62ternary operator result may not be an array (or struct containing an array) 63ternary operator result may not be an array (or struct containing an array) 64ternary operator result may not be an array (or struct containing an array) 65*%%*/ 66