Antonio Maiorano | 9834fef | 2021-06-04 15:28:47 +0000 | [diff] [blame] | 1 | #include <metal_stdlib> |
| 2 | |
| 3 | using namespace metal; |
Ben Clayton | f47887d | 2022-06-24 17:01:59 +0000 | [diff] [blame] | 4 | |
| 5 | template<typename T, size_t N> |
| 6 | struct tint_array { |
| 7 | const constant T& operator[](size_t i) const constant { return elements[i]; } |
| 8 | device T& operator[](size_t i) device { return elements[i]; } |
| 9 | const device T& operator[](size_t i) const device { return elements[i]; } |
| 10 | thread T& operator[](size_t i) thread { return elements[i]; } |
| 11 | const thread T& operator[](size_t i) const thread { return elements[i]; } |
| 12 | threadgroup T& operator[](size_t i) threadgroup { return elements[i]; } |
| 13 | const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; } |
| 14 | T elements[N]; |
Antonio Maiorano | 9834fef | 2021-06-04 15:28:47 +0000 | [diff] [blame] | 15 | }; |
Ben Clayton | 8ec32a6 | 2022-02-09 23:55:51 +0000 | [diff] [blame] | 16 | |
Antonio Maiorano | 9834fef | 2021-06-04 15:28:47 +0000 | [diff] [blame] | 17 | struct tint_symbol_1 { |
| 18 | float4 value [[color(0)]]; |
| 19 | }; |
Antonio Maiorano | 9834fef | 2021-06-04 15:28:47 +0000 | [diff] [blame] | 20 | |
James Price | a5d73ce | 2021-08-04 22:15:28 +0000 | [diff] [blame] | 21 | float4 tint_symbol_inner() { |
Ben Clayton | c64ca23 | 2022-06-29 00:55:36 +0000 | [diff] [blame] | 22 | int v1 = 1; |
| 23 | uint v2 = 1u; |
| 24 | float v3 = 1.0f; |
| 25 | int3 v4 = int3(1); |
| 26 | uint3 v5 = uint3(1u); |
| 27 | float3 v6 = float3(1.0f); |
| 28 | float3x3 v7 = float3x3(float3(1.0f), float3(1.0f), float3(1.0f)); |
| 29 | tint_array<float, 10> v9 = tint_array<float, 10>{}; |
Ben Clayton | cb6ddd2 | 2022-06-01 10:08:29 +0000 | [diff] [blame] | 30 | return float4(0.0f); |
James Price | a5d73ce | 2021-08-04 22:15:28 +0000 | [diff] [blame] | 31 | } |
| 32 | |
Antonio Maiorano | 9834fef | 2021-06-04 15:28:47 +0000 | [diff] [blame] | 33 | fragment tint_symbol_1 tint_symbol() { |
James Price | a5d73ce | 2021-08-04 22:15:28 +0000 | [diff] [blame] | 34 | float4 const inner_result = tint_symbol_inner(); |
| 35 | tint_symbol_1 wrapper_result = {}; |
| 36 | wrapper_result.value = inner_result; |
| 37 | return wrapper_result; |
Antonio Maiorano | 9834fef | 2021-06-04 15:28:47 +0000 | [diff] [blame] | 38 | } |
| 39 | |