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

133 lines
4.0 KiB
Plaintext
Raw Normal View History

#include <metal_stdlib>
using namespace metal;
struct S {
int3 v;
};
void f() {
thread S tint_symbol = {};
int3 v = tint_symbol.v;
int x = tint_symbol.v[0];
int y = tint_symbol.v[1];
int 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
int2 xx = tint_symbol.v.xx;
int2 xy = tint_symbol.v.xy;
int2 xz = tint_symbol.v.xz;
int2 yx = tint_symbol.v.yx;
int2 yy = tint_symbol.v.yy;
int2 yz = tint_symbol.v.yz;
int2 zx = tint_symbol.v.zx;
int2 zy = tint_symbol.v.zy;
int2 zz = tint_symbol.v.zz;
int3 xxx = tint_symbol.v.xxx;
int3 xxy = tint_symbol.v.xxy;
int3 xxz = tint_symbol.v.xxz;
int3 xyx = tint_symbol.v.xyx;
int3 xyy = tint_symbol.v.xyy;
int3 xyz = tint_symbol.v.xyz;
int3 xzx = tint_symbol.v.xzx;
int3 xzy = tint_symbol.v.xzy;
int3 xzz = tint_symbol.v.xzz;
int3 yxx = tint_symbol.v.yxx;
int3 yxy = tint_symbol.v.yxy;
int3 yxz = tint_symbol.v.yxz;
int3 yyx = tint_symbol.v.yyx;
int3 yyy = tint_symbol.v.yyy;
int3 yyz = tint_symbol.v.yyz;
int3 yzx = tint_symbol.v.yzx;
int3 yzy = tint_symbol.v.yzy;
int3 yzz = tint_symbol.v.yzz;
int3 zxx = tint_symbol.v.zxx;
int3 zxy = tint_symbol.v.zxy;
int3 zxz = tint_symbol.v.zxz;
int3 zyx = tint_symbol.v.zyx;
int3 zyy = tint_symbol.v.zyy;
int3 zyz = tint_symbol.v.zyz;
int3 zzx = tint_symbol.v.zzx;
int3 zzy = tint_symbol.v.zzy;
int3 zzz = tint_symbol.v.zzz;
int4 xxxx = tint_symbol.v.xxxx;
int4 xxxy = tint_symbol.v.xxxy;
int4 xxxz = tint_symbol.v.xxxz;
int4 xxyx = tint_symbol.v.xxyx;
int4 xxyy = tint_symbol.v.xxyy;
int4 xxyz = tint_symbol.v.xxyz;
int4 xxzx = tint_symbol.v.xxzx;
int4 xxzy = tint_symbol.v.xxzy;
int4 xxzz = tint_symbol.v.xxzz;
int4 xyxx = tint_symbol.v.xyxx;
int4 xyxy = tint_symbol.v.xyxy;
int4 xyxz = tint_symbol.v.xyxz;
int4 xyyx = tint_symbol.v.xyyx;
int4 xyyy = tint_symbol.v.xyyy;
int4 xyyz = tint_symbol.v.xyyz;
int4 xyzx = tint_symbol.v.xyzx;
int4 xyzy = tint_symbol.v.xyzy;
int4 xyzz = tint_symbol.v.xyzz;
int4 xzxx = tint_symbol.v.xzxx;
int4 xzxy = tint_symbol.v.xzxy;
int4 xzxz = tint_symbol.v.xzxz;
int4 xzyx = tint_symbol.v.xzyx;
int4 xzyy = tint_symbol.v.xzyy;
int4 xzyz = tint_symbol.v.xzyz;
int4 xzzx = tint_symbol.v.xzzx;
int4 xzzy = tint_symbol.v.xzzy;
int4 xzzz = tint_symbol.v.xzzz;
int4 yxxx = tint_symbol.v.yxxx;
int4 yxxy = tint_symbol.v.yxxy;
int4 yxxz = tint_symbol.v.yxxz;
int4 yxyx = tint_symbol.v.yxyx;
int4 yxyy = tint_symbol.v.yxyy;
int4 yxyz = tint_symbol.v.yxyz;
int4 yxzx = tint_symbol.v.yxzx;
int4 yxzy = tint_symbol.v.yxzy;
int4 yxzz = tint_symbol.v.yxzz;
int4 yyxx = tint_symbol.v.yyxx;
int4 yyxy = tint_symbol.v.yyxy;
int4 yyxz = tint_symbol.v.yyxz;
int4 yyyx = tint_symbol.v.yyyx;
int4 yyyy = tint_symbol.v.yyyy;
int4 yyyz = tint_symbol.v.yyyz;
int4 yyzx = tint_symbol.v.yyzx;
int4 yyzy = tint_symbol.v.yyzy;
int4 yyzz = tint_symbol.v.yyzz;
int4 yzxx = tint_symbol.v.yzxx;
int4 yzxy = tint_symbol.v.yzxy;
int4 yzxz = tint_symbol.v.yzxz;
int4 yzyx = tint_symbol.v.yzyx;
int4 yzyy = tint_symbol.v.yzyy;
int4 yzyz = tint_symbol.v.yzyz;
int4 yzzx = tint_symbol.v.yzzx;
int4 yzzy = tint_symbol.v.yzzy;
int4 yzzz = tint_symbol.v.yzzz;
int4 zxxx = tint_symbol.v.zxxx;
int4 zxxy = tint_symbol.v.zxxy;
int4 zxxz = tint_symbol.v.zxxz;
int4 zxyx = tint_symbol.v.zxyx;
int4 zxyy = tint_symbol.v.zxyy;
int4 zxyz = tint_symbol.v.zxyz;
int4 zxzx = tint_symbol.v.zxzx;
int4 zxzy = tint_symbol.v.zxzy;
int4 zxzz = tint_symbol.v.zxzz;
int4 zyxx = tint_symbol.v.zyxx;
int4 zyxy = tint_symbol.v.zyxy;
int4 zyxz = tint_symbol.v.zyxz;
int4 zyyx = tint_symbol.v.zyyx;
int4 zyyy = tint_symbol.v.zyyy;
int4 zyyz = tint_symbol.v.zyyz;
int4 zyzx = tint_symbol.v.zyzx;
int4 zyzy = tint_symbol.v.zyzy;
int4 zyzz = tint_symbol.v.zyzz;
int4 zzxx = tint_symbol.v.zzxx;
int4 zzxy = tint_symbol.v.zzxy;
int4 zzxz = tint_symbol.v.zzxz;
int4 zzyx = tint_symbol.v.zzyx;
int4 zzyy = tint_symbol.v.zzyy;
int4 zzyz = tint_symbol.v.zzyz;
int4 zzzx = tint_symbol.v.zzzx;
int4 zzzy = tint_symbol.v.zzzy;
int4 zzzz = tint_symbol.v.zzzz;
}