John Stiles | dce4d3e | 2020-09-25 14:35:13 -0400 | [diff] [blame] | 1 | struct S { |
| 2 | float f; |
| 3 | }; |
John Stiles | 6798e5d | 2020-09-17 18:20:26 -0400 | [diff] [blame] | 4 | |
John Stiles | dce4d3e | 2020-09-25 14:35:13 -0400 | [diff] [blame] | 5 | uniform int u; |
| 6 | |
John Stiles | c14defb | 2020-09-25 14:40:44 -0400 | [diff] [blame] | 7 | void assign_to_literal() { 1 = 2; } |
| 8 | void assign_to_uniform() { u = 0; } |
Brian Osman | 4a015c5 | 2021-02-19 16:26:13 -0500 | [diff] [blame] | 9 | void assign_to_const() { const int x = 1; x = 0; } |
| 10 | |
| 11 | void assign_to_const_swizzle() { const half4 x = half4(1); x.w = 0; } |
John Stiles | c14defb | 2020-09-25 14:40:44 -0400 | [diff] [blame] | 12 | void assign_to_repeated_swizzle() { half4 x; x.yy = half2(0); } |
Brian Osman | 4a015c5 | 2021-02-19 16:26:13 -0500 | [diff] [blame] | 13 | |
| 14 | void assign_to_foldable_ternary_const_left() { const float l = 1; float r; (true ? l : r) = 0; } |
| 15 | void assign_to_foldable_ternary_const_right() { float l; const float r = 1; (false ? l : r) = 0; } |
| 16 | void assign_to_foldable_ternary_const_both() { const float l = 1; const float r = 1; (true ? l : r) = 0; } |
John Stiles | 639e812 | 2021-05-24 10:52:23 -0400 | [diff] [blame] | 17 | void assign_to_unfoldable_ternary() { float l, r; (u > 0 ? l : r) = 0; } |
John Stiles | c14defb | 2020-09-25 14:40:44 -0400 | [diff] [blame] | 18 | void assign_to_unary_minus() { float x; -x = 0; } |
| 19 | void assign_to_unary_plus() { float x; +x = 0; } // TODO(skbug.com/10766) |
Brian Osman | ffee476 | 2021-02-19 16:29:50 -0500 | [diff] [blame] | 20 | |
| 21 | void assign_to_const_param(const int x) { x = 0; } |
| 22 | void assign_to_const_array_param(const int x[1]) { x[0] = 0; } |
| 23 | void assign_to_const_struct_param(const S s) { s.f = 0; } |