tint: Implement f16 keyword in Tint frontend

This patch:
1. Add the `f16` WGSL extension.
2. Add `f16` as keyword, and remove it from reserved word list.
3. Add ast::f16 and sem::f16, and implement validation that using `f16`
   type must be with `f16` extension enabled.
4. Add `Number<NumberKindF16>` for f16 literal and constant, and add
   `ast::FloatLiteralExpression::Suffix::kH`.
5. Add placeholder in all writer which report error when try to emit f16
   type.

Bugs: tint:1473, tint:1502
Change-Id: Ifb363beeb2699ed7cac57e07227d1b2cfa8050b4
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/89922
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Zhaoming Jiang <zhaoming.jiang@intel.com>
This commit is contained in:
Zhaoming Jiang
2022-05-13 12:01:11 +00:00
committed by Dawn LUCI CQ
parent e221ddd30e
commit 62bfd318ae
34 changed files with 502 additions and 11 deletions

View File

@@ -165,6 +165,7 @@ tint_unittests_source_set("tint_unittests_ast_src") {
"../../src/tint/ast/discard_statement_test.cc",
"../../src/tint/ast/enable_test.cc",
"../../src/tint/ast/external_texture_test.cc",
"../../src/tint/ast/f16_test.cc",
"../../src/tint/ast/f32_test.cc",
"../../src/tint/ast/fallthrough_statement_test.cc",
"../../src/tint/ast/float_literal_expression_test.cc",
@@ -289,6 +290,7 @@ tint_unittests_source_set("tint_unittests_sem_src") {
"../../src/tint/sem/depth_multisampled_texture_test.cc",
"../../src/tint/sem/depth_texture_test.cc",
"../../src/tint/sem/external_texture_test.cc",
"../../src/tint/sem/f16_test.cc",
"../../src/tint/sem/f32_test.cc",
"../../src/tint/sem/i32_test.cc",
"../../src/tint/sem/matrix_test.cc",