tint/writer/msl: Move packed_vector hacks to transform

Attempting to paper over all the MSL standard library holes for packed_vector in the MSL writer added complexity to the writer, produced messy output, and didn't actually catch all the cases where casts were needed.

Add a new PackedVec3 transform that applies the packed_vector -> vec casts in a smarter, more precise way.

Fixed: tint:1534
Change-Id: I73ce7e5a62fbc9cb04e1093133070f5fb8965dce
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/107340
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@chromium.org>
This commit is contained in:
Ben Clayton
2022-10-27 14:36:49 +00:00
committed by Dawn LUCI CQ
parent 59c0982426
commit a92f4259d5
53 changed files with 1070 additions and 379 deletions

View File

@@ -14,16 +14,6 @@ struct tint_array {
T elements[N];
};
template<typename T, int N, int M>
inline vec<T, M> operator*(matrix<T, N, M> lhs, packed_vec<T, N> rhs) {
return lhs * vec<T, N>(rhs);
}
template<typename T, int N, int M>
inline vec<T, N> operator*(packed_vec<T, M> lhs, matrix<T, N, M> rhs) {
return vec<T, M>(lhs) * rhs;
}
struct Inner {
/* 0x0000 */ int x;
/* 0x0004 */ tint_array<int8_t, 12> tint_pad;
@@ -46,11 +36,11 @@ struct S {
};
kernel void tint_symbol(const constant S* tint_symbol_1 [[buffer(0)]]) {
int3 const a = (*(tint_symbol_1)).a;
int3 const a = int3((*(tint_symbol_1)).a);
int const b = (*(tint_symbol_1)).b;
uint3 const c = (*(tint_symbol_1)).c;
uint3 const c = uint3((*(tint_symbol_1)).c);
uint const d = (*(tint_symbol_1)).d;
float3 const e = (*(tint_symbol_1)).e;
float3 const e = float3((*(tint_symbol_1)).e);
float const f = (*(tint_symbol_1)).f;
int2 const g = (*(tint_symbol_1)).g;
int2 const h = (*(tint_symbol_1)).h;