James Price | d68d3a9 | 2022-04-07 13:42:45 +0000 | [diff] [blame] | 1 | #include <metal_stdlib> |
James Price | b02fe31 | 2022-04-07 13:42:45 +0000 | [diff] [blame] | 2 | |
James Price | d68d3a9 | 2022-04-07 13:42:45 +0000 | [diff] [blame] | 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]; |
| 15 | }; |
| 16 | |
| 17 | void tint_symbol(device tint_array<uint, 1>* const tint_symbol_2) { |
James Price | d68d3a9 | 2022-04-07 13:42:45 +0000 | [diff] [blame] | 18 | (*(tint_symbol_2))[1] = ((*(tint_symbol_2))[1] - 1u); |
James Price | b02fe31 | 2022-04-07 13:42:45 +0000 | [diff] [blame] | 19 | } |
| 20 | |