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,20 +36,20 @@ struct S {
/* 0x0000 */ tint_array_wrapper_1 arr;
};
void tint_symbol_inner(constant S& s, uint idx) {
int3 const a = s.arr.arr[idx].a;
int const b = s.arr.arr[idx].b;
uint3 const c = s.arr.arr[idx].c;
uint const d = s.arr.arr[idx].d;
float3 const e = s.arr.arr[idx].e;
float const f = s.arr.arr[idx].f;
int2 const g = s.arr.arr[idx].g;
int2 const h = s.arr.arr[idx].h;
float2x3 const i = s.arr.arr[idx].i;
void tint_symbol_inner(uint idx, const constant S* const tint_symbol_1) {
int3 const a = (*(tint_symbol_1)).arr.arr[idx].a;
int const b = (*(tint_symbol_1)).arr.arr[idx].b;
uint3 const c = (*(tint_symbol_1)).arr.arr[idx].c;
uint const d = (*(tint_symbol_1)).arr.arr[idx].d;
float3 const e = (*(tint_symbol_1)).arr.arr[idx].e;
float const f = (*(tint_symbol_1)).arr.arr[idx].f;
int2 const g = (*(tint_symbol_1)).arr.arr[idx].g;
int2 const h = (*(tint_symbol_1)).arr.arr[idx].h;
float2x3 const i = (*(tint_symbol_1)).arr.arr[idx].i;
}
kernel void tint_symbol(uint idx [[thread_index_in_threadgroup]], constant S& s [[buffer(0)]]) {
tint_symbol_inner(s, idx);
kernel void tint_symbol(const constant S* tint_symbol_2 [[buffer(0)]], uint idx [[thread_index_in_threadgroup]]) {
tint_symbol_inner(idx, tint_symbol_2);
return;
}