Add transform/WrapArraysInStructs

And replace the MSL writer's logic to do this with the transform.

We need to do the same thing in HLSL, and in the future GLSL too.

Partially reverts fbfde720

Change-Id: Ie280e011bc3ded8e15ccacc0aeb12da3c2407389
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/54242
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: James Price <jrprice@google.com>
This commit is contained in:
Ben Clayton
2021-06-16 09:19:36 +00:00
committed by Ben Clayton
parent cfed1cb01e
commit 0597a2b51b
31 changed files with 771 additions and 255 deletions

View File

@@ -4,12 +4,12 @@ using namespace metal;
struct MyStruct {
float f1;
};
struct tint_array_wrapper {
float arr[10];
};
struct tint_symbol_1 {
float4 value [[color(0)]];
};
struct tint_array_wrapper_0 {
float array[10];
};
int ret_i32() {
return 1;
@@ -28,8 +28,8 @@ MyStruct ret_MyStruct() {
return tint_symbol_2;
}
tint_array_wrapper_0 ret_MyArray() {
tint_array_wrapper_0 const tint_symbol_3 = {};
tint_array_wrapper ret_MyArray() {
tint_array_wrapper const tint_symbol_3 = {.arr={}};
return tint_symbol_3;
}
@@ -42,13 +42,13 @@ void let_decls() {
float3 const v6 = float3(1.0f, 1.0f, 1.0f);
float3x3 const v7 = float3x3(v6, v6, v6);
MyStruct const v8 = {.f1=1.0f};
tint_array_wrapper_0 const v9 = {};
tint_array_wrapper const v9 = {.arr={}};
int const v10 = ret_i32();
uint const v11 = ret_u32();
float const v12 = ret_f32();
MyStruct const v13 = ret_MyStruct();
MyStruct const v14 = ret_MyStruct();
tint_array_wrapper_0 const v15 = ret_MyArray();
tint_array_wrapper const v15 = ret_MyArray();
}
fragment tint_symbol_1 tint_symbol() {

View File

@@ -4,12 +4,12 @@ using namespace metal;
struct MyStruct {
float f1;
};
struct tint_array_wrapper {
float arr[10];
};
struct tint_symbol_1 {
float4 value [[color(0)]];
};
struct tint_array_wrapper_0 {
float array[10];
};
int ret_i32() {
return 1;
@@ -28,8 +28,8 @@ MyStruct ret_MyStruct() {
return tint_symbol_2;
}
tint_array_wrapper_0 ret_MyArray() {
tint_array_wrapper_0 const tint_symbol_3 = {};
tint_array_wrapper ret_MyArray() {
tint_array_wrapper const tint_symbol_3 = {.arr={}};
return tint_symbol_3;
}
@@ -42,13 +42,13 @@ void var_decls() {
float3 v6 = float3(1.0f, 1.0f, 1.0f);
float3x3 v7 = float3x3(v6, v6, v6);
MyStruct v8 = {.f1=1.0f};
tint_array_wrapper_0 v9 = {};
tint_array_wrapper v9 = {.arr={}};
int v10 = ret_i32();
uint v11 = ret_u32();
float v12 = ret_f32();
MyStruct v13 = ret_MyStruct();
MyStruct v14 = ret_MyStruct();
tint_array_wrapper_0 v15 = ret_MyArray();
tint_array_wrapper v15 = ret_MyArray();
}
fragment tint_symbol_1 tint_symbol() {

View File

@@ -4,12 +4,12 @@ using namespace metal;
struct MyStruct {
float f1;
};
struct tint_array_wrapper {
float arr[10];
};
struct tint_symbol_1 {
float4 value [[color(0)]];
};
struct tint_array_wrapper_0 {
float array[10];
};
constant int v1 = 1;
constant uint v2 = 1u;
@@ -19,7 +19,7 @@ constant uint3 v5 = uint3(1u, 1u, 1u);
constant float3 v6 = float3(1.0f, 1.0f, 1.0f);
constant float3x3 v7 = float3x3(float3(1.0f, 1.0f, 1.0f), float3(1.0f, 1.0f, 1.0f), float3(1.0f, 1.0f, 1.0f));
constant MyStruct v8 = {};
constant tint_array_wrapper_0 v9 = {};
constant tint_array_wrapper v9 = {.arr={}};
fragment tint_symbol_1 tint_symbol() {
tint_symbol_1 const tint_symbol_2 = {.value=float4(0.0f, 0.0f, 0.0f, 0.0f)};
return tint_symbol_2;