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

133 lines
4.3 KiB
Plaintext
Raw Normal View History

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