Import Tint changes from Dawn
Changes:
- 78da6644356b1a0c2613e04690f626f932067622 Pass feature allowlist from Dawn to Tint by James Price <jrprice@google.com>
GitOrigin-RevId: 78da6644356b1a0c2613e04690f626f932067622
Change-Id: I28584a520c56febc98f6aad0c4d97764ff835f18
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/159460
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
diff --git a/src/tint/api/BUILD.bazel b/src/tint/api/BUILD.bazel
index 4f94d26..8853b01 100644
--- a/src/tint/api/BUILD.bazel
+++ b/src/tint/api/BUILD.bazel
@@ -55,6 +55,7 @@
"//src/tint/lang/spirv/reader/common",
"//src/tint/lang/wgsl",
"//src/tint/lang/wgsl/ast",
+ "//src/tint/lang/wgsl/common",
"//src/tint/lang/wgsl/program",
"//src/tint/lang/wgsl/sem",
"//src/tint/utils/containers",
diff --git a/src/tint/api/BUILD.cmake b/src/tint/api/BUILD.cmake
index 3c40856..570309b 100644
--- a/src/tint/api/BUILD.cmake
+++ b/src/tint/api/BUILD.cmake
@@ -57,6 +57,7 @@
tint_lang_spirv_reader_common
tint_lang_wgsl
tint_lang_wgsl_ast
+ tint_lang_wgsl_common
tint_lang_wgsl_program
tint_lang_wgsl_sem
tint_utils_containers
diff --git a/src/tint/api/BUILD.gn b/src/tint/api/BUILD.gn
index 62a7e7a..87b72d7 100644
--- a/src/tint/api/BUILD.gn
+++ b/src/tint/api/BUILD.gn
@@ -54,6 +54,7 @@
"${tint_src_dir}/lang/spirv/reader/common",
"${tint_src_dir}/lang/wgsl",
"${tint_src_dir}/lang/wgsl/ast",
+ "${tint_src_dir}/lang/wgsl/common",
"${tint_src_dir}/lang/wgsl/program",
"${tint_src_dir}/lang/wgsl/sem",
"${tint_src_dir}/utils/containers",
diff --git a/src/tint/cmd/bench/BUILD.bazel b/src/tint/cmd/bench/BUILD.bazel
index 4613dcc..9a81f43 100644
--- a/src/tint/cmd/bench/BUILD.bazel
+++ b/src/tint/cmd/bench/BUILD.bazel
@@ -52,6 +52,7 @@
"//src/tint/lang/spirv/reader/common",
"//src/tint/lang/wgsl",
"//src/tint/lang/wgsl/ast",
+ "//src/tint/lang/wgsl/common",
"//src/tint/lang/wgsl/program",
"//src/tint/lang/wgsl/sem",
"//src/tint/utils/containers",
diff --git a/src/tint/cmd/bench/BUILD.cmake b/src/tint/cmd/bench/BUILD.cmake
index 27b08a0..50d1d83 100644
--- a/src/tint/cmd/bench/BUILD.cmake
+++ b/src/tint/cmd/bench/BUILD.cmake
@@ -128,6 +128,7 @@
tint_lang_spirv_reader_common
tint_lang_wgsl
tint_lang_wgsl_ast
+ tint_lang_wgsl_common
tint_lang_wgsl_program
tint_lang_wgsl_sem
tint_utils_containers
diff --git a/src/tint/cmd/bench/BUILD.gn b/src/tint/cmd/bench/BUILD.gn
index b0eab2b..ae16dad 100644
--- a/src/tint/cmd/bench/BUILD.gn
+++ b/src/tint/cmd/bench/BUILD.gn
@@ -57,6 +57,7 @@
"${tint_src_dir}/lang/spirv/reader/common",
"${tint_src_dir}/lang/wgsl",
"${tint_src_dir}/lang/wgsl/ast",
+ "${tint_src_dir}/lang/wgsl/common",
"${tint_src_dir}/lang/wgsl/program",
"${tint_src_dir}/lang/wgsl/sem",
"${tint_src_dir}/utils/containers",
diff --git a/src/tint/cmd/common/BUILD.bazel b/src/tint/cmd/common/BUILD.bazel
index 30232da..b15b369 100644
--- a/src/tint/cmd/common/BUILD.bazel
+++ b/src/tint/cmd/common/BUILD.bazel
@@ -56,6 +56,7 @@
"//src/tint/lang/spirv/reader/common",
"//src/tint/lang/wgsl",
"//src/tint/lang/wgsl/ast",
+ "//src/tint/lang/wgsl/common",
"//src/tint/lang/wgsl/inspector",
"//src/tint/lang/wgsl/program",
"//src/tint/lang/wgsl/sem",
@@ -111,6 +112,7 @@
"//src/tint/lang/core/type",
"//src/tint/lang/wgsl",
"//src/tint/lang/wgsl/ast",
+ "//src/tint/lang/wgsl/common",
"//src/tint/lang/wgsl/program",
"//src/tint/lang/wgsl/resolver",
"//src/tint/lang/wgsl/sem",
diff --git a/src/tint/cmd/common/BUILD.cmake b/src/tint/cmd/common/BUILD.cmake
index dc5dcd4..7545e63 100644
--- a/src/tint/cmd/common/BUILD.cmake
+++ b/src/tint/cmd/common/BUILD.cmake
@@ -55,6 +55,7 @@
tint_lang_spirv_reader_common
tint_lang_wgsl
tint_lang_wgsl_ast
+ tint_lang_wgsl_common
tint_lang_wgsl_inspector
tint_lang_wgsl_program
tint_lang_wgsl_sem
@@ -114,6 +115,7 @@
tint_lang_core_type
tint_lang_wgsl
tint_lang_wgsl_ast
+ tint_lang_wgsl_common
tint_lang_wgsl_program
tint_lang_wgsl_resolver
tint_lang_wgsl_sem
diff --git a/src/tint/cmd/common/BUILD.gn b/src/tint/cmd/common/BUILD.gn
index 0272780..a6980f0 100644
--- a/src/tint/cmd/common/BUILD.gn
+++ b/src/tint/cmd/common/BUILD.gn
@@ -59,6 +59,7 @@
"${tint_src_dir}/lang/spirv/reader/common",
"${tint_src_dir}/lang/wgsl",
"${tint_src_dir}/lang/wgsl/ast",
+ "${tint_src_dir}/lang/wgsl/common",
"${tint_src_dir}/lang/wgsl/inspector",
"${tint_src_dir}/lang/wgsl/program",
"${tint_src_dir}/lang/wgsl/sem",
@@ -109,6 +110,7 @@
"${tint_src_dir}/lang/core/type",
"${tint_src_dir}/lang/wgsl",
"${tint_src_dir}/lang/wgsl/ast",
+ "${tint_src_dir}/lang/wgsl/common",
"${tint_src_dir}/lang/wgsl/program",
"${tint_src_dir}/lang/wgsl/resolver",
"${tint_src_dir}/lang/wgsl/sem",
diff --git a/src/tint/cmd/common/helper.cc b/src/tint/cmd/common/helper.cc
index fd2c48d..41fc79a 100644
--- a/src/tint/cmd/common/helper.cc
+++ b/src/tint/cmd/common/helper.cc
@@ -157,11 +157,14 @@
exit(1);
}
+ tint::wgsl::reader::Options options;
+ options.allowed_features = tint::wgsl::AllowedFeatures::Everything();
+
auto file = std::make_unique<tint::Source::File>(
opts.filename, std::string(data.begin(), data.end()));
return ProgramInfo{
- /* program */ tint::wgsl::reader::Parse(file.get()),
+ /* program */ tint::wgsl::reader::Parse(file.get(), options),
/* source_file */ std::move(file),
};
#else
diff --git a/src/tint/cmd/fuzz/wgsl/BUILD.cmake b/src/tint/cmd/fuzz/wgsl/BUILD.cmake
index 9648f95..eb85247 100644
--- a/src/tint/cmd/fuzz/wgsl/BUILD.cmake
+++ b/src/tint/cmd/fuzz/wgsl/BUILD.cmake
@@ -105,6 +105,7 @@
tint_lang_core_type
tint_lang_wgsl
tint_lang_wgsl_ast
+ tint_lang_wgsl_common
tint_lang_wgsl_program
tint_lang_wgsl_sem
tint_utils_containers
diff --git a/src/tint/cmd/fuzz/wgsl/BUILD.gn b/src/tint/cmd/fuzz/wgsl/BUILD.gn
index 5b86127..b55e57f 100644
--- a/src/tint/cmd/fuzz/wgsl/BUILD.gn
+++ b/src/tint/cmd/fuzz/wgsl/BUILD.gn
@@ -52,6 +52,7 @@
"${tint_src_dir}/lang/core/type",
"${tint_src_dir}/lang/wgsl",
"${tint_src_dir}/lang/wgsl/ast",
+ "${tint_src_dir}/lang/wgsl/common",
"${tint_src_dir}/lang/wgsl/program",
"${tint_src_dir}/lang/wgsl/sem",
"${tint_src_dir}/utils/containers",
diff --git a/src/tint/cmd/info/BUILD.bazel b/src/tint/cmd/info/BUILD.bazel
index 66b961e..a71fc36 100644
--- a/src/tint/cmd/info/BUILD.bazel
+++ b/src/tint/cmd/info/BUILD.bazel
@@ -50,6 +50,7 @@
"//src/tint/lang/spirv/reader/common",
"//src/tint/lang/wgsl",
"//src/tint/lang/wgsl/ast",
+ "//src/tint/lang/wgsl/common",
"//src/tint/lang/wgsl/inspector",
"//src/tint/lang/wgsl/program",
"//src/tint/lang/wgsl/sem",
diff --git a/src/tint/cmd/info/BUILD.cmake b/src/tint/cmd/info/BUILD.cmake
index a134da3..8da6ae4 100644
--- a/src/tint/cmd/info/BUILD.cmake
+++ b/src/tint/cmd/info/BUILD.cmake
@@ -51,6 +51,7 @@
tint_lang_spirv_reader_common
tint_lang_wgsl
tint_lang_wgsl_ast
+ tint_lang_wgsl_common
tint_lang_wgsl_inspector
tint_lang_wgsl_program
tint_lang_wgsl_sem
diff --git a/src/tint/cmd/info/BUILD.gn b/src/tint/cmd/info/BUILD.gn
index d130e3e..ac7005b 100644
--- a/src/tint/cmd/info/BUILD.gn
+++ b/src/tint/cmd/info/BUILD.gn
@@ -50,6 +50,7 @@
"${tint_src_dir}/lang/spirv/reader/common",
"${tint_src_dir}/lang/wgsl",
"${tint_src_dir}/lang/wgsl/ast",
+ "${tint_src_dir}/lang/wgsl/common",
"${tint_src_dir}/lang/wgsl/inspector",
"${tint_src_dir}/lang/wgsl/program",
"${tint_src_dir}/lang/wgsl/sem",
diff --git a/src/tint/cmd/loopy/BUILD.bazel b/src/tint/cmd/loopy/BUILD.bazel
index 13e47d9..4498c58 100644
--- a/src/tint/cmd/loopy/BUILD.bazel
+++ b/src/tint/cmd/loopy/BUILD.bazel
@@ -54,6 +54,7 @@
"//src/tint/lang/spirv/reader/common",
"//src/tint/lang/wgsl",
"//src/tint/lang/wgsl/ast",
+ "//src/tint/lang/wgsl/common",
"//src/tint/lang/wgsl/helpers",
"//src/tint/lang/wgsl/inspector",
"//src/tint/lang/wgsl/program",
diff --git a/src/tint/cmd/loopy/BUILD.cmake b/src/tint/cmd/loopy/BUILD.cmake
index 8b44ee8..332536d 100644
--- a/src/tint/cmd/loopy/BUILD.cmake
+++ b/src/tint/cmd/loopy/BUILD.cmake
@@ -55,6 +55,7 @@
tint_lang_spirv_reader_common
tint_lang_wgsl
tint_lang_wgsl_ast
+ tint_lang_wgsl_common
tint_lang_wgsl_helpers
tint_lang_wgsl_inspector
tint_lang_wgsl_program
diff --git a/src/tint/cmd/loopy/BUILD.gn b/src/tint/cmd/loopy/BUILD.gn
index 2b1cdec..e68fff0 100644
--- a/src/tint/cmd/loopy/BUILD.gn
+++ b/src/tint/cmd/loopy/BUILD.gn
@@ -54,6 +54,7 @@
"${tint_src_dir}/lang/spirv/reader/common",
"${tint_src_dir}/lang/wgsl",
"${tint_src_dir}/lang/wgsl/ast",
+ "${tint_src_dir}/lang/wgsl/common",
"${tint_src_dir}/lang/wgsl/helpers",
"${tint_src_dir}/lang/wgsl/inspector",
"${tint_src_dir}/lang/wgsl/program",
diff --git a/src/tint/cmd/tint/BUILD.bazel b/src/tint/cmd/tint/BUILD.bazel
index 24e679a..0b576e2 100644
--- a/src/tint/cmd/tint/BUILD.bazel
+++ b/src/tint/cmd/tint/BUILD.bazel
@@ -55,6 +55,7 @@
"//src/tint/lang/wgsl",
"//src/tint/lang/wgsl/ast",
"//src/tint/lang/wgsl/ast/transform",
+ "//src/tint/lang/wgsl/common",
"//src/tint/lang/wgsl/helpers",
"//src/tint/lang/wgsl/inspector",
"//src/tint/lang/wgsl/program",
diff --git a/src/tint/cmd/tint/BUILD.cmake b/src/tint/cmd/tint/BUILD.cmake
index 2079222..fa5a02e 100644
--- a/src/tint/cmd/tint/BUILD.cmake
+++ b/src/tint/cmd/tint/BUILD.cmake
@@ -56,6 +56,7 @@
tint_lang_wgsl
tint_lang_wgsl_ast
tint_lang_wgsl_ast_transform
+ tint_lang_wgsl_common
tint_lang_wgsl_helpers
tint_lang_wgsl_inspector
tint_lang_wgsl_program
diff --git a/src/tint/cmd/tint/BUILD.gn b/src/tint/cmd/tint/BUILD.gn
index 01c26f6..02c9071 100644
--- a/src/tint/cmd/tint/BUILD.gn
+++ b/src/tint/cmd/tint/BUILD.gn
@@ -55,6 +55,7 @@
"${tint_src_dir}/lang/wgsl",
"${tint_src_dir}/lang/wgsl/ast",
"${tint_src_dir}/lang/wgsl/ast/transform",
+ "${tint_src_dir}/lang/wgsl/common",
"${tint_src_dir}/lang/wgsl/helpers",
"${tint_src_dir}/lang/wgsl/inspector",
"${tint_src_dir}/lang/wgsl/program",
diff --git a/src/tint/cmd/tint/main.cc b/src/tint/cmd/tint/main.cc
index 0eb15fe..cc3aba1 100644
--- a/src/tint/cmd/tint/main.cc
+++ b/src/tint/cmd/tint/main.cc
@@ -321,14 +321,6 @@
opts->spirv_reader_options.allow_non_uniform_derivatives = true;
}
});
- auto& allow_chromium_extensions = options.Add<BoolOption>(
- "allow-chromium-extensions",
- "When using SPIR-V input, allow the use of Chromium-specific extensions", Default{false});
- TINT_DEFER({
- if (allow_chromium_extensions.value.value_or(false)) {
- opts->spirv_reader_options.allow_chromium_extensions = true;
- }
- });
#endif
auto& disable_wg_init = options.Add<BoolOption>(
@@ -668,8 +660,10 @@
#if TINT_BUILD_WGSL_READER
if (options.validate && options.skip_hash.count(hash) == 0) {
// Attempt to re-parse the output program with Tint's WGSL reader.
+ tint::wgsl::reader::Options parser_options;
+ parser_options.allowed_features = tint::wgsl::AllowedFeatures::Everything();
auto source = std::make_unique<tint::Source::File>(options.input_filename, result->wgsl);
- auto reparsed_program = tint::wgsl::reader::Parse(source.get());
+ auto reparsed_program = tint::wgsl::reader::Parse(source.get(), parser_options);
if (!reparsed_program.IsValid()) {
auto diag_printer = tint::diag::Printer::create(stderr, true);
tint::diag::Formatter diag_formatter;
diff --git a/src/tint/lang/core/constant/BUILD.bazel b/src/tint/lang/core/constant/BUILD.bazel
index 31dfe70..dfdb0d1 100644
--- a/src/tint/lang/core/constant/BUILD.bazel
+++ b/src/tint/lang/core/constant/BUILD.bazel
@@ -107,6 +107,7 @@
"//src/tint/lang/core/type:test",
"//src/tint/lang/wgsl",
"//src/tint/lang/wgsl/ast",
+ "//src/tint/lang/wgsl/common",
"//src/tint/lang/wgsl/intrinsic",
"//src/tint/lang/wgsl/program",
"//src/tint/lang/wgsl/resolver",
diff --git a/src/tint/lang/core/constant/BUILD.cmake b/src/tint/lang/core/constant/BUILD.cmake
index 480efc8..0a8076d 100644
--- a/src/tint/lang/core/constant/BUILD.cmake
+++ b/src/tint/lang/core/constant/BUILD.cmake
@@ -106,6 +106,7 @@
tint_lang_core_type_test
tint_lang_wgsl
tint_lang_wgsl_ast
+ tint_lang_wgsl_common
tint_lang_wgsl_intrinsic
tint_lang_wgsl_program
tint_lang_wgsl_resolver
diff --git a/src/tint/lang/core/constant/BUILD.gn b/src/tint/lang/core/constant/BUILD.gn
index a362523..64d4cce 100644
--- a/src/tint/lang/core/constant/BUILD.gn
+++ b/src/tint/lang/core/constant/BUILD.gn
@@ -108,6 +108,7 @@
"${tint_src_dir}/lang/core/type:unittests",
"${tint_src_dir}/lang/wgsl",
"${tint_src_dir}/lang/wgsl/ast",
+ "${tint_src_dir}/lang/wgsl/common",
"${tint_src_dir}/lang/wgsl/intrinsic",
"${tint_src_dir}/lang/wgsl/program",
"${tint_src_dir}/lang/wgsl/resolver",
diff --git a/src/tint/lang/core/intrinsic/BUILD.bazel b/src/tint/lang/core/intrinsic/BUILD.bazel
index 3ad57d9..b1ba629 100644
--- a/src/tint/lang/core/intrinsic/BUILD.bazel
+++ b/src/tint/lang/core/intrinsic/BUILD.bazel
@@ -85,6 +85,7 @@
"//src/tint/lang/core/type:test",
"//src/tint/lang/wgsl",
"//src/tint/lang/wgsl/ast",
+ "//src/tint/lang/wgsl/common",
"//src/tint/lang/wgsl/intrinsic",
"//src/tint/lang/wgsl/program",
"//src/tint/lang/wgsl/resolver",
diff --git a/src/tint/lang/core/intrinsic/BUILD.cmake b/src/tint/lang/core/intrinsic/BUILD.cmake
index 29d8720..d10b9fe 100644
--- a/src/tint/lang/core/intrinsic/BUILD.cmake
+++ b/src/tint/lang/core/intrinsic/BUILD.cmake
@@ -84,6 +84,7 @@
tint_lang_core_type_test
tint_lang_wgsl
tint_lang_wgsl_ast
+ tint_lang_wgsl_common
tint_lang_wgsl_intrinsic
tint_lang_wgsl_program
tint_lang_wgsl_resolver
diff --git a/src/tint/lang/core/intrinsic/BUILD.gn b/src/tint/lang/core/intrinsic/BUILD.gn
index 0b8100e..8294126 100644
--- a/src/tint/lang/core/intrinsic/BUILD.gn
+++ b/src/tint/lang/core/intrinsic/BUILD.gn
@@ -84,6 +84,7 @@
"${tint_src_dir}/lang/core/type:unittests",
"${tint_src_dir}/lang/wgsl",
"${tint_src_dir}/lang/wgsl/ast",
+ "${tint_src_dir}/lang/wgsl/common",
"${tint_src_dir}/lang/wgsl/intrinsic",
"${tint_src_dir}/lang/wgsl/program",
"${tint_src_dir}/lang/wgsl/resolver",
diff --git a/src/tint/lang/core/ir/transform/BUILD.bazel b/src/tint/lang/core/ir/transform/BUILD.bazel
index c5b1f51..8870a6b 100644
--- a/src/tint/lang/core/ir/transform/BUILD.bazel
+++ b/src/tint/lang/core/ir/transform/BUILD.bazel
@@ -143,6 +143,7 @@
"//src/tint/lang/core/type",
"//src/tint/lang/wgsl",
"//src/tint/lang/wgsl/ast",
+ "//src/tint/lang/wgsl/common",
"//src/tint/lang/wgsl/program",
"//src/tint/lang/wgsl/sem",
"//src/tint/lang/wgsl/writer/ir_to_program",
diff --git a/src/tint/lang/core/ir/transform/BUILD.cmake b/src/tint/lang/core/ir/transform/BUILD.cmake
index 40c0852..3465e11 100644
--- a/src/tint/lang/core/ir/transform/BUILD.cmake
+++ b/src/tint/lang/core/ir/transform/BUILD.cmake
@@ -133,6 +133,7 @@
tint_lang_core_type
tint_lang_wgsl
tint_lang_wgsl_ast
+ tint_lang_wgsl_common
tint_lang_wgsl_program
tint_lang_wgsl_sem
tint_lang_wgsl_writer_ir_to_program
diff --git a/src/tint/lang/core/ir/transform/BUILD.gn b/src/tint/lang/core/ir/transform/BUILD.gn
index f4fb43e..7343823 100644
--- a/src/tint/lang/core/ir/transform/BUILD.gn
+++ b/src/tint/lang/core/ir/transform/BUILD.gn
@@ -135,6 +135,7 @@
"${tint_src_dir}/lang/core/type",
"${tint_src_dir}/lang/wgsl",
"${tint_src_dir}/lang/wgsl/ast",
+ "${tint_src_dir}/lang/wgsl/common",
"${tint_src_dir}/lang/wgsl/program",
"${tint_src_dir}/lang/wgsl/sem",
"${tint_src_dir}/lang/wgsl/writer/ir_to_program",
diff --git a/src/tint/lang/core/ir/transform/direct_variable_access_wgsl_test.cc b/src/tint/lang/core/ir/transform/direct_variable_access_wgsl_test.cc
index b619a85..f72262b 100644
--- a/src/tint/lang/core/ir/transform/direct_variable_access_wgsl_test.cc
+++ b/src/tint/lang/core/ir/transform/direct_variable_access_wgsl_test.cc
@@ -59,8 +59,10 @@
class DirectVariableAccessTest : public TransformTestBase<testing::Test> {
public:
std::string Run(std::string in, const DirectVariableAccessOptions& options = {}) {
+ wgsl::reader::Options parser_options;
+ parser_options.allowed_features = wgsl::AllowedFeatures::Everything();
Source::File file{"test", in};
- auto program = wgsl::reader::Parse(&file);
+ auto program = wgsl::reader::Parse(&file, parser_options);
if (!program.IsValid()) {
return "wgsl::reader::Parse() failed: \n" + program.Diagnostics().str();
}
diff --git a/src/tint/lang/core/type/BUILD.bazel b/src/tint/lang/core/type/BUILD.bazel
index bc1786a..0f0cbe4 100644
--- a/src/tint/lang/core/type/BUILD.bazel
+++ b/src/tint/lang/core/type/BUILD.bazel
@@ -165,6 +165,7 @@
"//src/tint/lang/core/type",
"//src/tint/lang/wgsl",
"//src/tint/lang/wgsl/ast",
+ "//src/tint/lang/wgsl/common",
"//src/tint/lang/wgsl/program",
"//src/tint/lang/wgsl/resolver",
"//src/tint/lang/wgsl/sem",
diff --git a/src/tint/lang/core/type/BUILD.cmake b/src/tint/lang/core/type/BUILD.cmake
index 3526a99..2885687 100644
--- a/src/tint/lang/core/type/BUILD.cmake
+++ b/src/tint/lang/core/type/BUILD.cmake
@@ -164,6 +164,7 @@
tint_lang_core_type
tint_lang_wgsl
tint_lang_wgsl_ast
+ tint_lang_wgsl_common
tint_lang_wgsl_program
tint_lang_wgsl_resolver
tint_lang_wgsl_sem
diff --git a/src/tint/lang/core/type/BUILD.gn b/src/tint/lang/core/type/BUILD.gn
index 7a68cce..0abcd11 100644
--- a/src/tint/lang/core/type/BUILD.gn
+++ b/src/tint/lang/core/type/BUILD.gn
@@ -166,6 +166,7 @@
"${tint_src_dir}/lang/core/type",
"${tint_src_dir}/lang/wgsl",
"${tint_src_dir}/lang/wgsl/ast",
+ "${tint_src_dir}/lang/wgsl/common",
"${tint_src_dir}/lang/wgsl/program",
"${tint_src_dir}/lang/wgsl/resolver",
"${tint_src_dir}/lang/wgsl/sem",
diff --git a/src/tint/lang/glsl/writer/ast_printer/BUILD.bazel b/src/tint/lang/glsl/writer/ast_printer/BUILD.bazel
index de7e6a6..29e2970 100644
--- a/src/tint/lang/glsl/writer/ast_printer/BUILD.bazel
+++ b/src/tint/lang/glsl/writer/ast_printer/BUILD.bazel
@@ -127,6 +127,7 @@
"//src/tint/lang/wgsl/ast",
"//src/tint/lang/wgsl/ast/transform",
"//src/tint/lang/wgsl/ast:test",
+ "//src/tint/lang/wgsl/common",
"//src/tint/lang/wgsl/program",
"//src/tint/lang/wgsl/resolver",
"//src/tint/lang/wgsl/sem",
diff --git a/src/tint/lang/glsl/writer/ast_printer/BUILD.cmake b/src/tint/lang/glsl/writer/ast_printer/BUILD.cmake
index 687d173..0b6dd27 100644
--- a/src/tint/lang/glsl/writer/ast_printer/BUILD.cmake
+++ b/src/tint/lang/glsl/writer/ast_printer/BUILD.cmake
@@ -132,6 +132,7 @@
tint_lang_wgsl_ast
tint_lang_wgsl_ast_transform
tint_lang_wgsl_ast_test
+ tint_lang_wgsl_common
tint_lang_wgsl_program
tint_lang_wgsl_resolver
tint_lang_wgsl_sem
diff --git a/src/tint/lang/glsl/writer/ast_printer/BUILD.gn b/src/tint/lang/glsl/writer/ast_printer/BUILD.gn
index bfd4c88..955ffa0 100644
--- a/src/tint/lang/glsl/writer/ast_printer/BUILD.gn
+++ b/src/tint/lang/glsl/writer/ast_printer/BUILD.gn
@@ -131,6 +131,7 @@
"${tint_src_dir}/lang/wgsl/ast",
"${tint_src_dir}/lang/wgsl/ast:unittests",
"${tint_src_dir}/lang/wgsl/ast/transform",
+ "${tint_src_dir}/lang/wgsl/common",
"${tint_src_dir}/lang/wgsl/program",
"${tint_src_dir}/lang/wgsl/resolver",
"${tint_src_dir}/lang/wgsl/sem",
diff --git a/src/tint/lang/glsl/writer/ast_printer/ast_printer_test.cc b/src/tint/lang/glsl/writer/ast_printer/ast_printer_test.cc
index 9834a54..4962165 100644
--- a/src/tint/lang/glsl/writer/ast_printer/ast_printer_test.cc
+++ b/src/tint/lang/glsl/writer/ast_printer/ast_printer_test.cc
@@ -122,13 +122,14 @@
}
TEST_F(GlslASTPrinterTest, UnsupportedExtension) {
- Enable(Source{{12, 34}}, wgsl::Extension::kUndefined);
+ Enable(Source{{12, 34}}, wgsl::Extension::kChromiumInternalRelaxedUniformLayout);
ASTPrinter& gen = Build();
ASSERT_FALSE(gen.Generate());
- EXPECT_EQ(gen.Diagnostics().str(),
- R"(12:34 error: GLSL backend does not support extension 'undefined')");
+ EXPECT_EQ(
+ gen.Diagnostics().str(),
+ R"(12:34 error: GLSL backend does not support extension 'chromium_internal_relaxed_uniform_layout')");
}
TEST_F(GlslASTPrinterTest, RequiresDirective) {
diff --git a/src/tint/lang/glsl/writer/ast_raise/BUILD.bazel b/src/tint/lang/glsl/writer/ast_raise/BUILD.bazel
index cbcc048..72bd733 100644
--- a/src/tint/lang/glsl/writer/ast_raise/BUILD.bazel
+++ b/src/tint/lang/glsl/writer/ast_raise/BUILD.bazel
@@ -59,6 +59,7 @@
"//src/tint/lang/wgsl",
"//src/tint/lang/wgsl/ast",
"//src/tint/lang/wgsl/ast/transform",
+ "//src/tint/lang/wgsl/common",
"//src/tint/lang/wgsl/program",
"//src/tint/lang/wgsl/resolver",
"//src/tint/lang/wgsl/sem",
@@ -98,6 +99,7 @@
"//src/tint/lang/wgsl",
"//src/tint/lang/wgsl/ast",
"//src/tint/lang/wgsl/ast/transform",
+ "//src/tint/lang/wgsl/common",
"//src/tint/lang/wgsl/program",
"//src/tint/lang/wgsl/sem",
"//src/tint/utils/containers",
diff --git a/src/tint/lang/glsl/writer/ast_raise/BUILD.cmake b/src/tint/lang/glsl/writer/ast_raise/BUILD.cmake
index 1b6c303..6617049 100644
--- a/src/tint/lang/glsl/writer/ast_raise/BUILD.cmake
+++ b/src/tint/lang/glsl/writer/ast_raise/BUILD.cmake
@@ -60,6 +60,7 @@
tint_lang_wgsl
tint_lang_wgsl_ast
tint_lang_wgsl_ast_transform
+ tint_lang_wgsl_common
tint_lang_wgsl_program
tint_lang_wgsl_resolver
tint_lang_wgsl_sem
@@ -102,6 +103,7 @@
tint_lang_wgsl
tint_lang_wgsl_ast
tint_lang_wgsl_ast_transform
+ tint_lang_wgsl_common
tint_lang_wgsl_program
tint_lang_wgsl_sem
tint_utils_containers
diff --git a/src/tint/lang/glsl/writer/ast_raise/BUILD.gn b/src/tint/lang/glsl/writer/ast_raise/BUILD.gn
index 260692f..5a7980b 100644
--- a/src/tint/lang/glsl/writer/ast_raise/BUILD.gn
+++ b/src/tint/lang/glsl/writer/ast_raise/BUILD.gn
@@ -62,6 +62,7 @@
"${tint_src_dir}/lang/wgsl",
"${tint_src_dir}/lang/wgsl/ast",
"${tint_src_dir}/lang/wgsl/ast/transform",
+ "${tint_src_dir}/lang/wgsl/common",
"${tint_src_dir}/lang/wgsl/program",
"${tint_src_dir}/lang/wgsl/resolver",
"${tint_src_dir}/lang/wgsl/sem",
@@ -102,6 +103,7 @@
"${tint_src_dir}/lang/wgsl",
"${tint_src_dir}/lang/wgsl/ast",
"${tint_src_dir}/lang/wgsl/ast/transform",
+ "${tint_src_dir}/lang/wgsl/common",
"${tint_src_dir}/lang/wgsl/program",
"${tint_src_dir}/lang/wgsl/sem",
"${tint_src_dir}/utils/containers",
diff --git a/src/tint/lang/hlsl/writer/ast_printer/BUILD.bazel b/src/tint/lang/hlsl/writer/ast_printer/BUILD.bazel
index 7122484..3bd3f35 100644
--- a/src/tint/lang/hlsl/writer/ast_printer/BUILD.bazel
+++ b/src/tint/lang/hlsl/writer/ast_printer/BUILD.bazel
@@ -128,6 +128,7 @@
"//src/tint/lang/wgsl/ast",
"//src/tint/lang/wgsl/ast/transform",
"//src/tint/lang/wgsl/ast:test",
+ "//src/tint/lang/wgsl/common",
"//src/tint/lang/wgsl/program",
"//src/tint/lang/wgsl/resolver",
"//src/tint/lang/wgsl/sem",
diff --git a/src/tint/lang/hlsl/writer/ast_printer/BUILD.cmake b/src/tint/lang/hlsl/writer/ast_printer/BUILD.cmake
index a0420a8..8ce9a91 100644
--- a/src/tint/lang/hlsl/writer/ast_printer/BUILD.cmake
+++ b/src/tint/lang/hlsl/writer/ast_printer/BUILD.cmake
@@ -133,6 +133,7 @@
tint_lang_wgsl_ast
tint_lang_wgsl_ast_transform
tint_lang_wgsl_ast_test
+ tint_lang_wgsl_common
tint_lang_wgsl_program
tint_lang_wgsl_resolver
tint_lang_wgsl_sem
diff --git a/src/tint/lang/hlsl/writer/ast_printer/BUILD.gn b/src/tint/lang/hlsl/writer/ast_printer/BUILD.gn
index c2a5cff..3788b50 100644
--- a/src/tint/lang/hlsl/writer/ast_printer/BUILD.gn
+++ b/src/tint/lang/hlsl/writer/ast_printer/BUILD.gn
@@ -130,6 +130,7 @@
"${tint_src_dir}/lang/wgsl/ast",
"${tint_src_dir}/lang/wgsl/ast:unittests",
"${tint_src_dir}/lang/wgsl/ast/transform",
+ "${tint_src_dir}/lang/wgsl/common",
"${tint_src_dir}/lang/wgsl/program",
"${tint_src_dir}/lang/wgsl/resolver",
"${tint_src_dir}/lang/wgsl/sem",
diff --git a/src/tint/lang/hlsl/writer/ast_printer/ast_printer_test.cc b/src/tint/lang/hlsl/writer/ast_printer/ast_printer_test.cc
index 23c9713..632907a 100644
--- a/src/tint/lang/hlsl/writer/ast_printer/ast_printer_test.cc
+++ b/src/tint/lang/hlsl/writer/ast_printer/ast_printer_test.cc
@@ -45,13 +45,14 @@
}
TEST_F(HlslASTPrinterTest, UnsupportedExtension) {
- Enable(Source{{12, 34}}, wgsl::Extension::kUndefined);
+ Enable(Source{{12, 34}}, wgsl::Extension::kChromiumInternalRelaxedUniformLayout);
ASTPrinter& gen = Build();
ASSERT_FALSE(gen.Generate());
- EXPECT_EQ(gen.Diagnostics().str(),
- R"(12:34 error: HLSL backend does not support extension 'undefined')");
+ EXPECT_EQ(
+ gen.Diagnostics().str(),
+ R"(12:34 error: HLSL backend does not support extension 'chromium_internal_relaxed_uniform_layout')");
}
TEST_F(HlslASTPrinterTest, RequiresDirective) {
diff --git a/src/tint/lang/hlsl/writer/ast_raise/BUILD.bazel b/src/tint/lang/hlsl/writer/ast_raise/BUILD.bazel
index dd78bca..71d6a18 100644
--- a/src/tint/lang/hlsl/writer/ast_raise/BUILD.bazel
+++ b/src/tint/lang/hlsl/writer/ast_raise/BUILD.bazel
@@ -62,6 +62,7 @@
"//src/tint/lang/wgsl",
"//src/tint/lang/wgsl/ast",
"//src/tint/lang/wgsl/ast/transform",
+ "//src/tint/lang/wgsl/common",
"//src/tint/lang/wgsl/program",
"//src/tint/lang/wgsl/resolver",
"//src/tint/lang/wgsl/sem",
@@ -102,6 +103,7 @@
"//src/tint/lang/wgsl",
"//src/tint/lang/wgsl/ast",
"//src/tint/lang/wgsl/ast/transform",
+ "//src/tint/lang/wgsl/common",
"//src/tint/lang/wgsl/program",
"//src/tint/lang/wgsl/sem",
"//src/tint/utils/containers",
diff --git a/src/tint/lang/hlsl/writer/ast_raise/BUILD.cmake b/src/tint/lang/hlsl/writer/ast_raise/BUILD.cmake
index 5e50b59..189d75a 100644
--- a/src/tint/lang/hlsl/writer/ast_raise/BUILD.cmake
+++ b/src/tint/lang/hlsl/writer/ast_raise/BUILD.cmake
@@ -63,6 +63,7 @@
tint_lang_wgsl
tint_lang_wgsl_ast
tint_lang_wgsl_ast_transform
+ tint_lang_wgsl_common
tint_lang_wgsl_program
tint_lang_wgsl_resolver
tint_lang_wgsl_sem
@@ -106,6 +107,7 @@
tint_lang_wgsl
tint_lang_wgsl_ast
tint_lang_wgsl_ast_transform
+ tint_lang_wgsl_common
tint_lang_wgsl_program
tint_lang_wgsl_sem
tint_utils_containers
diff --git a/src/tint/lang/hlsl/writer/ast_raise/BUILD.gn b/src/tint/lang/hlsl/writer/ast_raise/BUILD.gn
index f2641e1..0e23db4 100644
--- a/src/tint/lang/hlsl/writer/ast_raise/BUILD.gn
+++ b/src/tint/lang/hlsl/writer/ast_raise/BUILD.gn
@@ -65,6 +65,7 @@
"${tint_src_dir}/lang/wgsl",
"${tint_src_dir}/lang/wgsl/ast",
"${tint_src_dir}/lang/wgsl/ast/transform",
+ "${tint_src_dir}/lang/wgsl/common",
"${tint_src_dir}/lang/wgsl/program",
"${tint_src_dir}/lang/wgsl/resolver",
"${tint_src_dir}/lang/wgsl/sem",
@@ -106,6 +107,7 @@
"${tint_src_dir}/lang/wgsl",
"${tint_src_dir}/lang/wgsl/ast",
"${tint_src_dir}/lang/wgsl/ast/transform",
+ "${tint_src_dir}/lang/wgsl/common",
"${tint_src_dir}/lang/wgsl/program",
"${tint_src_dir}/lang/wgsl/sem",
"${tint_src_dir}/utils/containers",
diff --git a/src/tint/lang/msl/writer/ast_printer/BUILD.bazel b/src/tint/lang/msl/writer/ast_printer/BUILD.bazel
index d40d1d9..5ffc9c4 100644
--- a/src/tint/lang/msl/writer/ast_printer/BUILD.bazel
+++ b/src/tint/lang/msl/writer/ast_printer/BUILD.bazel
@@ -124,6 +124,7 @@
"//src/tint/lang/wgsl",
"//src/tint/lang/wgsl/ast",
"//src/tint/lang/wgsl/ast:test",
+ "//src/tint/lang/wgsl/common",
"//src/tint/lang/wgsl/program",
"//src/tint/lang/wgsl/resolver",
"//src/tint/lang/wgsl/sem",
diff --git a/src/tint/lang/msl/writer/ast_printer/BUILD.cmake b/src/tint/lang/msl/writer/ast_printer/BUILD.cmake
index 81b3ca6..c1c315b 100644
--- a/src/tint/lang/msl/writer/ast_printer/BUILD.cmake
+++ b/src/tint/lang/msl/writer/ast_printer/BUILD.cmake
@@ -129,6 +129,7 @@
tint_lang_wgsl
tint_lang_wgsl_ast
tint_lang_wgsl_ast_test
+ tint_lang_wgsl_common
tint_lang_wgsl_program
tint_lang_wgsl_resolver
tint_lang_wgsl_sem
diff --git a/src/tint/lang/msl/writer/ast_printer/BUILD.gn b/src/tint/lang/msl/writer/ast_printer/BUILD.gn
index bcc505a..9f46788 100644
--- a/src/tint/lang/msl/writer/ast_printer/BUILD.gn
+++ b/src/tint/lang/msl/writer/ast_printer/BUILD.gn
@@ -128,6 +128,7 @@
"${tint_src_dir}/lang/wgsl",
"${tint_src_dir}/lang/wgsl/ast",
"${tint_src_dir}/lang/wgsl/ast:unittests",
+ "${tint_src_dir}/lang/wgsl/common",
"${tint_src_dir}/lang/wgsl/program",
"${tint_src_dir}/lang/wgsl/resolver",
"${tint_src_dir}/lang/wgsl/sem",
diff --git a/src/tint/lang/msl/writer/ast_printer/ast_printer.cc b/src/tint/lang/msl/writer/ast_printer/ast_printer.cc
index 3d49d28..aed7504 100644
--- a/src/tint/lang/msl/writer/ast_printer/ast_printer.cc
+++ b/src/tint/lang/msl/writer/ast_printer/ast_printer.cc
@@ -273,7 +273,6 @@
wgsl::Extension::kChromiumExperimentalDp4A,
wgsl::Extension::kChromiumExperimentalFullPtrParameters,
wgsl::Extension::kChromiumExperimentalPixelLocal,
- wgsl::Extension::kChromiumExperimentalPushConstant,
wgsl::Extension::kChromiumExperimentalReadWriteStorageTexture,
wgsl::Extension::kChromiumExperimentalSubgroups,
wgsl::Extension::kChromiumInternalDualSourceBlending,
diff --git a/src/tint/lang/msl/writer/ast_printer/ast_printer_test.cc b/src/tint/lang/msl/writer/ast_printer/ast_printer_test.cc
index 49fa3c1..b62df62 100644
--- a/src/tint/lang/msl/writer/ast_printer/ast_printer_test.cc
+++ b/src/tint/lang/msl/writer/ast_printer/ast_printer_test.cc
@@ -49,13 +49,14 @@
}
TEST_F(MslASTPrinterTest, UnsupportedExtension) {
- Enable(Source{{12, 34}}, wgsl::Extension::kUndefined);
+ Enable(Source{{12, 34}}, wgsl::Extension::kChromiumExperimentalPushConstant);
ASTPrinter& gen = Build();
ASSERT_FALSE(gen.Generate());
- EXPECT_EQ(gen.Diagnostics().str(),
- R"(12:34 error: MSL backend does not support extension 'undefined')");
+ EXPECT_EQ(
+ gen.Diagnostics().str(),
+ R"(12:34 error: MSL backend does not support extension 'chromium_experimental_push_constant')");
}
TEST_F(MslASTPrinterTest, RequiresDirective) {
diff --git a/src/tint/lang/msl/writer/ast_raise/BUILD.bazel b/src/tint/lang/msl/writer/ast_raise/BUILD.bazel
index 01d4701..a264fb7 100644
--- a/src/tint/lang/msl/writer/ast_raise/BUILD.bazel
+++ b/src/tint/lang/msl/writer/ast_raise/BUILD.bazel
@@ -58,6 +58,7 @@
"//src/tint/lang/wgsl",
"//src/tint/lang/wgsl/ast",
"//src/tint/lang/wgsl/ast/transform",
+ "//src/tint/lang/wgsl/common",
"//src/tint/lang/wgsl/program",
"//src/tint/lang/wgsl/resolver",
"//src/tint/lang/wgsl/sem",
@@ -96,6 +97,7 @@
"//src/tint/lang/wgsl",
"//src/tint/lang/wgsl/ast",
"//src/tint/lang/wgsl/ast/transform",
+ "//src/tint/lang/wgsl/common",
"//src/tint/lang/wgsl/program",
"//src/tint/lang/wgsl/resolver",
"//src/tint/lang/wgsl/sem",
diff --git a/src/tint/lang/msl/writer/ast_raise/BUILD.cmake b/src/tint/lang/msl/writer/ast_raise/BUILD.cmake
index 7a32d15..f0a8790 100644
--- a/src/tint/lang/msl/writer/ast_raise/BUILD.cmake
+++ b/src/tint/lang/msl/writer/ast_raise/BUILD.cmake
@@ -59,6 +59,7 @@
tint_lang_wgsl
tint_lang_wgsl_ast
tint_lang_wgsl_ast_transform
+ tint_lang_wgsl_common
tint_lang_wgsl_program
tint_lang_wgsl_resolver
tint_lang_wgsl_sem
@@ -100,6 +101,7 @@
tint_lang_wgsl
tint_lang_wgsl_ast
tint_lang_wgsl_ast_transform
+ tint_lang_wgsl_common
tint_lang_wgsl_program
tint_lang_wgsl_resolver
tint_lang_wgsl_sem
diff --git a/src/tint/lang/msl/writer/ast_raise/BUILD.gn b/src/tint/lang/msl/writer/ast_raise/BUILD.gn
index ece515f..6dff3c9 100644
--- a/src/tint/lang/msl/writer/ast_raise/BUILD.gn
+++ b/src/tint/lang/msl/writer/ast_raise/BUILD.gn
@@ -61,6 +61,7 @@
"${tint_src_dir}/lang/wgsl",
"${tint_src_dir}/lang/wgsl/ast",
"${tint_src_dir}/lang/wgsl/ast/transform",
+ "${tint_src_dir}/lang/wgsl/common",
"${tint_src_dir}/lang/wgsl/program",
"${tint_src_dir}/lang/wgsl/resolver",
"${tint_src_dir}/lang/wgsl/sem",
@@ -100,6 +101,7 @@
"${tint_src_dir}/lang/wgsl",
"${tint_src_dir}/lang/wgsl/ast",
"${tint_src_dir}/lang/wgsl/ast/transform",
+ "${tint_src_dir}/lang/wgsl/common",
"${tint_src_dir}/lang/wgsl/program",
"${tint_src_dir}/lang/wgsl/resolver",
"${tint_src_dir}/lang/wgsl/sem",
diff --git a/src/tint/lang/spirv/reader/BUILD.bazel b/src/tint/lang/spirv/reader/BUILD.bazel
index bc9853b..7d88550 100644
--- a/src/tint/lang/spirv/reader/BUILD.bazel
+++ b/src/tint/lang/spirv/reader/BUILD.bazel
@@ -51,6 +51,7 @@
"//src/tint/lang/spirv/reader/common",
"//src/tint/lang/wgsl",
"//src/tint/lang/wgsl/ast",
+ "//src/tint/lang/wgsl/common",
"//src/tint/lang/wgsl/program",
"//src/tint/lang/wgsl/sem",
"//src/tint/utils/containers",
@@ -60,6 +61,7 @@
"//src/tint/utils/macros",
"//src/tint/utils/math",
"//src/tint/utils/memory",
+ "//src/tint/utils/reflection",
"//src/tint/utils/result",
"//src/tint/utils/rtti",
"//src/tint/utils/symbol",
diff --git a/src/tint/lang/spirv/reader/BUILD.cmake b/src/tint/lang/spirv/reader/BUILD.cmake
index 99add41..540b7b4 100644
--- a/src/tint/lang/spirv/reader/BUILD.cmake
+++ b/src/tint/lang/spirv/reader/BUILD.cmake
@@ -56,6 +56,7 @@
tint_lang_spirv_reader_common
tint_lang_wgsl
tint_lang_wgsl_ast
+ tint_lang_wgsl_common
tint_lang_wgsl_program
tint_lang_wgsl_sem
tint_utils_containers
@@ -65,6 +66,7 @@
tint_utils_macros
tint_utils_math
tint_utils_memory
+ tint_utils_reflection
tint_utils_result
tint_utils_rtti
tint_utils_symbol
diff --git a/src/tint/lang/spirv/reader/BUILD.gn b/src/tint/lang/spirv/reader/BUILD.gn
index f82c090..2b415fb 100644
--- a/src/tint/lang/spirv/reader/BUILD.gn
+++ b/src/tint/lang/spirv/reader/BUILD.gn
@@ -50,6 +50,7 @@
"${tint_src_dir}/lang/spirv/reader/common",
"${tint_src_dir}/lang/wgsl",
"${tint_src_dir}/lang/wgsl/ast",
+ "${tint_src_dir}/lang/wgsl/common",
"${tint_src_dir}/lang/wgsl/program",
"${tint_src_dir}/lang/wgsl/sem",
"${tint_src_dir}/utils/containers",
@@ -59,6 +60,7 @@
"${tint_src_dir}/utils/macros",
"${tint_src_dir}/utils/math",
"${tint_src_dir}/utils/memory",
+ "${tint_src_dir}/utils/reflection",
"${tint_src_dir}/utils/result",
"${tint_src_dir}/utils/rtti",
"${tint_src_dir}/utils/symbol",
diff --git a/src/tint/lang/spirv/reader/ast_lower/BUILD.bazel b/src/tint/lang/spirv/reader/ast_lower/BUILD.bazel
index 84a991c..5f667a1 100644
--- a/src/tint/lang/spirv/reader/ast_lower/BUILD.bazel
+++ b/src/tint/lang/spirv/reader/ast_lower/BUILD.bazel
@@ -58,6 +58,7 @@
"//src/tint/lang/wgsl",
"//src/tint/lang/wgsl/ast",
"//src/tint/lang/wgsl/ast/transform",
+ "//src/tint/lang/wgsl/common",
"//src/tint/lang/wgsl/program",
"//src/tint/lang/wgsl/resolver",
"//src/tint/lang/wgsl/sem",
@@ -96,6 +97,7 @@
"//src/tint/lang/wgsl",
"//src/tint/lang/wgsl/ast",
"//src/tint/lang/wgsl/ast/transform",
+ "//src/tint/lang/wgsl/common",
"//src/tint/lang/wgsl/program",
"//src/tint/lang/wgsl/resolver",
"//src/tint/lang/wgsl/sem",
diff --git a/src/tint/lang/spirv/reader/ast_lower/BUILD.cmake b/src/tint/lang/spirv/reader/ast_lower/BUILD.cmake
index c06da8c..f73503c 100644
--- a/src/tint/lang/spirv/reader/ast_lower/BUILD.cmake
+++ b/src/tint/lang/spirv/reader/ast_lower/BUILD.cmake
@@ -59,6 +59,7 @@
tint_lang_wgsl
tint_lang_wgsl_ast
tint_lang_wgsl_ast_transform
+ tint_lang_wgsl_common
tint_lang_wgsl_program
tint_lang_wgsl_resolver
tint_lang_wgsl_sem
@@ -100,6 +101,7 @@
tint_lang_wgsl
tint_lang_wgsl_ast
tint_lang_wgsl_ast_transform
+ tint_lang_wgsl_common
tint_lang_wgsl_program
tint_lang_wgsl_resolver
tint_lang_wgsl_sem
diff --git a/src/tint/lang/spirv/reader/ast_lower/BUILD.gn b/src/tint/lang/spirv/reader/ast_lower/BUILD.gn
index 758dc8c..d904f52 100644
--- a/src/tint/lang/spirv/reader/ast_lower/BUILD.gn
+++ b/src/tint/lang/spirv/reader/ast_lower/BUILD.gn
@@ -61,6 +61,7 @@
"${tint_src_dir}/lang/wgsl",
"${tint_src_dir}/lang/wgsl/ast",
"${tint_src_dir}/lang/wgsl/ast/transform",
+ "${tint_src_dir}/lang/wgsl/common",
"${tint_src_dir}/lang/wgsl/program",
"${tint_src_dir}/lang/wgsl/resolver",
"${tint_src_dir}/lang/wgsl/sem",
@@ -100,6 +101,7 @@
"${tint_src_dir}/lang/wgsl",
"${tint_src_dir}/lang/wgsl/ast",
"${tint_src_dir}/lang/wgsl/ast/transform",
+ "${tint_src_dir}/lang/wgsl/common",
"${tint_src_dir}/lang/wgsl/program",
"${tint_src_dir}/lang/wgsl/resolver",
"${tint_src_dir}/lang/wgsl/sem",
diff --git a/src/tint/lang/spirv/reader/ast_parser/BUILD.bazel b/src/tint/lang/spirv/reader/ast_parser/BUILD.bazel
index c900e06..3afb571 100644
--- a/src/tint/lang/spirv/reader/ast_parser/BUILD.bazel
+++ b/src/tint/lang/spirv/reader/ast_parser/BUILD.bazel
@@ -71,6 +71,7 @@
"//src/tint/lang/wgsl",
"//src/tint/lang/wgsl/ast",
"//src/tint/lang/wgsl/ast/transform",
+ "//src/tint/lang/wgsl/common",
"//src/tint/lang/wgsl/program",
"//src/tint/lang/wgsl/resolver",
"//src/tint/lang/wgsl/sem",
@@ -149,6 +150,7 @@
"//src/tint/lang/spirv/reader/common",
"//src/tint/lang/wgsl",
"//src/tint/lang/wgsl/ast",
+ "//src/tint/lang/wgsl/common",
"//src/tint/lang/wgsl/program",
"//src/tint/lang/wgsl/sem",
"//src/tint/utils/containers",
diff --git a/src/tint/lang/spirv/reader/ast_parser/BUILD.cmake b/src/tint/lang/spirv/reader/ast_parser/BUILD.cmake
index 4ca0c57..6316fb3 100644
--- a/src/tint/lang/spirv/reader/ast_parser/BUILD.cmake
+++ b/src/tint/lang/spirv/reader/ast_parser/BUILD.cmake
@@ -72,6 +72,7 @@
tint_lang_wgsl
tint_lang_wgsl_ast
tint_lang_wgsl_ast_transform
+ tint_lang_wgsl_common
tint_lang_wgsl_program
tint_lang_wgsl_resolver
tint_lang_wgsl_sem
@@ -155,6 +156,7 @@
tint_lang_spirv_reader_common
tint_lang_wgsl
tint_lang_wgsl_ast
+ tint_lang_wgsl_common
tint_lang_wgsl_program
tint_lang_wgsl_sem
tint_utils_containers
diff --git a/src/tint/lang/spirv/reader/ast_parser/BUILD.gn b/src/tint/lang/spirv/reader/ast_parser/BUILD.gn
index 636ed27..85be154 100644
--- a/src/tint/lang/spirv/reader/ast_parser/BUILD.gn
+++ b/src/tint/lang/spirv/reader/ast_parser/BUILD.gn
@@ -74,6 +74,7 @@
"${tint_src_dir}/lang/wgsl",
"${tint_src_dir}/lang/wgsl/ast",
"${tint_src_dir}/lang/wgsl/ast/transform",
+ "${tint_src_dir}/lang/wgsl/common",
"${tint_src_dir}/lang/wgsl/program",
"${tint_src_dir}/lang/wgsl/resolver",
"${tint_src_dir}/lang/wgsl/sem",
@@ -155,6 +156,7 @@
"${tint_src_dir}/lang/spirv/reader/common",
"${tint_src_dir}/lang/wgsl",
"${tint_src_dir}/lang/wgsl/ast",
+ "${tint_src_dir}/lang/wgsl/common",
"${tint_src_dir}/lang/wgsl/program",
"${tint_src_dir}/lang/wgsl/sem",
"${tint_src_dir}/utils/containers",
diff --git a/src/tint/lang/spirv/reader/ast_parser/parse.cc b/src/tint/lang/spirv/reader/ast_parser/parse.cc
index 94c4355..e3f8cf6 100644
--- a/src/tint/lang/spirv/reader/ast_parser/parse.cc
+++ b/src/tint/lang/spirv/reader/ast_parser/parse.cc
@@ -60,41 +60,13 @@
builder.DiagnosticDirective(wgsl::DiagnosticSeverity::kOff, "derivative_uniformity");
}
- if (!options.allow_chromium_extensions) {
- // Check if any Chromium extensions were used.
- for (auto* enable : builder.AST().Enables()) {
- for (auto* extension : enable->extensions) {
- switch (extension->name) {
- case wgsl::Extension::kUndefined:
- case wgsl::Extension::kChromiumDisableUniformityAnalysis:
- case wgsl::Extension::kChromiumExperimentalDp4A:
- case wgsl::Extension::kChromiumExperimentalFullPtrParameters:
- case wgsl::Extension::kChromiumExperimentalPixelLocal:
- case wgsl::Extension::kChromiumExperimentalPushConstant:
- case wgsl::Extension::kChromiumExperimentalSubgroups:
- case wgsl::Extension::kChromiumInternalDualSourceBlending:
- case wgsl::Extension::kChromiumInternalRelaxedUniformLayout: {
- StringStream ss;
- ss << "module requires " << ToString(extension->name)
- << ", but 'allow-chromium-extensions' was not passed";
- builder.Diagnostics().add_error(diag::System::Reader, ss.str());
- return Program(std::move(builder));
- }
- case wgsl::Extension::kF16:
- case wgsl::Extension::kChromiumExperimentalReadWriteStorageTexture:
- break;
- }
- }
- }
- }
-
// The SPIR-V parser can construct disjoint AST nodes, which is invalid for
// the Resolver. Clone the Program to clean these up.
Program program_with_disjoint_ast(std::move(builder));
ProgramBuilder output;
program::CloneContext(&output, &program_with_disjoint_ast, false).Clone();
- auto program = Program(resolver::Resolve(output));
+ auto program = Program(resolver::Resolve(output, options.allowed_features));
if (!program.IsValid()) {
return program;
}
diff --git a/src/tint/lang/spirv/reader/common/BUILD.bazel b/src/tint/lang/spirv/reader/common/BUILD.bazel
index 568c114..0700a25 100644
--- a/src/tint/lang/spirv/reader/common/BUILD.bazel
+++ b/src/tint/lang/spirv/reader/common/BUILD.bazel
@@ -45,6 +45,16 @@
"options.h",
],
deps = [
+ "//src/tint/lang/wgsl",
+ "//src/tint/lang/wgsl/common",
+ "//src/tint/utils/containers",
+ "//src/tint/utils/ice",
+ "//src/tint/utils/macros",
+ "//src/tint/utils/math",
+ "//src/tint/utils/memory",
+ "//src/tint/utils/reflection",
+ "//src/tint/utils/rtti",
+ "//src/tint/utils/traits",
],
copts = COPTS,
visibility = ["//visibility:public"],
diff --git a/src/tint/lang/spirv/reader/common/BUILD.cmake b/src/tint/lang/spirv/reader/common/BUILD.cmake
index 4aa8158..871983e 100644
--- a/src/tint/lang/spirv/reader/common/BUILD.cmake
+++ b/src/tint/lang/spirv/reader/common/BUILD.cmake
@@ -42,3 +42,16 @@
lang/spirv/reader/common/common.cc
lang/spirv/reader/common/options.h
)
+
+tint_target_add_dependencies(tint_lang_spirv_reader_common lib
+ tint_lang_wgsl
+ tint_lang_wgsl_common
+ tint_utils_containers
+ tint_utils_ice
+ tint_utils_macros
+ tint_utils_math
+ tint_utils_memory
+ tint_utils_reflection
+ tint_utils_rtti
+ tint_utils_traits
+)
diff --git a/src/tint/lang/spirv/reader/common/BUILD.gn b/src/tint/lang/spirv/reader/common/BUILD.gn
index 9f7b5c0..391f597 100644
--- a/src/tint/lang/spirv/reader/common/BUILD.gn
+++ b/src/tint/lang/spirv/reader/common/BUILD.gn
@@ -43,5 +43,16 @@
"common.cc",
"options.h",
]
- deps = []
+ deps = [
+ "${tint_src_dir}/lang/wgsl",
+ "${tint_src_dir}/lang/wgsl/common",
+ "${tint_src_dir}/utils/containers",
+ "${tint_src_dir}/utils/ice",
+ "${tint_src_dir}/utils/macros",
+ "${tint_src_dir}/utils/math",
+ "${tint_src_dir}/utils/memory",
+ "${tint_src_dir}/utils/reflection",
+ "${tint_src_dir}/utils/rtti",
+ "${tint_src_dir}/utils/traits",
+ ]
}
diff --git a/src/tint/lang/spirv/reader/common/options.h b/src/tint/lang/spirv/reader/common/options.h
index 7f21c3e..34e572f 100644
--- a/src/tint/lang/spirv/reader/common/options.h
+++ b/src/tint/lang/spirv/reader/common/options.h
@@ -28,14 +28,17 @@
#ifndef SRC_TINT_LANG_SPIRV_READER_COMMON_OPTIONS_H_
#define SRC_TINT_LANG_SPIRV_READER_COMMON_OPTIONS_H_
+#include "src/tint/lang/wgsl/common/allowed_features.h"
+
namespace tint::spirv::reader {
/// Options that control how the SPIR-V parser should behave.
struct Options {
/// Set to `true` to allow calls to derivative builtins in non-uniform control flow.
bool allow_non_uniform_derivatives = false;
- /// Set to `true` to allow use of Chromium-specific extensions.
- bool allow_chromium_extensions = false;
+ // TODO(jrprice): Remove this when SPIR-V -> IR and IR -> WGSL are separate steps.
+ /// The extensions and language features that are allowed to be used in the generated WGSL.
+ wgsl::AllowedFeatures allowed_features = {};
};
} // namespace tint::spirv::reader
diff --git a/src/tint/lang/spirv/writer/ast_printer/BUILD.bazel b/src/tint/lang/spirv/writer/ast_printer/BUILD.bazel
index 256d92d..40919cf 100644
--- a/src/tint/lang/spirv/writer/ast_printer/BUILD.bazel
+++ b/src/tint/lang/spirv/writer/ast_printer/BUILD.bazel
@@ -128,6 +128,7 @@
"//src/tint/lang/wgsl",
"//src/tint/lang/wgsl/ast",
"//src/tint/lang/wgsl/ast:test",
+ "//src/tint/lang/wgsl/common",
"//src/tint/lang/wgsl/program",
"//src/tint/lang/wgsl/resolver",
"//src/tint/lang/wgsl/sem",
diff --git a/src/tint/lang/spirv/writer/ast_printer/BUILD.cmake b/src/tint/lang/spirv/writer/ast_printer/BUILD.cmake
index f9a06e5..e1f6e05 100644
--- a/src/tint/lang/spirv/writer/ast_printer/BUILD.cmake
+++ b/src/tint/lang/spirv/writer/ast_printer/BUILD.cmake
@@ -134,6 +134,7 @@
tint_lang_wgsl
tint_lang_wgsl_ast
tint_lang_wgsl_ast_test
+ tint_lang_wgsl_common
tint_lang_wgsl_program
tint_lang_wgsl_resolver
tint_lang_wgsl_sem
diff --git a/src/tint/lang/spirv/writer/ast_printer/BUILD.gn b/src/tint/lang/spirv/writer/ast_printer/BUILD.gn
index 48af55c..12b2c96 100644
--- a/src/tint/lang/spirv/writer/ast_printer/BUILD.gn
+++ b/src/tint/lang/spirv/writer/ast_printer/BUILD.gn
@@ -131,6 +131,7 @@
"${tint_src_dir}/lang/wgsl",
"${tint_src_dir}/lang/wgsl/ast",
"${tint_src_dir}/lang/wgsl/ast:unittests",
+ "${tint_src_dir}/lang/wgsl/common",
"${tint_src_dir}/lang/wgsl/program",
"${tint_src_dir}/lang/wgsl/resolver",
"${tint_src_dir}/lang/wgsl/sem",
diff --git a/src/tint/lang/spirv/writer/ast_printer/ast_printer_test.cc b/src/tint/lang/spirv/writer/ast_printer/ast_printer_test.cc
index 9fda078..5cbe8d4 100644
--- a/src/tint/lang/spirv/writer/ast_printer/ast_printer_test.cc
+++ b/src/tint/lang/spirv/writer/ast_printer/ast_printer_test.cc
@@ -44,13 +44,14 @@
}
TEST_F(SpirvASTPrinterTest, UnsupportedExtension) {
- Enable(Source{{12, 34}}, wgsl::Extension::kUndefined);
+ Enable(Source{{12, 34}}, wgsl::Extension::kChromiumInternalRelaxedUniformLayout);
auto program = resolver::Resolve(*this);
auto result = Generate(program, Options{});
EXPECT_FALSE(result);
- EXPECT_EQ(result.Failure().reason.str(),
- R"(12:34 error: SPIR-V backend does not support extension 'undefined')");
+ EXPECT_EQ(
+ result.Failure().reason.str(),
+ R"(12:34 error: SPIR-V backend does not support extension 'chromium_internal_relaxed_uniform_layout')");
}
TEST_F(SpirvASTPrinterTest, RequiresDirective) {
diff --git a/src/tint/lang/spirv/writer/ast_raise/BUILD.bazel b/src/tint/lang/spirv/writer/ast_raise/BUILD.bazel
index ff8c060..4dd9ee8 100644
--- a/src/tint/lang/spirv/writer/ast_raise/BUILD.bazel
+++ b/src/tint/lang/spirv/writer/ast_raise/BUILD.bazel
@@ -62,6 +62,7 @@
"//src/tint/lang/wgsl",
"//src/tint/lang/wgsl/ast",
"//src/tint/lang/wgsl/ast/transform",
+ "//src/tint/lang/wgsl/common",
"//src/tint/lang/wgsl/program",
"//src/tint/lang/wgsl/resolver",
"//src/tint/lang/wgsl/sem",
@@ -102,6 +103,7 @@
"//src/tint/lang/wgsl",
"//src/tint/lang/wgsl/ast",
"//src/tint/lang/wgsl/ast/transform",
+ "//src/tint/lang/wgsl/common",
"//src/tint/lang/wgsl/program",
"//src/tint/lang/wgsl/sem",
"//src/tint/utils/containers",
diff --git a/src/tint/lang/spirv/writer/ast_raise/BUILD.cmake b/src/tint/lang/spirv/writer/ast_raise/BUILD.cmake
index 8d6be5d..a3ac9dd 100644
--- a/src/tint/lang/spirv/writer/ast_raise/BUILD.cmake
+++ b/src/tint/lang/spirv/writer/ast_raise/BUILD.cmake
@@ -63,6 +63,7 @@
tint_lang_wgsl
tint_lang_wgsl_ast
tint_lang_wgsl_ast_transform
+ tint_lang_wgsl_common
tint_lang_wgsl_program
tint_lang_wgsl_resolver
tint_lang_wgsl_sem
@@ -106,6 +107,7 @@
tint_lang_wgsl
tint_lang_wgsl_ast
tint_lang_wgsl_ast_transform
+ tint_lang_wgsl_common
tint_lang_wgsl_program
tint_lang_wgsl_sem
tint_utils_containers
diff --git a/src/tint/lang/spirv/writer/ast_raise/BUILD.gn b/src/tint/lang/spirv/writer/ast_raise/BUILD.gn
index d4652bb..b54c6fc 100644
--- a/src/tint/lang/spirv/writer/ast_raise/BUILD.gn
+++ b/src/tint/lang/spirv/writer/ast_raise/BUILD.gn
@@ -65,6 +65,7 @@
"${tint_src_dir}/lang/wgsl",
"${tint_src_dir}/lang/wgsl/ast",
"${tint_src_dir}/lang/wgsl/ast/transform",
+ "${tint_src_dir}/lang/wgsl/common",
"${tint_src_dir}/lang/wgsl/program",
"${tint_src_dir}/lang/wgsl/resolver",
"${tint_src_dir}/lang/wgsl/sem",
@@ -106,6 +107,7 @@
"${tint_src_dir}/lang/wgsl",
"${tint_src_dir}/lang/wgsl/ast",
"${tint_src_dir}/lang/wgsl/ast/transform",
+ "${tint_src_dir}/lang/wgsl/common",
"${tint_src_dir}/lang/wgsl/program",
"${tint_src_dir}/lang/wgsl/sem",
"${tint_src_dir}/utils/containers",
diff --git a/src/tint/lang/wgsl/BUILD.bazel b/src/tint/lang/wgsl/BUILD.bazel
index 0dd8726..72a4cc6 100644
--- a/src/tint/lang/wgsl/BUILD.bazel
+++ b/src/tint/lang/wgsl/BUILD.bazel
@@ -93,6 +93,7 @@
"//src/tint/lang/core/type",
"//src/tint/lang/wgsl",
"//src/tint/lang/wgsl/ast",
+ "//src/tint/lang/wgsl/common",
"//src/tint/lang/wgsl/helpers:test",
"//src/tint/lang/wgsl/program",
"//src/tint/lang/wgsl/reader/lower",
diff --git a/src/tint/lang/wgsl/BUILD.cmake b/src/tint/lang/wgsl/BUILD.cmake
index 7a1599d..7e09df7 100644
--- a/src/tint/lang/wgsl/BUILD.cmake
+++ b/src/tint/lang/wgsl/BUILD.cmake
@@ -35,6 +35,7 @@
################################################################################
include(lang/wgsl/ast/BUILD.cmake)
+include(lang/wgsl/common/BUILD.cmake)
include(lang/wgsl/helpers/BUILD.cmake)
include(lang/wgsl/inspector/BUILD.cmake)
include(lang/wgsl/intrinsic/BUILD.cmake)
@@ -94,6 +95,7 @@
tint_lang_core_type
tint_lang_wgsl
tint_lang_wgsl_ast
+ tint_lang_wgsl_common
tint_lang_wgsl_helpers_test
tint_lang_wgsl_program
tint_lang_wgsl_reader_lower
@@ -180,6 +182,7 @@
tint_lang_core_type
tint_lang_wgsl
tint_lang_wgsl_ast
+ tint_lang_wgsl_common
tint_lang_wgsl_helpers
tint_lang_wgsl_program
tint_lang_wgsl_reader_lower
diff --git a/src/tint/lang/wgsl/BUILD.gn b/src/tint/lang/wgsl/BUILD.gn
index 619e1f8..e27e459 100644
--- a/src/tint/lang/wgsl/BUILD.gn
+++ b/src/tint/lang/wgsl/BUILD.gn
@@ -85,6 +85,7 @@
"${tint_src_dir}/lang/core/type",
"${tint_src_dir}/lang/wgsl",
"${tint_src_dir}/lang/wgsl/ast",
+ "${tint_src_dir}/lang/wgsl/common",
"${tint_src_dir}/lang/wgsl/helpers:unittests",
"${tint_src_dir}/lang/wgsl/program",
"${tint_src_dir}/lang/wgsl/reader/lower",
@@ -155,6 +156,7 @@
"${tint_src_dir}/lang/core/type",
"${tint_src_dir}/lang/wgsl",
"${tint_src_dir}/lang/wgsl/ast",
+ "${tint_src_dir}/lang/wgsl/common",
"${tint_src_dir}/lang/wgsl/helpers",
"${tint_src_dir}/lang/wgsl/program",
"${tint_src_dir}/lang/wgsl/reader/lower",
diff --git a/src/tint/lang/wgsl/ast/BUILD.bazel b/src/tint/lang/wgsl/ast/BUILD.bazel
index bc6462d..31601b6 100644
--- a/src/tint/lang/wgsl/ast/BUILD.bazel
+++ b/src/tint/lang/wgsl/ast/BUILD.bazel
@@ -309,6 +309,7 @@
"//src/tint/lang/wgsl",
"//src/tint/lang/wgsl/ast",
"//src/tint/lang/wgsl/ast/transform",
+ "//src/tint/lang/wgsl/common",
"//src/tint/lang/wgsl/program",
"//src/tint/lang/wgsl/resolver",
"//src/tint/lang/wgsl/sem",
diff --git a/src/tint/lang/wgsl/ast/BUILD.cmake b/src/tint/lang/wgsl/ast/BUILD.cmake
index e35a8b1..ebad7e9 100644
--- a/src/tint/lang/wgsl/ast/BUILD.cmake
+++ b/src/tint/lang/wgsl/ast/BUILD.cmake
@@ -301,6 +301,7 @@
tint_lang_wgsl
tint_lang_wgsl_ast
tint_lang_wgsl_ast_transform
+ tint_lang_wgsl_common
tint_lang_wgsl_program
tint_lang_wgsl_resolver
tint_lang_wgsl_sem
diff --git a/src/tint/lang/wgsl/ast/BUILD.gn b/src/tint/lang/wgsl/ast/BUILD.gn
index 9c36fd0..4580e46 100644
--- a/src/tint/lang/wgsl/ast/BUILD.gn
+++ b/src/tint/lang/wgsl/ast/BUILD.gn
@@ -301,6 +301,7 @@
"${tint_src_dir}/lang/wgsl",
"${tint_src_dir}/lang/wgsl/ast",
"${tint_src_dir}/lang/wgsl/ast/transform",
+ "${tint_src_dir}/lang/wgsl/common",
"${tint_src_dir}/lang/wgsl/program",
"${tint_src_dir}/lang/wgsl/resolver",
"${tint_src_dir}/lang/wgsl/sem",
diff --git a/src/tint/lang/wgsl/ast/module_clone_test.cc b/src/tint/lang/wgsl/ast/module_clone_test.cc
index 3444805..57386ce 100644
--- a/src/tint/lang/wgsl/ast/module_clone_test.cc
+++ b/src/tint/lang/wgsl/ast/module_clone_test.cc
@@ -136,7 +136,9 @@
)");
// Parse the wgsl, create the src program
- auto src = wgsl::reader::Parse(&file);
+ wgsl::reader::Options parser_options;
+ parser_options.allowed_features = wgsl::AllowedFeatures::Everything();
+ auto src = wgsl::reader::Parse(&file, parser_options);
ASSERT_TRUE(src.IsValid()) << src.Diagnostics();
diff --git a/src/tint/lang/wgsl/ast/transform/BUILD.bazel b/src/tint/lang/wgsl/ast/transform/BUILD.bazel
index 9fae0da..6410632 100644
--- a/src/tint/lang/wgsl/ast/transform/BUILD.bazel
+++ b/src/tint/lang/wgsl/ast/transform/BUILD.bazel
@@ -114,6 +114,7 @@
"//src/tint/lang/core/type",
"//src/tint/lang/wgsl",
"//src/tint/lang/wgsl/ast",
+ "//src/tint/lang/wgsl/common",
"//src/tint/lang/wgsl/program",
"//src/tint/lang/wgsl/resolver",
"//src/tint/lang/wgsl/sem",
@@ -185,6 +186,7 @@
"//src/tint/lang/wgsl/ast",
"//src/tint/lang/wgsl/ast/transform",
"//src/tint/lang/wgsl/ast:test",
+ "//src/tint/lang/wgsl/common",
"//src/tint/lang/wgsl/program",
"//src/tint/lang/wgsl/resolver",
"//src/tint/lang/wgsl/sem",
diff --git a/src/tint/lang/wgsl/ast/transform/BUILD.cmake b/src/tint/lang/wgsl/ast/transform/BUILD.cmake
index af6a354..9100dc7 100644
--- a/src/tint/lang/wgsl/ast/transform/BUILD.cmake
+++ b/src/tint/lang/wgsl/ast/transform/BUILD.cmake
@@ -113,6 +113,7 @@
tint_lang_core_type
tint_lang_wgsl
tint_lang_wgsl_ast
+ tint_lang_wgsl_common
tint_lang_wgsl_program
tint_lang_wgsl_resolver
tint_lang_wgsl_sem
@@ -186,6 +187,7 @@
tint_lang_wgsl_ast
tint_lang_wgsl_ast_transform
tint_lang_wgsl_ast_test
+ tint_lang_wgsl_common
tint_lang_wgsl_program
tint_lang_wgsl_resolver
tint_lang_wgsl_sem
diff --git a/src/tint/lang/wgsl/ast/transform/BUILD.gn b/src/tint/lang/wgsl/ast/transform/BUILD.gn
index 46777b2..0a1bc92 100644
--- a/src/tint/lang/wgsl/ast/transform/BUILD.gn
+++ b/src/tint/lang/wgsl/ast/transform/BUILD.gn
@@ -117,6 +117,7 @@
"${tint_src_dir}/lang/core/type",
"${tint_src_dir}/lang/wgsl",
"${tint_src_dir}/lang/wgsl/ast",
+ "${tint_src_dir}/lang/wgsl/common",
"${tint_src_dir}/lang/wgsl/program",
"${tint_src_dir}/lang/wgsl/resolver",
"${tint_src_dir}/lang/wgsl/sem",
@@ -187,6 +188,7 @@
"${tint_src_dir}/lang/wgsl/ast",
"${tint_src_dir}/lang/wgsl/ast:unittests",
"${tint_src_dir}/lang/wgsl/ast/transform",
+ "${tint_src_dir}/lang/wgsl/common",
"${tint_src_dir}/lang/wgsl/program",
"${tint_src_dir}/lang/wgsl/resolver",
"${tint_src_dir}/lang/wgsl/sem",
diff --git a/src/tint/lang/wgsl/ast/transform/helper_test.h b/src/tint/lang/wgsl/ast/transform/helper_test.h
index a4e69fa..b7e5121 100644
--- a/src/tint/lang/wgsl/ast/transform/helper_test.h
+++ b/src/tint/lang/wgsl/ast/transform/helper_test.h
@@ -94,8 +94,10 @@
/// @return the transformed output
template <typename... TRANSFORMS>
Output Run(std::string in, const DataMap& data = {}) {
+ wgsl::reader::Options options;
+ options.allowed_features = wgsl::AllowedFeatures::Everything();
auto file = std::make_unique<Source::File>("test", in);
- auto program = wgsl::reader::Parse(file.get());
+ auto program = wgsl::reader::Parse(file.get(), options);
// Keep this pointer alive after Transform() returns
files_.emplace_back(std::move(file));
@@ -153,8 +155,10 @@
/// @return true if the transform should be run for the given input.
template <typename TRANSFORM>
bool ShouldRun(std::string in, const DataMap& data = {}) {
+ wgsl::reader::Options options;
+ options.allowed_features = wgsl::AllowedFeatures::Everything();
auto file = std::make_unique<Source::File>("test", in);
- auto program = wgsl::reader::Parse(file.get());
+ auto program = wgsl::reader::Parse(file.get(), options);
return ShouldRun<TRANSFORM>(std::move(program), data);
}
diff --git a/src/tint/lang/wgsl/common/BUILD.bazel b/src/tint/lang/wgsl/common/BUILD.bazel
new file mode 100644
index 0000000..d587bc9
--- /dev/null
+++ b/src/tint/lang/wgsl/common/BUILD.bazel
@@ -0,0 +1,61 @@
+# Copyright 2023 The Dawn & Tint Authors
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+#
+# 1. Redistributions of source code must retain the above copyright notice, this
+# list of conditions and the following disclaimer.
+#
+# 2. Redistributions in binary form must reproduce the above copyright notice,
+# this list of conditions and the following disclaimer in the documentation
+# and/or other materials provided with the distribution.
+#
+# 3. Neither the name of the copyright holder nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+################################################################################
+# File generated by 'tools/src/cmd/gen' using the template:
+# tools/src/cmd/gen/build/BUILD.bazel.tmpl
+#
+# To regenerate run: './tools/run gen'
+#
+# Do not modify this file directly
+################################################################################
+
+load("//src/tint:flags.bzl", "COPTS")
+load("@bazel_skylib//lib:selects.bzl", "selects")
+cc_library(
+ name = "common",
+ srcs = [
+ "common.cc",
+ ],
+ hdrs = [
+ "allowed_features.h",
+ ],
+ deps = [
+ "//src/tint/lang/wgsl",
+ "//src/tint/utils/containers",
+ "//src/tint/utils/ice",
+ "//src/tint/utils/macros",
+ "//src/tint/utils/math",
+ "//src/tint/utils/memory",
+ "//src/tint/utils/reflection",
+ "//src/tint/utils/rtti",
+ "//src/tint/utils/traits",
+ ],
+ copts = COPTS,
+ visibility = ["//visibility:public"],
+)
+
diff --git a/src/tint/lang/wgsl/common/BUILD.cmake b/src/tint/lang/wgsl/common/BUILD.cmake
new file mode 100644
index 0000000..e99cd84
--- /dev/null
+++ b/src/tint/lang/wgsl/common/BUILD.cmake
@@ -0,0 +1,56 @@
+# Copyright 2023 The Dawn & Tint Authors
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+#
+# 1. Redistributions of source code must retain the above copyright notice, this
+# list of conditions and the following disclaimer.
+#
+# 2. Redistributions in binary form must reproduce the above copyright notice,
+# this list of conditions and the following disclaimer in the documentation
+# and/or other materials provided with the distribution.
+#
+# 3. Neither the name of the copyright holder nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+################################################################################
+# File generated by 'tools/src/cmd/gen' using the template:
+# tools/src/cmd/gen/build/BUILD.cmake.tmpl
+#
+# To regenerate run: './tools/run gen'
+#
+# Do not modify this file directly
+################################################################################
+
+################################################################################
+# Target: tint_lang_wgsl_common
+# Kind: lib
+################################################################################
+tint_add_target(tint_lang_wgsl_common lib
+ lang/wgsl/common/allowed_features.h
+ lang/wgsl/common/common.cc
+)
+
+tint_target_add_dependencies(tint_lang_wgsl_common lib
+ tint_lang_wgsl
+ tint_utils_containers
+ tint_utils_ice
+ tint_utils_macros
+ tint_utils_math
+ tint_utils_memory
+ tint_utils_reflection
+ tint_utils_rtti
+ tint_utils_traits
+)
diff --git a/src/tint/lang/wgsl/common/BUILD.gn b/src/tint/lang/wgsl/common/BUILD.gn
new file mode 100644
index 0000000..7b21348
--- /dev/null
+++ b/src/tint/lang/wgsl/common/BUILD.gn
@@ -0,0 +1,57 @@
+# Copyright 2023 The Dawn & Tint Authors
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+#
+# 1. Redistributions of source code must retain the above copyright notice, this
+# list of conditions and the following disclaimer.
+#
+# 2. Redistributions in binary form must reproduce the above copyright notice,
+# this list of conditions and the following disclaimer in the documentation
+# and/or other materials provided with the distribution.
+#
+# 3. Neither the name of the copyright holder nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+################################################################################
+# File generated by 'tools/src/cmd/gen' using the template:
+# tools/src/cmd/gen/build/BUILD.gn.tmpl
+#
+# To regenerate run: './tools/run gen'
+#
+# Do not modify this file directly
+################################################################################
+
+import("../../../../../scripts/tint_overrides_with_defaults.gni")
+
+import("${tint_src_dir}/tint.gni")
+
+libtint_source_set("common") {
+ sources = [
+ "allowed_features.h",
+ "common.cc",
+ ]
+ deps = [
+ "${tint_src_dir}/lang/wgsl",
+ "${tint_src_dir}/utils/containers",
+ "${tint_src_dir}/utils/ice",
+ "${tint_src_dir}/utils/macros",
+ "${tint_src_dir}/utils/math",
+ "${tint_src_dir}/utils/memory",
+ "${tint_src_dir}/utils/reflection",
+ "${tint_src_dir}/utils/rtti",
+ "${tint_src_dir}/utils/traits",
+ ]
+}
diff --git a/src/tint/lang/wgsl/common/allowed_features.h b/src/tint/lang/wgsl/common/allowed_features.h
new file mode 100644
index 0000000..080e3c8
--- /dev/null
+++ b/src/tint/lang/wgsl/common/allowed_features.h
@@ -0,0 +1,78 @@
+// Copyright 2023 The Dawn & Tint Authors
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+//
+// 1. Redistributions of source code must retain the above copyright notice, this
+// list of conditions and the following disclaimer.
+//
+// 2. Redistributions in binary form must reproduce the above copyright notice,
+// this list of conditions and the following disclaimer in the documentation
+// and/or other materials provided with the distribution.
+//
+// 3. Neither the name of the copyright holder nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+#ifndef SRC_TINT_LANG_WGSL_COMMON_ALLOWED_FEATURES_H_
+#define SRC_TINT_LANG_WGSL_COMMON_ALLOWED_FEATURES_H_
+
+#include <unordered_set>
+
+#include "src/tint/lang/wgsl/extension.h"
+#include "src/tint/lang/wgsl/language_feature.h"
+#include "src/tint/utils/reflection/reflection.h"
+
+namespace tint::wgsl {
+
+/// AllowedFeatures describes the set of extensions and language features that are allowed by the
+/// current environment.
+struct AllowedFeatures {
+ /// The extensions that are allowed.
+ std::unordered_set<wgsl::Extension> extensions;
+ /// The language features that are allowed.
+ std::unordered_set<wgsl::LanguageFeature> features;
+
+ /// Helper to produce an AllowedFeatures object that allows all extensions and features.
+ /// @returns the AllowedFeatures object
+ static AllowedFeatures Everything() {
+ AllowedFeatures allowed_features;
+
+ // Allow all extensions.
+ allowed_features.extensions.insert(wgsl::Extension::kChromiumDisableUniformityAnalysis);
+ allowed_features.extensions.insert(wgsl::Extension::kChromiumExperimentalDp4A);
+ allowed_features.extensions.insert(wgsl::Extension::kChromiumExperimentalFullPtrParameters);
+ allowed_features.extensions.insert(wgsl::Extension::kChromiumExperimentalPixelLocal);
+ allowed_features.extensions.insert(wgsl::Extension::kChromiumExperimentalPushConstant);
+ allowed_features.extensions.insert(
+ wgsl::Extension::kChromiumExperimentalReadWriteStorageTexture);
+ allowed_features.extensions.insert(wgsl::Extension::kChromiumExperimentalSubgroups);
+ allowed_features.extensions.insert(wgsl::Extension::kChromiumInternalDualSourceBlending);
+ allowed_features.extensions.insert(wgsl::Extension::kChromiumInternalRelaxedUniformLayout);
+ allowed_features.extensions.insert(wgsl::Extension::kF16);
+
+ // Allow all language features.
+ allowed_features.features.insert(
+ wgsl::LanguageFeature::kReadonlyAndReadwriteStorageTextures);
+
+ return allowed_features;
+ }
+
+ /// Reflect the fields of this class so that it can be used by tint::ForeachField().
+ TINT_REFLECT(extensions, features);
+};
+
+} // namespace tint::wgsl
+
+#endif // SRC_TINT_LANG_WGSL_COMMON_ALLOWED_FEATURES_H_
diff --git a/src/tint/lang/wgsl/common/common.cc b/src/tint/lang/wgsl/common/common.cc
new file mode 100644
index 0000000..ae20ec0
--- /dev/null
+++ b/src/tint/lang/wgsl/common/common.cc
@@ -0,0 +1,33 @@
+// Copyright 2023 The Dawn & Tint Authors
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+//
+// 1. Redistributions of source code must retain the above copyright notice, this
+// list of conditions and the following disclaimer.
+//
+// 2. Redistributions in binary form must reproduce the above copyright notice,
+// this list of conditions and the following disclaimer in the documentation
+// and/or other materials provided with the distribution.
+//
+// 3. Neither the name of the copyright holder nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+#if defined(__clang__)
+#pragma clang diagnostic ignored "-Wmissing-variable-declarations"
+#endif
+
+// A placeholder symbol used to emit a symbol for this lib target.
+int tint_lang_wgsl_common_symbol = 1;
diff --git a/src/tint/lang/wgsl/helpers/BUILD.bazel b/src/tint/lang/wgsl/helpers/BUILD.bazel
index f67fb39..acc0183 100644
--- a/src/tint/lang/wgsl/helpers/BUILD.bazel
+++ b/src/tint/lang/wgsl/helpers/BUILD.bazel
@@ -101,6 +101,7 @@
"//src/tint/lang/wgsl",
"//src/tint/lang/wgsl/ast",
"//src/tint/lang/wgsl/ast:test",
+ "//src/tint/lang/wgsl/common",
"//src/tint/lang/wgsl/helpers",
"//src/tint/lang/wgsl/intrinsic",
"//src/tint/lang/wgsl/program",
diff --git a/src/tint/lang/wgsl/helpers/BUILD.cmake b/src/tint/lang/wgsl/helpers/BUILD.cmake
index 94593a9..dbf2a9e 100644
--- a/src/tint/lang/wgsl/helpers/BUILD.cmake
+++ b/src/tint/lang/wgsl/helpers/BUILD.cmake
@@ -95,6 +95,7 @@
tint_lang_wgsl
tint_lang_wgsl_ast
tint_lang_wgsl_ast_test
+ tint_lang_wgsl_common
tint_lang_wgsl_helpers
tint_lang_wgsl_intrinsic
tint_lang_wgsl_program
diff --git a/src/tint/lang/wgsl/helpers/BUILD.gn b/src/tint/lang/wgsl/helpers/BUILD.gn
index d18c003..4ae3943 100644
--- a/src/tint/lang/wgsl/helpers/BUILD.gn
+++ b/src/tint/lang/wgsl/helpers/BUILD.gn
@@ -97,6 +97,7 @@
"${tint_src_dir}/lang/wgsl",
"${tint_src_dir}/lang/wgsl/ast",
"${tint_src_dir}/lang/wgsl/ast:unittests",
+ "${tint_src_dir}/lang/wgsl/common",
"${tint_src_dir}/lang/wgsl/helpers",
"${tint_src_dir}/lang/wgsl/intrinsic",
"${tint_src_dir}/lang/wgsl/program",
diff --git a/src/tint/lang/wgsl/helpers/append_vector_test.cc b/src/tint/lang/wgsl/helpers/append_vector_test.cc
index 679b4f8..f1a95d9 100644
--- a/src/tint/lang/wgsl/helpers/append_vector_test.cc
+++ b/src/tint/lang/wgsl/helpers/append_vector_test.cc
@@ -49,7 +49,7 @@
auto* vec_12 = Call<vec2<i32>>(scalar_1, scalar_2);
WrapInFunction(vec_12, scalar_3);
- resolver::Resolver resolver(this);
+ resolver::Resolver resolver(this, {});
EXPECT_TRUE(resolver.Resolve());
ASSERT_THAT(resolver.Diagnostics(), testing::IsEmpty());
@@ -90,7 +90,7 @@
auto* vec_12 = Call<vec2<i32>>(scalar_1, scalar_2);
WrapInFunction(vec_12, scalar_3);
- resolver::Resolver resolver(this);
+ resolver::Resolver resolver(this, {});
EXPECT_TRUE(resolver.Resolve());
ASSERT_THAT(resolver.Diagnostics(), testing::IsEmpty());
@@ -138,7 +138,7 @@
auto* vec_12 = Call<vec2<i32>>(uvec_12);
WrapInFunction(vec_12, scalar_3);
- resolver::Resolver resolver(this);
+ resolver::Resolver resolver(this, {});
EXPECT_TRUE(resolver.Resolve());
ASSERT_THAT(resolver.Diagnostics(), testing::IsEmpty());
@@ -187,7 +187,7 @@
auto* vec_12 = Call<vec2<i32>>(scalar_1, scalar_2);
WrapInFunction(vec_12, scalar_3);
- resolver::Resolver resolver(this);
+ resolver::Resolver resolver(this, {});
EXPECT_TRUE(resolver.Resolve());
ASSERT_THAT(resolver.Diagnostics(), testing::IsEmpty());
@@ -233,7 +233,7 @@
auto* vec_123 = Call<vec3<i32>>(scalar_1, scalar_2, scalar_3);
WrapInFunction(vec_123, scalar_4);
- resolver::Resolver resolver(this);
+ resolver::Resolver resolver(this, {});
EXPECT_TRUE(resolver.Resolve());
ASSERT_THAT(resolver.Diagnostics(), testing::IsEmpty());
@@ -276,7 +276,7 @@
auto* scalar_3 = Expr(3_i);
WrapInFunction(vec_12, scalar_3);
- resolver::Resolver resolver(this);
+ resolver::Resolver resolver(this, {});
EXPECT_TRUE(resolver.Resolve());
ASSERT_THAT(resolver.Diagnostics(), testing::IsEmpty());
@@ -315,7 +315,7 @@
auto* vec_12 = Call<vec2<i32>>(scalar_1, scalar_2);
WrapInFunction(vec_12, scalar_3);
- resolver::Resolver resolver(this);
+ resolver::Resolver resolver(this, {});
EXPECT_TRUE(resolver.Resolve());
ASSERT_THAT(resolver.Diagnostics(), testing::IsEmpty());
@@ -356,7 +356,7 @@
auto* scalar_3 = Expr("scalar_3");
WrapInFunction(vec_12, scalar_3);
- resolver::Resolver resolver(this);
+ resolver::Resolver resolver(this, {});
EXPECT_TRUE(resolver.Resolve());
ASSERT_THAT(resolver.Diagnostics(), testing::IsEmpty());
@@ -394,7 +394,7 @@
auto* scalar_3 = Expr("scalar_3");
WrapInFunction(vec_12, scalar_3);
- resolver::Resolver resolver(this);
+ resolver::Resolver resolver(this, {});
EXPECT_TRUE(resolver.Resolve());
ASSERT_THAT(resolver.Diagnostics(), testing::IsEmpty());
@@ -436,7 +436,7 @@
auto* scalar_3 = Expr("scalar_3");
WrapInFunction(vec_12, scalar_3);
- resolver::Resolver resolver(this);
+ resolver::Resolver resolver(this, {});
EXPECT_TRUE(resolver.Resolve());
ASSERT_THAT(resolver.Diagnostics(), testing::IsEmpty());
@@ -472,7 +472,7 @@
auto* vec000 = Call<vec3<i32>>();
WrapInFunction(vec000, scalar);
- resolver::Resolver resolver(this);
+ resolver::Resolver resolver(this, {});
EXPECT_TRUE(resolver.Resolve());
ASSERT_THAT(resolver.Diagnostics(), testing::IsEmpty());
diff --git a/src/tint/lang/wgsl/inspector/BUILD.bazel b/src/tint/lang/wgsl/inspector/BUILD.bazel
index 44a123f..a85b5c8 100644
--- a/src/tint/lang/wgsl/inspector/BUILD.bazel
+++ b/src/tint/lang/wgsl/inspector/BUILD.bazel
@@ -94,6 +94,7 @@
"//src/tint/lang/core/type",
"//src/tint/lang/wgsl",
"//src/tint/lang/wgsl/ast",
+ "//src/tint/lang/wgsl/common",
"//src/tint/lang/wgsl/inspector",
"//src/tint/lang/wgsl/program",
"//src/tint/lang/wgsl/resolver",
diff --git a/src/tint/lang/wgsl/inspector/BUILD.cmake b/src/tint/lang/wgsl/inspector/BUILD.cmake
index cc2a4fe..a36fd2c 100644
--- a/src/tint/lang/wgsl/inspector/BUILD.cmake
+++ b/src/tint/lang/wgsl/inspector/BUILD.cmake
@@ -95,6 +95,7 @@
tint_lang_core_type
tint_lang_wgsl
tint_lang_wgsl_ast
+ tint_lang_wgsl_common
tint_lang_wgsl_inspector
tint_lang_wgsl_program
tint_lang_wgsl_resolver
diff --git a/src/tint/lang/wgsl/inspector/BUILD.gn b/src/tint/lang/wgsl/inspector/BUILD.gn
index c10d7e2..a01205f 100644
--- a/src/tint/lang/wgsl/inspector/BUILD.gn
+++ b/src/tint/lang/wgsl/inspector/BUILD.gn
@@ -96,6 +96,7 @@
"${tint_src_dir}/lang/core/type",
"${tint_src_dir}/lang/wgsl",
"${tint_src_dir}/lang/wgsl/ast",
+ "${tint_src_dir}/lang/wgsl/common",
"${tint_src_dir}/lang/wgsl/inspector",
"${tint_src_dir}/lang/wgsl/program",
"${tint_src_dir}/lang/wgsl/resolver",
diff --git a/src/tint/lang/wgsl/inspector/inspector_runner_test.cc b/src/tint/lang/wgsl/inspector/inspector_runner_test.cc
index a40a586..db8e784 100644
--- a/src/tint/lang/wgsl/inspector/inspector_runner_test.cc
+++ b/src/tint/lang/wgsl/inspector/inspector_runner_test.cc
@@ -38,8 +38,10 @@
return *inspector_;
}
+ wgsl::reader::Options options;
+ options.allowed_features = wgsl::AllowedFeatures::Everything();
file_ = std::make_unique<Source::File>("test", shader);
- program_ = std::make_unique<Program>(wgsl::reader::Parse(file_.get()));
+ program_ = std::make_unique<Program>(wgsl::reader::Parse(file_.get(), options));
if (!program_->IsValid()) {
ADD_FAILURE() << program_->Diagnostics();
}
diff --git a/src/tint/lang/wgsl/ir_roundtrip_test.cc b/src/tint/lang/wgsl/ir_roundtrip_test.cc
index 35081fd..305beab 100644
--- a/src/tint/lang/wgsl/ir_roundtrip_test.cc
+++ b/src/tint/lang/wgsl/ir_roundtrip_test.cc
@@ -42,9 +42,11 @@
class IRToProgramRoundtripTest : public helpers::IRProgramTest {
public:
void Test(std::string_view input_wgsl, std::string_view expected_wgsl) {
+ wgsl::reader::Options options;
+ options.allowed_features = wgsl::AllowedFeatures::Everything();
auto input = tint::TrimSpace(input_wgsl);
Source::File file("test.wgsl", std::string(input));
- auto ir_module = wgsl::reader::WgslToIR(&file);
+ auto ir_module = wgsl::reader::WgslToIR(&file, options);
ASSERT_TRUE(ir_module) << ir_module;
auto disassembly = tint::core::ir::Disassemble(ir_module.Get());
diff --git a/src/tint/lang/wgsl/program/BUILD.bazel b/src/tint/lang/wgsl/program/BUILD.bazel
index 1906aad..3950041 100644
--- a/src/tint/lang/wgsl/program/BUILD.bazel
+++ b/src/tint/lang/wgsl/program/BUILD.bazel
@@ -89,6 +89,7 @@
"//src/tint/lang/wgsl",
"//src/tint/lang/wgsl/ast",
"//src/tint/lang/wgsl/ast:test",
+ "//src/tint/lang/wgsl/common",
"//src/tint/lang/wgsl/program",
"//src/tint/lang/wgsl/resolver",
"//src/tint/lang/wgsl/sem",
diff --git a/src/tint/lang/wgsl/program/BUILD.cmake b/src/tint/lang/wgsl/program/BUILD.cmake
index eea928d..2e04315 100644
--- a/src/tint/lang/wgsl/program/BUILD.cmake
+++ b/src/tint/lang/wgsl/program/BUILD.cmake
@@ -88,6 +88,7 @@
tint_lang_wgsl
tint_lang_wgsl_ast
tint_lang_wgsl_ast_test
+ tint_lang_wgsl_common
tint_lang_wgsl_program
tint_lang_wgsl_resolver
tint_lang_wgsl_sem
@@ -124,6 +125,7 @@
tint_lang_core_type
tint_lang_wgsl
tint_lang_wgsl_ast
+ tint_lang_wgsl_common
tint_lang_wgsl_program
tint_lang_wgsl_resolver
tint_lang_wgsl_sem
diff --git a/src/tint/lang/wgsl/program/BUILD.gn b/src/tint/lang/wgsl/program/BUILD.gn
index 5641e61..03d0b77 100644
--- a/src/tint/lang/wgsl/program/BUILD.gn
+++ b/src/tint/lang/wgsl/program/BUILD.gn
@@ -90,6 +90,7 @@
"${tint_src_dir}/lang/wgsl",
"${tint_src_dir}/lang/wgsl/ast",
"${tint_src_dir}/lang/wgsl/ast:unittests",
+ "${tint_src_dir}/lang/wgsl/common",
"${tint_src_dir}/lang/wgsl/program",
"${tint_src_dir}/lang/wgsl/resolver",
"${tint_src_dir}/lang/wgsl/sem",
@@ -119,6 +120,7 @@
"${tint_src_dir}/lang/core/type",
"${tint_src_dir}/lang/wgsl",
"${tint_src_dir}/lang/wgsl/ast",
+ "${tint_src_dir}/lang/wgsl/common",
"${tint_src_dir}/lang/wgsl/program",
"${tint_src_dir}/lang/wgsl/resolver",
"${tint_src_dir}/lang/wgsl/sem",
diff --git a/src/tint/lang/wgsl/reader/BUILD.bazel b/src/tint/lang/wgsl/reader/BUILD.bazel
index 3af3777..07fb326 100644
--- a/src/tint/lang/wgsl/reader/BUILD.bazel
+++ b/src/tint/lang/wgsl/reader/BUILD.bazel
@@ -42,6 +42,7 @@
"reader.cc",
],
hdrs = [
+ "options.h",
"reader.h",
],
deps = [
@@ -52,6 +53,7 @@
"//src/tint/lang/core/type",
"//src/tint/lang/wgsl",
"//src/tint/lang/wgsl/ast",
+ "//src/tint/lang/wgsl/common",
"//src/tint/lang/wgsl/program",
"//src/tint/lang/wgsl/reader/lower",
"//src/tint/lang/wgsl/resolver",
@@ -94,6 +96,7 @@
"//src/tint/lang/core/type",
"//src/tint/lang/wgsl",
"//src/tint/lang/wgsl/ast",
+ "//src/tint/lang/wgsl/common",
"//src/tint/lang/wgsl/program",
"//src/tint/lang/wgsl/sem",
"//src/tint/utils/containers",
diff --git a/src/tint/lang/wgsl/reader/BUILD.cmake b/src/tint/lang/wgsl/reader/BUILD.cmake
index 0b15276..a213212 100644
--- a/src/tint/lang/wgsl/reader/BUILD.cmake
+++ b/src/tint/lang/wgsl/reader/BUILD.cmake
@@ -45,6 +45,7 @@
# Condition: TINT_BUILD_WGSL_READER
################################################################################
tint_add_target(tint_lang_wgsl_reader lib
+ lang/wgsl/reader/options.h
lang/wgsl/reader/reader.cc
lang/wgsl/reader/reader.h
)
@@ -57,6 +58,7 @@
tint_lang_core_type
tint_lang_wgsl
tint_lang_wgsl_ast
+ tint_lang_wgsl_common
tint_lang_wgsl_program
tint_lang_wgsl_reader_lower
tint_lang_wgsl_resolver
@@ -103,6 +105,7 @@
tint_lang_core_type
tint_lang_wgsl
tint_lang_wgsl_ast
+ tint_lang_wgsl_common
tint_lang_wgsl_program
tint_lang_wgsl_sem
tint_utils_containers
diff --git a/src/tint/lang/wgsl/reader/BUILD.gn b/src/tint/lang/wgsl/reader/BUILD.gn
index 68559b3..8f4b35c 100644
--- a/src/tint/lang/wgsl/reader/BUILD.gn
+++ b/src/tint/lang/wgsl/reader/BUILD.gn
@@ -44,6 +44,7 @@
if (tint_build_wgsl_reader) {
libtint_source_set("reader") {
sources = [
+ "options.h",
"reader.cc",
"reader.h",
]
@@ -55,6 +56,7 @@
"${tint_src_dir}/lang/core/type",
"${tint_src_dir}/lang/wgsl",
"${tint_src_dir}/lang/wgsl/ast",
+ "${tint_src_dir}/lang/wgsl/common",
"${tint_src_dir}/lang/wgsl/program",
"${tint_src_dir}/lang/wgsl/reader/lower",
"${tint_src_dir}/lang/wgsl/resolver",
@@ -96,6 +98,7 @@
"${tint_src_dir}/lang/core/type",
"${tint_src_dir}/lang/wgsl",
"${tint_src_dir}/lang/wgsl/ast",
+ "${tint_src_dir}/lang/wgsl/common",
"${tint_src_dir}/lang/wgsl/program",
"${tint_src_dir}/lang/wgsl/sem",
"${tint_src_dir}/utils/containers",
diff --git a/src/tint/lang/wgsl/reader/options.h b/src/tint/lang/wgsl/reader/options.h
new file mode 100644
index 0000000..3ac0e03
--- /dev/null
+++ b/src/tint/lang/wgsl/reader/options.h
@@ -0,0 +1,47 @@
+// Copyright 2023 The Dawn & Tint Authors
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+//
+// 1. Redistributions of source code must retain the above copyright notice, this
+// list of conditions and the following disclaimer.
+//
+// 2. Redistributions in binary form must reproduce the above copyright notice,
+// this list of conditions and the following disclaimer in the documentation
+// and/or other materials provided with the distribution.
+//
+// 3. Neither the name of the copyright holder nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+#ifndef SRC_TINT_LANG_WGSL_READER_OPTIONS_H_
+#define SRC_TINT_LANG_WGSL_READER_OPTIONS_H_
+
+#include "src/tint/lang/wgsl/common/allowed_features.h"
+#include "src/tint/utils/reflection/reflection.h"
+
+namespace tint::wgsl::reader {
+
+/// Configuration options used for reading WGSL.
+struct Options {
+ /// The extensions and language features that are allowed to be used.
+ AllowedFeatures allowed_features{};
+
+ /// Reflect the fields of this class so that it can be used by tint::ForeachField().
+ TINT_REFLECT(allowed_features);
+};
+
+} // namespace tint::wgsl::reader
+
+#endif // SRC_TINT_LANG_WGSL_READER_OPTIONS_H_
diff --git a/src/tint/lang/wgsl/reader/parser/BUILD.bazel b/src/tint/lang/wgsl/reader/parser/BUILD.bazel
index 6bd0734..ce2d480 100644
--- a/src/tint/lang/wgsl/reader/parser/BUILD.bazel
+++ b/src/tint/lang/wgsl/reader/parser/BUILD.bazel
@@ -58,6 +58,7 @@
"//src/tint/lang/core/type",
"//src/tint/lang/wgsl",
"//src/tint/lang/wgsl/ast",
+ "//src/tint/lang/wgsl/common",
"//src/tint/lang/wgsl/program",
"//src/tint/lang/wgsl/resolver",
"//src/tint/lang/wgsl/sem",
@@ -159,6 +160,7 @@
"//src/tint/lang/wgsl",
"//src/tint/lang/wgsl/ast",
"//src/tint/lang/wgsl/ast:test",
+ "//src/tint/lang/wgsl/common",
"//src/tint/lang/wgsl/program",
"//src/tint/lang/wgsl/resolver",
"//src/tint/lang/wgsl/sem",
diff --git a/src/tint/lang/wgsl/reader/parser/BUILD.cmake b/src/tint/lang/wgsl/reader/parser/BUILD.cmake
index ef26632..427ec60 100644
--- a/src/tint/lang/wgsl/reader/parser/BUILD.cmake
+++ b/src/tint/lang/wgsl/reader/parser/BUILD.cmake
@@ -59,6 +59,7 @@
tint_lang_core_type
tint_lang_wgsl
tint_lang_wgsl_ast
+ tint_lang_wgsl_common
tint_lang_wgsl_program
tint_lang_wgsl_resolver
tint_lang_wgsl_sem
@@ -163,6 +164,7 @@
tint_lang_wgsl
tint_lang_wgsl_ast
tint_lang_wgsl_ast_test
+ tint_lang_wgsl_common
tint_lang_wgsl_program
tint_lang_wgsl_resolver
tint_lang_wgsl_sem
diff --git a/src/tint/lang/wgsl/reader/parser/BUILD.gn b/src/tint/lang/wgsl/reader/parser/BUILD.gn
index 0868966..9aca136 100644
--- a/src/tint/lang/wgsl/reader/parser/BUILD.gn
+++ b/src/tint/lang/wgsl/reader/parser/BUILD.gn
@@ -61,6 +61,7 @@
"${tint_src_dir}/lang/core/type",
"${tint_src_dir}/lang/wgsl",
"${tint_src_dir}/lang/wgsl/ast",
+ "${tint_src_dir}/lang/wgsl/common",
"${tint_src_dir}/lang/wgsl/program",
"${tint_src_dir}/lang/wgsl/resolver",
"${tint_src_dir}/lang/wgsl/sem",
@@ -162,6 +163,7 @@
"${tint_src_dir}/lang/wgsl",
"${tint_src_dir}/lang/wgsl/ast",
"${tint_src_dir}/lang/wgsl/ast:unittests",
+ "${tint_src_dir}/lang/wgsl/common",
"${tint_src_dir}/lang/wgsl/program",
"${tint_src_dir}/lang/wgsl/resolver",
"${tint_src_dir}/lang/wgsl/sem",
diff --git a/src/tint/lang/wgsl/reader/program_to_ir/BUILD.bazel b/src/tint/lang/wgsl/reader/program_to_ir/BUILD.bazel
index 5d7b546..619764a 100644
--- a/src/tint/lang/wgsl/reader/program_to_ir/BUILD.bazel
+++ b/src/tint/lang/wgsl/reader/program_to_ir/BUILD.bazel
@@ -100,6 +100,7 @@
"//src/tint/lang/core/type",
"//src/tint/lang/wgsl",
"//src/tint/lang/wgsl/ast",
+ "//src/tint/lang/wgsl/common",
"//src/tint/lang/wgsl/helpers:test",
"//src/tint/lang/wgsl/program",
"//src/tint/lang/wgsl/reader/lower",
diff --git a/src/tint/lang/wgsl/reader/program_to_ir/BUILD.cmake b/src/tint/lang/wgsl/reader/program_to_ir/BUILD.cmake
index adce581..c869ca2 100644
--- a/src/tint/lang/wgsl/reader/program_to_ir/BUILD.cmake
+++ b/src/tint/lang/wgsl/reader/program_to_ir/BUILD.cmake
@@ -104,6 +104,7 @@
tint_lang_core_type
tint_lang_wgsl
tint_lang_wgsl_ast
+ tint_lang_wgsl_common
tint_lang_wgsl_helpers_test
tint_lang_wgsl_program
tint_lang_wgsl_reader_lower
diff --git a/src/tint/lang/wgsl/reader/program_to_ir/BUILD.gn b/src/tint/lang/wgsl/reader/program_to_ir/BUILD.gn
index 45ba9ca..9948752 100644
--- a/src/tint/lang/wgsl/reader/program_to_ir/BUILD.gn
+++ b/src/tint/lang/wgsl/reader/program_to_ir/BUILD.gn
@@ -103,6 +103,7 @@
"${tint_src_dir}/lang/core/type",
"${tint_src_dir}/lang/wgsl",
"${tint_src_dir}/lang/wgsl/ast",
+ "${tint_src_dir}/lang/wgsl/common",
"${tint_src_dir}/lang/wgsl/helpers:unittests",
"${tint_src_dir}/lang/wgsl/program",
"${tint_src_dir}/lang/wgsl/reader/lower",
diff --git a/src/tint/lang/wgsl/reader/reader.cc b/src/tint/lang/wgsl/reader/reader.cc
index 44adea5..df1dc7b 100644
--- a/src/tint/lang/wgsl/reader/reader.cc
+++ b/src/tint/lang/wgsl/reader/reader.cc
@@ -36,14 +36,14 @@
namespace tint::wgsl::reader {
-Program Parse(const Source::File* file) {
+Program Parse(const Source::File* file, const Options& options) {
Parser parser(file);
parser.Parse();
- return resolver::Resolve(parser.builder());
+ return resolver::Resolve(parser.builder(), options.allowed_features);
}
-Result<core::ir::Module> WgslToIR(const Source::File* file) {
- Program program = Parse(file);
+Result<core::ir::Module> WgslToIR(const Source::File* file, const Options& options) {
+ Program program = Parse(file, options);
auto module = ProgramToIR(program);
if (!module) {
return module.Failure();
diff --git a/src/tint/lang/wgsl/reader/reader.h b/src/tint/lang/wgsl/reader/reader.h
index 3b5f8ed..40c973a 100644
--- a/src/tint/lang/wgsl/reader/reader.h
+++ b/src/tint/lang/wgsl/reader/reader.h
@@ -30,6 +30,7 @@
#include "src/tint/lang/core/ir/module.h"
#include "src/tint/lang/wgsl/program/program.h"
+#include "src/tint/lang/wgsl/reader/options.h"
namespace tint::wgsl::reader {
@@ -38,13 +39,15 @@
/// `program.Diagnostics.contains_errors()` will be true, and the
/// `program.Diagnostics()` will describe the error.
/// @param file the source file
+/// @param options the configuration options to use when parsing WGSL
/// @returns the parsed program
-Program Parse(const Source::File* file);
+Program Parse(const Source::File* file, const Options& options = {});
/// Parse a WGSL program from source, and return an IR module.
/// @param file the input WGSL file
+/// @param options the configuration options to use when parsing WGSL
/// @returns the resulting IR module, or failure
-Result<core::ir::Module> WgslToIR(const Source::File* file);
+Result<core::ir::Module> WgslToIR(const Source::File* file, const Options& options = {});
} // namespace tint::wgsl::reader
diff --git a/src/tint/lang/wgsl/resolver/BUILD.bazel b/src/tint/lang/wgsl/resolver/BUILD.bazel
index 578ead6..1d19962 100644
--- a/src/tint/lang/wgsl/resolver/BUILD.bazel
+++ b/src/tint/lang/wgsl/resolver/BUILD.bazel
@@ -66,6 +66,7 @@
"//src/tint/lang/core/type",
"//src/tint/lang/wgsl",
"//src/tint/lang/wgsl/ast",
+ "//src/tint/lang/wgsl/common",
"//src/tint/lang/wgsl/intrinsic",
"//src/tint/lang/wgsl/program",
"//src/tint/lang/wgsl/sem",
@@ -165,6 +166,7 @@
"//src/tint/lang/wgsl/ast",
"//src/tint/lang/wgsl/ast/transform",
"//src/tint/lang/wgsl/ast:test",
+ "//src/tint/lang/wgsl/common",
"//src/tint/lang/wgsl/intrinsic",
"//src/tint/lang/wgsl/program",
"//src/tint/lang/wgsl/resolver",
diff --git a/src/tint/lang/wgsl/resolver/BUILD.cmake b/src/tint/lang/wgsl/resolver/BUILD.cmake
index 63026bf..4ffe57c 100644
--- a/src/tint/lang/wgsl/resolver/BUILD.cmake
+++ b/src/tint/lang/wgsl/resolver/BUILD.cmake
@@ -65,6 +65,7 @@
tint_lang_core_type
tint_lang_wgsl
tint_lang_wgsl_ast
+ tint_lang_wgsl_common
tint_lang_wgsl_intrinsic
tint_lang_wgsl_program
tint_lang_wgsl_sem
@@ -159,6 +160,7 @@
tint_lang_wgsl_ast
tint_lang_wgsl_ast_transform
tint_lang_wgsl_ast_test
+ tint_lang_wgsl_common
tint_lang_wgsl_intrinsic
tint_lang_wgsl_program
tint_lang_wgsl_resolver
diff --git a/src/tint/lang/wgsl/resolver/BUILD.gn b/src/tint/lang/wgsl/resolver/BUILD.gn
index 86dc084..28b1f3f 100644
--- a/src/tint/lang/wgsl/resolver/BUILD.gn
+++ b/src/tint/lang/wgsl/resolver/BUILD.gn
@@ -69,6 +69,7 @@
"${tint_src_dir}/lang/core/type",
"${tint_src_dir}/lang/wgsl",
"${tint_src_dir}/lang/wgsl/ast",
+ "${tint_src_dir}/lang/wgsl/common",
"${tint_src_dir}/lang/wgsl/intrinsic",
"${tint_src_dir}/lang/wgsl/program",
"${tint_src_dir}/lang/wgsl/sem",
@@ -161,6 +162,7 @@
"${tint_src_dir}/lang/wgsl/ast",
"${tint_src_dir}/lang/wgsl/ast:unittests",
"${tint_src_dir}/lang/wgsl/ast/transform",
+ "${tint_src_dir}/lang/wgsl/common",
"${tint_src_dir}/lang/wgsl/intrinsic",
"${tint_src_dir}/lang/wgsl/program",
"${tint_src_dir}/lang/wgsl/resolver",
diff --git a/src/tint/lang/wgsl/resolver/builtin_validation_test.cc b/src/tint/lang/wgsl/resolver/builtin_validation_test.cc
index c317db4..60898ce 100644
--- a/src/tint/lang/wgsl/resolver/builtin_validation_test.cc
+++ b/src/tint/lang/wgsl/resolver/builtin_validation_test.cc
@@ -819,5 +819,20 @@
EXPECT_TRUE(r()->Resolve()) << r()->error();
}
+TEST_F(ResolverBuiltinValidationTest, TextureBarrier_FeatureDisallowed) {
+ // fn func { textureBarrier(); }
+ Func("func", tint::Empty, ty.void_(),
+ Vector{
+ CallStmt(Call(Source{Source::Location{12, 34}}, "textureBarrier")),
+ });
+
+ auto resolver = Resolver(this, {});
+ EXPECT_FALSE(resolver.Resolve());
+ EXPECT_EQ(resolver.error(),
+ "12:34 error: built-in function 'textureBarrier' requires the "
+ "readonly_and_readwrite_storage_textures language feature, which is not allowed in "
+ "the current environment");
+}
+
} // namespace
} // namespace tint::resolver
diff --git a/src/tint/lang/wgsl/resolver/resolve.cc b/src/tint/lang/wgsl/resolver/resolve.cc
index dd7b4c1..3765013 100644
--- a/src/tint/lang/wgsl/resolver/resolve.cc
+++ b/src/tint/lang/wgsl/resolver/resolve.cc
@@ -33,8 +33,8 @@
namespace tint::resolver {
-Program Resolve(ProgramBuilder& builder) {
- Resolver resolver(&builder);
+Program Resolve(ProgramBuilder& builder, const wgsl::AllowedFeatures& allowed_features) {
+ Resolver resolver(&builder, std::move(allowed_features));
resolver.Resolve();
return Program(std::move(builder));
}
diff --git a/src/tint/lang/wgsl/resolver/resolve.h b/src/tint/lang/wgsl/resolver/resolve.h
index 282817c..3e73d80 100644
--- a/src/tint/lang/wgsl/resolver/resolve.h
+++ b/src/tint/lang/wgsl/resolver/resolve.h
@@ -28,6 +28,8 @@
#ifndef SRC_TINT_LANG_WGSL_RESOLVER_RESOLVE_H_
#define SRC_TINT_LANG_WGSL_RESOLVER_RESOLVE_H_
+#include "src/tint/lang/wgsl/common/allowed_features.h"
+
namespace tint {
class Program;
class ProgramBuilder;
@@ -36,8 +38,11 @@
namespace tint::resolver {
/// Performs semantic analysis and validation on the program builder @p builder
+/// @param allowed_features the extensions and features that are allowed to be used
/// @returns the resolved Program. Program.Diagnostics() may contain validation errors.
-Program Resolve(ProgramBuilder& builder);
+Program Resolve(
+ ProgramBuilder& builder,
+ const wgsl::AllowedFeatures& allowed_features = wgsl::AllowedFeatures::Everything());
} // namespace tint::resolver
diff --git a/src/tint/lang/wgsl/resolver/resolver.cc b/src/tint/lang/wgsl/resolver/resolver.cc
index 33b4e81..c3d2f53 100644
--- a/src/tint/lang/wgsl/resolver/resolver.cc
+++ b/src/tint/lang/wgsl/resolver/resolver.cc
@@ -123,7 +123,7 @@
} // namespace
-Resolver::Resolver(ProgramBuilder* builder)
+Resolver::Resolver(ProgramBuilder* builder, const wgsl::AllowedFeatures& allowed_features)
: b(*builder),
diagnostics_(builder->Diagnostics()),
const_eval_(builder->constants, diagnostics_),
@@ -132,8 +132,10 @@
validator_(builder,
sem_,
enabled_extensions_,
+ allowed_features_,
atomic_composite_info_,
- valid_type_storage_layouts_) {}
+ valid_type_storage_layouts_),
+ allowed_features_(allowed_features) {}
Resolver::~Resolver() = default;
@@ -2420,7 +2422,7 @@
current_function_->AddDirectCall(call);
}
- if (!validator_.RequiredExtensionForBuiltinFn(call)) {
+ if (!validator_.RequiredFeaturesForBuiltinFn(call)) {
return nullptr;
}
@@ -3955,12 +3957,25 @@
for (auto* ext : enable->extensions) {
Mark(ext);
enabled_extensions_.Add(ext->name);
+ if (!allowed_features_.extensions.count(ext->name)) {
+ StringStream ss;
+ ss << "extension '" << ext->name << "' is not allowed in the current environment";
+ AddError(ss.str(), ext->source);
+ return false;
+ }
}
return true;
}
-bool Resolver::Requires(const ast::Requires*) {
- // TODO(crbug.com/tint/2081): Check that all features are allowed.
+bool Resolver::Requires(const ast::Requires* req) {
+ for (auto feature : req->features) {
+ if (!allowed_features_.features.count(feature)) {
+ StringStream ss;
+ ss << "language feature '" << feature << "' is not allowed in the current environment";
+ AddError(ss.str(), req->source);
+ return false;
+ }
+ }
return true;
}
diff --git a/src/tint/lang/wgsl/resolver/resolver.h b/src/tint/lang/wgsl/resolver/resolver.h
index 887b117..c489465 100644
--- a/src/tint/lang/wgsl/resolver/resolver.h
+++ b/src/tint/lang/wgsl/resolver/resolver.h
@@ -40,6 +40,7 @@
#include "src/tint/lang/core/constant/eval.h"
#include "src/tint/lang/core/constant/value.h"
#include "src/tint/lang/core/intrinsic/table.h"
+#include "src/tint/lang/wgsl/common/allowed_features.h"
#include "src/tint/lang/wgsl/intrinsic/dialect.h"
#include "src/tint/lang/wgsl/program/program_builder.h"
#include "src/tint/lang/wgsl/resolver/dependency_graph.h"
@@ -96,7 +97,8 @@
public:
/// Constructor
/// @param builder the program builder
- explicit Resolver(ProgramBuilder* builder);
+ /// @param allowed_features the extensions and features that are allowed to be used
+ explicit Resolver(ProgramBuilder* builder, const wgsl::AllowedFeatures& allowed_features);
/// Destructor
~Resolver();
@@ -689,6 +691,7 @@
DependencyGraph dependencies_;
SemHelper sem_;
Validator validator_;
+ wgsl::AllowedFeatures allowed_features_;
wgsl::Extensions enabled_extensions_;
Vector<sem::Function*, 8> entry_points_;
Hashmap<const core::type::Type*, const Source*, 8> atomic_composite_info_;
diff --git a/src/tint/lang/wgsl/resolver/resolver_helper_test.cc b/src/tint/lang/wgsl/resolver/resolver_helper_test.cc
index 7545306..237064b 100644
--- a/src/tint/lang/wgsl/resolver/resolver_helper_test.cc
+++ b/src/tint/lang/wgsl/resolver/resolver_helper_test.cc
@@ -31,7 +31,8 @@
namespace tint::resolver {
-TestHelper::TestHelper() : resolver_(std::make_unique<Resolver>(this)) {}
+TestHelper::TestHelper()
+ : resolver_(std::make_unique<Resolver>(this, wgsl::AllowedFeatures::Everything())) {}
TestHelper::~TestHelper() = default;
diff --git a/src/tint/lang/wgsl/resolver/resolver_test.cc b/src/tint/lang/wgsl/resolver/resolver_test.cc
index 0829fb5..9b3c171 100644
--- a/src/tint/lang/wgsl/resolver/resolver_test.cc
+++ b/src/tint/lang/wgsl/resolver/resolver_test.cc
@@ -2081,7 +2081,7 @@
{
ProgramBuilder b;
b.Ident("ident");
- Resolver(&b).Resolve();
+ Resolver(&b, {}).Resolve();
},
"internal compiler error: AST node 'tint::ast::Identifier' was not reached by the "
"resolver");
@@ -2094,7 +2094,7 @@
auto* expr = b.Expr(1_i);
b.GlobalVar("a", b.ty.i32(), core::AddressSpace::kPrivate, expr);
b.GlobalVar("b", b.ty.i32(), core::AddressSpace::kPrivate, expr);
- Resolver(&b).Resolve();
+ Resolver(&b, {}).Resolve();
},
"internal compiler error: AST node 'tint::ast::IntLiteralExpression' was encountered twice "
"in the same AST of a Program");
diff --git a/src/tint/lang/wgsl/resolver/type_validation_test.cc b/src/tint/lang/wgsl/resolver/type_validation_test.cc
index bf9d840..e5fcf1c 100644
--- a/src/tint/lang/wgsl/resolver/type_validation_test.cc
+++ b/src/tint/lang/wgsl/resolver/type_validation_test.cc
@@ -1208,6 +1208,23 @@
EXPECT_TRUE(r()->Resolve()) << r()->error();
}
+TEST_F(StorageTextureAccessTest, ReadOnlyAccess_FeatureDisallowed) {
+ // @group(0) @binding(0)
+ // var a : texture_storage_1d<r32uint, read>;
+
+ auto st = ty.storage_texture(Source{{12, 34}}, core::type::TextureDimension::k1d,
+ core::TexelFormat::kR32Uint, core::Access::kRead);
+
+ GlobalVar("a", st, Group(0_a), Binding(0_a));
+
+ auto resolver = Resolver(this, {});
+ EXPECT_FALSE(resolver.Resolve());
+ EXPECT_EQ(resolver.error(),
+ "12:34 error: read-only storage textures require the "
+ "readonly_and_readwrite_storage_textures language feature, which is not allowed in "
+ "the current environment");
+}
+
TEST_F(StorageTextureAccessTest, RWAccess_Pass) {
// @group(0) @binding(0)
// var a : texture_storage_1d<r32uint, read_write>;
@@ -1220,6 +1237,23 @@
EXPECT_TRUE(r()->Resolve()) << r()->error();
}
+TEST_F(StorageTextureAccessTest, RWAccess_FeatureDisallowed) {
+ // @group(0) @binding(0)
+ // var a : texture_storage_1d<r32uint, read_write>;
+
+ auto st = ty.storage_texture(Source{{12, 34}}, core::type::TextureDimension::k1d,
+ core::TexelFormat::kR32Uint, core::Access::kReadWrite);
+
+ GlobalVar("a", st, Group(0_a), Binding(0_a));
+
+ auto resolver = Resolver(this, {});
+ EXPECT_FALSE(resolver.Resolve());
+ EXPECT_EQ(resolver.error(),
+ "12:34 error: read-write storage textures require the "
+ "readonly_and_readwrite_storage_textures language feature, which is not allowed in "
+ "the current environment");
+}
+
} // namespace StorageTextureTests
namespace MatrixTests {
diff --git a/src/tint/lang/wgsl/resolver/uniformity_test.cc b/src/tint/lang/wgsl/resolver/uniformity_test.cc
index 07b7e3a..671d6f2 100644
--- a/src/tint/lang/wgsl/resolver/uniformity_test.cc
+++ b/src/tint/lang/wgsl/resolver/uniformity_test.cc
@@ -72,8 +72,10 @@
/// @param src the WGSL source code
/// @param should_pass true if `src` should pass the analysis, otherwise false
void RunTest(std::string src, bool should_pass) {
+ wgsl::reader::Options options;
+ options.allowed_features = wgsl::AllowedFeatures::Everything();
auto file = std::make_unique<Source::File>("test", src);
- auto program = wgsl::reader::Parse(file.get());
+ auto program = wgsl::reader::Parse(file.get(), options);
return RunTest(std::move(program), should_pass);
}
diff --git a/src/tint/lang/wgsl/resolver/validation_test.cc b/src/tint/lang/wgsl/resolver/validation_test.cc
index 977b79d..9d369b8 100644
--- a/src/tint/lang/wgsl/resolver/validation_test.cc
+++ b/src/tint/lang/wgsl/resolver/validation_test.cc
@@ -169,7 +169,7 @@
{
ProgramBuilder b;
b.WrapInFunction(b.create<FakeExpr>());
- Resolver(&b).Resolve();
+ Resolver(&b, {}).Resolve();
},
"internal compiler error: Switch() matched no cases. Type: tint::resolver::FakeExpr");
}
diff --git a/src/tint/lang/wgsl/resolver/validator.cc b/src/tint/lang/wgsl/resolver/validator.cc
index da7536d..c05eca2 100644
--- a/src/tint/lang/wgsl/resolver/validator.cc
+++ b/src/tint/lang/wgsl/resolver/validator.cc
@@ -165,12 +165,14 @@
ProgramBuilder* builder,
SemHelper& sem,
const wgsl::Extensions& enabled_extensions,
+ const wgsl::AllowedFeatures& allowed_features,
const Hashmap<const core::type::Type*, const Source*, 8>& atomic_composite_info,
Hashset<TypeAndAddressSpace, 8>& valid_type_storage_layouts)
: symbols_(builder->Symbols()),
diagnostics_(builder->Diagnostics()),
sem_(sem),
enabled_extensions_(enabled_extensions),
+ allowed_features_(allowed_features),
atomic_composite_info_(atomic_composite_info),
valid_type_storage_layouts_(valid_type_storage_layouts) {
// Set default severities for filterable diagnostic rules.
@@ -333,7 +335,27 @@
bool Validator::StorageTexture(const core::type::StorageTexture* t, const Source& source) const {
switch (t->access()) {
case core::Access::kRead:
+ if (!allowed_features_.features.count(
+ wgsl::LanguageFeature::kReadonlyAndReadwriteStorageTextures)) {
+ AddError(
+ "read-only storage textures require the "
+ "readonly_and_readwrite_storage_textures language feature, which is not "
+ "allowed in the current environment",
+ source);
+ return false;
+ }
+ break;
case core::Access::kReadWrite:
+ if (!allowed_features_.features.count(
+ wgsl::LanguageFeature::kReadonlyAndReadwriteStorageTextures)) {
+ AddError(
+ "read-write storage textures require the "
+ "readonly_and_readwrite_storage_textures language feature, which is not "
+ "allowed in the current environment",
+ source);
+ return false;
+ }
+ break;
case core::Access::kWrite:
break;
case core::Access::kUndefined:
@@ -1729,22 +1751,31 @@
return true;
}
-bool Validator::RequiredExtensionForBuiltinFn(const sem::Call* call) const {
+bool Validator::RequiredFeaturesForBuiltinFn(const sem::Call* call) const {
const auto* builtin = call->Target()->As<sem::BuiltinFn>();
if (!builtin) {
return true;
}
const auto extension = builtin->RequiredExtension();
- if (extension == wgsl::Extension::kUndefined) {
- return true;
+ if (extension != wgsl::Extension::kUndefined) {
+ if (!enabled_extensions_.Contains(extension)) {
+ AddError("cannot call built-in function '" + std::string(builtin->str()) +
+ "' without extension " + tint::ToString(extension),
+ call->Declaration()->source);
+ return false;
+ }
}
- if (!enabled_extensions_.Contains(extension)) {
- AddError("cannot call built-in function '" + std::string(builtin->str()) +
- "' without extension " + tint::ToString(extension),
- call->Declaration()->source);
- return false;
+ const auto feature = builtin->RequiredLanguageFeature();
+ if (feature != wgsl::LanguageFeature::kUndefined) {
+ if (!allowed_features_.features.count(feature)) {
+ AddError("built-in function '" + std::string(builtin->str()) + "' requires the " +
+ tint::ToString(feature) +
+ " language feature, which is not allowed in the current environment",
+ call->Declaration()->source);
+ return false;
+ }
}
return true;
diff --git a/src/tint/lang/wgsl/resolver/validator.h b/src/tint/lang/wgsl/resolver/validator.h
index ed880fb..20735de 100644
--- a/src/tint/lang/wgsl/resolver/validator.h
+++ b/src/tint/lang/wgsl/resolver/validator.h
@@ -34,6 +34,7 @@
#include "src/tint/lang/core/evaluation_stage.h"
#include "src/tint/lang/wgsl/ast/pipeline_stage.h"
+#include "src/tint/lang/wgsl/common/allowed_features.h"
#include "src/tint/lang/wgsl/program/program_builder.h"
#include "src/tint/lang/wgsl/resolver/sem_helper.h"
#include "src/tint/utils/containers/hashmap.h"
@@ -113,11 +114,13 @@
/// @param builder the program builder
/// @param helper the SEM helper to validate with
/// @param enabled_extensions all the extensions declared in current module
+ /// @param allowed_features the allowed extensions and features
/// @param atomic_composite_info atomic composite info of the module
/// @param valid_type_storage_layouts a set of validated type layouts by address space
Validator(ProgramBuilder* builder,
SemHelper& helper,
const wgsl::Extensions& enabled_extensions,
+ const wgsl::AllowedFeatures& allowed_features,
const Hashmap<const core::type::Type*, const Source*, 8>& atomic_composite_info,
Hashset<TypeAndAddressSpace, 8>& valid_type_storage_layouts);
~Validator();
@@ -482,10 +485,10 @@
/// @returns true on success, false otherwise
bool SubgroupBroadcast(const sem::Call* call) const;
- /// Validates an optional builtin function and its required extension.
+ /// Validates an optional builtin function and its required extensions and language features.
/// @param call the builtin call to validate
/// @returns true on success, false otherwise
- bool RequiredExtensionForBuiltinFn(const sem::Call* call) const;
+ bool RequiredFeaturesForBuiltinFn(const sem::Call* call) const;
/// Validates that 'f16' extension is enabled for f16 usage at @p source
/// @param source the source of the f16 usage
@@ -583,6 +586,7 @@
SemHelper& sem_;
DiagnosticFilterStack diagnostic_filters_;
const wgsl::Extensions& enabled_extensions_;
+ const wgsl::AllowedFeatures& allowed_features_;
const Hashmap<const core::type::Type*, const Source*, 8>& atomic_composite_info_;
Hashset<TypeAndAddressSpace, 8>& valid_type_storage_layouts_;
};
diff --git a/src/tint/lang/wgsl/sem/BUILD.bazel b/src/tint/lang/wgsl/sem/BUILD.bazel
index a2d9e51..22b1c0e 100644
--- a/src/tint/lang/wgsl/sem/BUILD.bazel
+++ b/src/tint/lang/wgsl/sem/BUILD.bazel
@@ -150,6 +150,7 @@
"//src/tint/lang/core/type",
"//src/tint/lang/wgsl",
"//src/tint/lang/wgsl/ast",
+ "//src/tint/lang/wgsl/common",
"//src/tint/lang/wgsl/program",
"//src/tint/lang/wgsl/resolver",
"//src/tint/lang/wgsl/sem",
diff --git a/src/tint/lang/wgsl/sem/BUILD.cmake b/src/tint/lang/wgsl/sem/BUILD.cmake
index 0194020..119cde7 100644
--- a/src/tint/lang/wgsl/sem/BUILD.cmake
+++ b/src/tint/lang/wgsl/sem/BUILD.cmake
@@ -149,6 +149,7 @@
tint_lang_core_type
tint_lang_wgsl
tint_lang_wgsl_ast
+ tint_lang_wgsl_common
tint_lang_wgsl_program
tint_lang_wgsl_resolver
tint_lang_wgsl_sem
diff --git a/src/tint/lang/wgsl/sem/BUILD.gn b/src/tint/lang/wgsl/sem/BUILD.gn
index a5ffe8a..6d7dfe9 100644
--- a/src/tint/lang/wgsl/sem/BUILD.gn
+++ b/src/tint/lang/wgsl/sem/BUILD.gn
@@ -151,6 +151,7 @@
"${tint_src_dir}/lang/core/type",
"${tint_src_dir}/lang/wgsl",
"${tint_src_dir}/lang/wgsl/ast",
+ "${tint_src_dir}/lang/wgsl/common",
"${tint_src_dir}/lang/wgsl/program",
"${tint_src_dir}/lang/wgsl/resolver",
"${tint_src_dir}/lang/wgsl/sem",
diff --git a/src/tint/lang/wgsl/sem/builtin_fn.cc b/src/tint/lang/wgsl/sem/builtin_fn.cc
index ea49f47..e180378 100644
--- a/src/tint/lang/wgsl/sem/builtin_fn.cc
+++ b/src/tint/lang/wgsl/sem/builtin_fn.cc
@@ -115,6 +115,13 @@
return wgsl::Extension::kUndefined;
}
+wgsl::LanguageFeature BuiltinFn::RequiredLanguageFeature() const {
+ if (fn_ == wgsl::BuiltinFn::kTextureBarrier) {
+ return wgsl::LanguageFeature::kReadonlyAndReadwriteStorageTextures;
+ }
+ return wgsl::LanguageFeature::kUndefined;
+}
+
} // namespace tint::sem
//! @endcond
diff --git a/src/tint/lang/wgsl/sem/builtin_fn.h b/src/tint/lang/wgsl/sem/builtin_fn.h
index 0f2537f..44e3138 100644
--- a/src/tint/lang/wgsl/sem/builtin_fn.h
+++ b/src/tint/lang/wgsl/sem/builtin_fn.h
@@ -33,6 +33,7 @@
#include "src/tint/lang/wgsl/builtin_fn.h"
#include "src/tint/lang/wgsl/extension.h"
+#include "src/tint/lang/wgsl/language_feature.h"
#include "src/tint/lang/wgsl/sem/call_target.h"
#include "src/tint/lang/wgsl/sem/pipeline_stage_set.h"
#include "src/tint/utils/math/hash.h"
@@ -114,9 +115,13 @@
bool HasSideEffects() const;
/// @returns the required extension of this builtin function. Returns
- /// wgsl::Extension::kNone if no extension is required.
+ /// wgsl::Extension::kUndefined if no extension is required.
wgsl::Extension RequiredExtension() const;
+ /// @returns the required language feature of this builtin function. Returns
+ /// wgsl::LanguageFeature::kUndefined if no language feature is required.
+ wgsl::LanguageFeature RequiredLanguageFeature() const;
+
/// @return the hash code for this object
std::size_t HashCode() const {
return Hash(Fn(), SupportedStages(), ReturnType(), Parameters(), IsDeprecated());
diff --git a/src/tint/lang/wgsl/writer/ast_printer/BUILD.bazel b/src/tint/lang/wgsl/writer/ast_printer/BUILD.bazel
index 92a7f93..bd87e10 100644
--- a/src/tint/lang/wgsl/writer/ast_printer/BUILD.bazel
+++ b/src/tint/lang/wgsl/writer/ast_printer/BUILD.bazel
@@ -114,6 +114,7 @@
"//src/tint/lang/core/type",
"//src/tint/lang/wgsl",
"//src/tint/lang/wgsl/ast",
+ "//src/tint/lang/wgsl/common",
"//src/tint/lang/wgsl/program",
"//src/tint/lang/wgsl/resolver",
"//src/tint/lang/wgsl/sem",
diff --git a/src/tint/lang/wgsl/writer/ast_printer/BUILD.cmake b/src/tint/lang/wgsl/writer/ast_printer/BUILD.cmake
index a3abc50..94c711f 100644
--- a/src/tint/lang/wgsl/writer/ast_printer/BUILD.cmake
+++ b/src/tint/lang/wgsl/writer/ast_printer/BUILD.cmake
@@ -118,6 +118,7 @@
tint_lang_core_type
tint_lang_wgsl
tint_lang_wgsl_ast
+ tint_lang_wgsl_common
tint_lang_wgsl_program
tint_lang_wgsl_resolver
tint_lang_wgsl_sem
diff --git a/src/tint/lang/wgsl/writer/ast_printer/BUILD.gn b/src/tint/lang/wgsl/writer/ast_printer/BUILD.gn
index ab5e562..88734f2 100644
--- a/src/tint/lang/wgsl/writer/ast_printer/BUILD.gn
+++ b/src/tint/lang/wgsl/writer/ast_printer/BUILD.gn
@@ -117,6 +117,7 @@
"${tint_src_dir}/lang/core/type",
"${tint_src_dir}/lang/wgsl",
"${tint_src_dir}/lang/wgsl/ast",
+ "${tint_src_dir}/lang/wgsl/common",
"${tint_src_dir}/lang/wgsl/program",
"${tint_src_dir}/lang/wgsl/resolver",
"${tint_src_dir}/lang/wgsl/sem",
diff --git a/src/tint/lang/wgsl/writer/ir_to_program/BUILD.bazel b/src/tint/lang/wgsl/writer/ir_to_program/BUILD.bazel
index 7257b04..9eae515 100644
--- a/src/tint/lang/wgsl/writer/ir_to_program/BUILD.bazel
+++ b/src/tint/lang/wgsl/writer/ir_to_program/BUILD.bazel
@@ -55,6 +55,7 @@
"//src/tint/lang/core/type",
"//src/tint/lang/wgsl",
"//src/tint/lang/wgsl/ast",
+ "//src/tint/lang/wgsl/common",
"//src/tint/lang/wgsl/intrinsic",
"//src/tint/lang/wgsl/ir",
"//src/tint/lang/wgsl/program",
diff --git a/src/tint/lang/wgsl/writer/ir_to_program/BUILD.cmake b/src/tint/lang/wgsl/writer/ir_to_program/BUILD.cmake
index 3f47887..d86a7dc 100644
--- a/src/tint/lang/wgsl/writer/ir_to_program/BUILD.cmake
+++ b/src/tint/lang/wgsl/writer/ir_to_program/BUILD.cmake
@@ -54,6 +54,7 @@
tint_lang_core_type
tint_lang_wgsl
tint_lang_wgsl_ast
+ tint_lang_wgsl_common
tint_lang_wgsl_intrinsic
tint_lang_wgsl_ir
tint_lang_wgsl_program
diff --git a/src/tint/lang/wgsl/writer/ir_to_program/BUILD.gn b/src/tint/lang/wgsl/writer/ir_to_program/BUILD.gn
index bc7e8d0..e2957b0 100644
--- a/src/tint/lang/wgsl/writer/ir_to_program/BUILD.gn
+++ b/src/tint/lang/wgsl/writer/ir_to_program/BUILD.gn
@@ -58,6 +58,7 @@
"${tint_src_dir}/lang/core/type",
"${tint_src_dir}/lang/wgsl",
"${tint_src_dir}/lang/wgsl/ast",
+ "${tint_src_dir}/lang/wgsl/common",
"${tint_src_dir}/lang/wgsl/intrinsic",
"${tint_src_dir}/lang/wgsl/ir",
"${tint_src_dir}/lang/wgsl/program",