dawn-cmake/test/array/function_parameter.wgsl.expected.msl
James Price 94ac078990 writer/msl: Wrap each array type in a struct
This allows them to be used in various places that WGSL allows, such
as function return types and parameters, and as the type of the RHS of
an assignment.

Fixed: tint:814
Fixed: tint:820
Change-Id: Idb6a901b9a34e96bb9733cc158191e7b3bafaa0e
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/52844
Auto-Submit: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: James Price <jrprice@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2021-06-02 17:23:03 +00:00

36 lines
690 B
Plaintext

#include <metal_stdlib>
using namespace metal;
struct tint_array_wrapper_0 {
float array[4];
};
struct tint_array_wrapper_1 {
tint_array_wrapper_0 array[3];
};
struct tint_array_wrapper_2 {
tint_array_wrapper_1 array[2];
};
float f1(tint_array_wrapper_0 const a) {
return a.array[3];
}
float f2(tint_array_wrapper_1 const a) {
return a.array[2].array[3];
}
float f3(tint_array_wrapper_2 const a) {
return a.array[1].array[2].array[3];
}
kernel void tint_symbol() {
tint_array_wrapper_0 const a1 = {};
tint_array_wrapper_1 const a2 = {};
tint_array_wrapper_2 const a3 = {};
float const v1 = f1(a1);
float const v2 = f2(a2);
float const v3 = f3(a3);
return;
}