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

40 lines
1.4 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 Constants {
/* 0x0000 */ uint zero;
};
struct Result {
/* 0x0000 */ uint value;
};
struct TestData {
/* 0x0000 */ tint_array<atomic_int, 3> data;
};
int runTest(device TestData* const tint_symbol_3, const constant Constants* const tint_symbol_4) {
return atomic_load_explicit(&((*(tint_symbol_3)).data[(0u + uint((*(tint_symbol_4)).zero))]), memory_order_relaxed);
}
kernel void tint_symbol(device TestData* tint_symbol_5 [[buffer(2)]], const constant Constants* tint_symbol_6 [[buffer(0)]], device Result* tint_symbol_7 [[buffer(1)]]) {
int const tint_symbol_1 = runTest(tint_symbol_5, tint_symbol_6);
uint const tint_symbol_2 = uint(tint_symbol_1);
(*(tint_symbol_7)).value = tint_symbol_2;
return;
}