dawn-cmake/test/tint/bug/tint/221.wgsl.expected.msl

45 lines
1.2 KiB
Plaintext

#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 Buf {
/* 0x0000 */ uint count;
/* 0x0004 */ tint_array<uint, 50> data;
};
kernel void tint_symbol(device Buf* tint_symbol_1 [[buffer(0)]]) {
uint i = 0u;
while (true) {
if ((i >= (*(tint_symbol_1)).count)) {
break;
}
uint const p_save = i;
if (((i % 2u) == 0u)) {
{
(*(tint_symbol_1)).data[p_save] = ((*(tint_symbol_1)).data[p_save] * 2u);
i = (i + 1u);
}
continue;
}
(*(tint_symbol_1)).data[p_save] = 0u;
{
(*(tint_symbol_1)).data[p_save] = ((*(tint_symbol_1)).data[p_save] * 2u);
i = (i + 1u);
}
}
return;
}