tint: Rework sem::Constant to be variant-of-vector

Instead of vector-of-variant.
This:
• Makes it impossible to produce a mix of scalar variant types, which
  would make no sense.
• Reduces the size of a Constant, by removing the union-tag from each
  element.

Also clean up terminology. Rename 'Constant::Scalar' to
 'Constant::Element'. Scalars are well-defined in WGSL, and with the
introduction of abstract-numerics, this no longer makes sense.

Bug: tint:1504
Change-Id: I599aa97ad1ea798b7db8e512a5990ba75827faad
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/91304
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
This commit is contained in:
Ben Clayton
2022-05-25 19:28:55 +00:00
committed by Dawn LUCI CQ
parent ce425feef5
commit 9707e6bb38
16 changed files with 545 additions and 171 deletions

View File

@@ -289,6 +289,7 @@ tint_unittests_source_set("tint_unittests_sem_src") {
"../../src/tint/sem/atomic_test.cc",
"../../src/tint/sem/bool_test.cc",
"../../src/tint/sem/builtin_test.cc",
"../../src/tint/sem/constant_test.cc",
"../../src/tint/sem/depth_multisampled_texture_test.cc",
"../../src/tint/sem/depth_texture_test.cc",
"../../src/tint/sem/expression_test.cc",