blob: 6507f5803fd58764142e76580316d15eb3ca3f54 [file] [log] [blame]
#include <metal_stdlib>
using namespace metal;
template<typename T, size_t N>
struct tint_array {
const constant T& operator[](size_t i) const constant { return elements[i]; }
device T& operator[](size_t i) device { return elements[i]; }
const device T& operator[](size_t i) const device { return elements[i]; }
thread T& operator[](size_t i) thread { return elements[i]; }
const thread T& operator[](size_t i) const thread { return elements[i]; }
threadgroup T& operator[](size_t i) threadgroup { return elements[i]; }
const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; }
T elements[N];
};
template<typename T, int N, int M>
inline vec<T, M> operator*(matrix<T, N, M> lhs, packed_vec<T, N> rhs) {
return lhs * vec<T, N>(rhs);
}
template<typename T, int N, int M>
inline vec<T, N> operator*(packed_vec<T, M> lhs, matrix<T, N, M> rhs) {
return vec<T, M>(lhs) * rhs;
}
struct Simulation {
/* 0x0000 */ uint i;
};
struct Particle {
/* 0x0000 */ tint_array<float3, 8> position;
/* 0x0080 */ float lifetime;
/* 0x0084 */ tint_array<int8_t, 12> tint_pad;
/* 0x0090 */ float4 color;
/* 0x00a0 */ packed_float3 velocity;
/* 0x00ac */ tint_array<int8_t, 4> tint_pad_1;
};
struct Particles {
/* 0x0000 */ tint_array<Particle, 1> p;
};
kernel void tint_symbol(const device Particles* tint_symbol_1 [[buffer(1)]], const constant Simulation* tint_symbol_2 [[buffer(0)]]) {
Particle particle = (*(tint_symbol_1)).p[0];
particle.position[(*(tint_symbol_2)).i] = particle.position[(*(tint_symbol_2)).i];
return;
}