Files
wgpu/tests/out/msl/access.msl
T

86 lines
2.6 KiB
Plaintext

// language: metal2.0
#include <metal_stdlib>
#include <simd/simd.h>
struct _mslBufferSizes {
metal::uint size0;
};
struct type_3 {
metal::uint2 inner[2];
};
typedef int type_5[1];
struct Bar {
metal::float4x4 matrix;
metal::atomic_int atom;
char _pad2[4];
type_3 arr;
type_5 data;
};
struct type_11 {
int inner[5];
};
float read_from_private(
thread float& foo_2
) {
float _e2 = foo_2;
return _e2;
}
struct fooInput {
};
struct fooOutput {
metal::float4 member [[position]];
};
vertex fooOutput foo(
metal::uint vi [[vertex_id]]
, device Bar& bar [[buffer(0)]]
, constant _mslBufferSizes& _buffer_sizes [[buffer(24)]]
) {
float foo_1 = 0.0;
type_11 c;
float baz = foo_1;
foo_1 = 1.0;
metal::float4x4 matrix = bar.matrix;
type_3 arr = bar.arr;
float b = bar.matrix[3].x;
int a = bar.data[(1 + (_buffer_sizes.size0 - 88 - 4) / 8) - 2u];
float _e25 = read_from_private(foo_1);
bar.matrix[1].z = 1.0;
bar.matrix = metal::float4x4(metal::float4(0.0), metal::float4(1.0), metal::float4(2.0), metal::float4(3.0));
for(int _i=0; _i<2; ++_i) bar.arr.inner[_i] = type_3 {metal::uint2(0u), metal::uint2(1u)}.inner[_i];
bar.data[1] = 1;
for(int _i=0; _i<5; ++_i) c.inner[_i] = type_11 {a, static_cast<int>(b), 3, 4, 5}.inner[_i];
c.inner[vi + 1u] = 42;
int value = c.inner[vi];
return fooOutput { matrix * static_cast<metal::float4>(metal::int4(value)) };
}
kernel void atomics(
device Bar& bar [[buffer(0)]]
, constant _mslBufferSizes& _buffer_sizes [[buffer(24)]]
) {
int tmp;
int value_1 = metal::atomic_load_explicit(&bar.atom, metal::memory_order_relaxed);
int _e6 = metal::atomic_fetch_add_explicit(&bar.atom, 5, metal::memory_order_relaxed);
tmp = _e6;
int _e9 = metal::atomic_fetch_sub_explicit(&bar.atom, 5, metal::memory_order_relaxed);
tmp = _e9;
int _e12 = metal::atomic_fetch_and_explicit(&bar.atom, 5, metal::memory_order_relaxed);
tmp = _e12;
int _e15 = metal::atomic_fetch_or_explicit(&bar.atom, 5, metal::memory_order_relaxed);
tmp = _e15;
int _e18 = metal::atomic_fetch_xor_explicit(&bar.atom, 5, metal::memory_order_relaxed);
tmp = _e18;
int _e21 = metal::atomic_fetch_min_explicit(&bar.atom, 5, metal::memory_order_relaxed);
tmp = _e21;
int _e24 = metal::atomic_fetch_max_explicit(&bar.atom, 5, metal::memory_order_relaxed);
tmp = _e24;
int _e27 = metal::atomic_exchange_explicit(&bar.atom, 5, metal::memory_order_relaxed);
tmp = _e27;
metal::atomic_store_explicit(&bar.atom, value_1, metal::memory_order_relaxed);
return;
}