1int i = 1; 2uint u = 1; 3float f = 1.0; 4 5// SkSL allows `float op <int literal>` and `<int literal> op float`, unlike GLSL. 6void f_eq_int_literal_ok() { f = 1; } 7void f_plus_int_literal_ok() { f + 1; } 8void f_minus_int_literal_ok() { f - 1; } 9void f_mul_int_literal_ok() { f * 1; } 10void f_div_int_literal_ok() { f / 1; } 11void int_literal_plus_f_ok() { 1 + f; } 12void int_literal_minus_f_ok() { 1 - f; } 13void int_literal_mul_f_ok() { 1 * f; } 14void int_literal_div_f_ok() { 1 / f; } 15 16// SkSL also allows `uint op <int literal>` and `<int literal> op uint` without the `u` suffix. 17void u_eq_int_literal_ok() { u = 1; } 18void u_plus_int_literal_ok() { u + 1; } 19void u_minus_int_literal_ok() { u - 1; } 20void u_mul_int_literal_ok() { u * 1; } 21void u_div_int_literal_ok() { u / 1; } 22void int_literal_plus_u_ok() { 1 + u; } 23void int_literal_minus_u_ok() { 1 - u; } 24void int_literal_mul_u_ok() { 1 * u; } 25void int_literal_div_u_ok() { 1 / u; } 26 27// Other than that, mixing scalar types without a cast is disallowed. 28void i_eq_float_literal_disallowed() { i = 1.0; } 29void u_eq_float_literal_disallowed() { u = 1.0; } 30void i_eq_u_disallowed() { i = u; } 31void i_eq_f_disallowed() { i = f; } 32float f_eq_i_disallowed() { f = i; } 33float f_eq_i_disallowed() { f = u; } 34void u_eq_i_disallowed() { u = i; } 35void u_eq_f_disallowed() { u = f; } 36void i_plus_float_literal_disallowed() { i + 1.0; } 37void i_minus_float_literal_disallowed() { i - 1.0; } 38void i_mul_float_literal_disallowed() { i * 1.0; } 39void i_div_float_literal_disallowed() { i / 1.0; } 40void float_literal_plus_i_disallowed() { 1.0 + i; } 41void float_literal_minus_i_disallowed() { 1.0 - i; } 42void float_literal_mul_i_disallowed() { 1.0 * i; } 43void float_literal_div_i_disallowed() { 1.0 / i; } 44void u_plus_float_literal_disallowed() { u + 1.0; } 45void u_minus_float_literal_disallowed() { u - 1.0; } 46void u_mul_float_literal_disallowed() { u * 1.0; } 47void u_div_float_literal_disallowed() { u / 1.0; } 48void float_literal_plus_u_disallowed() { 1.0 + u; } 49void float_literal_minus_u_disallowed() { 1.0 - u; } 50void float_literal_mul_u_disallowed() { 1.0 * u; } 51void float_literal_div_u_disallowed() { 1.0 / u; } 52void i_plus_f_disallowed() { i + f; } 53void i_minus_f_disallowed() { i - f; } 54void i_mul_f_disallowed() { i * f; } 55void i_div_f_disallowed() { i / f; } 56void f_plus_i_disallowed() { f + i; } 57void f_minus_i_disallowed() { f - i; } 58void f_mul_i_disallowed() { f * i; } 59void f_div_i_disallowed() { f / i; } 60void u_plus_f_disallowed() { u + f; } 61void u_minus_f_disallowed() { u - f; } 62void u_mul_f_disallowed() { u * f; } 63void u_div_f_disallowed() { u / f; } 64void f_plus_u_disallowed() { f + u; } 65void f_minus_u_disallowed() { f - u; } 66void f_mul_u_disallowed() { f * u; } 67void f_div_u_disallowed() { f / u; } 68void i_plus_u_disallowed() { i + u; } 69void i_minus_u_disallowed() { i - u; } 70void i_mul_u_disallowed() { i * u; } 71void i_div_u_disallowed() { i / u; } 72void u_plus_i_disallowed() { u + i; } 73void u_minus_i_disallowed() { u - i; } 74void u_mul_i_disallowed() { u * i; } 75void u_div_i_disallowed() { u / i; } 76