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

133 lines
4.1 KiB
Plaintext
Raw Normal View History

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