wsgl-writer: emit inf, nan, subnormal as hex float

Signed zeros are emitted.
Subormal numbers are emitted as hex float.

Handling Inf and NaN is unresolved in the spec.
See https://github.com/gpuweb/gpuweb/issues/1769

NaN tests are disabled, due to platform dependence.
Windows x86-64 seems to always set the high mantissa bit
on NaNs.

Fixed: tint:76
Change-Id: I06c69b93b04c869a63ec2f574022996acc7a6dbe
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/52321
Commit-Queue: David Neto <dneto@google.com>
Auto-Submit: David Neto <dneto@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
This commit is contained in:
David Neto
2021-05-27 20:46:46 +00:00
committed by Tint LUCI CQ
parent 0131ce2205
commit d5f4ea22f0
7 changed files with 393 additions and 2 deletions

View File

@@ -258,9 +258,9 @@ tint_unittests_source_set("tint_unittests_core_src") {
"../src/resolver/intrinsic_test.cc",
"../src/resolver/is_host_shareable_test.cc",
"../src/resolver/is_storeable_test.cc",
"../src/resolver/pipeline_overridable_constant_test.cc",
"../src/resolver/ptr_ref_test.cc",
"../src/resolver/ptr_ref_validation_test.cc",
"../src/resolver/pipeline_overridable_constant_test.cc",
"../src/resolver/resolver_test.cc",
"../src/resolver/resolver_test_helper.cc",
"../src/resolver/resolver_test_helper.h",
@@ -511,6 +511,7 @@ tint_unittests_source_set("tint_unittests_wgsl_writer_src") {
"../src/writer/wgsl/generator_impl_global_decl_test.cc",
"../src/writer/wgsl/generator_impl_identifier_test.cc",
"../src/writer/wgsl/generator_impl_if_test.cc",
"../src/writer/wgsl/generator_impl_literal_test.cc",
"../src/writer/wgsl/generator_impl_loop_test.cc",
"../src/writer/wgsl/generator_impl_member_accessor_test.cc",
"../src/writer/wgsl/generator_impl_return_test.cc",