wgpu/naga/tests/out/msl/globals.msl

101 lines
2.8 KiB
Plaintext
Raw Normal View History

// language: metal1.0
2021-05-29 01:49:50 +00:00
#include <metal_stdlib>
#include <simd/simd.h>
using metal::uint;
2022-01-06 01:15:09 +00:00
struct _mslBufferSizes {
uint size3;
2022-01-06 01:15:09 +00:00
};
struct type_2 {
float inner[10];
2021-05-29 01:49:50 +00:00
};
struct FooStruct {
2021-12-27 02:57:47 +00:00
metal::packed_float3 v3_;
float v1_;
};
2022-01-06 01:15:09 +00:00
typedef metal::float2 type_6[1];
2022-01-21 17:30:18 +00:00
struct type_8 {
metal::float4 inner[20];
2022-01-06 01:15:09 +00:00
};
struct type_11 {
metal::float2x4 inner[2];
};
struct type_12 {
type_11 inner[2];
};
struct type_14 {
metal::float4x2 inner[2];
};
struct type_15 {
type_14 inner[2];
};
2023-04-05 15:38:03 +00:00
constant bool Foo_1 = true;
2021-05-29 01:49:50 +00:00
2022-04-11 11:43:28 +00:00
void test_msl_packed_vec3_as_arg(
metal::float3 arg
) {
return;
}
void test_msl_packed_vec3_(
device FooStruct& alignment
2022-04-11 11:43:28 +00:00
) {
2023-04-19 13:16:46 +00:00
int idx = 1;
2022-04-11 11:43:28 +00:00
alignment.v3_ = metal::float3(1.0);
alignment.v3_[0] = 1.0;
alignment.v3_[0] = 2.0;
int _e16 = idx;
alignment.v3_[_e16] = 3.0;
FooStruct data = alignment;
2023-06-12 15:02:27 +00:00
metal::float3 l0_ = data.v3_;
metal::float2 l1_ = metal::float3(data.v3_).zx;
2022-04-11 11:43:28 +00:00
test_msl_packed_vec3_as_arg(data.v3_);
2023-06-12 15:02:27 +00:00
metal::float3 mvm0_ = metal::float3(data.v3_) * metal::float3x3 {};
metal::float3 mvm1_ = metal::float3x3 {} * metal::float3(data.v3_);
metal::float3 svm0_ = data.v3_ * 2.0;
metal::float3 svm1_ = 2.0 * data.v3_;
2022-04-11 11:43:28 +00:00
}
kernel void main_(
metal::uint3 __local_invocation_id [[thread_position_in_threadgroup]]
, threadgroup type_2& wg
, threadgroup metal::atomic_uint& at_1
, device FooStruct& alignment [[user(fake0)]]
, device type_6 const& dummy [[user(fake0)]]
, constant type_8& float_vecs [[user(fake0)]]
, constant metal::float3& global_vec [[user(fake0)]]
, constant metal::float3x2& global_mat [[user(fake0)]]
, constant type_12& global_nested_arrays_of_matrices_2x4_ [[user(fake0)]]
, constant type_15& global_nested_arrays_of_matrices_4x2_ [[user(fake0)]]
, constant _mslBufferSizes& _buffer_sizes [[user(fake0)]]
2021-05-29 01:49:50 +00:00
) {
if (metal::all(__local_invocation_id == metal::uint3(0u))) {
wg = {};
metal::atomic_store_explicit(&at_1, 0, metal::memory_order_relaxed);
}
metal::threadgroup_barrier(metal::mem_flags::mem_threadgroup);
2023-04-19 13:16:46 +00:00
float Foo = 1.0;
bool at = true;
2022-04-11 11:43:28 +00:00
test_msl_packed_vec3_(alignment);
metal::float4x2 _e5 = global_nested_arrays_of_matrices_4x2_.inner[0].inner[0];
metal::float4 _e10 = global_nested_arrays_of_matrices_2x4_.inner[0].inner[0][0];
wg.inner[7] = (_e5 * _e10).x;
metal::float3x2 _e16 = global_mat;
metal::float3 _e18 = global_vec;
wg.inner[6] = (_e16 * _e18).x;
float _e26 = dummy[1].y;
wg.inner[5] = _e26;
float _e32 = float_vecs.inner[0].w;
wg.inner[4] = _e32;
float _e37 = alignment.v1_;
wg.inner[3] = _e37;
float _e43 = alignment.v3_[0];
wg.inner[2] = _e43;
alignment.v1_ = 4.0;
wg.inner[1] = static_cast<float>(1 + (_buffer_sizes.size3 - 0 - 8) / 8);
metal::atomic_store_explicit(&at_1, 2u, metal::memory_order_relaxed);
2022-04-11 11:43:28 +00:00
return;
2021-05-29 01:49:50 +00:00
}