mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-05-17 12:51:28 +00:00
This patch make HLSL writer support emitting f16 types, f16 literals, f16 constructor and convertor. Unittests are also implemented. The HLSL writer will emit f16 literal as `float16_t(1.23h)`, making the type explicit, and map f16 types as follow. The generated code require DXC with SM6.0 or higher, and `-enable-16bit-types`. WGSL type -> HLSL type f16 -> float16_t vec2<f16> -> vector<float16_t, 2> vec3<f16> -> vector<float16_t, 3> vec4<f16> -> vector<float16_t, 4> mat2x2<f16> -> matrix<float16_t, 2, 2> mat2x3<f16> -> matrix<float16_t, 2, 3> mat2x4<f16> -> matrix<float16_t, 2, 4> mat3x2<f16> -> matrix<float16_t, 3, 2> mat3x3<f16> -> matrix<float16_t, 3, 3> mat3x4<f16> -> matrix<float16_t, 3, 4> mat4x2<f16> -> matrix<float16_t, 4, 2> mat4x3<f16> -> matrix<float16_t, 4, 3> mat4x4<f16> -> matrix<float16_t, 4, 4> Bug: tint:1473, tint:1502 Change-Id: Iaf564f3ce29ace2984cef19d7df5a7dfb0fab2ef Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/95685 Commit-Queue: Zhaoming Jiang <zhaoming.jiang@intel.com> Reviewed-by: Ben Clayton <bclayton@google.com>