tint/resolver: Add f16 types, constructor, and conversions
This patch add f16 types and their constructors and conversions in
resolver and intrinsic table. Also implement relating unit tests.
Bug: tint:1473, tint:1502
Change-Id: Ida1336193a72a73959e50e6a3eb12be44c0396b5
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/94642
Commit-Queue: Zhaoming Jiang <zhaoming.jiang@intel.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
diff --git a/src/tint/resolver/host_shareable_validation_test.cc b/src/tint/resolver/host_shareable_validation_test.cc
index 5e59b44..13a04c9 100644
--- a/src/tint/resolver/host_shareable_validation_test.cc
+++ b/src/tint/resolver/host_shareable_validation_test.cc
@@ -104,15 +104,19 @@
}
TEST_F(ResolverHostShareableValidationTest, NoError) {
+ Enable(ast::Extension::kF16);
+
auto* i1 = Structure("I1", {
- Member(Source{{1, 1}}, "x1", ty.f32()),
- Member(Source{{2, 1}}, "y1", ty.vec3<f32>()),
- Member(Source{{3, 1}}, "z1", ty.array<i32, 4>()),
+ Member(Source{{1, 1}}, "w1", ty.f16()),
+ Member(Source{{2, 1}}, "x1", ty.f32()),
+ Member(Source{{3, 1}}, "y1", ty.vec3<f32>()),
+ Member(Source{{4, 1}}, "z1", ty.array<i32, 4>()),
});
auto* a1 = Alias("a1", ty.Of(i1));
auto* i2 = Structure("I2", {
- Member(Source{{4, 1}}, "x2", ty.mat2x2<f32>()),
- Member(Source{{5, 1}}, "y2", ty.Of(i1)),
+ Member(Source{{5, 1}}, "x2", ty.mat2x2<f32>()),
+ Member(Source{{6, 1}}, "w2", ty.mat3x4<f16>()),
+ Member(Source{{7, 1}}, "z2", ty.Of(i1)),
});
auto* a2 = Alias("a2", ty.Of(i2));
auto* i3 = Structure("I3", {