mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-07-15 17:45:58 +00:00
This CL implements f16 in uniform and storage address space, allowing using f16 types in uniform and storage buffers on all backends. Tint uint tests and Dawn E2E tests are added to validate the f16 types work as expected. Bug: tint:1473, tint:1502 Change-Id: I15e3de1033d3727f2ea33f4657f682c5f13c2153 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/106320 Kokoro: Kokoro <noreply+kokoro@google.com> Commit-Queue: Zhaoming Jiang <zhaoming.jiang@intel.com> Reviewed-by: Ben Clayton <bclayton@google.com>
146 lines
6.2 KiB
Plaintext
146 lines
6.2 KiB
Plaintext
#include <metal_stdlib>
|
|
|
|
using namespace metal;
|
|
|
|
template<typename T, size_t N>
|
|
struct tint_array {
|
|
const constant T& operator[](size_t i) const constant { return elements[i]; }
|
|
device T& operator[](size_t i) device { return elements[i]; }
|
|
const device T& operator[](size_t i) const device { return elements[i]; }
|
|
thread T& operator[](size_t i) thread { return elements[i]; }
|
|
const thread T& operator[](size_t i) const thread { return elements[i]; }
|
|
threadgroup T& operator[](size_t i) threadgroup { return elements[i]; }
|
|
const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; }
|
|
T elements[N];
|
|
};
|
|
|
|
struct S {
|
|
/* 0x0000 */ packed_half3 v;
|
|
/* 0x0006 */ tint_array<int8_t, 2> tint_pad;
|
|
};
|
|
|
|
void f(const constant S* const tint_symbol) {
|
|
half3 v = half3((*(tint_symbol)).v);
|
|
half x = (*(tint_symbol)).v[0];
|
|
half y = (*(tint_symbol)).v[1];
|
|
half z = (*(tint_symbol)).v[2];
|
|
half2 xx = half3((*(tint_symbol)).v).xx;
|
|
half2 xy = half3((*(tint_symbol)).v).xy;
|
|
half2 xz = half3((*(tint_symbol)).v).xz;
|
|
half2 yx = half3((*(tint_symbol)).v).yx;
|
|
half2 yy = half3((*(tint_symbol)).v).yy;
|
|
half2 yz = half3((*(tint_symbol)).v).yz;
|
|
half2 zx = half3((*(tint_symbol)).v).zx;
|
|
half2 zy = half3((*(tint_symbol)).v).zy;
|
|
half2 zz = half3((*(tint_symbol)).v).zz;
|
|
half3 xxx = half3((*(tint_symbol)).v).xxx;
|
|
half3 xxy = half3((*(tint_symbol)).v).xxy;
|
|
half3 xxz = half3((*(tint_symbol)).v).xxz;
|
|
half3 xyx = half3((*(tint_symbol)).v).xyx;
|
|
half3 xyy = half3((*(tint_symbol)).v).xyy;
|
|
half3 xyz = half3((*(tint_symbol)).v).xyz;
|
|
half3 xzx = half3((*(tint_symbol)).v).xzx;
|
|
half3 xzy = half3((*(tint_symbol)).v).xzy;
|
|
half3 xzz = half3((*(tint_symbol)).v).xzz;
|
|
half3 yxx = half3((*(tint_symbol)).v).yxx;
|
|
half3 yxy = half3((*(tint_symbol)).v).yxy;
|
|
half3 yxz = half3((*(tint_symbol)).v).yxz;
|
|
half3 yyx = half3((*(tint_symbol)).v).yyx;
|
|
half3 yyy = half3((*(tint_symbol)).v).yyy;
|
|
half3 yyz = half3((*(tint_symbol)).v).yyz;
|
|
half3 yzx = half3((*(tint_symbol)).v).yzx;
|
|
half3 yzy = half3((*(tint_symbol)).v).yzy;
|
|
half3 yzz = half3((*(tint_symbol)).v).yzz;
|
|
half3 zxx = half3((*(tint_symbol)).v).zxx;
|
|
half3 zxy = half3((*(tint_symbol)).v).zxy;
|
|
half3 zxz = half3((*(tint_symbol)).v).zxz;
|
|
half3 zyx = half3((*(tint_symbol)).v).zyx;
|
|
half3 zyy = half3((*(tint_symbol)).v).zyy;
|
|
half3 zyz = half3((*(tint_symbol)).v).zyz;
|
|
half3 zzx = half3((*(tint_symbol)).v).zzx;
|
|
half3 zzy = half3((*(tint_symbol)).v).zzy;
|
|
half3 zzz = half3((*(tint_symbol)).v).zzz;
|
|
half4 xxxx = half3((*(tint_symbol)).v).xxxx;
|
|
half4 xxxy = half3((*(tint_symbol)).v).xxxy;
|
|
half4 xxxz = half3((*(tint_symbol)).v).xxxz;
|
|
half4 xxyx = half3((*(tint_symbol)).v).xxyx;
|
|
half4 xxyy = half3((*(tint_symbol)).v).xxyy;
|
|
half4 xxyz = half3((*(tint_symbol)).v).xxyz;
|
|
half4 xxzx = half3((*(tint_symbol)).v).xxzx;
|
|
half4 xxzy = half3((*(tint_symbol)).v).xxzy;
|
|
half4 xxzz = half3((*(tint_symbol)).v).xxzz;
|
|
half4 xyxx = half3((*(tint_symbol)).v).xyxx;
|
|
half4 xyxy = half3((*(tint_symbol)).v).xyxy;
|
|
half4 xyxz = half3((*(tint_symbol)).v).xyxz;
|
|
half4 xyyx = half3((*(tint_symbol)).v).xyyx;
|
|
half4 xyyy = half3((*(tint_symbol)).v).xyyy;
|
|
half4 xyyz = half3((*(tint_symbol)).v).xyyz;
|
|
half4 xyzx = half3((*(tint_symbol)).v).xyzx;
|
|
half4 xyzy = half3((*(tint_symbol)).v).xyzy;
|
|
half4 xyzz = half3((*(tint_symbol)).v).xyzz;
|
|
half4 xzxx = half3((*(tint_symbol)).v).xzxx;
|
|
half4 xzxy = half3((*(tint_symbol)).v).xzxy;
|
|
half4 xzxz = half3((*(tint_symbol)).v).xzxz;
|
|
half4 xzyx = half3((*(tint_symbol)).v).xzyx;
|
|
half4 xzyy = half3((*(tint_symbol)).v).xzyy;
|
|
half4 xzyz = half3((*(tint_symbol)).v).xzyz;
|
|
half4 xzzx = half3((*(tint_symbol)).v).xzzx;
|
|
half4 xzzy = half3((*(tint_symbol)).v).xzzy;
|
|
half4 xzzz = half3((*(tint_symbol)).v).xzzz;
|
|
half4 yxxx = half3((*(tint_symbol)).v).yxxx;
|
|
half4 yxxy = half3((*(tint_symbol)).v).yxxy;
|
|
half4 yxxz = half3((*(tint_symbol)).v).yxxz;
|
|
half4 yxyx = half3((*(tint_symbol)).v).yxyx;
|
|
half4 yxyy = half3((*(tint_symbol)).v).yxyy;
|
|
half4 yxyz = half3((*(tint_symbol)).v).yxyz;
|
|
half4 yxzx = half3((*(tint_symbol)).v).yxzx;
|
|
half4 yxzy = half3((*(tint_symbol)).v).yxzy;
|
|
half4 yxzz = half3((*(tint_symbol)).v).yxzz;
|
|
half4 yyxx = half3((*(tint_symbol)).v).yyxx;
|
|
half4 yyxy = half3((*(tint_symbol)).v).yyxy;
|
|
half4 yyxz = half3((*(tint_symbol)).v).yyxz;
|
|
half4 yyyx = half3((*(tint_symbol)).v).yyyx;
|
|
half4 yyyy = half3((*(tint_symbol)).v).yyyy;
|
|
half4 yyyz = half3((*(tint_symbol)).v).yyyz;
|
|
half4 yyzx = half3((*(tint_symbol)).v).yyzx;
|
|
half4 yyzy = half3((*(tint_symbol)).v).yyzy;
|
|
half4 yyzz = half3((*(tint_symbol)).v).yyzz;
|
|
half4 yzxx = half3((*(tint_symbol)).v).yzxx;
|
|
half4 yzxy = half3((*(tint_symbol)).v).yzxy;
|
|
half4 yzxz = half3((*(tint_symbol)).v).yzxz;
|
|
half4 yzyx = half3((*(tint_symbol)).v).yzyx;
|
|
half4 yzyy = half3((*(tint_symbol)).v).yzyy;
|
|
half4 yzyz = half3((*(tint_symbol)).v).yzyz;
|
|
half4 yzzx = half3((*(tint_symbol)).v).yzzx;
|
|
half4 yzzy = half3((*(tint_symbol)).v).yzzy;
|
|
half4 yzzz = half3((*(tint_symbol)).v).yzzz;
|
|
half4 zxxx = half3((*(tint_symbol)).v).zxxx;
|
|
half4 zxxy = half3((*(tint_symbol)).v).zxxy;
|
|
half4 zxxz = half3((*(tint_symbol)).v).zxxz;
|
|
half4 zxyx = half3((*(tint_symbol)).v).zxyx;
|
|
half4 zxyy = half3((*(tint_symbol)).v).zxyy;
|
|
half4 zxyz = half3((*(tint_symbol)).v).zxyz;
|
|
half4 zxzx = half3((*(tint_symbol)).v).zxzx;
|
|
half4 zxzy = half3((*(tint_symbol)).v).zxzy;
|
|
half4 zxzz = half3((*(tint_symbol)).v).zxzz;
|
|
half4 zyxx = half3((*(tint_symbol)).v).zyxx;
|
|
half4 zyxy = half3((*(tint_symbol)).v).zyxy;
|
|
half4 zyxz = half3((*(tint_symbol)).v).zyxz;
|
|
half4 zyyx = half3((*(tint_symbol)).v).zyyx;
|
|
half4 zyyy = half3((*(tint_symbol)).v).zyyy;
|
|
half4 zyyz = half3((*(tint_symbol)).v).zyyz;
|
|
half4 zyzx = half3((*(tint_symbol)).v).zyzx;
|
|
half4 zyzy = half3((*(tint_symbol)).v).zyzy;
|
|
half4 zyzz = half3((*(tint_symbol)).v).zyzz;
|
|
half4 zzxx = half3((*(tint_symbol)).v).zzxx;
|
|
half4 zzxy = half3((*(tint_symbol)).v).zzxy;
|
|
half4 zzxz = half3((*(tint_symbol)).v).zzxz;
|
|
half4 zzyx = half3((*(tint_symbol)).v).zzyx;
|
|
half4 zzyy = half3((*(tint_symbol)).v).zzyy;
|
|
half4 zzyz = half3((*(tint_symbol)).v).zzyz;
|
|
half4 zzzx = half3((*(tint_symbol)).v).zzzx;
|
|
half4 zzzy = half3((*(tint_symbol)).v).zzzy;
|
|
half4 zzzz = half3((*(tint_symbol)).v).zzzz;
|
|
}
|
|
|