dawn-cmake/test/tint/expressions/swizzle/read/vec3/f16.wgsl.expected.msl

133 lines
4.1 KiB
Plaintext
Raw Normal View History

#include <metal_stdlib>
using namespace metal;
struct S {
half3 v;
};
void f() {
thread S tint_symbol = {};
half3 v = tint_symbol.v;
half x = tint_symbol.v[0];
half y = tint_symbol.v[1];
half z = tint_symbol.v[2];
tint/msl: Preserve trailing vec3 padding In order to preserve padding properly for MSL, we need to use its packed_vec type for all vec3 types in storage buffers, not just struct members. This commit includes a complete rewrite of the PackedVec3 transform to achieve this. The key details are: * An internal `__packed_vec3<>` type was added, which corresponds to a `type::Vector` with an additional flag to indicate that it will be emitted as packed vector. * The `PackedVec3` transform replaces all vec3 types used in host-shareable address spaces with the internal `__packed_vec3` type. This includes vec3 types that appear as the store type of a pointer. * When used as an array element, these `__packed_vec3` types are wrapped in a struct that contains a single `__packed_vec3` member. This allows us to add an `@align()` attribute that ensures that `array<vec3<T>>` still has the correct array element stride. * When the `vec3<T>` appears as a struct member in the input program, we apply the `@align()` to that member to ensure that we do not change its offset. * Matrix types with three rows that are used in memory are replaced with an array of columns, where each column uses a `__packed_vec3` inside an aligned wrapper structure as above. * Accesses to host-shareable memory that involve any of these types invoke a "pack" or "unpack" helper function to convert them to the equivalent type that uses `__packed_vec3` or a regular `vec3` as required. * The `chromium_internal_relaxed_uniform_layout` extension is used to avoid issues where modifying a type in the uniform address space triggers stricter layout validation rules. Bug: tint:1571 Fixed: tint:1837 Change-Id: Idaf2da2f5bcb2be00c85ec657edfb614186476bb Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/121200 Reviewed-by: Ben Clayton <bclayton@google.com> Commit-Queue: James Price <jrprice@google.com> Kokoro: Kokoro <noreply+kokoro@google.com>
2023-02-27 20:21:03 +00:00
half2 xx = tint_symbol.v.xx;
half2 xy = tint_symbol.v.xy;
half2 xz = tint_symbol.v.xz;
half2 yx = tint_symbol.v.yx;
half2 yy = tint_symbol.v.yy;
half2 yz = tint_symbol.v.yz;
half2 zx = tint_symbol.v.zx;
half2 zy = tint_symbol.v.zy;
half2 zz = tint_symbol.v.zz;
half3 xxx = tint_symbol.v.xxx;
half3 xxy = tint_symbol.v.xxy;
half3 xxz = tint_symbol.v.xxz;
half3 xyx = tint_symbol.v.xyx;
half3 xyy = tint_symbol.v.xyy;
half3 xyz = tint_symbol.v.xyz;
half3 xzx = tint_symbol.v.xzx;
half3 xzy = tint_symbol.v.xzy;
half3 xzz = tint_symbol.v.xzz;
half3 yxx = tint_symbol.v.yxx;
half3 yxy = tint_symbol.v.yxy;
half3 yxz = tint_symbol.v.yxz;
half3 yyx = tint_symbol.v.yyx;
half3 yyy = tint_symbol.v.yyy;
half3 yyz = tint_symbol.v.yyz;
half3 yzx = tint_symbol.v.yzx;
half3 yzy = tint_symbol.v.yzy;
half3 yzz = tint_symbol.v.yzz;
half3 zxx = tint_symbol.v.zxx;
half3 zxy = tint_symbol.v.zxy;
half3 zxz = tint_symbol.v.zxz;
half3 zyx = tint_symbol.v.zyx;
half3 zyy = tint_symbol.v.zyy;
half3 zyz = tint_symbol.v.zyz;
half3 zzx = tint_symbol.v.zzx;
half3 zzy = tint_symbol.v.zzy;
half3 zzz = tint_symbol.v.zzz;
half4 xxxx = tint_symbol.v.xxxx;
half4 xxxy = tint_symbol.v.xxxy;
half4 xxxz = tint_symbol.v.xxxz;
half4 xxyx = tint_symbol.v.xxyx;
half4 xxyy = tint_symbol.v.xxyy;
half4 xxyz = tint_symbol.v.xxyz;
half4 xxzx = tint_symbol.v.xxzx;
half4 xxzy = tint_symbol.v.xxzy;
half4 xxzz = tint_symbol.v.xxzz;
half4 xyxx = tint_symbol.v.xyxx;
half4 xyxy = tint_symbol.v.xyxy;
half4 xyxz = tint_symbol.v.xyxz;
half4 xyyx = tint_symbol.v.xyyx;
half4 xyyy = tint_symbol.v.xyyy;
half4 xyyz = tint_symbol.v.xyyz;
half4 xyzx = tint_symbol.v.xyzx;
half4 xyzy = tint_symbol.v.xyzy;
half4 xyzz = tint_symbol.v.xyzz;
half4 xzxx = tint_symbol.v.xzxx;
half4 xzxy = tint_symbol.v.xzxy;
half4 xzxz = tint_symbol.v.xzxz;
half4 xzyx = tint_symbol.v.xzyx;
half4 xzyy = tint_symbol.v.xzyy;
half4 xzyz = tint_symbol.v.xzyz;
half4 xzzx = tint_symbol.v.xzzx;
half4 xzzy = tint_symbol.v.xzzy;
half4 xzzz = tint_symbol.v.xzzz;
half4 yxxx = tint_symbol.v.yxxx;
half4 yxxy = tint_symbol.v.yxxy;
half4 yxxz = tint_symbol.v.yxxz;
half4 yxyx = tint_symbol.v.yxyx;
half4 yxyy = tint_symbol.v.yxyy;
half4 yxyz = tint_symbol.v.yxyz;
half4 yxzx = tint_symbol.v.yxzx;
half4 yxzy = tint_symbol.v.yxzy;
half4 yxzz = tint_symbol.v.yxzz;
half4 yyxx = tint_symbol.v.yyxx;
half4 yyxy = tint_symbol.v.yyxy;
half4 yyxz = tint_symbol.v.yyxz;
half4 yyyx = tint_symbol.v.yyyx;
half4 yyyy = tint_symbol.v.yyyy;
half4 yyyz = tint_symbol.v.yyyz;
half4 yyzx = tint_symbol.v.yyzx;
half4 yyzy = tint_symbol.v.yyzy;
half4 yyzz = tint_symbol.v.yyzz;
half4 yzxx = tint_symbol.v.yzxx;
half4 yzxy = tint_symbol.v.yzxy;
half4 yzxz = tint_symbol.v.yzxz;
half4 yzyx = tint_symbol.v.yzyx;
half4 yzyy = tint_symbol.v.yzyy;
half4 yzyz = tint_symbol.v.yzyz;
half4 yzzx = tint_symbol.v.yzzx;
half4 yzzy = tint_symbol.v.yzzy;
half4 yzzz = tint_symbol.v.yzzz;
half4 zxxx = tint_symbol.v.zxxx;
half4 zxxy = tint_symbol.v.zxxy;
half4 zxxz = tint_symbol.v.zxxz;
half4 zxyx = tint_symbol.v.zxyx;
half4 zxyy = tint_symbol.v.zxyy;
half4 zxyz = tint_symbol.v.zxyz;
half4 zxzx = tint_symbol.v.zxzx;
half4 zxzy = tint_symbol.v.zxzy;
half4 zxzz = tint_symbol.v.zxzz;
half4 zyxx = tint_symbol.v.zyxx;
half4 zyxy = tint_symbol.v.zyxy;
half4 zyxz = tint_symbol.v.zyxz;
half4 zyyx = tint_symbol.v.zyyx;
half4 zyyy = tint_symbol.v.zyyy;
half4 zyyz = tint_symbol.v.zyyz;
half4 zyzx = tint_symbol.v.zyzx;
half4 zyzy = tint_symbol.v.zyzy;
half4 zyzz = tint_symbol.v.zyzz;
half4 zzxx = tint_symbol.v.zzxx;
half4 zzxy = tint_symbol.v.zzxy;
half4 zzxz = tint_symbol.v.zzxz;
half4 zzyx = tint_symbol.v.zzyx;
half4 zzyy = tint_symbol.v.zzyy;
half4 zzyz = tint_symbol.v.zzyz;
half4 zzzx = tint_symbol.v.zzzx;
half4 zzzy = tint_symbol.v.zzzy;
half4 zzzz = tint_symbol.v.zzzz;
}