blob: b1e90cf8d041279740ac1de048ddb6de22e8a656 [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];
};
struct tint_packed_vec3_f32_array_element {
/* 0x0000 */ packed_float3 elements;
/* 0x000c */ tint_array<int8_t, 4> tint_pad;
};
struct Particle_tint_packed_vec3 {
/* 0x0000 */ tint_array<tint_packed_vec3_f32_array_element, 8> position;
/* 0x0080 */ float lifetime;
/* 0x0084 */ tint_array<int8_t, 12> tint_pad_1;
/* 0x0090 */ float4 color;
/* 0x00a0 */ packed_float3 velocity;
/* 0x00ac */ tint_array<int8_t, 4> tint_pad_2;
};
struct Particles_tint_packed_vec3 {
/* 0x0000 */ tint_array<Particle_tint_packed_vec3, 1> p;
};
tint_array<float3, 8> tint_unpack_vec3_in_composite(tint_array<tint_packed_vec3_f32_array_element, 8> in) {
tint_array<float3, 8> result = {};
for(uint i = 0u; (i < 8u); i = (i + 1u)) {
result[i] = float3(in[i].elements);
}
return result;
}
struct Particle {
tint_array<float3, 8> position;
float lifetime;
float4 color;
float3 velocity;
};
Particle tint_unpack_vec3_in_composite_1(Particle_tint_packed_vec3 in) {
Particle result = {};
result.position = tint_unpack_vec3_in_composite(in.position);
result.lifetime = in.lifetime;
result.color = in.color;
result.velocity = float3(in.velocity);
return result;
}
struct Simulation {
/* 0x0000 */ uint i;
};
struct Particles {
tint_array<Particle, 1> p;
};
kernel void tint_symbol(const device Particles_tint_packed_vec3* tint_symbol_1 [[buffer(1)]], const constant Simulation* tint_symbol_2 [[buffer(0)]]) {
Particle particle = tint_unpack_vec3_in_composite_1((*(tint_symbol_1)).p[0]);
particle.position[(*(tint_symbol_2)).i] = particle.position[(*(tint_symbol_2)).i];
return;
}