tint->dawn: Shuffle source tree in preperation of merging repos

docs/    -> docs/tint/
fuzzers/ -> src/tint/fuzzers/
samples/ -> src/tint/cmd/
src/     -> src/tint/
test/    -> test/tint/

BUG=tint:1418,tint:1433

Change-Id: Id2aa79f989aef3245b80ef4aa37a27ff16cd700b
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/80482
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
This commit is contained in:
Ryan Harrison
2022-02-21 15:19:07 +00:00
committed by Tint LUCI CQ
parent 38f1e9c75c
commit dbc13af287
12231 changed files with 4897 additions and 4871 deletions

View File

@@ -0,0 +1,52 @@
type ArrayType = array<vec4<i32>, 4>;
struct S {
arr : ArrayType;
};
var<private> src_private : ArrayType;
var<workgroup> src_workgroup : ArrayType;
@group(0) @binding(0) var<uniform> src_uniform : S;
@group(0) @binding(1) var<storage, read_write> src_storage : S;
fn ret_arr() -> ArrayType {
return ArrayType();
}
fn ret_struct_arr() -> S {
return S();
}
fn foo(src_param : ArrayType) {
var src_function : ArrayType;
var dst : ArrayType;
// Assign from type constructor.
dst = ArrayType(vec4(1), vec4(2), vec4(3), vec4(3));
// Assign from parameter.
dst = src_param;
// Assign from function call.
dst = ret_arr();
// Assign from constant.
let src_let : ArrayType = ArrayType();
dst = src_let;
// Assign from var, various storage classes.
dst = src_function;
dst = src_private;
dst = src_workgroup;
// Assign from struct.arr, various storage classes.
dst = ret_struct_arr().arr;
dst = src_uniform.arr;
dst = src_storage.arr;
// Nested assignment.
var dst_nested : array<array<array<i32, 2>, 3>, 4>;
var src_nested : array<array<array<i32, 2>, 3>, 4>;
dst_nested = src_nested;
}

View File

@@ -0,0 +1,49 @@
#version 310 es
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void unused_entry_point() {
return;
}
struct S {
ivec4 arr[4];
};
ivec4 src_private[4] = ivec4[4](ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0));
shared ivec4 src_workgroup[4];
layout(binding = 0) uniform S_1 {
ivec4 arr[4];
} src_uniform;
layout(binding = 1, std430) buffer S_2 {
ivec4 arr[4];
} src_storage;
ivec4[4] ret_arr() {
ivec4 tint_symbol[4] = ivec4[4](ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0));
return tint_symbol;
}
S ret_struct_arr() {
S tint_symbol_1 = S(ivec4[4](ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0)));
return tint_symbol_1;
}
void foo(ivec4 src_param[4]) {
ivec4 src_function[4] = ivec4[4](ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0));
ivec4 dst[4] = ivec4[4](ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0));
ivec4 tint_symbol_2[4] = ivec4[4](ivec4(1), ivec4(2), ivec4(3), ivec4(3));
dst = tint_symbol_2;
dst = src_param;
dst = ret_arr();
ivec4 src_let[4] = ivec4[4](ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0));
dst = src_let;
dst = src_function;
dst = src_private;
dst = src_workgroup;
dst = ret_struct_arr().arr;
dst = src_uniform.arr;
dst = src_storage.arr;
int dst_nested[4][3][2] = int[4][3][2](int[3][2](int[2](0, 0), int[2](0, 0), int[2](0, 0)), int[3][2](int[2](0, 0), int[2](0, 0), int[2](0, 0)), int[3][2](int[2](0, 0), int[2](0, 0), int[2](0, 0)), int[3][2](int[2](0, 0), int[2](0, 0), int[2](0, 0)));
int src_nested[4][3][2] = int[4][3][2](int[3][2](int[2](0, 0), int[2](0, 0), int[2](0, 0)), int[3][2](int[2](0, 0), int[2](0, 0), int[2](0, 0)), int[3][2](int[2](0, 0), int[2](0, 0), int[2](0, 0)), int[3][2](int[2](0, 0), int[2](0, 0), int[2](0, 0)));
dst_nested = src_nested;
}

View File

@@ -0,0 +1,69 @@
[numthreads(1, 1, 1)]
void unused_entry_point() {
return;
}
struct S {
int4 arr[4];
};
static int4 src_private[4] = (int4[4])0;
groupshared int4 src_workgroup[4];
cbuffer cbuffer_src_uniform : register(b0, space0) {
uint4 src_uniform[4];
};
RWByteAddressBuffer src_storage : register(u1, space0);
typedef int4 ret_arr_ret[4];
ret_arr_ret ret_arr() {
const int4 tint_symbol_5[4] = (int4[4])0;
return tint_symbol_5;
}
S ret_struct_arr() {
const S tint_symbol_6 = (S)0;
return tint_symbol_6;
}
typedef int4 tint_symbol_1_ret[4];
tint_symbol_1_ret tint_symbol_1(uint4 buffer[4], uint offset) {
int4 arr_1[4] = (int4[4])0;
{
[loop] for(uint i = 0u; (i < 4u); i = (i + 1u)) {
const uint scalar_offset = ((offset + (i * 16u))) / 4;
arr_1[i] = asint(buffer[scalar_offset / 4]);
}
}
return arr_1;
}
typedef int4 tint_symbol_3_ret[4];
tint_symbol_3_ret tint_symbol_3(RWByteAddressBuffer buffer, uint offset) {
int4 arr_2[4] = (int4[4])0;
{
[loop] for(uint i_1 = 0u; (i_1 < 4u); i_1 = (i_1 + 1u)) {
arr_2[i_1] = asint(buffer.Load4((offset + (i_1 * 16u))));
}
}
return arr_2;
}
void foo(int4 src_param[4]) {
int4 src_function[4] = (int4[4])0;
int4 tint_symbol[4] = (int4[4])0;
const int4 tint_symbol_7[4] = {int4((1).xxxx), int4((2).xxxx), int4((3).xxxx), int4((3).xxxx)};
tint_symbol = tint_symbol_7;
tint_symbol = src_param;
tint_symbol = ret_arr();
const int4 src_let[4] = (int4[4])0;
tint_symbol = src_let;
tint_symbol = src_function;
tint_symbol = src_private;
tint_symbol = src_workgroup;
tint_symbol = ret_struct_arr().arr;
tint_symbol = tint_symbol_1(src_uniform, 0u);
tint_symbol = tint_symbol_3(src_storage, 0u);
int dst_nested[4][3][2] = (int[4][3][2])0;
int src_nested[4][3][2] = (int[4][3][2])0;
dst_nested = src_nested;
}

View File

@@ -0,0 +1,53 @@
#include <metal_stdlib>
using namespace metal;
struct tint_array_wrapper {
/* 0x0000 */ int4 arr[4];
};
struct S {
/* 0x0000 */ tint_array_wrapper arr;
};
tint_array_wrapper ret_arr() {
tint_array_wrapper const tint_symbol = {.arr={}};
return tint_symbol;
}
S ret_struct_arr() {
S const tint_symbol_1 = {};
return tint_symbol_1;
}
struct tint_array_wrapper_3 {
int arr[2];
};
struct tint_array_wrapper_2 {
tint_array_wrapper_3 arr[3];
};
struct tint_array_wrapper_1 {
tint_array_wrapper_2 arr[4];
};
void foo(tint_array_wrapper src_param, thread tint_array_wrapper* const tint_symbol_3, threadgroup tint_array_wrapper* const tint_symbol_4, const constant S* const tint_symbol_5, device S* const tint_symbol_6) {
tint_array_wrapper src_function = {};
tint_array_wrapper dst = {};
tint_array_wrapper const tint_symbol_2 = {.arr={int4(1), int4(2), int4(3), int4(3)}};
dst = tint_symbol_2;
dst = src_param;
dst = ret_arr();
tint_array_wrapper const src_let = {.arr={}};
dst = src_let;
dst = src_function;
dst = *(tint_symbol_3);
dst = *(tint_symbol_4);
dst = ret_struct_arr().arr;
dst = (*(tint_symbol_5)).arr;
dst = (*(tint_symbol_6)).arr;
tint_array_wrapper_1 dst_nested = {};
tint_array_wrapper_1 src_nested = {};
dst_nested = src_nested;
}

View File

@@ -0,0 +1,117 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 64
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
OpExecutionMode %unused_entry_point LocalSize 1 1 1
OpName %src_private "src_private"
OpName %src_workgroup "src_workgroup"
OpName %S "S"
OpMemberName %S 0 "arr"
OpName %src_uniform "src_uniform"
OpName %src_storage "src_storage"
OpName %unused_entry_point "unused_entry_point"
OpName %ret_arr "ret_arr"
OpName %ret_struct_arr "ret_struct_arr"
OpName %foo "foo"
OpName %src_param "src_param"
OpName %src_function "src_function"
OpName %dst "dst"
OpName %dst_nested "dst_nested"
OpName %src_nested "src_nested"
OpDecorate %_arr_v4int_uint_4 ArrayStride 16
OpDecorate %S Block
OpMemberDecorate %S 0 Offset 0
OpDecorate %src_uniform NonWritable
OpDecorate %src_uniform DescriptorSet 0
OpDecorate %src_uniform Binding 0
OpDecorate %src_storage DescriptorSet 0
OpDecorate %src_storage Binding 1
OpDecorate %_arr_int_uint_2 ArrayStride 4
OpDecorate %_arr__arr_int_uint_2_uint_3 ArrayStride 8
OpDecorate %_arr__arr__arr_int_uint_2_uint_3_uint_4 ArrayStride 24
%int = OpTypeInt 32 1
%v4int = OpTypeVector %int 4
%uint = OpTypeInt 32 0
%uint_4 = OpConstant %uint 4
%_arr_v4int_uint_4 = OpTypeArray %v4int %uint_4
%_ptr_Private__arr_v4int_uint_4 = OpTypePointer Private %_arr_v4int_uint_4
%8 = OpConstantNull %_arr_v4int_uint_4
%src_private = OpVariable %_ptr_Private__arr_v4int_uint_4 Private %8
%_ptr_Workgroup__arr_v4int_uint_4 = OpTypePointer Workgroup %_arr_v4int_uint_4
%src_workgroup = OpVariable %_ptr_Workgroup__arr_v4int_uint_4 Workgroup
%S = OpTypeStruct %_arr_v4int_uint_4
%_ptr_Uniform_S = OpTypePointer Uniform %S
%src_uniform = OpVariable %_ptr_Uniform_S Uniform
%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S
%src_storage = OpVariable %_ptr_StorageBuffer_S StorageBuffer
%void = OpTypeVoid
%16 = OpTypeFunction %void
%20 = OpTypeFunction %_arr_v4int_uint_4
%23 = OpTypeFunction %S
%26 = OpConstantNull %S
%27 = OpTypeFunction %void %_arr_v4int_uint_4
%_ptr_Function__arr_v4int_uint_4 = OpTypePointer Function %_arr_v4int_uint_4
%int_1 = OpConstant %int 1
%35 = OpConstantComposite %v4int %int_1 %int_1 %int_1 %int_1
%int_2 = OpConstant %int 2
%37 = OpConstantComposite %v4int %int_2 %int_2 %int_2 %int_2
%int_3 = OpConstant %int 3
%39 = OpConstantComposite %v4int %int_3 %int_3 %int_3 %int_3
%40 = OpConstantComposite %_arr_v4int_uint_4 %35 %37 %39 %39
%uint_0 = OpConstant %uint 0
%_ptr_Uniform__arr_v4int_uint_4 = OpTypePointer Uniform %_arr_v4int_uint_4
%_ptr_StorageBuffer__arr_v4int_uint_4 = OpTypePointer StorageBuffer %_arr_v4int_uint_4
%uint_2 = OpConstant %uint 2
%_arr_int_uint_2 = OpTypeArray %int %uint_2
%uint_3 = OpConstant %uint 3
%_arr__arr_int_uint_2_uint_3 = OpTypeArray %_arr_int_uint_2 %uint_3
%_arr__arr__arr_int_uint_2_uint_3_uint_4 = OpTypeArray %_arr__arr_int_uint_2_uint_3 %uint_4
%_ptr_Function__arr__arr__arr_int_uint_2_uint_3_uint_4 = OpTypePointer Function %_arr__arr__arr_int_uint_2_uint_3_uint_4
%61 = OpConstantNull %_arr__arr__arr_int_uint_2_uint_3_uint_4
%unused_entry_point = OpFunction %void None %16
%19 = OpLabel
OpReturn
OpFunctionEnd
%ret_arr = OpFunction %_arr_v4int_uint_4 None %20
%22 = OpLabel
OpReturnValue %8
OpFunctionEnd
%ret_struct_arr = OpFunction %S None %23
%25 = OpLabel
OpReturnValue %26
OpFunctionEnd
%foo = OpFunction %void None %27
%src_param = OpFunctionParameter %_arr_v4int_uint_4
%30 = OpLabel
%src_function = OpVariable %_ptr_Function__arr_v4int_uint_4 Function %8
%dst = OpVariable %_ptr_Function__arr_v4int_uint_4 Function %8
%dst_nested = OpVariable %_ptr_Function__arr__arr__arr_int_uint_2_uint_3_uint_4 Function %61
%src_nested = OpVariable %_ptr_Function__arr__arr__arr_int_uint_2_uint_3_uint_4 Function %61
OpStore %dst %40
OpStore %dst %src_param
%41 = OpFunctionCall %_arr_v4int_uint_4 %ret_arr
OpStore %dst %41
OpStore %dst %8
%42 = OpLoad %_arr_v4int_uint_4 %src_function
OpStore %dst %42
%43 = OpLoad %_arr_v4int_uint_4 %src_private
OpStore %dst %43
%44 = OpLoad %_arr_v4int_uint_4 %src_workgroup
OpStore %dst %44
%45 = OpFunctionCall %S %ret_struct_arr
%46 = OpCompositeExtract %_arr_v4int_uint_4 %45 0
OpStore %dst %46
%49 = OpAccessChain %_ptr_Uniform__arr_v4int_uint_4 %src_uniform %uint_0
%50 = OpLoad %_arr_v4int_uint_4 %49
OpStore %dst %50
%52 = OpAccessChain %_ptr_StorageBuffer__arr_v4int_uint_4 %src_storage %uint_0
%53 = OpLoad %_arr_v4int_uint_4 %52
OpStore %dst %53
%63 = OpLoad %_arr__arr__arr_int_uint_2_uint_3_uint_4 %src_nested
OpStore %dst_nested %63
OpReturn
OpFunctionEnd

View File

@@ -0,0 +1,40 @@
type ArrayType = array<vec4<i32>, 4>;
struct S {
arr : ArrayType;
}
var<private> src_private : ArrayType;
var<workgroup> src_workgroup : ArrayType;
@group(0) @binding(0) var<uniform> src_uniform : S;
@group(0) @binding(1) var<storage, read_write> src_storage : S;
fn ret_arr() -> ArrayType {
return ArrayType();
}
fn ret_struct_arr() -> S {
return S();
}
fn foo(src_param : ArrayType) {
var src_function : ArrayType;
var dst : ArrayType;
dst = ArrayType(vec4(1), vec4(2), vec4(3), vec4(3));
dst = src_param;
dst = ret_arr();
let src_let : ArrayType = ArrayType();
dst = src_let;
dst = src_function;
dst = src_private;
dst = src_workgroup;
dst = ret_struct_arr().arr;
dst = src_uniform.arr;
dst = src_storage.arr;
var dst_nested : array<array<array<i32, 2>, 3>, 4>;
var src_nested : array<array<array<i32, 2>, 3>, 4>;
dst_nested = src_nested;
}

View File

@@ -0,0 +1,52 @@
type ArrayType = array<vec4<i32>, 4>;
struct S {
arr : ArrayType;
};
var<private> src_private : ArrayType;
var<workgroup> src_workgroup : ArrayType;
@group(0) @binding(0) var<uniform> src_uniform : S;
@group(0) @binding(1) var<storage, read_write> src_storage : S;
var<private> dst : ArrayType;
var<private> dst_nested : array<array<array<i32, 2>, 3>, 4>;
fn ret_arr() -> ArrayType {
return ArrayType();
}
fn ret_struct_arr() -> S {
return S();
}
fn foo(src_param : ArrayType) {
var src_function : ArrayType;
// Assign from type constructor.
dst = ArrayType(vec4(1), vec4(2), vec4(3), vec4(3));
// Assign from parameter.
dst = src_param;
// Assign from function call.
dst = ret_arr();
// Assign from constant.
let src_let : ArrayType = ArrayType();
dst = src_let;
// Assign from var, various storage classes.
dst = src_function;
dst = src_private;
dst = src_workgroup;
// Assign from struct.arr, various storage classes.
dst = ret_struct_arr().arr;
dst = src_uniform.arr;
dst = src_storage.arr;
// Nested assignment.
var src_nested : array<array<array<i32, 2>, 3>, 4>;
dst_nested = src_nested;
}

View File

@@ -0,0 +1,49 @@
#version 310 es
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void unused_entry_point() {
return;
}
struct S {
ivec4 arr[4];
};
ivec4 src_private[4] = ivec4[4](ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0));
shared ivec4 src_workgroup[4];
layout(binding = 0) uniform S_1 {
ivec4 arr[4];
} src_uniform;
layout(binding = 1, std430) buffer S_2 {
ivec4 arr[4];
} src_storage;
ivec4 dst[4] = ivec4[4](ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0));
int dst_nested[4][3][2] = int[4][3][2](int[3][2](int[2](0, 0), int[2](0, 0), int[2](0, 0)), int[3][2](int[2](0, 0), int[2](0, 0), int[2](0, 0)), int[3][2](int[2](0, 0), int[2](0, 0), int[2](0, 0)), int[3][2](int[2](0, 0), int[2](0, 0), int[2](0, 0)));
ivec4[4] ret_arr() {
ivec4 tint_symbol[4] = ivec4[4](ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0));
return tint_symbol;
}
S ret_struct_arr() {
S tint_symbol_1 = S(ivec4[4](ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0)));
return tint_symbol_1;
}
void foo(ivec4 src_param[4]) {
ivec4 src_function[4] = ivec4[4](ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0));
ivec4 tint_symbol_2[4] = ivec4[4](ivec4(1), ivec4(2), ivec4(3), ivec4(3));
dst = tint_symbol_2;
dst = src_param;
dst = ret_arr();
ivec4 src_let[4] = ivec4[4](ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0));
dst = src_let;
dst = src_function;
dst = src_private;
dst = src_workgroup;
dst = ret_struct_arr().arr;
dst = src_uniform.arr;
dst = src_storage.arr;
int src_nested[4][3][2] = int[4][3][2](int[3][2](int[2](0, 0), int[2](0, 0), int[2](0, 0)), int[3][2](int[2](0, 0), int[2](0, 0), int[2](0, 0)), int[3][2](int[2](0, 0), int[2](0, 0), int[2](0, 0)), int[3][2](int[2](0, 0), int[2](0, 0), int[2](0, 0)));
dst_nested = src_nested;
}

View File

@@ -0,0 +1,69 @@
[numthreads(1, 1, 1)]
void unused_entry_point() {
return;
}
struct S {
int4 arr[4];
};
static int4 src_private[4] = (int4[4])0;
groupshared int4 src_workgroup[4];
cbuffer cbuffer_src_uniform : register(b0, space0) {
uint4 src_uniform[4];
};
RWByteAddressBuffer src_storage : register(u1, space0);
static int4 tint_symbol[4] = (int4[4])0;
static int dst_nested[4][3][2] = (int[4][3][2])0;
typedef int4 ret_arr_ret[4];
ret_arr_ret ret_arr() {
const int4 tint_symbol_5[4] = (int4[4])0;
return tint_symbol_5;
}
S ret_struct_arr() {
const S tint_symbol_6 = (S)0;
return tint_symbol_6;
}
typedef int4 tint_symbol_1_ret[4];
tint_symbol_1_ret tint_symbol_1(uint4 buffer[4], uint offset) {
int4 arr_1[4] = (int4[4])0;
{
[loop] for(uint i = 0u; (i < 4u); i = (i + 1u)) {
const uint scalar_offset = ((offset + (i * 16u))) / 4;
arr_1[i] = asint(buffer[scalar_offset / 4]);
}
}
return arr_1;
}
typedef int4 tint_symbol_3_ret[4];
tint_symbol_3_ret tint_symbol_3(RWByteAddressBuffer buffer, uint offset) {
int4 arr_2[4] = (int4[4])0;
{
[loop] for(uint i_1 = 0u; (i_1 < 4u); i_1 = (i_1 + 1u)) {
arr_2[i_1] = asint(buffer.Load4((offset + (i_1 * 16u))));
}
}
return arr_2;
}
void foo(int4 src_param[4]) {
int4 src_function[4] = (int4[4])0;
const int4 tint_symbol_7[4] = {int4((1).xxxx), int4((2).xxxx), int4((3).xxxx), int4((3).xxxx)};
tint_symbol = tint_symbol_7;
tint_symbol = src_param;
tint_symbol = ret_arr();
const int4 src_let[4] = (int4[4])0;
tint_symbol = src_let;
tint_symbol = src_function;
tint_symbol = src_private;
tint_symbol = src_workgroup;
tint_symbol = ret_struct_arr().arr;
tint_symbol = tint_symbol_1(src_uniform, 0u);
tint_symbol = tint_symbol_3(src_storage, 0u);
int src_nested[4][3][2] = (int[4][3][2])0;
dst_nested = src_nested;
}

View File

@@ -0,0 +1,51 @@
#include <metal_stdlib>
using namespace metal;
struct tint_array_wrapper {
/* 0x0000 */ int4 arr[4];
};
struct S {
/* 0x0000 */ tint_array_wrapper arr;
};
struct tint_array_wrapper_3 {
int arr[2];
};
struct tint_array_wrapper_2 {
tint_array_wrapper_3 arr[3];
};
struct tint_array_wrapper_1 {
tint_array_wrapper_2 arr[4];
};
tint_array_wrapper ret_arr() {
tint_array_wrapper const tint_symbol = {.arr={}};
return tint_symbol;
}
S ret_struct_arr() {
S const tint_symbol_1 = {};
return tint_symbol_1;
}
void foo(tint_array_wrapper src_param, thread tint_array_wrapper* const tint_symbol_3, thread tint_array_wrapper* const tint_symbol_4, threadgroup tint_array_wrapper* const tint_symbol_5, const constant S* const tint_symbol_6, device S* const tint_symbol_7, thread tint_array_wrapper_1* const tint_symbol_8) {
tint_array_wrapper src_function = {};
tint_array_wrapper const tint_symbol_2 = {.arr={int4(1), int4(2), int4(3), int4(3)}};
*(tint_symbol_3) = tint_symbol_2;
*(tint_symbol_3) = src_param;
*(tint_symbol_3) = ret_arr();
tint_array_wrapper const src_let = {.arr={}};
*(tint_symbol_3) = src_let;
*(tint_symbol_3) = src_function;
*(tint_symbol_3) = *(tint_symbol_4);
*(tint_symbol_3) = *(tint_symbol_5);
*(tint_symbol_3) = ret_struct_arr().arr;
*(tint_symbol_3) = (*(tint_symbol_6)).arr;
*(tint_symbol_3) = (*(tint_symbol_7)).arr;
tint_array_wrapper_1 src_nested = {};
*(tint_symbol_8) = src_nested;
}

View File

@@ -0,0 +1,118 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 65
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
OpExecutionMode %unused_entry_point LocalSize 1 1 1
OpName %src_private "src_private"
OpName %src_workgroup "src_workgroup"
OpName %S "S"
OpMemberName %S 0 "arr"
OpName %src_uniform "src_uniform"
OpName %src_storage "src_storage"
OpName %dst "dst"
OpName %dst_nested "dst_nested"
OpName %unused_entry_point "unused_entry_point"
OpName %ret_arr "ret_arr"
OpName %ret_struct_arr "ret_struct_arr"
OpName %foo "foo"
OpName %src_param "src_param"
OpName %src_function "src_function"
OpName %src_nested "src_nested"
OpDecorate %_arr_v4int_uint_4 ArrayStride 16
OpDecorate %S Block
OpMemberDecorate %S 0 Offset 0
OpDecorate %src_uniform NonWritable
OpDecorate %src_uniform DescriptorSet 0
OpDecorate %src_uniform Binding 0
OpDecorate %src_storage DescriptorSet 0
OpDecorate %src_storage Binding 1
OpDecorate %_arr_int_uint_2 ArrayStride 4
OpDecorate %_arr__arr_int_uint_2_uint_3 ArrayStride 8
OpDecorate %_arr__arr__arr_int_uint_2_uint_3_uint_4 ArrayStride 24
%int = OpTypeInt 32 1
%v4int = OpTypeVector %int 4
%uint = OpTypeInt 32 0
%uint_4 = OpConstant %uint 4
%_arr_v4int_uint_4 = OpTypeArray %v4int %uint_4
%_ptr_Private__arr_v4int_uint_4 = OpTypePointer Private %_arr_v4int_uint_4
%8 = OpConstantNull %_arr_v4int_uint_4
%src_private = OpVariable %_ptr_Private__arr_v4int_uint_4 Private %8
%_ptr_Workgroup__arr_v4int_uint_4 = OpTypePointer Workgroup %_arr_v4int_uint_4
%src_workgroup = OpVariable %_ptr_Workgroup__arr_v4int_uint_4 Workgroup
%S = OpTypeStruct %_arr_v4int_uint_4
%_ptr_Uniform_S = OpTypePointer Uniform %S
%src_uniform = OpVariable %_ptr_Uniform_S Uniform
%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S
%src_storage = OpVariable %_ptr_StorageBuffer_S StorageBuffer
%dst = OpVariable %_ptr_Private__arr_v4int_uint_4 Private %8
%uint_2 = OpConstant %uint 2
%_arr_int_uint_2 = OpTypeArray %int %uint_2
%uint_3 = OpConstant %uint 3
%_arr__arr_int_uint_2_uint_3 = OpTypeArray %_arr_int_uint_2 %uint_3
%_arr__arr__arr_int_uint_2_uint_3_uint_4 = OpTypeArray %_arr__arr_int_uint_2_uint_3 %uint_4
%_ptr_Private__arr__arr__arr_int_uint_2_uint_3_uint_4 = OpTypePointer Private %_arr__arr__arr_int_uint_2_uint_3_uint_4
%24 = OpConstantNull %_arr__arr__arr_int_uint_2_uint_3_uint_4
%dst_nested = OpVariable %_ptr_Private__arr__arr__arr_int_uint_2_uint_3_uint_4 Private %24
%void = OpTypeVoid
%25 = OpTypeFunction %void
%29 = OpTypeFunction %_arr_v4int_uint_4
%32 = OpTypeFunction %S
%35 = OpConstantNull %S
%36 = OpTypeFunction %void %_arr_v4int_uint_4
%_ptr_Function__arr_v4int_uint_4 = OpTypePointer Function %_arr_v4int_uint_4
%int_1 = OpConstant %int 1
%43 = OpConstantComposite %v4int %int_1 %int_1 %int_1 %int_1
%int_2 = OpConstant %int 2
%45 = OpConstantComposite %v4int %int_2 %int_2 %int_2 %int_2
%int_3 = OpConstant %int 3
%47 = OpConstantComposite %v4int %int_3 %int_3 %int_3 %int_3
%48 = OpConstantComposite %_arr_v4int_uint_4 %43 %45 %47 %47
%uint_0 = OpConstant %uint 0
%_ptr_Uniform__arr_v4int_uint_4 = OpTypePointer Uniform %_arr_v4int_uint_4
%_ptr_StorageBuffer__arr_v4int_uint_4 = OpTypePointer StorageBuffer %_arr_v4int_uint_4
%_ptr_Function__arr__arr__arr_int_uint_2_uint_3_uint_4 = OpTypePointer Function %_arr__arr__arr_int_uint_2_uint_3_uint_4
%unused_entry_point = OpFunction %void None %25
%28 = OpLabel
OpReturn
OpFunctionEnd
%ret_arr = OpFunction %_arr_v4int_uint_4 None %29
%31 = OpLabel
OpReturnValue %8
OpFunctionEnd
%ret_struct_arr = OpFunction %S None %32
%34 = OpLabel
OpReturnValue %35
OpFunctionEnd
%foo = OpFunction %void None %36
%src_param = OpFunctionParameter %_arr_v4int_uint_4
%39 = OpLabel
%src_function = OpVariable %_ptr_Function__arr_v4int_uint_4 Function %8
%src_nested = OpVariable %_ptr_Function__arr__arr__arr_int_uint_2_uint_3_uint_4 Function %24
OpStore %dst %48
OpStore %dst %src_param
%49 = OpFunctionCall %_arr_v4int_uint_4 %ret_arr
OpStore %dst %49
OpStore %dst %8
%50 = OpLoad %_arr_v4int_uint_4 %src_function
OpStore %dst %50
%51 = OpLoad %_arr_v4int_uint_4 %src_private
OpStore %dst %51
%52 = OpLoad %_arr_v4int_uint_4 %src_workgroup
OpStore %dst %52
%53 = OpFunctionCall %S %ret_struct_arr
%54 = OpCompositeExtract %_arr_v4int_uint_4 %53 0
OpStore %dst %54
%57 = OpAccessChain %_ptr_Uniform__arr_v4int_uint_4 %src_uniform %uint_0
%58 = OpLoad %_arr_v4int_uint_4 %57
OpStore %dst %58
%60 = OpAccessChain %_ptr_StorageBuffer__arr_v4int_uint_4 %src_storage %uint_0
%61 = OpLoad %_arr_v4int_uint_4 %60
OpStore %dst %61
%64 = OpLoad %_arr__arr__arr_int_uint_2_uint_3_uint_4 %src_nested
OpStore %dst_nested %64
OpReturn
OpFunctionEnd

View File

@@ -0,0 +1,42 @@
type ArrayType = array<vec4<i32>, 4>;
struct S {
arr : ArrayType;
}
var<private> src_private : ArrayType;
var<workgroup> src_workgroup : ArrayType;
@group(0) @binding(0) var<uniform> src_uniform : S;
@group(0) @binding(1) var<storage, read_write> src_storage : S;
var<private> dst : ArrayType;
var<private> dst_nested : array<array<array<i32, 2>, 3>, 4>;
fn ret_arr() -> ArrayType {
return ArrayType();
}
fn ret_struct_arr() -> S {
return S();
}
fn foo(src_param : ArrayType) {
var src_function : ArrayType;
dst = ArrayType(vec4(1), vec4(2), vec4(3), vec4(3));
dst = src_param;
dst = ret_arr();
let src_let : ArrayType = ArrayType();
dst = src_let;
dst = src_function;
dst = src_private;
dst = src_workgroup;
dst = ret_struct_arr().arr;
dst = src_uniform.arr;
dst = src_storage.arr;
var src_nested : array<array<array<i32, 2>, 3>, 4>;
dst_nested = src_nested;
}

View File

@@ -0,0 +1,56 @@
type ArrayType = array<vec4<i32>, 4>;
struct S {
arr : ArrayType;
};
struct S_nested {
arr : array<array<array<i32, 2>, 3>, 4>;
};
var<private> src_private : ArrayType;
var<workgroup> src_workgroup : ArrayType;
@group(0) @binding(0) var<uniform> src_uniform : S;
@group(0) @binding(1) var<storage, read_write> src_storage : S;
@group(0) @binding(2) var<storage, read_write> dst : S;
@group(0) @binding(3) var<storage, read_write> dst_nested : S_nested;
fn ret_arr() -> ArrayType {
return ArrayType();
}
fn ret_struct_arr() -> S {
return S();
}
fn foo(src_param : ArrayType) {
var src_function : ArrayType;
// Assign from type constructor.
dst.arr = ArrayType(vec4(1), vec4(2), vec4(3), vec4(3));
// Assign from parameter.
dst.arr = src_param;
// Assign from function call.
dst.arr = ret_arr();
// Assign from constant.
let src_let : ArrayType = ArrayType();
dst.arr = src_let;
// Assign from var, various storage classes.
dst.arr = src_function;
dst.arr = src_private;
dst.arr = src_workgroup;
// Assign from struct.arr, various storage classes.
dst.arr = ret_struct_arr().arr;
dst.arr = src_uniform.arr;
dst.arr = src_storage.arr;
// Nested assignment.
var src_nested : array<array<array<i32, 2>, 3>, 4>;
dst_nested.arr = src_nested;
}

View File

@@ -0,0 +1,57 @@
#version 310 es
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void unused_entry_point() {
return;
}
struct S {
ivec4 arr[4];
};
struct S_nested {
int arr[4][3][2];
};
ivec4 src_private[4] = ivec4[4](ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0));
shared ivec4 src_workgroup[4];
layout(binding = 0) uniform S_1 {
ivec4 arr[4];
} src_uniform;
layout(binding = 1, std430) buffer S_2 {
ivec4 arr[4];
} src_storage;
layout(binding = 2, std430) buffer S_3 {
ivec4 arr[4];
} dst;
layout(binding = 3, std430) buffer S_nested_1 {
int arr[4][3][2];
} dst_nested;
ivec4[4] ret_arr() {
ivec4 tint_symbol[4] = ivec4[4](ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0));
return tint_symbol;
}
S ret_struct_arr() {
S tint_symbol_1 = S(ivec4[4](ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0)));
return tint_symbol_1;
}
void foo(ivec4 src_param[4]) {
ivec4 src_function[4] = ivec4[4](ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0));
ivec4 tint_symbol_2[4] = ivec4[4](ivec4(1), ivec4(2), ivec4(3), ivec4(3));
dst.arr = tint_symbol_2;
dst.arr = src_param;
dst.arr = ret_arr();
ivec4 src_let[4] = ivec4[4](ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0));
dst.arr = src_let;
dst.arr = src_function;
dst.arr = src_private;
dst.arr = src_workgroup;
dst.arr = ret_struct_arr().arr;
dst.arr = src_uniform.arr;
dst.arr = src_storage.arr;
int src_nested[4][3][2] = int[4][3][2](int[3][2](int[2](0, 0), int[2](0, 0), int[2](0, 0)), int[3][2](int[2](0, 0), int[2](0, 0), int[2](0, 0)), int[3][2](int[2](0, 0), int[2](0, 0), int[2](0, 0)), int[3][2](int[2](0, 0), int[2](0, 0), int[2](0, 0)));
dst_nested.arr = src_nested;
}

View File

@@ -0,0 +1,105 @@
[numthreads(1, 1, 1)]
void unused_entry_point() {
return;
}
struct S {
int4 arr[4];
};
static int4 src_private[4] = (int4[4])0;
groupshared int4 src_workgroup[4];
cbuffer cbuffer_src_uniform : register(b0, space0) {
uint4 src_uniform[4];
};
RWByteAddressBuffer src_storage : register(u1, space0);
RWByteAddressBuffer tint_symbol : register(u2, space0);
RWByteAddressBuffer dst_nested : register(u3, space0);
typedef int4 ret_arr_ret[4];
ret_arr_ret ret_arr() {
const int4 tint_symbol_11[4] = (int4[4])0;
return tint_symbol_11;
}
S ret_struct_arr() {
const S tint_symbol_12 = (S)0;
return tint_symbol_12;
}
void tint_symbol_1(RWByteAddressBuffer buffer, uint offset, int4 value[4]) {
int4 array[4] = value;
{
[loop] for(uint i = 0u; (i < 4u); i = (i + 1u)) {
buffer.Store4((offset + (i * 16u)), asuint(array[i]));
}
}
}
typedef int4 tint_symbol_3_ret[4];
tint_symbol_3_ret tint_symbol_3(uint4 buffer[4], uint offset) {
int4 arr_1[4] = (int4[4])0;
{
[loop] for(uint i_1 = 0u; (i_1 < 4u); i_1 = (i_1 + 1u)) {
const uint scalar_offset = ((offset + (i_1 * 16u))) / 4;
arr_1[i_1] = asint(buffer[scalar_offset / 4]);
}
}
return arr_1;
}
typedef int4 tint_symbol_5_ret[4];
tint_symbol_5_ret tint_symbol_5(RWByteAddressBuffer buffer, uint offset) {
int4 arr_2[4] = (int4[4])0;
{
[loop] for(uint i_2 = 0u; (i_2 < 4u); i_2 = (i_2 + 1u)) {
arr_2[i_2] = asint(buffer.Load4((offset + (i_2 * 16u))));
}
}
return arr_2;
}
void tint_symbol_9(RWByteAddressBuffer buffer, uint offset, int value[2]) {
int array_3[2] = value;
{
[loop] for(uint i_3 = 0u; (i_3 < 2u); i_3 = (i_3 + 1u)) {
buffer.Store((offset + (i_3 * 4u)), asuint(array_3[i_3]));
}
}
}
void tint_symbol_8(RWByteAddressBuffer buffer, uint offset, int value[3][2]) {
int array_2[3][2] = value;
{
[loop] for(uint i_4 = 0u; (i_4 < 3u); i_4 = (i_4 + 1u)) {
tint_symbol_9(buffer, (offset + (i_4 * 8u)), array_2[i_4]);
}
}
}
void tint_symbol_7(RWByteAddressBuffer buffer, uint offset, int value[4][3][2]) {
int array_1[4][3][2] = value;
{
[loop] for(uint i_5 = 0u; (i_5 < 4u); i_5 = (i_5 + 1u)) {
tint_symbol_8(buffer, (offset + (i_5 * 24u)), array_1[i_5]);
}
}
}
void foo(int4 src_param[4]) {
int4 src_function[4] = (int4[4])0;
const int4 tint_symbol_13[4] = {int4((1).xxxx), int4((2).xxxx), int4((3).xxxx), int4((3).xxxx)};
tint_symbol_1(tint_symbol, 0u, tint_symbol_13);
tint_symbol_1(tint_symbol, 0u, src_param);
tint_symbol_1(tint_symbol, 0u, ret_arr());
const int4 src_let[4] = (int4[4])0;
tint_symbol_1(tint_symbol, 0u, src_let);
tint_symbol_1(tint_symbol, 0u, src_function);
tint_symbol_1(tint_symbol, 0u, src_private);
tint_symbol_1(tint_symbol, 0u, src_workgroup);
tint_symbol_1(tint_symbol, 0u, ret_struct_arr().arr);
tint_symbol_1(tint_symbol, 0u, tint_symbol_3(src_uniform, 0u));
tint_symbol_1(tint_symbol, 0u, tint_symbol_5(src_storage, 0u));
int src_nested[4][3][2] = (int[4][3][2])0;
tint_symbol_7(dst_nested, 0u, src_nested);
}

View File

@@ -0,0 +1,55 @@
#include <metal_stdlib>
using namespace metal;
struct tint_array_wrapper {
/* 0x0000 */ int4 arr[4];
};
struct S {
/* 0x0000 */ tint_array_wrapper arr;
};
struct tint_array_wrapper_3 {
/* 0x0000 */ int arr[2];
};
struct tint_array_wrapper_2 {
/* 0x0000 */ tint_array_wrapper_3 arr[3];
};
struct tint_array_wrapper_1 {
/* 0x0000 */ tint_array_wrapper_2 arr[4];
};
struct S_nested {
/* 0x0000 */ tint_array_wrapper_1 arr;
};
tint_array_wrapper ret_arr() {
tint_array_wrapper const tint_symbol = {.arr={}};
return tint_symbol;
}
S ret_struct_arr() {
S const tint_symbol_1 = {};
return tint_symbol_1;
}
void foo(tint_array_wrapper src_param, device S* const tint_symbol_3, thread tint_array_wrapper* const tint_symbol_4, threadgroup tint_array_wrapper* const tint_symbol_5, const constant S* const tint_symbol_6, device S* const tint_symbol_7, device S_nested* const tint_symbol_8) {
tint_array_wrapper src_function = {};
tint_array_wrapper const tint_symbol_2 = {.arr={int4(1), int4(2), int4(3), int4(3)}};
(*(tint_symbol_3)).arr = tint_symbol_2;
(*(tint_symbol_3)).arr = src_param;
(*(tint_symbol_3)).arr = ret_arr();
tint_array_wrapper const src_let = {.arr={}};
(*(tint_symbol_3)).arr = src_let;
(*(tint_symbol_3)).arr = src_function;
(*(tint_symbol_3)).arr = *(tint_symbol_4);
(*(tint_symbol_3)).arr = *(tint_symbol_5);
(*(tint_symbol_3)).arr = ret_struct_arr().arr;
(*(tint_symbol_3)).arr = (*(tint_symbol_6)).arr;
(*(tint_symbol_3)).arr = (*(tint_symbol_7)).arr;
tint_array_wrapper_1 src_nested = {};
(*(tint_symbol_8)).arr = src_nested;
}

View File

@@ -0,0 +1,139 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 78
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
OpExecutionMode %unused_entry_point LocalSize 1 1 1
OpName %src_private "src_private"
OpName %src_workgroup "src_workgroup"
OpName %S "S"
OpMemberName %S 0 "arr"
OpName %src_uniform "src_uniform"
OpName %src_storage "src_storage"
OpName %dst "dst"
OpName %S_nested "S_nested"
OpMemberName %S_nested 0 "arr"
OpName %dst_nested "dst_nested"
OpName %unused_entry_point "unused_entry_point"
OpName %ret_arr "ret_arr"
OpName %ret_struct_arr "ret_struct_arr"
OpName %foo "foo"
OpName %src_param "src_param"
OpName %src_function "src_function"
OpName %src_nested "src_nested"
OpDecorate %_arr_v4int_uint_4 ArrayStride 16
OpDecorate %S Block
OpMemberDecorate %S 0 Offset 0
OpDecorate %src_uniform NonWritable
OpDecorate %src_uniform DescriptorSet 0
OpDecorate %src_uniform Binding 0
OpDecorate %src_storage DescriptorSet 0
OpDecorate %src_storage Binding 1
OpDecorate %dst DescriptorSet 0
OpDecorate %dst Binding 2
OpDecorate %S_nested Block
OpMemberDecorate %S_nested 0 Offset 0
OpDecorate %_arr_int_uint_2 ArrayStride 4
OpDecorate %_arr__arr_int_uint_2_uint_3 ArrayStride 8
OpDecorate %_arr__arr__arr_int_uint_2_uint_3_uint_4 ArrayStride 24
OpDecorate %dst_nested DescriptorSet 0
OpDecorate %dst_nested Binding 3
%int = OpTypeInt 32 1
%v4int = OpTypeVector %int 4
%uint = OpTypeInt 32 0
%uint_4 = OpConstant %uint 4
%_arr_v4int_uint_4 = OpTypeArray %v4int %uint_4
%_ptr_Private__arr_v4int_uint_4 = OpTypePointer Private %_arr_v4int_uint_4
%8 = OpConstantNull %_arr_v4int_uint_4
%src_private = OpVariable %_ptr_Private__arr_v4int_uint_4 Private %8
%_ptr_Workgroup__arr_v4int_uint_4 = OpTypePointer Workgroup %_arr_v4int_uint_4
%src_workgroup = OpVariable %_ptr_Workgroup__arr_v4int_uint_4 Workgroup
%S = OpTypeStruct %_arr_v4int_uint_4
%_ptr_Uniform_S = OpTypePointer Uniform %S
%src_uniform = OpVariable %_ptr_Uniform_S Uniform
%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S
%src_storage = OpVariable %_ptr_StorageBuffer_S StorageBuffer
%dst = OpVariable %_ptr_StorageBuffer_S StorageBuffer
%uint_2 = OpConstant %uint 2
%_arr_int_uint_2 = OpTypeArray %int %uint_2
%uint_3 = OpConstant %uint 3
%_arr__arr_int_uint_2_uint_3 = OpTypeArray %_arr_int_uint_2 %uint_3
%_arr__arr__arr_int_uint_2_uint_3_uint_4 = OpTypeArray %_arr__arr_int_uint_2_uint_3 %uint_4
%S_nested = OpTypeStruct %_arr__arr__arr_int_uint_2_uint_3_uint_4
%_ptr_StorageBuffer_S_nested = OpTypePointer StorageBuffer %S_nested
%dst_nested = OpVariable %_ptr_StorageBuffer_S_nested StorageBuffer
%void = OpTypeVoid
%25 = OpTypeFunction %void
%29 = OpTypeFunction %_arr_v4int_uint_4
%32 = OpTypeFunction %S
%35 = OpConstantNull %S
%36 = OpTypeFunction %void %_arr_v4int_uint_4
%_ptr_Function__arr_v4int_uint_4 = OpTypePointer Function %_arr_v4int_uint_4
%uint_0 = OpConstant %uint 0
%_ptr_StorageBuffer__arr_v4int_uint_4 = OpTypePointer StorageBuffer %_arr_v4int_uint_4
%int_1 = OpConstant %int 1
%46 = OpConstantComposite %v4int %int_1 %int_1 %int_1 %int_1
%int_2 = OpConstant %int 2
%48 = OpConstantComposite %v4int %int_2 %int_2 %int_2 %int_2
%int_3 = OpConstant %int 3
%50 = OpConstantComposite %v4int %int_3 %int_3 %int_3 %int_3
%51 = OpConstantComposite %_arr_v4int_uint_4 %46 %48 %50 %50
%_ptr_Uniform__arr_v4int_uint_4 = OpTypePointer Uniform %_arr_v4int_uint_4
%_ptr_Function__arr__arr__arr_int_uint_2_uint_3_uint_4 = OpTypePointer Function %_arr__arr__arr_int_uint_2_uint_3_uint_4
%74 = OpConstantNull %_arr__arr__arr_int_uint_2_uint_3_uint_4
%_ptr_StorageBuffer__arr__arr__arr_int_uint_2_uint_3_uint_4 = OpTypePointer StorageBuffer %_arr__arr__arr_int_uint_2_uint_3_uint_4
%unused_entry_point = OpFunction %void None %25
%28 = OpLabel
OpReturn
OpFunctionEnd
%ret_arr = OpFunction %_arr_v4int_uint_4 None %29
%31 = OpLabel
OpReturnValue %8
OpFunctionEnd
%ret_struct_arr = OpFunction %S None %32
%34 = OpLabel
OpReturnValue %35
OpFunctionEnd
%foo = OpFunction %void None %36
%src_param = OpFunctionParameter %_arr_v4int_uint_4
%39 = OpLabel
%src_function = OpVariable %_ptr_Function__arr_v4int_uint_4 Function %8
%src_nested = OpVariable %_ptr_Function__arr__arr__arr_int_uint_2_uint_3_uint_4 Function %74
%44 = OpAccessChain %_ptr_StorageBuffer__arr_v4int_uint_4 %dst %uint_0
OpStore %44 %51
%52 = OpAccessChain %_ptr_StorageBuffer__arr_v4int_uint_4 %dst %uint_0
OpStore %52 %src_param
%53 = OpAccessChain %_ptr_StorageBuffer__arr_v4int_uint_4 %dst %uint_0
%54 = OpFunctionCall %_arr_v4int_uint_4 %ret_arr
OpStore %53 %54
%55 = OpAccessChain %_ptr_StorageBuffer__arr_v4int_uint_4 %dst %uint_0
OpStore %55 %8
%56 = OpAccessChain %_ptr_StorageBuffer__arr_v4int_uint_4 %dst %uint_0
%57 = OpLoad %_arr_v4int_uint_4 %src_function
OpStore %56 %57
%58 = OpAccessChain %_ptr_StorageBuffer__arr_v4int_uint_4 %dst %uint_0
%59 = OpLoad %_arr_v4int_uint_4 %src_private
OpStore %58 %59
%60 = OpAccessChain %_ptr_StorageBuffer__arr_v4int_uint_4 %dst %uint_0
%61 = OpLoad %_arr_v4int_uint_4 %src_workgroup
OpStore %60 %61
%62 = OpAccessChain %_ptr_StorageBuffer__arr_v4int_uint_4 %dst %uint_0
%63 = OpFunctionCall %S %ret_struct_arr
%64 = OpCompositeExtract %_arr_v4int_uint_4 %63 0
OpStore %62 %64
%65 = OpAccessChain %_ptr_StorageBuffer__arr_v4int_uint_4 %dst %uint_0
%67 = OpAccessChain %_ptr_Uniform__arr_v4int_uint_4 %src_uniform %uint_0
%68 = OpLoad %_arr_v4int_uint_4 %67
OpStore %65 %68
%69 = OpAccessChain %_ptr_StorageBuffer__arr_v4int_uint_4 %dst %uint_0
%70 = OpAccessChain %_ptr_StorageBuffer__arr_v4int_uint_4 %src_storage %uint_0
%71 = OpLoad %_arr_v4int_uint_4 %70
OpStore %69 %71
%76 = OpAccessChain %_ptr_StorageBuffer__arr__arr__arr_int_uint_2_uint_3_uint_4 %dst_nested %uint_0
%77 = OpLoad %_arr__arr__arr_int_uint_2_uint_3_uint_4 %src_nested
OpStore %76 %77
OpReturn
OpFunctionEnd

View File

@@ -0,0 +1,46 @@
type ArrayType = array<vec4<i32>, 4>;
struct S {
arr : ArrayType;
}
struct S_nested {
arr : array<array<array<i32, 2>, 3>, 4>;
}
var<private> src_private : ArrayType;
var<workgroup> src_workgroup : ArrayType;
@group(0) @binding(0) var<uniform> src_uniform : S;
@group(0) @binding(1) var<storage, read_write> src_storage : S;
@group(0) @binding(2) var<storage, read_write> dst : S;
@group(0) @binding(3) var<storage, read_write> dst_nested : S_nested;
fn ret_arr() -> ArrayType {
return ArrayType();
}
fn ret_struct_arr() -> S {
return S();
}
fn foo(src_param : ArrayType) {
var src_function : ArrayType;
dst.arr = ArrayType(vec4(1), vec4(2), vec4(3), vec4(3));
dst.arr = src_param;
dst.arr = ret_arr();
let src_let : ArrayType = ArrayType();
dst.arr = src_let;
dst.arr = src_function;
dst.arr = src_private;
dst.arr = src_workgroup;
dst.arr = ret_struct_arr().arr;
dst.arr = src_uniform.arr;
dst.arr = src_storage.arr;
var src_nested : array<array<array<i32, 2>, 3>, 4>;
dst_nested.arr = src_nested;
}

View File

@@ -0,0 +1,27 @@
type ArrayType = array<i32, 4>;
struct S {
arr : array<i32, 4>;
};
fn foo() {
let src : ArrayType = ArrayType();
var dst : ArrayType;
var dst_struct : S;
var dst_array : array<ArrayType, 2>;
let dst_ptr : ptr<function, ArrayType> = &dst;
let dst_struct_ptr : ptr<function, S> = &dst_struct;
let dst_array_ptr : ptr<function, array<ArrayType, 2>> = &dst_array;
// Assign to struct.member.
dst_struct.arr = src;
// Assign to array[index].
dst_array[1] = src;
// Assign via pointers.
*dst_ptr = src;
(*dst_struct_ptr).arr = src;
(*dst_array_ptr)[0] = src;
}

View File

@@ -0,0 +1,22 @@
#version 310 es
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void unused_entry_point() {
return;
}
struct S {
int arr[4];
};
void foo() {
int src[4] = int[4](0, 0, 0, 0);
int dst[4] = int[4](0, 0, 0, 0);
S dst_struct = S(int[4](0, 0, 0, 0));
int dst_array[2][4] = int[2][4](int[4](0, 0, 0, 0), int[4](0, 0, 0, 0));
dst_struct.arr = src;
dst_array[1] = src;
dst = src;
dst_struct.arr = src;
dst_array[0] = src;
}

View File

@@ -0,0 +1,20 @@
[numthreads(1, 1, 1)]
void unused_entry_point() {
return;
}
struct S {
int arr[4];
};
void foo() {
const int src[4] = (int[4])0;
int tint_symbol[4] = (int[4])0;
S dst_struct = (S)0;
int dst_array[2][4] = (int[2][4])0;
dst_struct.arr = src;
dst_array[1] = src;
tint_symbol = src;
dst_struct.arr = src;
dst_array[0] = src;
}

View File

@@ -0,0 +1,27 @@
#include <metal_stdlib>
using namespace metal;
struct tint_array_wrapper {
int arr[4];
};
struct S {
tint_array_wrapper arr;
};
struct tint_array_wrapper_1 {
tint_array_wrapper arr[2];
};
void foo() {
tint_array_wrapper const src = {.arr={}};
tint_array_wrapper dst = {};
S dst_struct = {};
tint_array_wrapper_1 dst_array = {};
dst_struct.arr = src;
dst_array.arr[1] = src;
dst = src;
dst_struct.arr = src;
dst_array.arr[0] = src;
}

View File

@@ -0,0 +1,57 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 30
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
OpExecutionMode %unused_entry_point LocalSize 1 1 1
OpName %unused_entry_point "unused_entry_point"
OpName %foo "foo"
OpName %dst "dst"
OpName %S "S"
OpMemberName %S 0 "arr"
OpName %dst_struct "dst_struct"
OpName %dst_array "dst_array"
OpDecorate %_arr_int_uint_4 ArrayStride 4
OpMemberDecorate %S 0 Offset 0
OpDecorate %_arr__arr_int_uint_4_uint_2 ArrayStride 16
%void = OpTypeVoid
%1 = OpTypeFunction %void
%int = OpTypeInt 32 1
%uint = OpTypeInt 32 0
%uint_4 = OpConstant %uint 4
%_arr_int_uint_4 = OpTypeArray %int %uint_4
%11 = OpConstantNull %_arr_int_uint_4
%_ptr_Function__arr_int_uint_4 = OpTypePointer Function %_arr_int_uint_4
%S = OpTypeStruct %_arr_int_uint_4
%_ptr_Function_S = OpTypePointer Function %S
%17 = OpConstantNull %S
%uint_2 = OpConstant %uint 2
%_arr__arr_int_uint_4_uint_2 = OpTypeArray %_arr_int_uint_4 %uint_2
%_ptr_Function__arr__arr_int_uint_4_uint_2 = OpTypePointer Function %_arr__arr_int_uint_4_uint_2
%22 = OpConstantNull %_arr__arr_int_uint_4_uint_2
%uint_0 = OpConstant %uint 0
%int_1 = OpConstant %int 1
%int_0 = OpConstant %int 0
%unused_entry_point = OpFunction %void None %1
%4 = OpLabel
OpReturn
OpFunctionEnd
%foo = OpFunction %void None %1
%6 = OpLabel
%dst = OpVariable %_ptr_Function__arr_int_uint_4 Function %11
%dst_struct = OpVariable %_ptr_Function_S Function %17
%dst_array = OpVariable %_ptr_Function__arr__arr_int_uint_4_uint_2 Function %22
%24 = OpAccessChain %_ptr_Function__arr_int_uint_4 %dst_struct %uint_0
OpStore %24 %11
%26 = OpAccessChain %_ptr_Function__arr_int_uint_4 %dst_array %int_1
OpStore %26 %11
OpStore %dst %11
%27 = OpAccessChain %_ptr_Function__arr_int_uint_4 %dst_struct %uint_0
OpStore %27 %11
%29 = OpAccessChain %_ptr_Function__arr_int_uint_4 %dst_array %int_0
OpStore %29 %11
OpReturn
OpFunctionEnd

View File

@@ -0,0 +1,20 @@
type ArrayType = array<i32, 4>;
struct S {
arr : array<i32, 4>;
}
fn foo() {
let src : ArrayType = ArrayType();
var dst : ArrayType;
var dst_struct : S;
var dst_array : array<ArrayType, 2>;
let dst_ptr : ptr<function, ArrayType> = &(dst);
let dst_struct_ptr : ptr<function, S> = &(dst_struct);
let dst_array_ptr : ptr<function, array<ArrayType, 2>> = &(dst_array);
dst_struct.arr = src;
dst_array[1] = src;
*(dst_ptr) = src;
(*(dst_struct_ptr)).arr = src;
(*(dst_array_ptr))[0] = src;
}

View File

@@ -0,0 +1,52 @@
type ArrayType = array<vec4<i32>, 4>;
struct S {
arr : ArrayType;
};
var<private> src_private : ArrayType;
var<workgroup> src_workgroup : ArrayType;
@group(0) @binding(0) var<uniform> src_uniform : S;
@group(0) @binding(1) var<storage, read_write> src_storage : S;
var<workgroup> dst : ArrayType;
var<workgroup> dst_nested : array<array<array<i32, 2>, 3>, 4>;
fn ret_arr() -> ArrayType {
return ArrayType();
}
fn ret_struct_arr() -> S {
return S();
}
fn foo(src_param : ArrayType) {
var src_function : ArrayType;
// Assign from type constructor.
dst = ArrayType(vec4(1), vec4(2), vec4(3), vec4(3));
// Assign from parameter.
dst = src_param;
// Assign from function call.
dst = ret_arr();
// Assign from constant.
let src_let : ArrayType = ArrayType();
dst = src_let;
// Assign from var, various storage classes.
dst = src_function;
dst = src_private;
dst = src_workgroup;
// Assign from struct.arr, various storage classes.
dst = ret_struct_arr().arr;
dst = src_uniform.arr;
dst = src_storage.arr;
// Nested assignment.
var src_nested : array<array<array<i32, 2>, 3>, 4>;
dst_nested = src_nested;
}

View File

@@ -0,0 +1,49 @@
#version 310 es
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void unused_entry_point() {
return;
}
struct S {
ivec4 arr[4];
};
ivec4 src_private[4] = ivec4[4](ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0));
shared ivec4 src_workgroup[4];
layout(binding = 0) uniform S_1 {
ivec4 arr[4];
} src_uniform;
layout(binding = 1, std430) buffer S_2 {
ivec4 arr[4];
} src_storage;
shared ivec4 dst[4];
shared int dst_nested[4][3][2];
ivec4[4] ret_arr() {
ivec4 tint_symbol[4] = ivec4[4](ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0));
return tint_symbol;
}
S ret_struct_arr() {
S tint_symbol_1 = S(ivec4[4](ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0)));
return tint_symbol_1;
}
void foo(ivec4 src_param[4]) {
ivec4 src_function[4] = ivec4[4](ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0));
ivec4 tint_symbol_2[4] = ivec4[4](ivec4(1), ivec4(2), ivec4(3), ivec4(3));
dst = tint_symbol_2;
dst = src_param;
dst = ret_arr();
ivec4 src_let[4] = ivec4[4](ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0), ivec4(0, 0, 0, 0));
dst = src_let;
dst = src_function;
dst = src_private;
dst = src_workgroup;
dst = ret_struct_arr().arr;
dst = src_uniform.arr;
dst = src_storage.arr;
int src_nested[4][3][2] = int[4][3][2](int[3][2](int[2](0, 0), int[2](0, 0), int[2](0, 0)), int[3][2](int[2](0, 0), int[2](0, 0), int[2](0, 0)), int[3][2](int[2](0, 0), int[2](0, 0), int[2](0, 0)), int[3][2](int[2](0, 0), int[2](0, 0), int[2](0, 0)));
dst_nested = src_nested;
}

View File

@@ -0,0 +1,69 @@
[numthreads(1, 1, 1)]
void unused_entry_point() {
return;
}
struct S {
int4 arr[4];
};
static int4 src_private[4] = (int4[4])0;
groupshared int4 src_workgroup[4];
cbuffer cbuffer_src_uniform : register(b0, space0) {
uint4 src_uniform[4];
};
RWByteAddressBuffer src_storage : register(u1, space0);
groupshared int4 tint_symbol[4];
groupshared int dst_nested[4][3][2];
typedef int4 ret_arr_ret[4];
ret_arr_ret ret_arr() {
const int4 tint_symbol_5[4] = (int4[4])0;
return tint_symbol_5;
}
S ret_struct_arr() {
const S tint_symbol_6 = (S)0;
return tint_symbol_6;
}
typedef int4 tint_symbol_1_ret[4];
tint_symbol_1_ret tint_symbol_1(uint4 buffer[4], uint offset) {
int4 arr_1[4] = (int4[4])0;
{
[loop] for(uint i = 0u; (i < 4u); i = (i + 1u)) {
const uint scalar_offset = ((offset + (i * 16u))) / 4;
arr_1[i] = asint(buffer[scalar_offset / 4]);
}
}
return arr_1;
}
typedef int4 tint_symbol_3_ret[4];
tint_symbol_3_ret tint_symbol_3(RWByteAddressBuffer buffer, uint offset) {
int4 arr_2[4] = (int4[4])0;
{
[loop] for(uint i_1 = 0u; (i_1 < 4u); i_1 = (i_1 + 1u)) {
arr_2[i_1] = asint(buffer.Load4((offset + (i_1 * 16u))));
}
}
return arr_2;
}
void foo(int4 src_param[4]) {
int4 src_function[4] = (int4[4])0;
const int4 tint_symbol_7[4] = {int4((1).xxxx), int4((2).xxxx), int4((3).xxxx), int4((3).xxxx)};
tint_symbol = tint_symbol_7;
tint_symbol = src_param;
tint_symbol = ret_arr();
const int4 src_let[4] = (int4[4])0;
tint_symbol = src_let;
tint_symbol = src_function;
tint_symbol = src_private;
tint_symbol = src_workgroup;
tint_symbol = ret_struct_arr().arr;
tint_symbol = tint_symbol_1(src_uniform, 0u);
tint_symbol = tint_symbol_3(src_storage, 0u);
int src_nested[4][3][2] = (int[4][3][2])0;
dst_nested = src_nested;
}

View File

@@ -0,0 +1,51 @@
#include <metal_stdlib>
using namespace metal;
struct tint_array_wrapper {
/* 0x0000 */ int4 arr[4];
};
struct S {
/* 0x0000 */ tint_array_wrapper arr;
};
struct tint_array_wrapper_3 {
int arr[2];
};
struct tint_array_wrapper_2 {
tint_array_wrapper_3 arr[3];
};
struct tint_array_wrapper_1 {
tint_array_wrapper_2 arr[4];
};
tint_array_wrapper ret_arr() {
tint_array_wrapper const tint_symbol = {.arr={}};
return tint_symbol;
}
S ret_struct_arr() {
S const tint_symbol_1 = {};
return tint_symbol_1;
}
void foo(tint_array_wrapper src_param, threadgroup tint_array_wrapper* const tint_symbol_3, thread tint_array_wrapper* const tint_symbol_4, threadgroup tint_array_wrapper* const tint_symbol_5, const constant S* const tint_symbol_6, device S* const tint_symbol_7, threadgroup tint_array_wrapper_1* const tint_symbol_8) {
tint_array_wrapper src_function = {};
tint_array_wrapper const tint_symbol_2 = {.arr={int4(1), int4(2), int4(3), int4(3)}};
*(tint_symbol_3) = tint_symbol_2;
*(tint_symbol_3) = src_param;
*(tint_symbol_3) = ret_arr();
tint_array_wrapper const src_let = {.arr={}};
*(tint_symbol_3) = src_let;
*(tint_symbol_3) = src_function;
*(tint_symbol_3) = *(tint_symbol_4);
*(tint_symbol_3) = *(tint_symbol_5);
*(tint_symbol_3) = ret_struct_arr().arr;
*(tint_symbol_3) = (*(tint_symbol_6)).arr;
*(tint_symbol_3) = (*(tint_symbol_7)).arr;
tint_array_wrapper_1 src_nested = {};
*(tint_symbol_8) = src_nested;
}

View File

@@ -0,0 +1,118 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 65
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
OpExecutionMode %unused_entry_point LocalSize 1 1 1
OpName %src_private "src_private"
OpName %src_workgroup "src_workgroup"
OpName %S "S"
OpMemberName %S 0 "arr"
OpName %src_uniform "src_uniform"
OpName %src_storage "src_storage"
OpName %dst "dst"
OpName %dst_nested "dst_nested"
OpName %unused_entry_point "unused_entry_point"
OpName %ret_arr "ret_arr"
OpName %ret_struct_arr "ret_struct_arr"
OpName %foo "foo"
OpName %src_param "src_param"
OpName %src_function "src_function"
OpName %src_nested "src_nested"
OpDecorate %_arr_v4int_uint_4 ArrayStride 16
OpDecorate %S Block
OpMemberDecorate %S 0 Offset 0
OpDecorate %src_uniform NonWritable
OpDecorate %src_uniform DescriptorSet 0
OpDecorate %src_uniform Binding 0
OpDecorate %src_storage DescriptorSet 0
OpDecorate %src_storage Binding 1
OpDecorate %_arr_int_uint_2 ArrayStride 4
OpDecorate %_arr__arr_int_uint_2_uint_3 ArrayStride 8
OpDecorate %_arr__arr__arr_int_uint_2_uint_3_uint_4 ArrayStride 24
%int = OpTypeInt 32 1
%v4int = OpTypeVector %int 4
%uint = OpTypeInt 32 0
%uint_4 = OpConstant %uint 4
%_arr_v4int_uint_4 = OpTypeArray %v4int %uint_4
%_ptr_Private__arr_v4int_uint_4 = OpTypePointer Private %_arr_v4int_uint_4
%8 = OpConstantNull %_arr_v4int_uint_4
%src_private = OpVariable %_ptr_Private__arr_v4int_uint_4 Private %8
%_ptr_Workgroup__arr_v4int_uint_4 = OpTypePointer Workgroup %_arr_v4int_uint_4
%src_workgroup = OpVariable %_ptr_Workgroup__arr_v4int_uint_4 Workgroup
%S = OpTypeStruct %_arr_v4int_uint_4
%_ptr_Uniform_S = OpTypePointer Uniform %S
%src_uniform = OpVariable %_ptr_Uniform_S Uniform
%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S
%src_storage = OpVariable %_ptr_StorageBuffer_S StorageBuffer
%dst = OpVariable %_ptr_Workgroup__arr_v4int_uint_4 Workgroup
%uint_2 = OpConstant %uint 2
%_arr_int_uint_2 = OpTypeArray %int %uint_2
%uint_3 = OpConstant %uint 3
%_arr__arr_int_uint_2_uint_3 = OpTypeArray %_arr_int_uint_2 %uint_3
%_arr__arr__arr_int_uint_2_uint_3_uint_4 = OpTypeArray %_arr__arr_int_uint_2_uint_3 %uint_4
%_ptr_Workgroup__arr__arr__arr_int_uint_2_uint_3_uint_4 = OpTypePointer Workgroup %_arr__arr__arr_int_uint_2_uint_3_uint_4
%dst_nested = OpVariable %_ptr_Workgroup__arr__arr__arr_int_uint_2_uint_3_uint_4 Workgroup
%void = OpTypeVoid
%24 = OpTypeFunction %void
%28 = OpTypeFunction %_arr_v4int_uint_4
%31 = OpTypeFunction %S
%34 = OpConstantNull %S
%35 = OpTypeFunction %void %_arr_v4int_uint_4
%_ptr_Function__arr_v4int_uint_4 = OpTypePointer Function %_arr_v4int_uint_4
%int_1 = OpConstant %int 1
%42 = OpConstantComposite %v4int %int_1 %int_1 %int_1 %int_1
%int_2 = OpConstant %int 2
%44 = OpConstantComposite %v4int %int_2 %int_2 %int_2 %int_2
%int_3 = OpConstant %int 3
%46 = OpConstantComposite %v4int %int_3 %int_3 %int_3 %int_3
%47 = OpConstantComposite %_arr_v4int_uint_4 %42 %44 %46 %46
%uint_0 = OpConstant %uint 0
%_ptr_Uniform__arr_v4int_uint_4 = OpTypePointer Uniform %_arr_v4int_uint_4
%_ptr_StorageBuffer__arr_v4int_uint_4 = OpTypePointer StorageBuffer %_arr_v4int_uint_4
%_ptr_Function__arr__arr__arr_int_uint_2_uint_3_uint_4 = OpTypePointer Function %_arr__arr__arr_int_uint_2_uint_3_uint_4
%63 = OpConstantNull %_arr__arr__arr_int_uint_2_uint_3_uint_4
%unused_entry_point = OpFunction %void None %24
%27 = OpLabel
OpReturn
OpFunctionEnd
%ret_arr = OpFunction %_arr_v4int_uint_4 None %28
%30 = OpLabel
OpReturnValue %8
OpFunctionEnd
%ret_struct_arr = OpFunction %S None %31
%33 = OpLabel
OpReturnValue %34
OpFunctionEnd
%foo = OpFunction %void None %35
%src_param = OpFunctionParameter %_arr_v4int_uint_4
%38 = OpLabel
%src_function = OpVariable %_ptr_Function__arr_v4int_uint_4 Function %8
%src_nested = OpVariable %_ptr_Function__arr__arr__arr_int_uint_2_uint_3_uint_4 Function %63
OpStore %dst %47
OpStore %dst %src_param
%48 = OpFunctionCall %_arr_v4int_uint_4 %ret_arr
OpStore %dst %48
OpStore %dst %8
%49 = OpLoad %_arr_v4int_uint_4 %src_function
OpStore %dst %49
%50 = OpLoad %_arr_v4int_uint_4 %src_private
OpStore %dst %50
%51 = OpLoad %_arr_v4int_uint_4 %src_workgroup
OpStore %dst %51
%52 = OpFunctionCall %S %ret_struct_arr
%53 = OpCompositeExtract %_arr_v4int_uint_4 %52 0
OpStore %dst %53
%56 = OpAccessChain %_ptr_Uniform__arr_v4int_uint_4 %src_uniform %uint_0
%57 = OpLoad %_arr_v4int_uint_4 %56
OpStore %dst %57
%59 = OpAccessChain %_ptr_StorageBuffer__arr_v4int_uint_4 %src_storage %uint_0
%60 = OpLoad %_arr_v4int_uint_4 %59
OpStore %dst %60
%64 = OpLoad %_arr__arr__arr_int_uint_2_uint_3_uint_4 %src_nested
OpStore %dst_nested %64
OpReturn
OpFunctionEnd

View File

@@ -0,0 +1,42 @@
type ArrayType = array<vec4<i32>, 4>;
struct S {
arr : ArrayType;
}
var<private> src_private : ArrayType;
var<workgroup> src_workgroup : ArrayType;
@group(0) @binding(0) var<uniform> src_uniform : S;
@group(0) @binding(1) var<storage, read_write> src_storage : S;
var<workgroup> dst : ArrayType;
var<workgroup> dst_nested : array<array<array<i32, 2>, 3>, 4>;
fn ret_arr() -> ArrayType {
return ArrayType();
}
fn ret_struct_arr() -> S {
return S();
}
fn foo(src_param : ArrayType) {
var src_function : ArrayType;
dst = ArrayType(vec4(1), vec4(2), vec4(3), vec4(3));
dst = src_param;
dst = ret_arr();
let src_let : ArrayType = ArrayType();
dst = src_let;
dst = src_function;
dst = src_private;
dst = src_workgroup;
dst = ret_struct_arr().arr;
dst = src_uniform.arr;
dst = src_storage.arr;
var src_nested : array<array<array<i32, 2>, 3>, 4>;
dst_nested = src_nested;
}

View File

@@ -0,0 +1,21 @@
fn f1(a : array<f32, 4>) -> f32 {
return a[3];
}
fn f2(a : array<array<f32, 4>, 3>) -> f32 {
return a[2][3];
}
fn f3(a : array<array<array<f32, 4>, 3>, 2>) -> f32 {
return a[1][2][3];
}
@stage(compute) @workgroup_size(1)
fn main() {
let a1 : array<f32, 4> = array<f32, 4>();
let a2 : array<array<f32, 4>, 3> = array<array<f32, 4>, 3>();
let a3 : array<array<array<f32, 4>, 3>, 2> = array<array<array<f32, 4>, 3>, 2>();
let v1 : f32 = f1(a1);
let v2 : f32 = f2(a2);
let v3 : f32 = f3(a3);
}

View File

@@ -0,0 +1,28 @@
#version 310 es
float f1(float a[4]) {
return a[3];
}
float f2(float a[3][4]) {
return a[2][3];
}
float f3(float a[2][3][4]) {
return a[1][2][3];
}
void tint_symbol() {
float a1[4] = float[4](0.0f, 0.0f, 0.0f, 0.0f);
float a2[3][4] = float[3][4](float[4](0.0f, 0.0f, 0.0f, 0.0f), float[4](0.0f, 0.0f, 0.0f, 0.0f), float[4](0.0f, 0.0f, 0.0f, 0.0f));
float a3[2][3][4] = float[2][3][4](float[3][4](float[4](0.0f, 0.0f, 0.0f, 0.0f), float[4](0.0f, 0.0f, 0.0f, 0.0f), float[4](0.0f, 0.0f, 0.0f, 0.0f)), float[3][4](float[4](0.0f, 0.0f, 0.0f, 0.0f), float[4](0.0f, 0.0f, 0.0f, 0.0f), float[4](0.0f, 0.0f, 0.0f, 0.0f)));
float v1 = f1(a1);
float v2 = f2(a2);
float v3 = f3(a3);
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
tint_symbol();
return;
}

View File

@@ -0,0 +1,22 @@
float f1(float a[4]) {
return a[3];
}
float f2(float a[3][4]) {
return a[2][3];
}
float f3(float a[2][3][4]) {
return a[1][2][3];
}
[numthreads(1, 1, 1)]
void main() {
const float a1[4] = (float[4])0;
const float a2[3][4] = (float[3][4])0;
const float a3[2][3][4] = (float[2][3][4])0;
const float v1 = f1(a1);
const float v2 = f2(a2);
const float v3 = f3(a3);
return;
}

View File

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

View File

@@ -0,0 +1,67 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 41
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %main "main"
OpExecutionMode %main LocalSize 1 1 1
OpName %f1 "f1"
OpName %a "a"
OpName %f2 "f2"
OpName %a_0 "a"
OpName %f3 "f3"
OpName %a_1 "a"
OpName %main "main"
OpDecorate %_arr_float_uint_4 ArrayStride 4
OpDecorate %_arr__arr_float_uint_4_uint_3 ArrayStride 16
OpDecorate %_arr__arr__arr_float_uint_4_uint_3_uint_2 ArrayStride 48
%float = OpTypeFloat 32
%uint = OpTypeInt 32 0
%uint_4 = OpConstant %uint 4
%_arr_float_uint_4 = OpTypeArray %float %uint_4
%1 = OpTypeFunction %float %_arr_float_uint_4
%int = OpTypeInt 32 1
%int_3 = OpConstant %int 3
%uint_3 = OpConstant %uint 3
%_arr__arr_float_uint_4_uint_3 = OpTypeArray %_arr_float_uint_4 %uint_3
%12 = OpTypeFunction %float %_arr__arr_float_uint_4_uint_3
%int_2 = OpConstant %int 2
%uint_2 = OpConstant %uint 2
%_arr__arr__arr_float_uint_4_uint_3_uint_2 = OpTypeArray %_arr__arr_float_uint_4_uint_3 %uint_2
%21 = OpTypeFunction %float %_arr__arr__arr_float_uint_4_uint_3_uint_2
%int_1 = OpConstant %int 1
%void = OpTypeVoid
%31 = OpTypeFunction %void
%35 = OpConstantNull %_arr_float_uint_4
%36 = OpConstantNull %_arr__arr_float_uint_4_uint_3
%37 = OpConstantNull %_arr__arr__arr_float_uint_4_uint_3_uint_2
%f1 = OpFunction %float None %1
%a = OpFunctionParameter %_arr_float_uint_4
%8 = OpLabel
%11 = OpCompositeExtract %float %a 3
OpReturnValue %11
OpFunctionEnd
%f2 = OpFunction %float None %12
%a_0 = OpFunctionParameter %_arr__arr_float_uint_4_uint_3
%17 = OpLabel
%19 = OpCompositeExtract %_arr_float_uint_4 %a_0 2
%20 = OpCompositeExtract %float %19 3
OpReturnValue %20
OpFunctionEnd
%f3 = OpFunction %float None %21
%a_1 = OpFunctionParameter %_arr__arr__arr_float_uint_4_uint_3_uint_2
%26 = OpLabel
%28 = OpCompositeExtract %_arr__arr_float_uint_4_uint_3 %a_1 1
%29 = OpCompositeExtract %_arr_float_uint_4 %28 2
%30 = OpCompositeExtract %float %29 3
OpReturnValue %30
OpFunctionEnd
%main = OpFunction %void None %31
%34 = OpLabel
%38 = OpFunctionCall %float %f1 %35
%39 = OpFunctionCall %float %f2 %36
%40 = OpFunctionCall %float %f3 %37
OpReturn
OpFunctionEnd

View File

@@ -0,0 +1,21 @@
fn f1(a : array<f32, 4>) -> f32 {
return a[3];
}
fn f2(a : array<array<f32, 4>, 3>) -> f32 {
return a[2][3];
}
fn f3(a : array<array<array<f32, 4>, 3>, 2>) -> f32 {
return a[1][2][3];
}
@stage(compute) @workgroup_size(1)
fn main() {
let a1 : array<f32, 4> = array<f32, 4>();
let a2 : array<array<f32, 4>, 3> = array<array<f32, 4>, 3>();
let a3 : array<array<array<f32, 4>, 3>, 2> = array<array<array<f32, 4>, 3>, 2>();
let v1 : f32 = f1(a1);
let v2 : f32 = f2(a2);
let v3 : f32 = f3(a3);
}

View File

@@ -0,0 +1,18 @@
fn f1() -> array<f32, 4> {
return array<f32, 4>();
}
fn f2() -> array<array<f32, 4>, 3> {
return array<array<f32, 4>, 3>(f1(), f1(), f1());
}
fn f3() -> array<array<array<f32, 4>, 3>, 2> {
return array<array<array<f32, 4>, 3>, 2>(f2(), f2());
}
@stage(compute) @workgroup_size(1)
fn main() {
let a1 : array<f32, 4> = f1();
let a2 : array<array<f32, 4>, 3> = f2();
let a3 : array<array<array<f32, 4>, 3>, 2> = f3();
}

View File

@@ -0,0 +1,28 @@
#version 310 es
float[4] f1() {
float tint_symbol_1[4] = float[4](0.0f, 0.0f, 0.0f, 0.0f);
return tint_symbol_1;
}
float[3][4] f2() {
float tint_symbol_2[3][4] = float[3][4](f1(), f1(), f1());
return tint_symbol_2;
}
float[2][3][4] f3() {
float tint_symbol_3[2][3][4] = float[2][3][4](f2(), f2());
return tint_symbol_3;
}
void tint_symbol() {
float a1[4] = f1();
float a2[3][4] = f2();
float a3[2][3][4] = f3();
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
tint_symbol();
return;
}

View File

@@ -0,0 +1,25 @@
typedef float f1_ret[4];
f1_ret f1() {
const float tint_symbol[4] = (float[4])0;
return tint_symbol;
}
typedef float f2_ret[3][4];
f2_ret f2() {
const float tint_symbol_1[3][4] = {f1(), f1(), f1()};
return tint_symbol_1;
}
typedef float f3_ret[2][3][4];
f3_ret f3() {
const float tint_symbol_2[2][3][4] = {f2(), f2()};
return tint_symbol_2;
}
[numthreads(1, 1, 1)]
void main() {
const float a1[4] = f1();
const float a2[3][4] = f2();
const float a3[2][3][4] = f3();
return;
}

View File

@@ -0,0 +1,37 @@
#include <metal_stdlib>
using namespace metal;
struct tint_array_wrapper {
float arr[4];
};
tint_array_wrapper f1() {
tint_array_wrapper const tint_symbol_1 = {.arr={}};
return tint_symbol_1;
}
struct tint_array_wrapper_1 {
tint_array_wrapper arr[3];
};
tint_array_wrapper_1 f2() {
tint_array_wrapper_1 const tint_symbol_2 = {.arr={f1(), f1(), f1()}};
return tint_symbol_2;
}
struct tint_array_wrapper_2 {
tint_array_wrapper_1 arr[2];
};
tint_array_wrapper_2 f3() {
tint_array_wrapper_2 const tint_symbol_3 = {.arr={f2(), f2()}};
return tint_symbol_3;
}
kernel void tint_symbol() {
tint_array_wrapper const a1 = f1();
tint_array_wrapper_1 const a2 = f2();
tint_array_wrapper_2 const a3 = f3();
return;
}

View File

@@ -0,0 +1,56 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 33
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %main "main"
OpExecutionMode %main LocalSize 1 1 1
OpName %f1 "f1"
OpName %f2 "f2"
OpName %f3 "f3"
OpName %main "main"
OpDecorate %_arr_float_uint_4 ArrayStride 4
OpDecorate %_arr__arr_float_uint_4_uint_3 ArrayStride 16
OpDecorate %_arr__arr__arr_float_uint_4_uint_3_uint_2 ArrayStride 48
%float = OpTypeFloat 32
%uint = OpTypeInt 32 0
%uint_4 = OpConstant %uint 4
%_arr_float_uint_4 = OpTypeArray %float %uint_4
%1 = OpTypeFunction %_arr_float_uint_4
%8 = OpConstantNull %_arr_float_uint_4
%uint_3 = OpConstant %uint 3
%_arr__arr_float_uint_4_uint_3 = OpTypeArray %_arr_float_uint_4 %uint_3
%9 = OpTypeFunction %_arr__arr_float_uint_4_uint_3
%uint_2 = OpConstant %uint 2
%_arr__arr__arr_float_uint_4_uint_3_uint_2 = OpTypeArray %_arr__arr_float_uint_4_uint_3 %uint_2
%18 = OpTypeFunction %_arr__arr__arr_float_uint_4_uint_3_uint_2
%void = OpTypeVoid
%26 = OpTypeFunction %void
%f1 = OpFunction %_arr_float_uint_4 None %1
%7 = OpLabel
OpReturnValue %8
OpFunctionEnd
%f2 = OpFunction %_arr__arr_float_uint_4_uint_3 None %9
%13 = OpLabel
%14 = OpFunctionCall %_arr_float_uint_4 %f1
%15 = OpFunctionCall %_arr_float_uint_4 %f1
%16 = OpFunctionCall %_arr_float_uint_4 %f1
%17 = OpCompositeConstruct %_arr__arr_float_uint_4_uint_3 %14 %15 %16
OpReturnValue %17
OpFunctionEnd
%f3 = OpFunction %_arr__arr__arr_float_uint_4_uint_3_uint_2 None %18
%22 = OpLabel
%23 = OpFunctionCall %_arr__arr_float_uint_4_uint_3 %f2
%24 = OpFunctionCall %_arr__arr_float_uint_4_uint_3 %f2
%25 = OpCompositeConstruct %_arr__arr__arr_float_uint_4_uint_3_uint_2 %23 %24
OpReturnValue %25
OpFunctionEnd
%main = OpFunction %void None %26
%29 = OpLabel
%30 = OpFunctionCall %_arr_float_uint_4 %f1
%31 = OpFunctionCall %_arr__arr_float_uint_4_uint_3 %f2
%32 = OpFunctionCall %_arr__arr__arr_float_uint_4_uint_3_uint_2 %f3
OpReturn
OpFunctionEnd

View File

@@ -0,0 +1,18 @@
fn f1() -> array<f32, 4> {
return array<f32, 4>();
}
fn f2() -> array<array<f32, 4>, 3> {
return array<array<f32, 4>, 3>(f1(), f1(), f1());
}
fn f3() -> array<array<array<f32, 4>, 3>, 2> {
return array<array<array<f32, 4>, 3>, 2>(f2(), f2());
}
@stage(compute) @workgroup_size(1)
fn main() {
let a1 : array<f32, 4> = f1();
let a2 : array<array<f32, 4>, 3> = f2();
let a3 : array<array<array<f32, 4>, 3>, 2> = f3();
}

14
test/tint/array/size.wgsl Normal file
View File

@@ -0,0 +1,14 @@
let slen = 4;
let ulen = 4u;
@stage(fragment)
fn main() {
var signed_literal : array<f32, 4>;
var unsigned_literal : array<f32, 4u>;
var signed_constant : array<f32, slen>;
var unsigned_constant : array<f32, ulen>;
// Ensure that the types are compatible.
signed_literal = unsigned_constant;
signed_constant = unsigned_literal;
}

View File

@@ -0,0 +1,18 @@
#version 310 es
precision mediump float;
const int slen = 4;
const uint ulen = 4u;
void tint_symbol() {
float signed_literal[4] = float[4](0.0f, 0.0f, 0.0f, 0.0f);
float unsigned_literal[4] = float[4](0.0f, 0.0f, 0.0f, 0.0f);
float signed_constant[4] = float[4](0.0f, 0.0f, 0.0f, 0.0f);
float unsigned_constant[4] = float[4](0.0f, 0.0f, 0.0f, 0.0f);
signed_literal = unsigned_constant;
signed_constant = unsigned_literal;
}
void main() {
tint_symbol();
return;
}

View File

@@ -0,0 +1,12 @@
static const int slen = 4;
static const uint ulen = 4u;
void main() {
float signed_literal[4] = (float[4])0;
float unsigned_literal[4] = (float[4])0;
float signed_constant[4] = (float[4])0;
float unsigned_constant[4] = (float[4])0;
signed_literal = unsigned_constant;
signed_constant = unsigned_literal;
return;
}

View File

@@ -0,0 +1,21 @@
#include <metal_stdlib>
using namespace metal;
constant int slen = 4;
constant uint ulen = 4u;
struct tint_array_wrapper {
float arr[4];
};
fragment void tint_symbol() {
tint_array_wrapper signed_literal = {};
tint_array_wrapper unsigned_literal = {};
tint_array_wrapper signed_constant = {};
tint_array_wrapper unsigned_constant = {};
signed_literal = unsigned_constant;
signed_constant = unsigned_literal;
return;
}

View File

@@ -0,0 +1,39 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 19
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint Fragment %main "main"
OpExecutionMode %main OriginUpperLeft
OpName %slen "slen"
OpName %ulen "ulen"
OpName %main "main"
OpName %signed_literal "signed_literal"
OpName %unsigned_literal "unsigned_literal"
OpName %signed_constant "signed_constant"
OpName %unsigned_constant "unsigned_constant"
OpDecorate %_arr_float_ulen ArrayStride 4
%int = OpTypeInt 32 1
%slen = OpConstant %int 4
%uint = OpTypeInt 32 0
%ulen = OpConstant %uint 4
%void = OpTypeVoid
%5 = OpTypeFunction %void
%float = OpTypeFloat 32
%_arr_float_ulen = OpTypeArray %float %ulen
%_ptr_Function__arr_float_ulen = OpTypePointer Function %_arr_float_ulen
%13 = OpConstantNull %_arr_float_ulen
%main = OpFunction %void None %5
%8 = OpLabel
%signed_literal = OpVariable %_ptr_Function__arr_float_ulen Function %13
%unsigned_literal = OpVariable %_ptr_Function__arr_float_ulen Function %13
%signed_constant = OpVariable %_ptr_Function__arr_float_ulen Function %13
%unsigned_constant = OpVariable %_ptr_Function__arr_float_ulen Function %13
%17 = OpLoad %_arr_float_ulen %unsigned_constant
OpStore %signed_literal %17
%18 = OpLoad %_arr_float_ulen %unsigned_literal
OpStore %signed_constant %18
OpReturn
OpFunctionEnd

View File

@@ -0,0 +1,13 @@
let slen = 4;
let ulen = 4u;
@stage(fragment)
fn main() {
var signed_literal : array<f32, 4>;
var unsigned_literal : array<f32, 4u>;
var signed_constant : array<f32, slen>;
var unsigned_constant : array<f32, ulen>;
signed_literal = unsigned_constant;
signed_constant = unsigned_literal;
}

View File

@@ -0,0 +1,71 @@
; type ARR_A = @stride(8) array<f32, 2>;
; type ARR_B = @stride(128) array<@stride(16) array<ARR_A, 4>, 3>;
; struct S {
; a : ARR_B;
; };
; @group(0) @binding(0) var<storage, read_write> s : S;
;
; @stage(compute) @workgroup_size(1)
; fn f() {
; let a : ARR_B = s.a;
; let b : array<@stride(8) array<f32, 2>, 3> = s.a[3];
; let c = s.a[3][2];
; let d = s.a[3][2][1];
; s.a = ARR_B();
; s.a[3][2][1] = 5.0;
; }
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %f "f"
OpExecutionMode %f LocalSize 1 1 1
OpName %S "S"
OpMemberName %S 0 "a"
OpName %s "s"
OpName %f "f"
OpDecorate %S Block
OpMemberDecorate %S 0 Offset 0
OpDecorate %_arr_float_uint_2 ArrayStride 8
OpDecorate %_arr__arr_float_uint_2_uint_3 ArrayStride 16
OpDecorate %_arr__arr__arr_float_uint_2_uint_3_uint_4 ArrayStride 128
OpDecorate %s DescriptorSet 0
OpDecorate %s Binding 0
%float = OpTypeFloat 32
%uint = OpTypeInt 32 0
%uint_2 = OpConstant %uint 2
%_arr_float_uint_2 = OpTypeArray %float %uint_2
%uint_3 = OpConstant %uint 3
%_arr__arr_float_uint_2_uint_3 = OpTypeArray %_arr_float_uint_2 %uint_3
%uint_4 = OpConstant %uint 4
%_arr__arr__arr_float_uint_2_uint_3_uint_4 = OpTypeArray %_arr__arr_float_uint_2_uint_3 %uint_4
%S = OpTypeStruct %_arr__arr__arr_float_uint_2_uint_3_uint_4
%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S
%s = OpVariable %_ptr_StorageBuffer_S StorageBuffer
%void = OpTypeVoid
%12 = OpTypeFunction %void
%uint_0 = OpConstant %uint 0
%_ptr_StorageBuffer__arr__arr__arr_float_uint_2_uint_3_uint_4 = OpTypePointer StorageBuffer %_arr__arr__arr_float_uint_2_uint_3_uint_4
%int = OpTypeInt 32 1
%int_3 = OpConstant %int 3
%_ptr_StorageBuffer__arr__arr_float_uint_2_uint_3 = OpTypePointer StorageBuffer %_arr__arr_float_uint_2_uint_3
%int_2 = OpConstant %int 2
%_ptr_StorageBuffer__arr_float_uint_2 = OpTypePointer StorageBuffer %_arr_float_uint_2
%int_1 = OpConstant %int 1
%_ptr_StorageBuffer_float = OpTypePointer StorageBuffer %float
%34 = OpConstantNull %_arr__arr__arr_float_uint_2_uint_3_uint_4
%float_5 = OpConstant %float 5
%f = OpFunction %void None %12
%15 = OpLabel
%18 = OpAccessChain %_ptr_StorageBuffer__arr__arr__arr_float_uint_2_uint_3_uint_4 %s %uint_0
%19 = OpLoad %_arr__arr__arr_float_uint_2_uint_3_uint_4 %18
%23 = OpAccessChain %_ptr_StorageBuffer__arr__arr_float_uint_2_uint_3 %s %uint_0 %int_3
%24 = OpLoad %_arr__arr_float_uint_2_uint_3 %23
%27 = OpAccessChain %_ptr_StorageBuffer__arr_float_uint_2 %s %uint_0 %int_3 %int_2
%28 = OpLoad %_arr_float_uint_2 %27
%31 = OpAccessChain %_ptr_StorageBuffer_float %s %uint_0 %int_3 %int_2 %int_1
%32 = OpLoad %float %31
%33 = OpAccessChain %_ptr_StorageBuffer__arr__arr__arr_float_uint_2_uint_3_uint_4 %s %uint_0
OpStore %33 %34
%35 = OpAccessChain %_ptr_StorageBuffer_float %s %uint_0 %int_3 %int_2 %int_1
OpStore %35 %float_5
OpReturn
OpFunctionEnd

View File

@@ -0,0 +1,37 @@
#version 310 es
struct strided_arr {
float el;
};
struct strided_arr_1 {
strided_arr el[3][2];
};
struct S {
strided_arr_1 a[4];
};
layout(binding = 0, std430) buffer S_1 {
strided_arr_1 a[4];
} s;
void f_1() {
strided_arr_1 x_19[4] = s.a;
strided_arr x_24[3][2] = s.a[3].el;
strided_arr x_28[2] = s.a[3].el[2];
float x_32 = s.a[3].el[2][1].el;
strided_arr_1 tint_symbol[4] = strided_arr_1[4](strided_arr_1(strided_arr[3][2](strided_arr[2](strided_arr(0.0f), strided_arr(0.0f)), strided_arr[2](strided_arr(0.0f), strided_arr(0.0f)), strided_arr[2](strided_arr(0.0f), strided_arr(0.0f)))), strided_arr_1(strided_arr[3][2](strided_arr[2](strided_arr(0.0f), strided_arr(0.0f)), strided_arr[2](strided_arr(0.0f), strided_arr(0.0f)), strided_arr[2](strided_arr(0.0f), strided_arr(0.0f)))), strided_arr_1(strided_arr[3][2](strided_arr[2](strided_arr(0.0f), strided_arr(0.0f)), strided_arr[2](strided_arr(0.0f), strided_arr(0.0f)), strided_arr[2](strided_arr(0.0f), strided_arr(0.0f)))), strided_arr_1(strided_arr[3][2](strided_arr[2](strided_arr(0.0f), strided_arr(0.0f)), strided_arr[2](strided_arr(0.0f), strided_arr(0.0f)), strided_arr[2](strided_arr(0.0f), strided_arr(0.0f)))));
s.a = tint_symbol;
s.a[3].el[2][1].el = 5.0f;
return;
}
void f() {
f_1();
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
f();
return;
}

View File

@@ -0,0 +1,103 @@
struct strided_arr {
float el;
};
struct strided_arr_1 {
strided_arr el[3][2];
};
RWByteAddressBuffer s : register(u0, space0);
strided_arr tint_symbol_4(RWByteAddressBuffer buffer, uint offset) {
const strided_arr tint_symbol_12 = {asfloat(buffer.Load((offset + 0u)))};
return tint_symbol_12;
}
typedef strided_arr tint_symbol_3_ret[2];
tint_symbol_3_ret tint_symbol_3(RWByteAddressBuffer buffer, uint offset) {
strided_arr arr[2] = (strided_arr[2])0;
{
[loop] for(uint i = 0u; (i < 2u); i = (i + 1u)) {
arr[i] = tint_symbol_4(buffer, (offset + (i * 8u)));
}
}
return arr;
}
typedef strided_arr tint_symbol_2_ret[3][2];
tint_symbol_2_ret tint_symbol_2(RWByteAddressBuffer buffer, uint offset) {
strided_arr arr_1[3][2] = (strided_arr[3][2])0;
{
[loop] for(uint i_1 = 0u; (i_1 < 3u); i_1 = (i_1 + 1u)) {
arr_1[i_1] = tint_symbol_3(buffer, (offset + (i_1 * 16u)));
}
}
return arr_1;
}
strided_arr_1 tint_symbol_1(RWByteAddressBuffer buffer, uint offset) {
const strided_arr_1 tint_symbol_13 = {tint_symbol_2(buffer, (offset + 0u))};
return tint_symbol_13;
}
typedef strided_arr_1 tint_symbol_ret[4];
tint_symbol_ret tint_symbol(RWByteAddressBuffer buffer, uint offset) {
strided_arr_1 arr_2[4] = (strided_arr_1[4])0;
{
[loop] for(uint i_2 = 0u; (i_2 < 4u); i_2 = (i_2 + 1u)) {
arr_2[i_2] = tint_symbol_1(buffer, (offset + (i_2 * 128u)));
}
}
return arr_2;
}
void tint_symbol_10(RWByteAddressBuffer buffer, uint offset, strided_arr value) {
buffer.Store((offset + 0u), asuint(value.el));
}
void tint_symbol_9(RWByteAddressBuffer buffer, uint offset, strided_arr value[2]) {
strided_arr array_2[2] = value;
{
[loop] for(uint i_3 = 0u; (i_3 < 2u); i_3 = (i_3 + 1u)) {
tint_symbol_10(buffer, (offset + (i_3 * 8u)), array_2[i_3]);
}
}
}
void tint_symbol_8(RWByteAddressBuffer buffer, uint offset, strided_arr value[3][2]) {
strided_arr array_1[3][2] = value;
{
[loop] for(uint i_4 = 0u; (i_4 < 3u); i_4 = (i_4 + 1u)) {
tint_symbol_9(buffer, (offset + (i_4 * 16u)), array_1[i_4]);
}
}
}
void tint_symbol_7(RWByteAddressBuffer buffer, uint offset, strided_arr_1 value) {
tint_symbol_8(buffer, (offset + 0u), value.el);
}
void tint_symbol_6(RWByteAddressBuffer buffer, uint offset, strided_arr_1 value[4]) {
strided_arr_1 array[4] = value;
{
[loop] for(uint i_5 = 0u; (i_5 < 4u); i_5 = (i_5 + 1u)) {
tint_symbol_7(buffer, (offset + (i_5 * 128u)), array[i_5]);
}
}
}
void f_1() {
const strided_arr_1 x_19[4] = tint_symbol(s, 0u);
const strided_arr x_24[3][2] = tint_symbol_2(s, 384u);
const strided_arr x_28[2] = tint_symbol_3(s, 416u);
const float x_32 = asfloat(s.Load(424u));
const strided_arr_1 tint_symbol_14[4] = (strided_arr_1[4])0;
tint_symbol_6(s, 0u, tint_symbol_14);
s.Store(424u, asuint(5.0f));
return;
}
[numthreads(1, 1, 1)]
void f() {
f_1();
return;
}

View File

@@ -0,0 +1,45 @@
#include <metal_stdlib>
using namespace metal;
struct strided_arr {
/* 0x0000 */ float el;
/* 0x0004 */ int8_t tint_pad[4];
};
struct tint_array_wrapper {
/* 0x0000 */ strided_arr arr[2];
};
struct tint_array_wrapper_1 {
/* 0x0000 */ tint_array_wrapper arr[3];
};
struct strided_arr_1 {
/* 0x0000 */ tint_array_wrapper_1 el;
/* 0x0030 */ int8_t tint_pad_1[80];
};
struct tint_array_wrapper_2 {
/* 0x0000 */ strided_arr_1 arr[4];
};
struct S {
/* 0x0000 */ tint_array_wrapper_2 a;
};
void f_1(device S* const tint_symbol_1) {
tint_array_wrapper_2 const x_19 = (*(tint_symbol_1)).a;
tint_array_wrapper_1 const x_24 = (*(tint_symbol_1)).a.arr[3].el;
tint_array_wrapper const x_28 = (*(tint_symbol_1)).a.arr[3].el.arr[2];
float const x_32 = (*(tint_symbol_1)).a.arr[3].el.arr[2].arr[1].el;
tint_array_wrapper_2 const tint_symbol = {.arr={}};
(*(tint_symbol_1)).a = tint_symbol;
(*(tint_symbol_1)).a.arr[3].el.arr[2].arr[1].el = 5.0f;
return;
}
kernel void f(device S* tint_symbol_2 [[buffer(0)]]) {
f_1(tint_symbol_2);
return;
}

View File

@@ -0,0 +1,74 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 42
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %f "f"
OpExecutionMode %f LocalSize 1 1 1
OpName %S "S"
OpMemberName %S 0 "a"
OpName %strided_arr_1 "strided_arr_1"
OpMemberName %strided_arr_1 0 "el"
OpName %strided_arr "strided_arr"
OpMemberName %strided_arr 0 "el"
OpName %s "s"
OpName %f_1 "f_1"
OpName %f "f"
OpDecorate %S Block
OpMemberDecorate %S 0 Offset 0
OpMemberDecorate %strided_arr_1 0 Offset 0
OpMemberDecorate %strided_arr 0 Offset 0
OpDecorate %_arr_strided_arr_uint_2 ArrayStride 8
OpDecorate %_arr__arr_strided_arr_uint_2_uint_3 ArrayStride 16
OpDecorate %_arr_strided_arr_1_uint_4 ArrayStride 128
OpDecorate %s DescriptorSet 0
OpDecorate %s Binding 0
%float = OpTypeFloat 32
%strided_arr = OpTypeStruct %float
%uint = OpTypeInt 32 0
%uint_2 = OpConstant %uint 2
%_arr_strided_arr_uint_2 = OpTypeArray %strided_arr %uint_2
%uint_3 = OpConstant %uint 3
%_arr__arr_strided_arr_uint_2_uint_3 = OpTypeArray %_arr_strided_arr_uint_2 %uint_3
%strided_arr_1 = OpTypeStruct %_arr__arr_strided_arr_uint_2_uint_3
%uint_4 = OpConstant %uint 4
%_arr_strided_arr_1_uint_4 = OpTypeArray %strided_arr_1 %uint_4
%S = OpTypeStruct %_arr_strided_arr_1_uint_4
%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S
%s = OpVariable %_ptr_StorageBuffer_S StorageBuffer
%void = OpTypeVoid
%14 = OpTypeFunction %void
%uint_0 = OpConstant %uint 0
%_ptr_StorageBuffer__arr_strided_arr_1_uint_4 = OpTypePointer StorageBuffer %_arr_strided_arr_1_uint_4
%int = OpTypeInt 32 1
%int_3 = OpConstant %int 3
%_ptr_StorageBuffer__arr__arr_strided_arr_uint_2_uint_3 = OpTypePointer StorageBuffer %_arr__arr_strided_arr_uint_2_uint_3
%int_2 = OpConstant %int 2
%_ptr_StorageBuffer__arr_strided_arr_uint_2 = OpTypePointer StorageBuffer %_arr_strided_arr_uint_2
%int_1 = OpConstant %int 1
%_ptr_StorageBuffer_float = OpTypePointer StorageBuffer %float
%36 = OpConstantNull %_arr_strided_arr_1_uint_4
%float_5 = OpConstant %float 5
%f_1 = OpFunction %void None %14
%17 = OpLabel
%20 = OpAccessChain %_ptr_StorageBuffer__arr_strided_arr_1_uint_4 %s %uint_0
%21 = OpLoad %_arr_strided_arr_1_uint_4 %20
%25 = OpAccessChain %_ptr_StorageBuffer__arr__arr_strided_arr_uint_2_uint_3 %s %uint_0 %int_3 %uint_0
%26 = OpLoad %_arr__arr_strided_arr_uint_2_uint_3 %25
%29 = OpAccessChain %_ptr_StorageBuffer__arr_strided_arr_uint_2 %s %uint_0 %int_3 %uint_0 %int_2
%30 = OpLoad %_arr_strided_arr_uint_2 %29
%33 = OpAccessChain %_ptr_StorageBuffer_float %s %uint_0 %int_3 %uint_0 %int_2 %int_1 %uint_0
%34 = OpLoad %float %33
%35 = OpAccessChain %_ptr_StorageBuffer__arr_strided_arr_1_uint_4 %s %uint_0
OpStore %35 %36
%37 = OpAccessChain %_ptr_StorageBuffer_float %s %uint_0 %int_3 %uint_0 %int_2 %int_1 %uint_0
OpStore %37 %float_5
OpReturn
OpFunctionEnd
%f = OpFunction %void None %14
%40 = OpLabel
%41 = OpFunctionCall %void %f_1
OpReturn
OpFunctionEnd

View File

@@ -0,0 +1,36 @@
struct strided_arr {
@size(8)
el : f32;
}
type Arr = array<strided_arr, 2u>;
type Arr_1 = array<Arr, 3u>;
struct strided_arr_1 {
@size(128)
el : Arr_1;
}
type Arr_2 = array<strided_arr_1, 4u>;
struct S {
a : Arr_2;
}
@group(0) @binding(0) var<storage, read_write> s : S;
fn f_1() {
let x_19 : Arr_2 = s.a;
let x_24 : Arr_1 = s.a[3].el;
let x_28 : Arr = s.a[3].el[2];
let x_32 : f32 = s.a[3].el[2][1].el;
s.a = array<strided_arr_1, 4u>();
s.a[3].el[2][1].el = 5.0;
return;
}
@stage(compute) @workgroup_size(1, 1, 1)
fn f() {
f_1();
}

View File

@@ -0,0 +1,48 @@
@stage(compute) @workgroup_size(1)
fn main() {
let x : i32 = 42;
// Test basic usage.
let empty : array<i32, 4> = array<i32, 4>();
let nonempty : array<i32, 4> = array<i32, 4>(1, 2, 3, 4);
let nonempty_with_expr : array<i32, 4> =
array<i32, 4>(1, x, x + 1, nonempty[3]);
// Test nested arrays.
let nested_empty : array<array<array<i32, 4>, 3>, 2> =
array<array<array<i32, 4>, 3>, 2>();
let nested_nonempty : array<array<array<i32, 4>, 3>, 2> =
array<array<array<i32, 4>, 3>, 2>(
array<array<i32, 4>, 3>(
array<i32, 4>(1, 2, 3, 4),
array<i32, 4>(5, 6, 7, 8),
array<i32, 4>(9, 10, 11, 12)),
array<array<i32, 4>, 3>(
array<i32, 4>(13, 14, 15, 16),
array<i32, 4>(17, 18, 19, 20),
array<i32, 4>(21, 22, 23, 24)));
let nested_nonempty_with_expr : array<array<array<i32, 4>, 3>, 2> =
array<array<array<i32, 4>, 3>, 2>(
array<array<i32, 4>, 3>(
array<i32, 4>(1, 2, x, x + 1),
array<i32, 4>(5, 6, nonempty[2], nonempty[3] + 1),
nonempty),
nested_nonempty[1]);
// Test use of constructors as sub-expressions.
let subexpr_empty : i32 = array<i32, 4>()[1];
let subexpr_nonempty : i32 = array<i32, 4>(1, 2, 3, 4)[2];
let subexpr_nonempty_with_expr : i32 =
array<i32, 4>(1, x, x + 1, nonempty[3])[2];
let subexpr_nested_empty : array<i32, 4> = array<array<i32, 4>, 2>()[1];
let subexpr_nested_nonempty : array<i32, 4> =
array<array<i32, 4>, 2>(
array<i32, 4>(1, 2, 3, 4),
array<i32, 4>(5, 6, 7, 8)
)[1];
let subexpr_nested_nonempty_with_expr : array<i32, 4> =
array<array<i32, 4>, 2>(
array<i32, 4>(1, x, x + 1, nonempty[3]),
nested_nonempty[1][2],
)[1];
}

View File

@@ -0,0 +1,43 @@
#version 310 es
void tint_symbol() {
int x = 42;
int empty[4] = int[4](0, 0, 0, 0);
int nonempty[4] = int[4](1, 2, 3, 4);
int nonempty_with_expr[4] = int[4](1, x, (x + 1), nonempty[3]);
int nested_empty[2][3][4] = int[2][3][4](int[3][4](int[4](0, 0, 0, 0), int[4](0, 0, 0, 0), int[4](0, 0, 0, 0)), int[3][4](int[4](0, 0, 0, 0), int[4](0, 0, 0, 0), int[4](0, 0, 0, 0)));
int tint_symbol_1[4] = int[4](1, 2, 3, 4);
int tint_symbol_2[4] = int[4](5, 6, 7, 8);
int tint_symbol_3[4] = int[4](9, 10, 11, 12);
int tint_symbol_4[3][4] = int[3][4](tint_symbol_1, tint_symbol_2, tint_symbol_3);
int tint_symbol_5[4] = int[4](13, 14, 15, 16);
int tint_symbol_6[4] = int[4](17, 18, 19, 20);
int tint_symbol_7[4] = int[4](21, 22, 23, 24);
int tint_symbol_8[3][4] = int[3][4](tint_symbol_5, tint_symbol_6, tint_symbol_7);
int nested_nonempty[2][3][4] = int[2][3][4](tint_symbol_4, tint_symbol_8);
int tint_symbol_9[4] = int[4](1, 2, x, (x + 1));
int tint_symbol_10[4] = int[4](5, 6, nonempty[2], (nonempty[3] + 1));
int tint_symbol_11[3][4] = int[3][4](tint_symbol_9, tint_symbol_10, nonempty);
int nested_nonempty_with_expr[2][3][4] = int[2][3][4](tint_symbol_11, nested_nonempty[1]);
int tint_symbol_12[4] = int[4](0, 0, 0, 0);
int subexpr_empty = tint_symbol_12[1];
int tint_symbol_13[4] = int[4](1, 2, 3, 4);
int subexpr_nonempty = tint_symbol_13[2];
int tint_symbol_14[4] = int[4](1, x, (x + 1), nonempty[3]);
int subexpr_nonempty_with_expr = tint_symbol_14[2];
int tint_symbol_15[2][4] = int[2][4](int[4](0, 0, 0, 0), int[4](0, 0, 0, 0));
int subexpr_nested_empty[4] = tint_symbol_15[1];
int tint_symbol_16[4] = int[4](1, 2, 3, 4);
int tint_symbol_17[4] = int[4](5, 6, 7, 8);
int tint_symbol_18[2][4] = int[2][4](tint_symbol_16, tint_symbol_17);
int subexpr_nested_nonempty[4] = tint_symbol_18[1];
int tint_symbol_19[4] = int[4](1, x, (x + 1), nonempty[3]);
int tint_symbol_20[2][4] = int[2][4](tint_symbol_19, nested_nonempty[1][2]);
int subexpr_nested_nonempty_with_expr[4] = tint_symbol_20[1];
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
tint_symbol();
return;
}

View File

@@ -0,0 +1,37 @@
[numthreads(1, 1, 1)]
void main() {
const int x = 42;
const int empty[4] = (int[4])0;
const int nonempty[4] = {1, 2, 3, 4};
const int nonempty_with_expr[4] = {1, x, (x + 1), nonempty[3]};
const int nested_empty[2][3][4] = (int[2][3][4])0;
const int tint_symbol[4] = {1, 2, 3, 4};
const int tint_symbol_1[4] = {5, 6, 7, 8};
const int tint_symbol_2[4] = {9, 10, 11, 12};
const int tint_symbol_3[3][4] = {tint_symbol, tint_symbol_1, tint_symbol_2};
const int tint_symbol_4[4] = {13, 14, 15, 16};
const int tint_symbol_5[4] = {17, 18, 19, 20};
const int tint_symbol_6[4] = {21, 22, 23, 24};
const int tint_symbol_7[3][4] = {tint_symbol_4, tint_symbol_5, tint_symbol_6};
const int nested_nonempty[2][3][4] = {tint_symbol_3, tint_symbol_7};
const int tint_symbol_8[4] = {1, 2, x, (x + 1)};
const int tint_symbol_9[4] = {5, 6, nonempty[2], (nonempty[3] + 1)};
const int tint_symbol_10[3][4] = {tint_symbol_8, tint_symbol_9, nonempty};
const int nested_nonempty_with_expr[2][3][4] = {tint_symbol_10, nested_nonempty[1]};
const int tint_symbol_11[4] = (int[4])0;
const int subexpr_empty = tint_symbol_11[1];
const int tint_symbol_12[4] = {1, 2, 3, 4};
const int subexpr_nonempty = tint_symbol_12[2];
const int tint_symbol_13[4] = {1, x, (x + 1), nonempty[3]};
const int subexpr_nonempty_with_expr = tint_symbol_13[2];
const int tint_symbol_14[2][4] = (int[2][4])0;
const int subexpr_nested_empty[4] = tint_symbol_14[1];
const int tint_symbol_15[4] = {1, 2, 3, 4};
const int tint_symbol_16[4] = {5, 6, 7, 8};
const int tint_symbol_17[2][4] = {tint_symbol_15, tint_symbol_16};
const int subexpr_nested_nonempty[4] = tint_symbol_17[1];
const int tint_symbol_18[4] = {1, x, (x + 1), nonempty[3]};
const int tint_symbol_19[2][4] = {tint_symbol_18, nested_nonempty[1][2]};
const int subexpr_nested_nonempty_with_expr[4] = tint_symbol_19[1];
return;
}

View File

@@ -0,0 +1,56 @@
#include <metal_stdlib>
using namespace metal;
struct tint_array_wrapper {
int arr[4];
};
struct tint_array_wrapper_2 {
tint_array_wrapper arr[3];
};
struct tint_array_wrapper_1 {
tint_array_wrapper_2 arr[2];
};
struct tint_array_wrapper_3 {
tint_array_wrapper arr[2];
};
kernel void tint_symbol() {
int const x = 42;
tint_array_wrapper const empty = {.arr={}};
tint_array_wrapper const nonempty = {.arr={1, 2, 3, 4}};
tint_array_wrapper const nonempty_with_expr = {.arr={1, x, as_type<int>((as_type<uint>(x) + as_type<uint>(1))), nonempty.arr[3]}};
tint_array_wrapper_1 const nested_empty = {.arr={}};
tint_array_wrapper const tint_symbol_1 = {.arr={1, 2, 3, 4}};
tint_array_wrapper const tint_symbol_2 = {.arr={5, 6, 7, 8}};
tint_array_wrapper const tint_symbol_3 = {.arr={9, 10, 11, 12}};
tint_array_wrapper_2 const tint_symbol_4 = {.arr={tint_symbol_1, tint_symbol_2, tint_symbol_3}};
tint_array_wrapper const tint_symbol_5 = {.arr={13, 14, 15, 16}};
tint_array_wrapper const tint_symbol_6 = {.arr={17, 18, 19, 20}};
tint_array_wrapper const tint_symbol_7 = {.arr={21, 22, 23, 24}};
tint_array_wrapper_2 const tint_symbol_8 = {.arr={tint_symbol_5, tint_symbol_6, tint_symbol_7}};
tint_array_wrapper_1 const nested_nonempty = {.arr={tint_symbol_4, tint_symbol_8}};
tint_array_wrapper const tint_symbol_9 = {.arr={1, 2, x, as_type<int>((as_type<uint>(x) + as_type<uint>(1)))}};
tint_array_wrapper const tint_symbol_10 = {.arr={5, 6, nonempty.arr[2], as_type<int>((as_type<uint>(nonempty.arr[3]) + as_type<uint>(1)))}};
tint_array_wrapper_2 const tint_symbol_11 = {.arr={tint_symbol_9, tint_symbol_10, nonempty}};
tint_array_wrapper_1 const nested_nonempty_with_expr = {.arr={tint_symbol_11, nested_nonempty.arr[1]}};
tint_array_wrapper const tint_symbol_12 = {.arr={}};
int const subexpr_empty = tint_symbol_12.arr[1];
tint_array_wrapper const tint_symbol_13 = {.arr={1, 2, 3, 4}};
int const subexpr_nonempty = tint_symbol_13.arr[2];
tint_array_wrapper const tint_symbol_14 = {.arr={1, x, as_type<int>((as_type<uint>(x) + as_type<uint>(1))), nonempty.arr[3]}};
int const subexpr_nonempty_with_expr = tint_symbol_14.arr[2];
tint_array_wrapper_3 const tint_symbol_15 = {.arr={}};
tint_array_wrapper const subexpr_nested_empty = tint_symbol_15.arr[1];
tint_array_wrapper const tint_symbol_16 = {.arr={1, 2, 3, 4}};
tint_array_wrapper const tint_symbol_17 = {.arr={5, 6, 7, 8}};
tint_array_wrapper_3 const tint_symbol_18 = {.arr={tint_symbol_16, tint_symbol_17}};
tint_array_wrapper const subexpr_nested_nonempty = tint_symbol_18.arr[1];
tint_array_wrapper const tint_symbol_19 = {.arr={1, x, as_type<int>((as_type<uint>(x) + as_type<uint>(1))), nonempty.arr[3]}};
tint_array_wrapper_3 const tint_symbol_20 = {.arr={tint_symbol_19, nested_nonempty.arr[1].arr[2]}};
tint_array_wrapper const subexpr_nested_nonempty_with_expr = tint_symbol_20.arr[1];
return;
}

View File

@@ -0,0 +1,94 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 79
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %main "main"
OpExecutionMode %main LocalSize 1 1 1
OpName %main "main"
OpDecorate %_arr_int_uint_4 ArrayStride 4
OpDecorate %_arr__arr_int_uint_4_uint_3 ArrayStride 16
OpDecorate %_arr__arr__arr_int_uint_4_uint_3_uint_2 ArrayStride 48
OpDecorate %_arr__arr_int_uint_4_uint_2 ArrayStride 16
%void = OpTypeVoid
%1 = OpTypeFunction %void
%int = OpTypeInt 32 1
%int_42 = OpConstant %int 42
%uint = OpTypeInt 32 0
%uint_4 = OpConstant %uint 4
%_arr_int_uint_4 = OpTypeArray %int %uint_4
%10 = OpConstantNull %_arr_int_uint_4
%int_1 = OpConstant %int 1
%int_2 = OpConstant %int 2
%int_3 = OpConstant %int 3
%int_4 = OpConstant %int 4
%15 = OpConstantComposite %_arr_int_uint_4 %int_1 %int_2 %int_3 %int_4
%uint_3 = OpConstant %uint 3
%_arr__arr_int_uint_4_uint_3 = OpTypeArray %_arr_int_uint_4 %uint_3
%uint_2 = OpConstant %uint 2
%_arr__arr__arr_int_uint_4_uint_3_uint_2 = OpTypeArray %_arr__arr_int_uint_4_uint_3 %uint_2
%23 = OpConstantNull %_arr__arr__arr_int_uint_4_uint_3_uint_2
%int_5 = OpConstant %int 5
%int_6 = OpConstant %int 6
%int_7 = OpConstant %int 7
%int_8 = OpConstant %int 8
%28 = OpConstantComposite %_arr_int_uint_4 %int_5 %int_6 %int_7 %int_8
%int_9 = OpConstant %int 9
%int_10 = OpConstant %int 10
%int_11 = OpConstant %int 11
%int_12 = OpConstant %int 12
%33 = OpConstantComposite %_arr_int_uint_4 %int_9 %int_10 %int_11 %int_12
%34 = OpConstantComposite %_arr__arr_int_uint_4_uint_3 %15 %28 %33
%int_13 = OpConstant %int 13
%int_14 = OpConstant %int 14
%int_15 = OpConstant %int 15
%int_16 = OpConstant %int 16
%39 = OpConstantComposite %_arr_int_uint_4 %int_13 %int_14 %int_15 %int_16
%int_17 = OpConstant %int 17
%int_18 = OpConstant %int 18
%int_19 = OpConstant %int 19
%int_20 = OpConstant %int 20
%44 = OpConstantComposite %_arr_int_uint_4 %int_17 %int_18 %int_19 %int_20
%int_21 = OpConstant %int 21
%int_22 = OpConstant %int 22
%int_23 = OpConstant %int 23
%int_24 = OpConstant %int 24
%49 = OpConstantComposite %_arr_int_uint_4 %int_21 %int_22 %int_23 %int_24
%50 = OpConstantComposite %_arr__arr_int_uint_4_uint_3 %39 %44 %49
%51 = OpConstantComposite %_arr__arr__arr_int_uint_4_uint_3_uint_2 %34 %50
%_arr__arr_int_uint_4_uint_2 = OpTypeArray %_arr_int_uint_4 %uint_2
%68 = OpConstantNull %_arr__arr_int_uint_4_uint_2
%70 = OpConstantComposite %_arr__arr_int_uint_4_uint_2 %15 %28
%main = OpFunction %void None %1
%4 = OpLabel
%16 = OpIAdd %int %int_42 %int_1
%17 = OpCompositeExtract %int %15 3
%18 = OpCompositeConstruct %_arr_int_uint_4 %int_1 %int_42 %16 %17
%52 = OpIAdd %int %int_42 %int_1
%53 = OpCompositeConstruct %_arr_int_uint_4 %int_1 %int_2 %int_42 %52
%54 = OpCompositeExtract %int %15 2
%55 = OpCompositeExtract %int %15 3
%56 = OpIAdd %int %55 %int_1
%57 = OpCompositeConstruct %_arr_int_uint_4 %int_5 %int_6 %54 %56
%58 = OpCompositeConstruct %_arr__arr_int_uint_4_uint_3 %53 %57 %15
%59 = OpCompositeExtract %_arr__arr_int_uint_4_uint_3 %51 1
%60 = OpCompositeConstruct %_arr__arr__arr_int_uint_4_uint_3_uint_2 %58 %59
%61 = OpCompositeExtract %int %10 1
%62 = OpCompositeExtract %int %15 2
%63 = OpIAdd %int %int_42 %int_1
%64 = OpCompositeExtract %int %15 3
%65 = OpCompositeConstruct %_arr_int_uint_4 %int_1 %int_42 %63 %64
%66 = OpCompositeExtract %int %65 2
%69 = OpCompositeExtract %_arr_int_uint_4 %68 1
%71 = OpCompositeExtract %_arr_int_uint_4 %70 1
%72 = OpIAdd %int %int_42 %int_1
%73 = OpCompositeExtract %int %15 3
%74 = OpCompositeConstruct %_arr_int_uint_4 %int_1 %int_42 %72 %73
%75 = OpCompositeExtract %_arr__arr_int_uint_4_uint_3 %51 1
%76 = OpCompositeExtract %_arr_int_uint_4 %75 2
%77 = OpCompositeConstruct %_arr__arr_int_uint_4_uint_2 %74 %76
%78 = OpCompositeExtract %_arr_int_uint_4 %77 1
OpReturn
OpFunctionEnd

View File

@@ -0,0 +1,16 @@
@stage(compute) @workgroup_size(1)
fn main() {
let x : i32 = 42;
let empty : array<i32, 4> = array<i32, 4>();
let nonempty : array<i32, 4> = array<i32, 4>(1, 2, 3, 4);
let nonempty_with_expr : array<i32, 4> = array<i32, 4>(1, x, (x + 1), nonempty[3]);
let nested_empty : array<array<array<i32, 4>, 3>, 2> = array<array<array<i32, 4>, 3>, 2>();
let nested_nonempty : array<array<array<i32, 4>, 3>, 2> = array<array<array<i32, 4>, 3>, 2>(array<array<i32, 4>, 3>(array<i32, 4>(1, 2, 3, 4), array<i32, 4>(5, 6, 7, 8), array<i32, 4>(9, 10, 11, 12)), array<array<i32, 4>, 3>(array<i32, 4>(13, 14, 15, 16), array<i32, 4>(17, 18, 19, 20), array<i32, 4>(21, 22, 23, 24)));
let nested_nonempty_with_expr : array<array<array<i32, 4>, 3>, 2> = array<array<array<i32, 4>, 3>, 2>(array<array<i32, 4>, 3>(array<i32, 4>(1, 2, x, (x + 1)), array<i32, 4>(5, 6, nonempty[2], (nonempty[3] + 1)), nonempty), nested_nonempty[1]);
let subexpr_empty : i32 = array<i32, 4>()[1];
let subexpr_nonempty : i32 = array<i32, 4>(1, 2, 3, 4)[2];
let subexpr_nonempty_with_expr : i32 = array<i32, 4>(1, x, (x + 1), nonempty[3])[2];
let subexpr_nested_empty : array<i32, 4> = array<array<i32, 4>, 2>()[1];
let subexpr_nested_nonempty : array<i32, 4> = array<array<i32, 4>, 2>(array<i32, 4>(1, 2, 3, 4), array<i32, 4>(5, 6, 7, 8))[1];
let subexpr_nested_nonempty_with_expr : array<i32, 4> = array<array<i32, 4>, 2>(array<i32, 4>(1, x, (x + 1), nonempty[3]), nested_nonempty[1][2])[1];
}