msl: Handle buffer variables in transform

This removes a lot of awkward logic from the MSL writer, and means
that we now handle all module-scope variables with the same transform.

Change-Id: I782e36a4b88dafbc3f8364f7caa7f95c6ae3f5f1
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/67643
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
This commit is contained in:
James Price
2021-10-28 15:00:39 +00:00
parent c6ce5785d0
commit e548db90f6
141 changed files with 1681 additions and 1546 deletions

View File

@@ -36,17 +36,17 @@ struct S {
/* 0x00ac */ int8_t tint_pad_1[4];
};
kernel void tint_symbol(const device S& s [[buffer(0)]]) {
int3 const a = s.a;
int const b = s.b;
uint3 const c = s.c;
uint const d = s.d;
float3 const e = s.e;
float const f = s.f;
float2x3 const g = s.g;
float3x2 const h = s.h;
Inner const i = s.i;
tint_array_wrapper const j = s.j;
kernel void tint_symbol(const device S* tint_symbol_1 [[buffer(0)]]) {
int3 const a = (*(tint_symbol_1)).a;
int const b = (*(tint_symbol_1)).b;
uint3 const c = (*(tint_symbol_1)).c;
uint const d = (*(tint_symbol_1)).d;
float3 const e = (*(tint_symbol_1)).e;
float const f = (*(tint_symbol_1)).f;
float2x3 const g = (*(tint_symbol_1)).g;
float3x2 const h = (*(tint_symbol_1)).h;
Inner const i = (*(tint_symbol_1)).i;
tint_array_wrapper const j = (*(tint_symbol_1)).j;
return;
}

View File

@@ -36,19 +36,19 @@ struct S {
/* 0x00ac */ int8_t tint_pad_1[4];
};
kernel void tint_symbol(device S& s [[buffer(0)]]) {
s.a = int3();
s.b = int();
s.c = uint3();
s.d = uint();
s.e = float3();
s.f = float();
s.g = float2x3();
s.h = float3x2();
kernel void tint_symbol(device S* tint_symbol_3 [[buffer(0)]]) {
(*(tint_symbol_3)).a = int3();
(*(tint_symbol_3)).b = int();
(*(tint_symbol_3)).c = uint3();
(*(tint_symbol_3)).d = uint();
(*(tint_symbol_3)).e = float3();
(*(tint_symbol_3)).f = float();
(*(tint_symbol_3)).g = float2x3();
(*(tint_symbol_3)).h = float3x2();
Inner const tint_symbol_1 = {};
s.i = tint_symbol_1;
(*(tint_symbol_3)).i = tint_symbol_1;
tint_array_wrapper const tint_symbol_2 = {.arr={}};
s.j = tint_symbol_2;
(*(tint_symbol_3)).j = tint_symbol_2;
return;
}