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,59 @@
struct S1 {
a : i32;
b : i32;
c : i32;
d : i32;
};
struct S2 {
e : i32;
f : S1;
};
struct S3 {
g : i32;
h : S1;
i : S2;
};
struct T {
a : array<i32, 2>;
};
@stage(compute) @workgroup_size(1)
fn main() {
let x : i32 = 42;
// Test basic usage.
let empty : S1 = S1();
let nonempty : S1 = S1(1, 2, 3, 4);
let nonempty_with_expr : S1 = S1(1, x, x + 1, nonempty.d);
// Test nested structs.
let nested_empty : S3 = S3();
let nested_nonempty : S3 = S3(1, S1(2, 3, 4, 5), S2(6, S1(7, 8, 9, 10)));
let nested_nonempty_with_expr : S3 =
S3(1, S1(2, x, x + 1, nested_nonempty.i.f.d), S2(6, nonempty));
// Test use of constructors as sub-expressions.
let subexpr_empty : i32 = S1().a;
let subexpr_nonempty : i32 = S1(1, 2, 3, 4).b;
let subexpr_nonempty_with_expr : i32 = S1(1, x, x + 1, nonempty.d).c;
let subexpr_nested_empty : S1 = S2().f;
let subexpr_nested_nonempty : S1 = S2(1, S1(2, 3, 4, 5)).f;
let subexpr_nested_nonempty_with_expr : S1 =
S2(1, S1(2, x, x + 1, nested_nonempty.i.f.d)).f;
// Test arrays of structs containing arrays.
let aosoa_empty : array<T, 2> = array<T, 2>();
let aosoa_nonempty : array<T, 2> =
array<T, 2>(
T(array<i32, 2>(1, 2)),
T(array<i32, 2>(3, 4)),
);
let aosoa_nonempty_with_expr : array<T, 2> =
array<T, 2>(
T(array<i32, 2>(1, aosoa_nonempty[0].a[0] + 1)),
aosoa_nonempty[1],
);
}

View File

@@ -0,0 +1,67 @@
#version 310 es
struct S1 {
int a;
int b;
int c;
int d;
};
struct S2 {
int e;
S1 f;
};
struct S3 {
int g;
S1 h;
S2 i;
};
struct T {
int a[2];
};
void tint_symbol() {
int x = 42;
S1 empty = S1(0, 0, 0, 0);
S1 nonempty = S1(1, 2, 3, 4);
S1 nonempty_with_expr = S1(1, x, (x + 1), nonempty.d);
S3 nested_empty = S3(0, S1(0, 0, 0, 0), S2(0, S1(0, 0, 0, 0)));
S1 tint_symbol_1 = S1(2, 3, 4, 5);
S1 tint_symbol_2 = S1(7, 8, 9, 10);
S2 tint_symbol_3 = S2(6, tint_symbol_2);
S3 nested_nonempty = S3(1, tint_symbol_1, tint_symbol_3);
S1 tint_symbol_4 = S1(2, x, (x + 1), nested_nonempty.i.f.d);
S2 tint_symbol_5 = S2(6, nonempty);
S3 nested_nonempty_with_expr = S3(1, tint_symbol_4, tint_symbol_5);
S1 tint_symbol_6 = S1(0, 0, 0, 0);
int subexpr_empty = tint_symbol_6.a;
S1 tint_symbol_7 = S1(1, 2, 3, 4);
int subexpr_nonempty = tint_symbol_7.b;
S1 tint_symbol_8 = S1(1, x, (x + 1), nonempty.d);
int subexpr_nonempty_with_expr = tint_symbol_8.c;
S2 tint_symbol_9 = S2(0, S1(0, 0, 0, 0));
S1 subexpr_nested_empty = tint_symbol_9.f;
S1 tint_symbol_10 = S1(2, 3, 4, 5);
S2 tint_symbol_11 = S2(1, tint_symbol_10);
S1 subexpr_nested_nonempty = tint_symbol_11.f;
S1 tint_symbol_12 = S1(2, x, (x + 1), nested_nonempty.i.f.d);
S2 tint_symbol_13 = S2(1, tint_symbol_12);
S1 subexpr_nested_nonempty_with_expr = tint_symbol_13.f;
T aosoa_empty[2] = T[2](T(int[2](0, 0)), T(int[2](0, 0)));
int tint_symbol_14[2] = int[2](1, 2);
T tint_symbol_15 = T(tint_symbol_14);
int tint_symbol_16[2] = int[2](3, 4);
T tint_symbol_17 = T(tint_symbol_16);
T aosoa_nonempty[2] = T[2](tint_symbol_15, tint_symbol_17);
int tint_symbol_18[2] = int[2](1, (aosoa_nonempty[0].a[0] + 1));
T tint_symbol_19 = T(tint_symbol_18);
T aosoa_nonempty_with_expr[2] = T[2](tint_symbol_19, aosoa_nonempty[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,58 @@
struct S1 {
int a;
int b;
int c;
int d;
};
struct S2 {
int e;
S1 f;
};
struct S3 {
int g;
S1 h;
S2 i;
};
struct T {
int a[2];
};
[numthreads(1, 1, 1)]
void main() {
const int x = 42;
const S1 empty = (S1)0;
const S1 nonempty = {1, 2, 3, 4};
const S1 nonempty_with_expr = {1, x, (x + 1), nonempty.d};
const S3 nested_empty = (S3)0;
const S1 tint_symbol = {2, 3, 4, 5};
const S1 tint_symbol_1 = {7, 8, 9, 10};
const S2 tint_symbol_2 = {6, tint_symbol_1};
const S3 nested_nonempty = {1, tint_symbol, tint_symbol_2};
const S1 tint_symbol_3 = {2, x, (x + 1), nested_nonempty.i.f.d};
const S2 tint_symbol_4 = {6, nonempty};
const S3 nested_nonempty_with_expr = {1, tint_symbol_3, tint_symbol_4};
const S1 tint_symbol_5 = (S1)0;
const int subexpr_empty = tint_symbol_5.a;
const S1 tint_symbol_6 = {1, 2, 3, 4};
const int subexpr_nonempty = tint_symbol_6.b;
const S1 tint_symbol_7 = {1, x, (x + 1), nonempty.d};
const int subexpr_nonempty_with_expr = tint_symbol_7.c;
const S2 tint_symbol_8 = (S2)0;
const S1 subexpr_nested_empty = tint_symbol_8.f;
const S1 tint_symbol_9 = {2, 3, 4, 5};
const S2 tint_symbol_10 = {1, tint_symbol_9};
const S1 subexpr_nested_nonempty = tint_symbol_10.f;
const S1 tint_symbol_11 = {2, x, (x + 1), nested_nonempty.i.f.d};
const S2 tint_symbol_12 = {1, tint_symbol_11};
const S1 subexpr_nested_nonempty_with_expr = tint_symbol_12.f;
const T aosoa_empty[2] = (T[2])0;
const int tint_symbol_13[2] = {1, 2};
const T tint_symbol_14 = {tint_symbol_13};
const int tint_symbol_15[2] = {3, 4};
const T tint_symbol_16 = {tint_symbol_15};
const T aosoa_nonempty[2] = {tint_symbol_14, tint_symbol_16};
const int tint_symbol_17[2] = {1, (aosoa_nonempty[0].a[0] + 1)};
const T tint_symbol_18 = {tint_symbol_17};
const T aosoa_nonempty_with_expr[2] = {tint_symbol_18, aosoa_nonempty[1]};
return;
}

View File

@@ -0,0 +1,72 @@
#include <metal_stdlib>
using namespace metal;
struct S1 {
int a;
int b;
int c;
int d;
};
struct S2 {
int e;
S1 f;
};
struct S3 {
int g;
S1 h;
S2 i;
};
struct tint_array_wrapper {
int arr[2];
};
struct T {
tint_array_wrapper a;
};
struct tint_array_wrapper_1 {
T arr[2];
};
kernel void tint_symbol() {
int const x = 42;
S1 const empty = {};
S1 const nonempty = {.a=1, .b=2, .c=3, .d=4};
S1 const nonempty_with_expr = {.a=1, .b=x, .c=as_type<int>((as_type<uint>(x) + as_type<uint>(1))), .d=nonempty.d};
S3 const nested_empty = {};
S1 const tint_symbol_1 = {.a=2, .b=3, .c=4, .d=5};
S1 const tint_symbol_2 = {.a=7, .b=8, .c=9, .d=10};
S2 const tint_symbol_3 = {.e=6, .f=tint_symbol_2};
S3 const nested_nonempty = {.g=1, .h=tint_symbol_1, .i=tint_symbol_3};
S1 const tint_symbol_4 = {.a=2, .b=x, .c=as_type<int>((as_type<uint>(x) + as_type<uint>(1))), .d=nested_nonempty.i.f.d};
S2 const tint_symbol_5 = {.e=6, .f=nonempty};
S3 const nested_nonempty_with_expr = {.g=1, .h=tint_symbol_4, .i=tint_symbol_5};
S1 const tint_symbol_6 = {};
int const subexpr_empty = tint_symbol_6.a;
S1 const tint_symbol_7 = {.a=1, .b=2, .c=3, .d=4};
int const subexpr_nonempty = tint_symbol_7.b;
S1 const tint_symbol_8 = {.a=1, .b=x, .c=as_type<int>((as_type<uint>(x) + as_type<uint>(1))), .d=nonempty.d};
int const subexpr_nonempty_with_expr = tint_symbol_8.c;
S2 const tint_symbol_9 = {};
S1 const subexpr_nested_empty = tint_symbol_9.f;
S1 const tint_symbol_10 = {.a=2, .b=3, .c=4, .d=5};
S2 const tint_symbol_11 = {.e=1, .f=tint_symbol_10};
S1 const subexpr_nested_nonempty = tint_symbol_11.f;
S1 const tint_symbol_12 = {.a=2, .b=x, .c=as_type<int>((as_type<uint>(x) + as_type<uint>(1))), .d=nested_nonempty.i.f.d};
S2 const tint_symbol_13 = {.e=1, .f=tint_symbol_12};
S1 const subexpr_nested_nonempty_with_expr = tint_symbol_13.f;
tint_array_wrapper_1 const aosoa_empty = {.arr={}};
tint_array_wrapper const tint_symbol_14 = {.arr={1, 2}};
T const tint_symbol_15 = {.a=tint_symbol_14};
tint_array_wrapper const tint_symbol_16 = {.arr={3, 4}};
T const tint_symbol_17 = {.a=tint_symbol_16};
tint_array_wrapper_1 const aosoa_nonempty = {.arr={tint_symbol_15, tint_symbol_17}};
tint_array_wrapper const tint_symbol_18 = {.arr={1, as_type<int>((as_type<uint>(aosoa_nonempty.arr[0].a.arr[0]) + as_type<uint>(1)))}};
T const tint_symbol_19 = {.a=tint_symbol_18};
tint_array_wrapper_1 const aosoa_nonempty_with_expr = {.arr={tint_symbol_19, aosoa_nonempty.arr[1]}};
return;
}

View File

@@ -0,0 +1,111 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 74
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %main "main"
OpExecutionMode %main LocalSize 1 1 1
OpName %main "main"
OpName %S1 "S1"
OpMemberName %S1 0 "a"
OpMemberName %S1 1 "b"
OpMemberName %S1 2 "c"
OpMemberName %S1 3 "d"
OpName %S3 "S3"
OpMemberName %S3 0 "g"
OpMemberName %S3 1 "h"
OpMemberName %S3 2 "i"
OpName %S2 "S2"
OpMemberName %S2 0 "e"
OpMemberName %S2 1 "f"
OpName %T "T"
OpMemberName %T 0 "a"
OpMemberDecorate %S1 0 Offset 0
OpMemberDecorate %S1 1 Offset 4
OpMemberDecorate %S1 2 Offset 8
OpMemberDecorate %S1 3 Offset 12
OpMemberDecorate %S3 0 Offset 0
OpMemberDecorate %S3 1 Offset 4
OpMemberDecorate %S3 2 Offset 20
OpMemberDecorate %S2 0 Offset 0
OpMemberDecorate %S2 1 Offset 4
OpMemberDecorate %T 0 Offset 0
OpDecorate %_arr_int_uint_2 ArrayStride 4
OpDecorate %_arr_T_uint_2 ArrayStride 8
%void = OpTypeVoid
%1 = OpTypeFunction %void
%int = OpTypeInt 32 1
%int_42 = OpConstant %int 42
%S1 = OpTypeStruct %int %int %int %int
%8 = OpConstantNull %S1
%int_1 = OpConstant %int 1
%int_2 = OpConstant %int 2
%int_3 = OpConstant %int 3
%int_4 = OpConstant %int 4
%13 = OpConstantComposite %S1 %int_1 %int_2 %int_3 %int_4
%S2 = OpTypeStruct %int %S1
%S3 = OpTypeStruct %int %S1 %S2
%19 = OpConstantNull %S3
%int_5 = OpConstant %int 5
%21 = OpConstantComposite %S1 %int_2 %int_3 %int_4 %int_5
%int_6 = OpConstant %int 6
%int_7 = OpConstant %int 7
%int_8 = OpConstant %int 8
%int_9 = OpConstant %int 9
%int_10 = OpConstant %int 10
%27 = OpConstantComposite %S1 %int_7 %int_8 %int_9 %int_10
%28 = OpConstantComposite %S2 %int_6 %27
%29 = OpConstantComposite %S3 %int_1 %21 %28
%43 = OpConstantNull %S2
%45 = OpConstantComposite %S2 %int_1 %21
%uint = OpTypeInt 32 0
%uint_2 = OpConstant %uint 2
%_arr_int_uint_2 = OpTypeArray %int %uint_2
%T = OpTypeStruct %_arr_int_uint_2
%_arr_T_uint_2 = OpTypeArray %T %uint_2
%59 = OpConstantNull %_arr_T_uint_2
%60 = OpConstantComposite %_arr_int_uint_2 %int_1 %int_2
%61 = OpConstantComposite %T %60
%62 = OpConstantComposite %_arr_int_uint_2 %int_3 %int_4
%63 = OpConstantComposite %T %62
%64 = OpConstantComposite %_arr_T_uint_2 %61 %63
%int_0 = OpConstant %int 0
%main = OpFunction %void None %1
%4 = OpLabel
%14 = OpIAdd %int %int_42 %int_1
%15 = OpCompositeExtract %int %13 3
%16 = OpCompositeConstruct %S1 %int_1 %int_42 %14 %15
%30 = OpIAdd %int %int_42 %int_1
%31 = OpCompositeExtract %S2 %29 2
%32 = OpCompositeExtract %S1 %31 1
%33 = OpCompositeExtract %int %32 3
%34 = OpCompositeConstruct %S1 %int_2 %int_42 %30 %33
%35 = OpCompositeConstruct %S2 %int_6 %13
%36 = OpCompositeConstruct %S3 %int_1 %34 %35
%37 = OpCompositeExtract %int %8 0
%38 = OpCompositeExtract %int %13 1
%39 = OpIAdd %int %int_42 %int_1
%40 = OpCompositeExtract %int %13 3
%41 = OpCompositeConstruct %S1 %int_1 %int_42 %39 %40
%42 = OpCompositeExtract %int %41 2
%44 = OpCompositeExtract %S1 %43 1
%46 = OpCompositeExtract %S1 %45 1
%47 = OpIAdd %int %int_42 %int_1
%48 = OpCompositeExtract %S2 %29 2
%49 = OpCompositeExtract %S1 %48 1
%50 = OpCompositeExtract %int %49 3
%51 = OpCompositeConstruct %S1 %int_2 %int_42 %47 %50
%52 = OpCompositeConstruct %S2 %int_1 %51
%53 = OpCompositeExtract %S1 %52 1
%66 = OpCompositeExtract %T %64 0
%67 = OpCompositeExtract %_arr_int_uint_2 %66 0
%68 = OpCompositeExtract %int %67 0
%69 = OpIAdd %int %68 %int_1
%70 = OpCompositeConstruct %_arr_int_uint_2 %int_1 %69
%71 = OpCompositeConstruct %T %70
%72 = OpCompositeExtract %T %64 1
%73 = OpCompositeConstruct %_arr_T_uint_2 %71 %72
OpReturn
OpFunctionEnd

View File

@@ -0,0 +1,41 @@
struct S1 {
a : i32;
b : i32;
c : i32;
d : i32;
}
struct S2 {
e : i32;
f : S1;
}
struct S3 {
g : i32;
h : S1;
i : S2;
}
struct T {
a : array<i32, 2>;
}
@stage(compute) @workgroup_size(1)
fn main() {
let x : i32 = 42;
let empty : S1 = S1();
let nonempty : S1 = S1(1, 2, 3, 4);
let nonempty_with_expr : S1 = S1(1, x, (x + 1), nonempty.d);
let nested_empty : S3 = S3();
let nested_nonempty : S3 = S3(1, S1(2, 3, 4, 5), S2(6, S1(7, 8, 9, 10)));
let nested_nonempty_with_expr : S3 = S3(1, S1(2, x, (x + 1), nested_nonempty.i.f.d), S2(6, nonempty));
let subexpr_empty : i32 = S1().a;
let subexpr_nonempty : i32 = S1(1, 2, 3, 4).b;
let subexpr_nonempty_with_expr : i32 = S1(1, x, (x + 1), nonempty.d).c;
let subexpr_nested_empty : S1 = S2().f;
let subexpr_nested_nonempty : S1 = S2(1, S1(2, 3, 4, 5)).f;
let subexpr_nested_nonempty_with_expr : S1 = S2(1, S1(2, x, (x + 1), nested_nonempty.i.f.d)).f;
let aosoa_empty : array<T, 2> = array<T, 2>();
let aosoa_nonempty : array<T, 2> = array<T, 2>(T(array<i32, 2>(1, 2)), T(array<i32, 2>(3, 4)));
let aosoa_nonempty_with_expr : array<T, 2> = array<T, 2>(T(array<i32, 2>(1, (aosoa_nonempty[0].a[0] + 1))), aosoa_nonempty[1]);
}