From e4039c76c731b4e41181ea07ef3afe1ed9400aab Mon Sep 17 00:00:00 2001 From: dan sinclair Date: Fri, 17 Feb 2023 21:58:59 +0000 Subject: [PATCH] Move the Extension builtin to the builtin/ folder. This CL moves Extension from ast:: to builtin:: Change-Id: Ica1e6f4f9229341b547011389d47ae3be9830b0d Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/120362 Commit-Queue: Dan Sinclair Reviewed-by: Ben Clayton Kokoro: Kokoro --- src/tint/BUILD.gn | 16 +- src/tint/CMakeLists.txt | 2 +- src/tint/ast/enable.cc | 2 +- src/tint/ast/enable.h | 6 +- src/tint/ast/enable_test.cc | 4 +- src/tint/ast/module_test.cc | 4 +- src/tint/{ast => builtin}/extension.cc | 8 +- src/tint/{ast => builtin}/extension.cc.tmpl | 6 +- src/tint/{ast => builtin}/extension.h | 12 +- src/tint/{ast => builtin}/extension.h.tmpl | 10 +- src/tint/{ast => builtin}/extension_bench.cc | 8 +- .../{ast => builtin}/extension_bench.cc.tmpl | 6 +- src/tint/{ast => builtin}/extension_test.cc | 11 +- .../{ast => builtin}/extension_test.cc.tmpl | 9 +- src/tint/cmd/main.cc | 2 +- src/tint/inspector/inspector.cc | 2 +- src/tint/inspector/inspector_test.cc | 2 +- src/tint/ir/builder_impl_test.cc | 2 +- src/tint/program_builder.h | 6 +- src/tint/reader/wgsl/parser_impl.cc | 7 +- .../wgsl/parser_impl_enable_directive_test.cc | 10 +- .../address_space_layout_validation_test.cc | 6 +- .../resolver/address_space_validation_test.cc | 72 +++---- src/tint/resolver/builtin_test.cc | 46 ++--- src/tint/resolver/builtin_validation_test.cc | 4 +- src/tint/resolver/call_test.cc | 2 +- src/tint/resolver/call_validation_test.cc | 6 +- .../resolver/const_eval_binary_op_test.cc | 2 +- src/tint/resolver/const_eval_builtin_test.cc | 2 +- .../resolver/const_eval_construction_test.cc | 36 ++-- .../resolver/const_eval_conversion_test.cc | 8 +- src/tint/resolver/const_eval_indexing_test.cc | 2 +- .../resolver/const_eval_member_access_test.cc | 4 +- src/tint/resolver/const_eval_unary_op_test.cc | 2 +- src/tint/resolver/dependency_graph_test.cc | 2 +- .../resolver/entry_point_validation_test.cc | 18 +- src/tint/resolver/expression_kind_test.cc | 2 +- src/tint/resolver/f16_extension_test.cc | 12 +- src/tint/resolver/function_validation_test.cc | 2 +- .../host_shareable_validation_test.cc | 2 +- src/tint/resolver/materialize_test.cc | 10 +- src/tint/resolver/override_test.cc | 2 +- src/tint/resolver/resolver.cc | 2 +- src/tint/resolver/resolver.h | 2 +- src/tint/resolver/side_effects_test.cc | 3 +- src/tint/resolver/struct_layout_test.cc | 8 +- .../type_initializer_validation_test.cc | 90 ++++----- src/tint/resolver/type_validation_test.cc | 20 +- src/tint/resolver/validator.cc | 13 +- src/tint/resolver/validator.h | 4 +- src/tint/resolver/variable_test.cc | 6 +- src/tint/resolver/variable_validation_test.cc | 2 +- src/tint/sem/builtin.cc | 6 +- src/tint/sem/builtin.h | 6 +- src/tint/sem/module.cc | 2 +- src/tint/sem/module.h | 8 +- src/tint/transform/builtin_polyfill.cc | 4 +- src/tint/transform/clamp_frag_depth.cc | 2 +- src/tint/transform/direct_variable_access.cc | 2 +- .../transform/disable_uniformity_analysis.cc | 4 +- src/tint/transform/preserve_padding.cc | 4 +- src/tint/writer/check_supported_extensions.cc | 4 +- src/tint/writer/check_supported_extensions.h | 4 +- .../writer/check_supported_extensions_test.cc | 10 +- src/tint/writer/glsl/generator_impl.cc | 2 +- .../writer/glsl/generator_impl_binary_test.cc | 26 +-- .../glsl/generator_impl_builtin_test.cc | 28 +-- .../glsl/generator_impl_initializer_test.cc | 20 +- .../generator_impl_module_constant_test.cc | 6 +- .../writer/glsl/generator_impl_type_test.cc | 6 +- ...rator_impl_variable_decl_statement_test.cc | 10 +- src/tint/writer/hlsl/generator_impl.cc | 10 +- .../writer/hlsl/generator_impl_binary_test.cc | 16 +- .../hlsl/generator_impl_builtin_test.cc | 34 ++-- .../hlsl/generator_impl_initializer_test.cc | 20 +- .../generator_impl_member_accessor_test.cc | 14 +- .../generator_impl_module_constant_test.cc | 6 +- src/tint/writer/hlsl/generator_impl_test.cc | 2 +- ...rator_impl_variable_decl_statement_test.cc | 10 +- src/tint/writer/msl/generator_impl.cc | 8 +- .../writer/msl/generator_impl_binary_test.cc | 4 +- .../writer/msl/generator_impl_builtin_test.cc | 26 +-- .../msl/generator_impl_initializer_test.cc | 20 +- .../generator_impl_module_constant_test.cc | 6 +- src/tint/writer/msl/generator_impl_test.cc | 2 +- ...rator_impl_variable_decl_statement_test.cc | 14 +- src/tint/writer/spirv/builder.cc | 16 +- src/tint/writer/spirv/builder.h | 2 +- .../spirv/builder_binary_expression_test.cc | 34 ++-- src/tint/writer/spirv/builder_builtin_test.cc | 48 ++--- .../spirv/builder_global_variable_test.cc | 2 +- .../builder_initializer_expression_test.cc | 178 +++++++++--------- src/tint/writer/spirv/builder_literal_test.cc | 4 +- src/tint/writer/spirv/builder_test.cc | 2 +- src/tint/writer/spirv/builder_type_test.cc | 8 +- .../writer/wgsl/generator_impl_cast_test.cc | 4 +- .../writer/wgsl/generator_impl_enable_test.cc | 2 +- .../wgsl/generator_impl_initializer_test.cc | 8 +- .../wgsl/generator_impl_literal_test.cc | 2 +- .../writer/wgsl/generator_impl_type_test.cc | 6 +- ...rator_impl_variable_decl_statement_test.cc | 6 +- 101 files changed, 604 insertions(+), 591 deletions(-) rename src/tint/{ast => builtin}/extension.cc (94%) rename src/tint/{ast => builtin}/extension.cc.tmpl (85%) rename src/tint/{ast => builtin}/extension.h (90%) rename src/tint/{ast => builtin}/extension.h.tmpl (81%) rename src/tint/{ast => builtin}/extension_bench.cc (94%) rename src/tint/{ast => builtin}/extension_bench.cc.tmpl (86%) rename src/tint/{ast => builtin}/extension_test.cc (95%) rename src/tint/{ast => builtin}/extension_test.cc.tmpl (83%) diff --git a/src/tint/BUILD.gn b/src/tint/BUILD.gn index d54b9307e5..10358f0e41 100644 --- a/src/tint/BUILD.gn +++ b/src/tint/BUILD.gn @@ -277,6 +277,7 @@ libtint_source_set("libtint_program_src") { deps = [ ":libtint_ast_hdrs", ":libtint_base_src", + ":libtint_builtins_src", ":libtint_constant_src", ":libtint_sem_src", ":libtint_text_src", @@ -310,6 +311,7 @@ libtint_source_set("libtint_inspector_src") { deps = [ ":libtint_ast_src", ":libtint_base_src", + ":libtint_builtins_src", ":libtint_program_src", ":libtint_sem_src", ":libtint_type_src", @@ -468,7 +470,6 @@ libtint_source_set("libtint_ast_hdrs") { "ast/discard_statement.h", "ast/enable.h", "ast/expression.h", - "ast/extension.h", "ast/float_literal_expression.h", "ast/for_loop_statement.h", "ast/function.h", @@ -554,7 +555,6 @@ libtint_source_set("libtint_ast_src") { "ast/discard_statement.cc", "ast/enable.cc", "ast/expression.cc", - "ast/extension.cc", "ast/float_literal_expression.cc", "ast/for_loop_statement.cc", "ast/function.cc", @@ -685,6 +685,7 @@ libtint_source_set("libtint_sem_src") { deps = [ ":libtint_ast_hdrs", ":libtint_base_src", + ":libtint_builtins_src", ":libtint_constant_src", ":libtint_type_src", ] @@ -694,7 +695,10 @@ libtint_source_set("libtint_builtins_src") { sources = [ "builtin/builtin_value.cc", "builtin/builtin_value.h", + "builtin/extension.cc", + "builtin/extension.h", ] + deps = [ ":libtint_base_src" ] } libtint_source_set("libtint_type_src") { @@ -869,6 +873,7 @@ libtint_source_set("libtint_writer_src") { deps = [ ":libtint_ast_src", ":libtint_base_src", + ":libtint_builtins_src", ":libtint_inspector_src", ":libtint_program_src", ":libtint_sem_src", @@ -1232,7 +1237,6 @@ if (tint_build_unittests) { "ast/diagnostic_directive_test.cc", "ast/discard_statement_test.cc", "ast/enable_test.cc", - "ast/extension_test.cc", "ast/float_literal_expression_test.cc", "ast/for_loop_statement_test.cc", "ast/function_test.cc", @@ -1282,7 +1286,10 @@ if (tint_build_unittests) { } tint_unittests_source_set("tint_unittests_builtins_src") { - sources = [ "builtin/builtin_value_test.cc" ] + sources = [ + "builtin/builtin_value_test.cc", + "builtin/extension_test.cc", + ] deps = [ ":libtint_builtins_src" ] } @@ -1373,6 +1380,7 @@ if (tint_build_unittests) { ] deps = [ ":libtint_base_src", + ":libtint_builtins_src", ":libtint_transform_src", ":tint_unittests_ast_src", ] diff --git a/src/tint/CMakeLists.txt b/src/tint/CMakeLists.txt index 385e906411..bdaf2f4ae2 100644 --- a/src/tint/CMakeLists.txt +++ b/src/tint/CMakeLists.txt @@ -549,8 +549,8 @@ list(APPEND TINT_LIB_SRCS ) tint_generated(builtin/builtin_value BENCH TEST) +tint_generated(builtin/extension BENCH TEST) tint_generated(ast/diagnostic_control BENCH TEST) -tint_generated(ast/extension BENCH TEST) tint_generated(ast/interpolate_attribute BENCH TEST) tint_generated(resolver/init_conv_intrinsic) tint_generated(sem/builtin_type) diff --git a/src/tint/ast/enable.cc b/src/tint/ast/enable.cc index 896b0197ef..6087a3ef61 100644 --- a/src/tint/ast/enable.cc +++ b/src/tint/ast/enable.cc @@ -20,7 +20,7 @@ TINT_INSTANTIATE_TYPEINFO(tint::ast::Enable); namespace tint::ast { -Enable::Enable(ProgramID pid, NodeID nid, const Source& src, Extension ext) +Enable::Enable(ProgramID pid, NodeID nid, const Source& src, builtin::Extension ext) : Base(pid, nid, src), extension(ext) {} Enable::Enable(Enable&&) = default; diff --git a/src/tint/ast/enable.h b/src/tint/ast/enable.h index 4c27113c0d..0c64df9101 100644 --- a/src/tint/ast/enable.h +++ b/src/tint/ast/enable.h @@ -19,8 +19,8 @@ #include #include -#include "src/tint/ast/extension.h" #include "src/tint/ast/node.h" +#include "src/tint/builtin/extension.h" namespace tint::ast { @@ -36,7 +36,7 @@ class Enable final : public Castable { /// @param nid the unique node identifier /// @param src the source of this node /// @param ext the extension - Enable(ProgramID pid, NodeID nid, const Source& src, Extension ext); + Enable(ProgramID pid, NodeID nid, const Source& src, builtin::Extension ext); /// Move constructor Enable(Enable&&); @@ -49,7 +49,7 @@ class Enable final : public Castable { const Enable* Clone(CloneContext* ctx) const override; /// The extension name - const Extension extension; + const builtin::Extension extension; }; } // namespace tint::ast diff --git a/src/tint/ast/enable_test.cc b/src/tint/ast/enable_test.cc index e8b6e5c20f..921501866e 100644 --- a/src/tint/ast/enable_test.cc +++ b/src/tint/ast/enable_test.cc @@ -22,12 +22,12 @@ namespace { using EnableTest = TestHelper; TEST_F(EnableTest, Creation) { - auto* ext = create(Source{{{20, 2}, {20, 5}}}, Extension::kF16); + auto* ext = create(Source{{{20, 2}, {20, 5}}}, builtin::Extension::kF16); EXPECT_EQ(ext->source.range.begin.line, 20u); EXPECT_EQ(ext->source.range.begin.column, 2u); EXPECT_EQ(ext->source.range.end.line, 20u); EXPECT_EQ(ext->source.range.end.column, 5u); - EXPECT_EQ(ext->extension, Extension::kF16); + EXPECT_EQ(ext->extension, builtin::Extension::kF16); } } // namespace diff --git a/src/tint/ast/module_test.cc b/src/tint/ast/module_test.cc index cd03781e4e..24faaee434 100644 --- a/src/tint/ast/module_test.cc +++ b/src/tint/ast/module_test.cc @@ -135,9 +135,9 @@ TEST_F(ModuleTest, CloneOrder) { } TEST_F(ModuleTest, Directives) { - auto* enable_1 = Enable(ast::Extension::kF16); + auto* enable_1 = Enable(builtin::Extension::kF16); auto* diagnostic_1 = DiagnosticDirective(DiagnosticSeverity::kWarning, "foo"); - auto* enable_2 = Enable(ast::Extension::kChromiumExperimentalFullPtrParameters); + auto* enable_2 = Enable(builtin::Extension::kChromiumExperimentalFullPtrParameters); auto* diagnostic_2 = DiagnosticDirective(DiagnosticSeverity::kOff, "bar"); this->SetResolveOnBuild(false); diff --git a/src/tint/ast/extension.cc b/src/tint/builtin/extension.cc similarity index 94% rename from src/tint/ast/extension.cc rename to src/tint/builtin/extension.cc index 31a80839c6..3d57867bbb 100644 --- a/src/tint/ast/extension.cc +++ b/src/tint/builtin/extension.cc @@ -15,14 +15,14 @@ //////////////////////////////////////////////////////////////////////////////// // File generated by tools/src/cmd/gen // using the template: -// src/tint/ast/extension.cc.tmpl +// src/tint/builtin/extension.cc.tmpl // // Do not modify this file directly //////////////////////////////////////////////////////////////////////////////// -#include "src/tint/ast/extension.h" +#include "src/tint/builtin/extension.h" -namespace tint::ast { +namespace tint::builtin { /// ParseExtension parses a Extension from a string. /// @param str the string to parse @@ -64,4 +64,4 @@ std::ostream& operator<<(std::ostream& out, Extension value) { return out << ""; } -} // namespace tint::ast +} // namespace tint::builtin diff --git a/src/tint/ast/extension.cc.tmpl b/src/tint/builtin/extension.cc.tmpl similarity index 85% rename from src/tint/ast/extension.cc.tmpl rename to src/tint/builtin/extension.cc.tmpl index e0f319ec7a..5f00264a6c 100644 --- a/src/tint/ast/extension.cc.tmpl +++ b/src/tint/builtin/extension.cc.tmpl @@ -11,12 +11,12 @@ See: {{- Import "src/tint/templates/enums.tmpl.inc" -}} {{- $enum := (Sem.Enum "extension") -}} -#include "src/tint/ast/extension.h" +#include "src/tint/builtin/extension.h" -namespace tint::ast { +namespace tint::builtin { {{ Eval "ParseEnum" $enum}} {{ Eval "EnumOStream" $enum}} -} // namespace tint::ast +} // namespace tint::builtin diff --git a/src/tint/ast/extension.h b/src/tint/builtin/extension.h similarity index 90% rename from src/tint/ast/extension.h rename to src/tint/builtin/extension.h index 062e3fc5bd..f0ebeca278 100644 --- a/src/tint/ast/extension.h +++ b/src/tint/builtin/extension.h @@ -15,19 +15,19 @@ //////////////////////////////////////////////////////////////////////////////// // File generated by tools/src/cmd/gen // using the template: -// src/tint/ast/extension.h.tmpl +// src/tint/builtin/extension.h.tmpl // // Do not modify this file directly //////////////////////////////////////////////////////////////////////////////// -#ifndef SRC_TINT_AST_EXTENSION_H_ -#define SRC_TINT_AST_EXTENSION_H_ +#ifndef SRC_TINT_BUILTIN_EXTENSION_H_ +#define SRC_TINT_BUILTIN_EXTENSION_H_ #include #include "src/tint/utils/unique_vector.h" -namespace tint::ast { +namespace tint::builtin { /// An enumerator of WGSL extensions /// @see src/tint/intrinsics.def for extension descriptions @@ -61,6 +61,6 @@ constexpr const char* kExtensionStrings[] = { // A unique vector of extensions using Extensions = utils::UniqueVector; -} // namespace tint::ast +} // namespace tint::builtin -#endif // SRC_TINT_AST_EXTENSION_H_ +#endif // SRC_TINT_BUILTIN_EXTENSION_H_ diff --git a/src/tint/ast/extension.h.tmpl b/src/tint/builtin/extension.h.tmpl similarity index 81% rename from src/tint/ast/extension.h.tmpl rename to src/tint/builtin/extension.h.tmpl index 29feff962a..3051ad44e6 100644 --- a/src/tint/ast/extension.h.tmpl +++ b/src/tint/builtin/extension.h.tmpl @@ -11,14 +11,14 @@ See: {{- Import "src/tint/templates/enums.tmpl.inc" -}} {{- $enum := (Sem.Enum "extension") -}} -#ifndef SRC_TINT_AST_EXTENSION_H_ -#define SRC_TINT_AST_EXTENSION_H_ +#ifndef SRC_TINT_BUILTIN_EXTENSION_H_ +#define SRC_TINT_BUILTIN_EXTENSION_H_ #include #include "src/tint/utils/unique_vector.h" -namespace tint::ast { +namespace tint::builtin { /// An enumerator of WGSL extensions /// @see src/tint/intrinsics.def for extension descriptions @@ -27,6 +27,6 @@ namespace tint::ast { // A unique vector of extensions using Extensions = utils::UniqueVector; -} // namespace tint::ast +} // namespace tint::builtin -#endif // SRC_TINT_AST_EXTENSION_H_ +#endif // SRC_TINT_BUILTIN_EXTENSION_H_ diff --git a/src/tint/ast/extension_bench.cc b/src/tint/builtin/extension_bench.cc similarity index 94% rename from src/tint/ast/extension_bench.cc rename to src/tint/builtin/extension_bench.cc index 3bf35f6791..4619ce2faa 100644 --- a/src/tint/ast/extension_bench.cc +++ b/src/tint/builtin/extension_bench.cc @@ -15,18 +15,18 @@ //////////////////////////////////////////////////////////////////////////////// // File generated by tools/src/cmd/gen // using the template: -// src/tint/ast/extension_bench.cc.tmpl +// src/tint/builtin/extension_bench.cc.tmpl // // Do not modify this file directly //////////////////////////////////////////////////////////////////////////////// -#include "src/tint/ast/extension.h" +#include "src/tint/builtin/extension.h" #include #include "benchmark/benchmark.h" -namespace tint::ast { +namespace tint::builtin { namespace { void ExtensionParser(::benchmark::State& state) { @@ -78,4 +78,4 @@ void ExtensionParser(::benchmark::State& state) { BENCHMARK(ExtensionParser); } // namespace -} // namespace tint::ast +} // namespace tint::builtin diff --git a/src/tint/ast/extension_bench.cc.tmpl b/src/tint/builtin/extension_bench.cc.tmpl similarity index 86% rename from src/tint/ast/extension_bench.cc.tmpl rename to src/tint/builtin/extension_bench.cc.tmpl index af3dc9595a..5019b55bc9 100644 --- a/src/tint/ast/extension_bench.cc.tmpl +++ b/src/tint/builtin/extension_bench.cc.tmpl @@ -11,16 +11,16 @@ See: {{- Import "src/tint/templates/enums.tmpl.inc" -}} {{- $enum := (Sem.Enum "extension") -}} -#include "src/tint/ast/extension.h" +#include "src/tint/builtin/extension.h" #include #include "benchmark/benchmark.h" -namespace tint::ast { +namespace tint::builtin { namespace { {{ Eval "BenchmarkParseEnum" $enum }} } // namespace -} // namespace tint::ast +} // namespace tint::builtin diff --git a/src/tint/ast/extension_test.cc b/src/tint/builtin/extension_test.cc similarity index 95% rename from src/tint/ast/extension_test.cc rename to src/tint/builtin/extension_test.cc index ea08dccef0..01eb1aec5f 100644 --- a/src/tint/ast/extension_test.cc +++ b/src/tint/builtin/extension_test.cc @@ -15,19 +15,20 @@ //////////////////////////////////////////////////////////////////////////////// // File generated by tools/src/cmd/gen // using the template: -// src/tint/ast/extension_test.cc.tmpl +// src/tint/builtin/extension_test.cc.tmpl // // Do not modify this file directly //////////////////////////////////////////////////////////////////////////////// -#include "src/tint/ast/extension.h" +#include "src/tint/builtin/extension.h" + +#include #include -#include "src/tint/ast/test_helper.h" #include "src/tint/utils/string.h" -namespace tint::ast { +namespace tint::builtin { namespace { namespace parse_print_tests { @@ -92,4 +93,4 @@ INSTANTIATE_TEST_SUITE_P(ValidCases, ExtensionPrintTest, testing::ValuesIn(kVali } // namespace parse_print_tests } // namespace -} // namespace tint::ast +} // namespace tint::builtin diff --git a/src/tint/ast/extension_test.cc.tmpl b/src/tint/builtin/extension_test.cc.tmpl similarity index 83% rename from src/tint/ast/extension_test.cc.tmpl rename to src/tint/builtin/extension_test.cc.tmpl index 8c7a6af339..6b735b7059 100644 --- a/src/tint/ast/extension_test.cc.tmpl +++ b/src/tint/builtin/extension_test.cc.tmpl @@ -11,17 +11,18 @@ See: {{- Import "src/tint/templates/enums.tmpl.inc" -}} {{- $enum := (Sem.Enum "extension") -}} -#include "src/tint/ast/extension.h" +#include "src/tint/builtin/extension.h" + +#include #include -#include "src/tint/ast/test_helper.h" #include "src/tint/utils/string.h" -namespace tint::ast { +namespace tint::builtin { namespace { {{ Eval "TestParsePrintEnum" $enum}} } // namespace -} // namespace tint::ast +} // namespace tint::builtin diff --git a/src/tint/cmd/main.cc b/src/tint/cmd/main.cc index 49037a764c..cd46885720 100644 --- a/src/tint/cmd/main.cc +++ b/src/tint/cmd/main.cc @@ -734,7 +734,7 @@ bool GenerateHlsl(const tint::Program* program, const Options& options) { auto enable_list = program->AST().Enables(); bool dxc_require_16bit_types = false; for (auto enable : enable_list) { - if (enable->extension == tint::ast::Extension::kF16) { + if (enable->extension == tint::builtin::Extension::kF16) { dxc_require_16bit_types = true; break; } diff --git a/src/tint/inspector/inspector.cc b/src/tint/inspector/inspector.cc index 2a9c27db1d..40658db790 100644 --- a/src/tint/inspector/inspector.cc +++ b/src/tint/inspector/inspector.cc @@ -19,7 +19,6 @@ #include "src/tint/ast/bool_literal_expression.h" #include "src/tint/ast/call_expression.h" -#include "src/tint/ast/extension.h" #include "src/tint/ast/float_literal_expression.h" #include "src/tint/ast/id_attribute.h" #include "src/tint/ast/identifier.h" @@ -29,6 +28,7 @@ #include "src/tint/ast/module.h" #include "src/tint/ast/override.h" #include "src/tint/ast/var.h" +#include "src/tint/builtin/extension.h" #include "src/tint/sem/call.h" #include "src/tint/sem/function.h" #include "src/tint/sem/module.h" diff --git a/src/tint/inspector/inspector_test.cc b/src/tint/inspector/inspector_test.cc index c9762a1ee0..743f87822c 100644 --- a/src/tint/inspector/inspector_test.cc +++ b/src/tint/inspector/inspector_test.cc @@ -289,7 +289,7 @@ TEST_P(InspectorGetEntryPointComponentAndCompositionTest, Test) { std::function tint_type = GetTypeFunction(component, composition); if (component == ComponentType::kF16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); } auto* in_var = Param("in_var", tint_type(), diff --git a/src/tint/ir/builder_impl_test.cc b/src/tint/ir/builder_impl_test.cc index 44c2a616d1..6430c5847a 100644 --- a/src/tint/ir/builder_impl_test.cc +++ b/src/tint/ir/builder_impl_test.cc @@ -1509,7 +1509,7 @@ TEST_F(IR_BuilderImplTest, EmitLiteral_F32) { } TEST_F(IR_BuilderImplTest, EmitLiteral_F16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* expr = Expr(1.2_h); GlobalVar("a", ty.f16(), type::AddressSpace::kPrivate, expr); diff --git a/src/tint/program_builder.h b/src/tint/program_builder.h index cc57ed30e9..0f8a6edfc4 100644 --- a/src/tint/program_builder.h +++ b/src/tint/program_builder.h @@ -42,7 +42,6 @@ #include "src/tint/ast/disable_validation_attribute.h" #include "src/tint/ast/discard_statement.h" #include "src/tint/ast/enable.h" -#include "src/tint/ast/extension.h" #include "src/tint/ast/float_literal_expression.h" #include "src/tint/ast/for_loop_statement.h" #include "src/tint/ast/id_attribute.h" @@ -74,6 +73,7 @@ #include "src/tint/ast/variable_decl_statement.h" #include "src/tint/ast/while_statement.h" #include "src/tint/ast/workgroup_attribute.h" +#include "src/tint/builtin/extension.h" #include "src/tint/constant/composite.h" #include "src/tint/constant/splat.h" #include "src/tint/constant/value.h" @@ -2036,7 +2036,7 @@ class ProgramBuilder { /// Adds the extension to the list of enable directives at the top of the module. /// @param ext the extension to enable /// @return an `ast::Enable` enabling the given extension. - const ast::Enable* Enable(ast::Extension ext) { + const ast::Enable* Enable(builtin::Extension ext) { auto* enable = create(ext); AST().AddEnable(enable); return enable; @@ -2046,7 +2046,7 @@ class ProgramBuilder { /// @param source the enable source /// @param ext the extension to enable /// @return an `ast::Enable` enabling the given extension. - const ast::Enable* Enable(const Source& source, ast::Extension ext) { + const ast::Enable* Enable(const Source& source, builtin::Extension ext) { auto* enable = create(source, ext); AST().AddEnable(enable); return enable; diff --git a/src/tint/reader/wgsl/parser_impl.cc b/src/tint/reader/wgsl/parser_impl.cc index 2fe2386233..ac166b9fbe 100644 --- a/src/tint/reader/wgsl/parser_impl.cc +++ b/src/tint/reader/wgsl/parser_impl.cc @@ -422,14 +422,15 @@ Maybe ParserImpl::enable_directive() { return add_error(t.source(), "enable directives don't take parenthesis"); } - auto extension = ast::Extension::kUndefined; + auto extension = builtin::Extension::kUndefined; if (t.Is(Token::Type::kF16)) { // `f16` is a valid extension name and also a keyword synchronized_ = true; next(); - extension = ast::Extension::kF16; + extension = builtin::Extension::kF16; } else { - auto ext = expect_enum("extension", ast::ParseExtension, ast::kExtensionStrings); + auto ext = + expect_enum("extension", builtin::ParseExtension, builtin::kExtensionStrings); if (ext.errored) { return Failure::kErrored; } diff --git a/src/tint/reader/wgsl/parser_impl_enable_directive_test.cc b/src/tint/reader/wgsl/parser_impl_enable_directive_test.cc index 260175da36..529bc15478 100644 --- a/src/tint/reader/wgsl/parser_impl_enable_directive_test.cc +++ b/src/tint/reader/wgsl/parser_impl_enable_directive_test.cc @@ -30,7 +30,7 @@ TEST_F(EnableDirectiveTest, Valid) { auto& ast = program.AST(); ASSERT_EQ(ast.Enables().Length(), 1u); auto* enable = ast.Enables()[0]; - EXPECT_EQ(enable->extension, ast::Extension::kF16); + EXPECT_EQ(enable->extension, builtin::Extension::kF16); ASSERT_EQ(ast.GlobalDeclarations().Length(), 1u); EXPECT_EQ(ast.GlobalDeclarations()[0], enable); } @@ -48,8 +48,8 @@ enable f16; ASSERT_EQ(ast.Enables().Length(), 2u); auto* enable_a = ast.Enables()[0]; auto* enable_b = ast.Enables()[1]; - EXPECT_EQ(enable_a->extension, ast::Extension::kF16); - EXPECT_EQ(enable_b->extension, ast::Extension::kF16); + EXPECT_EQ(enable_a->extension, builtin::Extension::kF16); + EXPECT_EQ(enable_b->extension, builtin::Extension::kF16); ASSERT_EQ(ast.GlobalDeclarations().Length(), 2u); EXPECT_EQ(ast.GlobalDeclarations()[0], enable_a); EXPECT_EQ(ast.GlobalDeclarations()[1], enable_b); @@ -168,7 +168,7 @@ enable f16; // Accept the enable directive although it caused an error ASSERT_EQ(ast.Enables().Length(), 1u); auto* enable = ast.Enables()[0]; - EXPECT_EQ(enable->extension, ast::Extension::kF16); + EXPECT_EQ(enable->extension, builtin::Extension::kF16); ASSERT_EQ(ast.GlobalDeclarations().Length(), 2u); EXPECT_EQ(ast.GlobalDeclarations()[1], enable); } @@ -188,7 +188,7 @@ enable f16; // Accept the enable directive although it cause an error ASSERT_EQ(ast.Enables().Length(), 1u); auto* enable = ast.Enables()[0]; - EXPECT_EQ(enable->extension, ast::Extension::kF16); + EXPECT_EQ(enable->extension, builtin::Extension::kF16); ASSERT_EQ(ast.GlobalDeclarations().Length(), 1u); EXPECT_EQ(ast.GlobalDeclarations()[0], enable); } diff --git a/src/tint/resolver/address_space_layout_validation_test.cc b/src/tint/resolver/address_space_layout_validation_test.cc index 4a2411bdb7..041e566d21 100644 --- a/src/tint/resolver/address_space_layout_validation_test.cc +++ b/src/tint/resolver/address_space_layout_validation_test.cc @@ -371,7 +371,7 @@ TEST_F(ResolverAddressSpaceLayoutValidationTest, UniformBuffer_Vec3F16MemberOffs // @group(0) @binding(0) // var a : ScalarPackedAtEndOfVec3; - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); Structure("ScalarPackedAtEndOfVec3", utils::Vector{ Member("v", ty.vec3(ty.f16())), @@ -568,7 +568,7 @@ TEST_F(ResolverAddressSpaceLayoutValidationTest, PushConstant_UnalignedMember) { // @align(1) b : f32; // }; // var a : S; - Enable(ast::Extension::kChromiumExperimentalPushConstant); + Enable(builtin::Extension::kChromiumExperimentalPushConstant); Structure( Source{{12, 34}}, "S", utils::Vector{Member("a", ty.f32(), utils::Vector{MemberSize(5_a)}), @@ -595,7 +595,7 @@ TEST_F(ResolverAddressSpaceLayoutValidationTest, PushConstant_Aligned) { // @align(4) b : f32; // }; // var a : S; - Enable(ast::Extension::kChromiumExperimentalPushConstant); + Enable(builtin::Extension::kChromiumExperimentalPushConstant); Structure("S", utils::Vector{Member("a", ty.f32(), utils::Vector{MemberSize(5_a)}), Member("b", ty.f32(), utils::Vector{MemberAlign(4_i)})}); GlobalVar("a", ty("S"), type::AddressSpace::kPushConstant); diff --git a/src/tint/resolver/address_space_validation_test.cc b/src/tint/resolver/address_space_validation_test.cc index f96b29fca6..2c879de526 100644 --- a/src/tint/resolver/address_space_validation_test.cc +++ b/src/tint/resolver/address_space_validation_test.cc @@ -249,7 +249,7 @@ TEST_F(ResolverAddressSpaceValidationTest, PointerAlias_Storage_IntScalar) { TEST_F(ResolverAddressSpaceValidationTest, GlobalVariable_Storage_F16) { // enable f16; // var g : f16; - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); GlobalVar("g", ty.f16(), type::AddressSpace::kStorage, Binding(0_a), Group(0_a)); @@ -259,7 +259,7 @@ TEST_F(ResolverAddressSpaceValidationTest, GlobalVariable_Storage_F16) { TEST_F(ResolverAddressSpaceValidationTest, PointerAlias_Storage_F16) { // enable f16; // type t = ptr; - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); Alias("t", ty.pointer(ty.f16(), type::AddressSpace::kStorage)); @@ -270,7 +270,7 @@ TEST_F(ResolverAddressSpaceValidationTest, GlobalVariable_Storage_F16Alias) { // enable f16; // type a = f16; // var g : a; - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); Alias("a", ty.f16()); GlobalVar("g", ty("a"), type::AddressSpace::kStorage, Binding(0_a), Group(0_a)); @@ -282,7 +282,7 @@ TEST_F(ResolverAddressSpaceValidationTest, PointerAlias_Storage_F16Alias) { // enable f16; // type a = f16; // type t = ptr; - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); Alias("a", ty.f16()); Alias("t", ty.pointer(ty("a"), type::AddressSpace::kStorage)); @@ -306,7 +306,7 @@ TEST_F(ResolverAddressSpaceValidationTest, PointerAlias_Storage_VectorF32) { TEST_F(ResolverAddressSpaceValidationTest, GlobalVariable_Storage_VectorF16) { // var g : vec4; - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); GlobalVar("g", ty.vec(ty.f16(), 4u), type::AddressSpace::kStorage, Binding(0_a), Group(0_a)); ASSERT_TRUE(r()->Resolve()) << r()->error(); @@ -314,7 +314,7 @@ TEST_F(ResolverAddressSpaceValidationTest, GlobalVariable_Storage_VectorF16) { TEST_F(ResolverAddressSpaceValidationTest, PointerAlias_Storage_VectorF16) { // type t = ptr>; - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); Alias("t", ty.pointer(ty.vec(ty.f16(), 4u), type::AddressSpace::kStorage)); ASSERT_TRUE(r()->Resolve()) << r()->error(); @@ -343,7 +343,7 @@ TEST_F(ResolverAddressSpaceValidationTest, GlobalVariable_Storage_ArrayF16) { // enable f16; // struct S{ a : f16 }; // var g : array; - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); Structure("S", utils::Vector{Member("a", ty.f16())}); GlobalVar("g", ty.array(ty("S"), 3_u), type::AddressSpace::kStorage, type::Access::kRead, @@ -356,7 +356,7 @@ TEST_F(ResolverAddressSpaceValidationTest, PointerAlias_Storage_ArrayF16) { // enable f16; // struct S{ a : f16 }; // type t = ptr>; - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); Structure("S", utils::Vector{Member("a", ty.f16())}); Alias("t", @@ -412,7 +412,7 @@ TEST_F(ResolverAddressSpaceValidationTest, PointerAlias_Storage_StructI32Aliases TEST_F(ResolverAddressSpaceValidationTest, GlobalVariable_Storage_StructF16) { // struct S { x : f16 }; // var g : S; - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); Structure("S", utils::Vector{Member("x", ty.f16())}); GlobalVar("g", ty("S"), type::AddressSpace::kStorage, type::Access::kRead, Binding(0_a), @@ -424,7 +424,7 @@ TEST_F(ResolverAddressSpaceValidationTest, GlobalVariable_Storage_StructF16) { TEST_F(ResolverAddressSpaceValidationTest, PointerAlias_Storage_StructF16) { // struct S { x : f16 }; // type t = ptr; - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); Structure("S", utils::Vector{Member("x", ty.f16())}); Alias("t", ty.pointer(ty("S"), type::AddressSpace::kStorage, type::Access::kRead)); @@ -436,7 +436,7 @@ TEST_F(ResolverAddressSpaceValidationTest, GlobalVariable_Storage_StructF16Alias // struct S { x : f16 }; // type a1 = S; // var g : a1; - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); Structure("S", utils::Vector{Member("x", ty.f16())}); Alias("a1", ty("S")); @@ -451,7 +451,7 @@ TEST_F(ResolverAddressSpaceValidationTest, PointerAlias_Storage_StructF16Aliases // struct S { x : f16 }; // type a1 = S; // type t = ptr; - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); Structure("S", utils::Vector{Member("x", ty.f16())}); Alias("a1", ty("S")); @@ -675,7 +675,7 @@ TEST_F(ResolverAddressSpaceValidationTest, PointerAlias_UniformBufferIntScalar) TEST_F(ResolverAddressSpaceValidationTest, GlobalVariable_UniformBufferF16) { // enable f16; // var g : f16; - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); GlobalVar("g", ty.f16(), type::AddressSpace::kUniform, Binding(0_a), Group(0_a)); @@ -685,7 +685,7 @@ TEST_F(ResolverAddressSpaceValidationTest, GlobalVariable_UniformBufferF16) { TEST_F(ResolverAddressSpaceValidationTest, PointerAlias_UniformBufferF16) { // enable f16; // type t = ptr; - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); Alias("t", ty.pointer(ty.f16(), type::AddressSpace::kUniform)); @@ -709,7 +709,7 @@ TEST_F(ResolverAddressSpaceValidationTest, PointerAlias_UniformBufferVectorF32) TEST_F(ResolverAddressSpaceValidationTest, GlobalVariable_UniformBufferVectorF16) { // enable f16; // var g : vec4; - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); GlobalVar("g", ty.vec4(), type::AddressSpace::kUniform, Binding(0_a), Group(0_a)); @@ -719,7 +719,7 @@ TEST_F(ResolverAddressSpaceValidationTest, GlobalVariable_UniformBufferVectorF16 TEST_F(ResolverAddressSpaceValidationTest, PointerAlias_UniformBufferVectorF16) { // enable f16; // type t = ptr>; - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); Alias("t", ty.pointer(ty.vec4(), type::AddressSpace::kUniform)); @@ -754,7 +754,7 @@ TEST_F(ResolverAddressSpaceValidationTest, GlobalVariable_UniformBufferArrayF16) // @size(16) f : f16; // } // var g : array; - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); Structure("S", utils::Vector{Member("a", ty.f16(), utils::Vector{MemberSize(16_a)})}); GlobalVar("g", ty.array(ty("S"), 3_u), type::AddressSpace::kUniform, Binding(0_a), Group(0_a)); @@ -768,7 +768,7 @@ TEST_F(ResolverAddressSpaceValidationTest, PointerAlias_UniformBufferArrayF16) { // @size(16) f : f16; // } // type t = ptr>; - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); Structure("S", utils::Vector{Member("a", ty.f16(), utils::Vector{MemberSize(16_a)})}); Alias("t", ty.pointer(ty.array(ty("S"), 3_u), type::AddressSpace::kUniform)); @@ -820,7 +820,7 @@ TEST_F(ResolverAddressSpaceValidationTest, GlobalVariable_UniformBufferStructF16 // enable f16; // struct S { x : f16 }; // var g : S; - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); Structure("S", utils::Vector{Member("x", ty.f16())}); GlobalVar("g", ty("S"), type::AddressSpace::kUniform, Binding(0_a), Group(0_a)); @@ -832,7 +832,7 @@ TEST_F(ResolverAddressSpaceValidationTest, PointerAlias_UniformBufferStructF16) // enable f16; // struct S { x : f16 }; // type t = ptr; - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); Structure("S", utils::Vector{Member("x", ty.f16())}); Alias("t", ty.pointer(ty("S"), type::AddressSpace::kUniform)); @@ -845,7 +845,7 @@ TEST_F(ResolverAddressSpaceValidationTest, GlobalVariable_UniformBufferStructF16 // struct S { x : f16 }; // type a1 = S; // var g : a1; - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); Structure("S", utils::Vector{Member("x", ty.f16())}); Alias("a1", ty("S")); @@ -859,7 +859,7 @@ TEST_F(ResolverAddressSpaceValidationTest, PointerAlias_UniformBufferStructF16Al // struct S { x : f16 }; // type a1 = S; // type t = ptr; - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); Structure("S", utils::Vector{Member("x", ty.f16())}); Alias("a1", ty("S")); @@ -871,7 +871,7 @@ TEST_F(ResolverAddressSpaceValidationTest, PointerAlias_UniformBufferStructF16Al TEST_F(ResolverAddressSpaceValidationTest, GlobalVariable_PushConstantBool) { // enable chromium_experimental_push_constant; // var g : bool; - Enable(ast::Extension::kChromiumExperimentalPushConstant); + Enable(builtin::Extension::kChromiumExperimentalPushConstant); GlobalVar(Source{{56, 78}}, "g", ty.bool_(Source{{12, 34}}), type::AddressSpace::kPushConstant); ASSERT_FALSE(r()->Resolve()); @@ -884,7 +884,7 @@ TEST_F(ResolverAddressSpaceValidationTest, GlobalVariable_PushConstantBool) { TEST_F(ResolverAddressSpaceValidationTest, PointerAlias_PushConstantBool) { // enable chromium_experimental_push_constant; // type t = ptr; - Enable(ast::Extension::kChromiumExperimentalPushConstant); + Enable(builtin::Extension::kChromiumExperimentalPushConstant); Alias(Source{{56, 78}}, "t", ty.pointer(ty.bool_(Source{{12, 34}}), type::AddressSpace::kPushConstant)); @@ -899,8 +899,8 @@ TEST_F(ResolverAddressSpaceValidationTest, GlobalVariable_PushConstantF16) { // enable f16; // enable chromium_experimental_push_constant; // var g : f16; - Enable(ast::Extension::kF16); - Enable(ast::Extension::kChromiumExperimentalPushConstant); + Enable(builtin::Extension::kF16); + Enable(builtin::Extension::kChromiumExperimentalPushConstant); GlobalVar("g", ty.f16(Source{{56, 78}}), type::AddressSpace::kPushConstant); ASSERT_FALSE(r()->Resolve()); @@ -912,8 +912,8 @@ TEST_F(ResolverAddressSpaceValidationTest, PointerAlias_PushConstantF16) { // enable f16; // enable chromium_experimental_push_constant; // type t = ptr; - Enable(ast::Extension::kF16); - Enable(ast::Extension::kChromiumExperimentalPushConstant); + Enable(builtin::Extension::kF16); + Enable(builtin::Extension::kChromiumExperimentalPushConstant); Alias("t", ty.pointer(ty.f16(Source{{56, 78}}), type::AddressSpace::kPushConstant)); ASSERT_FALSE(r()->Resolve()); @@ -924,7 +924,7 @@ TEST_F(ResolverAddressSpaceValidationTest, PointerAlias_PushConstantF16) { TEST_F(ResolverAddressSpaceValidationTest, GlobalVariable_PushConstantPointer) { // enable chromium_experimental_push_constant; // var g : ptr; - Enable(ast::Extension::kChromiumExperimentalPushConstant); + Enable(builtin::Extension::kChromiumExperimentalPushConstant); GlobalVar(Source{{56, 78}}, "g", ty.pointer(Source{{12, 34}}, ty.f32(), type::AddressSpace::kPrivate), type::AddressSpace::kPushConstant); @@ -939,7 +939,7 @@ TEST_F(ResolverAddressSpaceValidationTest, GlobalVariable_PushConstantPointer) { TEST_F(ResolverAddressSpaceValidationTest, PointerAlias_PushConstantPointer) { // enable chromium_experimental_push_constant; // type t = ptr>; - Enable(ast::Extension::kChromiumExperimentalPushConstant); + Enable(builtin::Extension::kChromiumExperimentalPushConstant); Alias(Source{{56, 78}}, "t", ty.pointer(ty.pointer(Source{{12, 34}}, ty.f32(), type::AddressSpace::kPrivate), type::AddressSpace::kPushConstant)); @@ -954,7 +954,7 @@ note: while instantiating ptr, read TEST_F(ResolverAddressSpaceValidationTest, GlobalVariable_PushConstantIntScalar) { // enable chromium_experimental_push_constant; // var g : i32; - Enable(ast::Extension::kChromiumExperimentalPushConstant); + Enable(builtin::Extension::kChromiumExperimentalPushConstant); GlobalVar("g", ty.i32(), type::AddressSpace::kPushConstant); ASSERT_TRUE(r()->Resolve()) << r()->error(); @@ -963,7 +963,7 @@ TEST_F(ResolverAddressSpaceValidationTest, GlobalVariable_PushConstantIntScalar) TEST_F(ResolverAddressSpaceValidationTest, PointerAlias_PushConstantIntScalar) { // enable chromium_experimental_push_constant; // type t = ptr; - Enable(ast::Extension::kChromiumExperimentalPushConstant); + Enable(builtin::Extension::kChromiumExperimentalPushConstant); Alias("t", ty.pointer(ty.i32(), type::AddressSpace::kPushConstant)); ASSERT_TRUE(r()->Resolve()) << r()->error(); @@ -972,7 +972,7 @@ TEST_F(ResolverAddressSpaceValidationTest, PointerAlias_PushConstantIntScalar) { TEST_F(ResolverAddressSpaceValidationTest, GlobalVariable_PushConstantVectorF32) { // enable chromium_experimental_push_constant; // var g : vec4; - Enable(ast::Extension::kChromiumExperimentalPushConstant); + Enable(builtin::Extension::kChromiumExperimentalPushConstant); GlobalVar("g", ty.vec4(), type::AddressSpace::kPushConstant); ASSERT_TRUE(r()->Resolve()) << r()->error(); @@ -981,7 +981,7 @@ TEST_F(ResolverAddressSpaceValidationTest, GlobalVariable_PushConstantVectorF32) TEST_F(ResolverAddressSpaceValidationTest, PointerAlias_PushConstantVectorF32) { // enable chromium_experimental_push_constant; // var g : vec4; - Enable(ast::Extension::kChromiumExperimentalPushConstant); + Enable(builtin::Extension::kChromiumExperimentalPushConstant); Alias("t", ty.pointer(ty.vec4(), type::AddressSpace::kPushConstant)); ASSERT_TRUE(r()->Resolve()) << r()->error(); @@ -991,7 +991,7 @@ TEST_F(ResolverAddressSpaceValidationTest, GlobalVariable_PushConstantArrayF32) // enable chromium_experimental_push_constant; // struct S { a : f32} // var g : array; - Enable(ast::Extension::kChromiumExperimentalPushConstant); + Enable(builtin::Extension::kChromiumExperimentalPushConstant); Structure("S", utils::Vector{Member("a", ty.f32())}); GlobalVar("g", ty.array(ty("S"), 3_u), type::AddressSpace::kPushConstant); @@ -1002,7 +1002,7 @@ TEST_F(ResolverAddressSpaceValidationTest, PointerAlias_PushConstantArrayF32) { // enable chromium_experimental_push_constant; // struct S { a : f32} // type t = ptr>; - Enable(ast::Extension::kChromiumExperimentalPushConstant); + Enable(builtin::Extension::kChromiumExperimentalPushConstant); Structure("S", utils::Vector{Member("a", ty.f32())}); Alias("t", ty.pointer(ty.array(ty("S"), 3_u), type::AddressSpace::kPushConstant)); diff --git a/src/tint/resolver/builtin_test.cc b/src/tint/resolver/builtin_test.cc index dc49f3af9d..e3becab6b8 100644 --- a/src/tint/resolver/builtin_test.cc +++ b/src/tint/resolver/builtin_test.cc @@ -471,7 +471,7 @@ TEST_P(ResolverBuiltinTest_FloatBuiltin_IdenticalType, FourParams_Vector_f32) { TEST_P(ResolverBuiltinTest_FloatBuiltin_IdenticalType, OneParam_Scalar_f16) { auto param = GetParam(); - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto val = 0.5_h; if (param.name == std::string("acosh")) { @@ -499,7 +499,7 @@ TEST_P(ResolverBuiltinTest_FloatBuiltin_IdenticalType, OneParam_Scalar_f16) { TEST_P(ResolverBuiltinTest_FloatBuiltin_IdenticalType, OneParam_Vector_f16) { auto param = GetParam(); - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto val = param.name == std::string("acosh") ? vec3(1.0_h, 2.0_h, 3.0_h) : vec3(0.5_h, 0.5_h, 0.8_h); @@ -528,7 +528,7 @@ TEST_P(ResolverBuiltinTest_FloatBuiltin_IdenticalType, OneParam_Vector_f16) { TEST_P(ResolverBuiltinTest_FloatBuiltin_IdenticalType, TwoParams_Scalar_f16) { auto param = GetParam(); - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* call = Call(param.name, 1_h, 1_h); WrapInFunction(call); @@ -551,7 +551,7 @@ TEST_P(ResolverBuiltinTest_FloatBuiltin_IdenticalType, TwoParams_Scalar_f16) { TEST_P(ResolverBuiltinTest_FloatBuiltin_IdenticalType, TwoParams_Vector_f16) { auto param = GetParam(); - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* call = Call(param.name, vec3(1_h, 1_h, 3_h), vec3(1_h, 1_h, 3_h)); WrapInFunction(call); @@ -577,7 +577,7 @@ TEST_P(ResolverBuiltinTest_FloatBuiltin_IdenticalType, TwoParams_Vector_f16) { TEST_P(ResolverBuiltinTest_FloatBuiltin_IdenticalType, ThreeParams_Scalar_f16) { auto param = GetParam(); - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* call = Call(param.name, 0_h, 1_h, 2_h); WrapInFunction(call); @@ -600,7 +600,7 @@ TEST_P(ResolverBuiltinTest_FloatBuiltin_IdenticalType, ThreeParams_Scalar_f16) { TEST_P(ResolverBuiltinTest_FloatBuiltin_IdenticalType, ThreeParams_Vector_f16) { auto param = GetParam(); - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* call = Call(param.name, vec3(0_h, 0_h, 0_h), vec3(1_h, 1_h, 1_h), vec3(2_h, 2_h, 2_h)); @@ -628,7 +628,7 @@ TEST_P(ResolverBuiltinTest_FloatBuiltin_IdenticalType, ThreeParams_Vector_f16) { TEST_P(ResolverBuiltinTest_FloatBuiltin_IdenticalType, FourParams_Scalar_f16) { auto param = GetParam(); - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* call = Call(param.name, 1_h, 1_h, 1_h, 1_h); WrapInFunction(call); @@ -651,7 +651,7 @@ TEST_P(ResolverBuiltinTest_FloatBuiltin_IdenticalType, FourParams_Scalar_f16) { TEST_P(ResolverBuiltinTest_FloatBuiltin_IdenticalType, FourParams_Vector_f16) { auto param = GetParam(); - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* call = Call(param.name, vec3(1_h, 1_h, 3_h), vec3(1_h, 1_h, 3_h), vec3(1_h, 1_h, 3_h), vec3(1_h, 1_h, 3_h)); @@ -745,7 +745,7 @@ TEST_F(ResolverBuiltinFloatTest, Cross_f32) { } TEST_F(ResolverBuiltinFloatTest, Cross_f16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* call = Call("cross", vec3(1_h, 2_h, 3_h), vec3(1_h, 2_h, 3_h)); WrapInFunction(call); @@ -841,7 +841,7 @@ TEST_F(ResolverBuiltinFloatTest, Distance_Scalar_f32) { } TEST_F(ResolverBuiltinFloatTest, Distance_Scalar_f16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* call = Call("distance", 1_h, 1_h); WrapInFunction(call); @@ -863,7 +863,7 @@ TEST_F(ResolverBuiltinFloatTest, Distance_Vector_f32) { } TEST_F(ResolverBuiltinFloatTest, Distance_Vector_f16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* call = Call("distance", vec3(1_h, 1_h, 3_h), vec3(1_h, 1_h, 3_h)); WrapInFunction(call); @@ -949,7 +949,7 @@ TEST_F(ResolverBuiltinFloatTest, FrexpScalar_f32) { } TEST_F(ResolverBuiltinFloatTest, FrexpScalar_f16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* call = Call("frexp", 1_h); WrapInFunction(call); @@ -1013,7 +1013,7 @@ TEST_F(ResolverBuiltinFloatTest, FrexpVector_f32) { } TEST_F(ResolverBuiltinFloatTest, FrexpVector_f16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* call = Call("frexp", vec3()); WrapInFunction(call); @@ -1075,7 +1075,7 @@ TEST_F(ResolverBuiltinFloatTest, Length_Scalar_f32) { } TEST_F(ResolverBuiltinFloatTest, Length_Scalar_f16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* call = Call("length", 1_h); WrapInFunction(call); @@ -1097,7 +1097,7 @@ TEST_F(ResolverBuiltinFloatTest, Length_FloatVector_f32) { } TEST_F(ResolverBuiltinFloatTest, Length_FloatVector_f16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* call = Call("length", vec3(1_h, 1_h, 3_h)); WrapInFunction(call); @@ -1152,7 +1152,7 @@ TEST_F(ResolverBuiltinFloatTest, Mix_VectorScalar_f32) { } TEST_F(ResolverBuiltinFloatTest, Mix_VectorScalar_f16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* call = Call("mix", vec3(1_h, 1_h, 1_h), vec3(1_h, 1_h, 1_h), 4_h); WrapInFunction(call); @@ -1198,7 +1198,7 @@ TEST_F(ResolverBuiltinFloatTest, ModfScalar_f32) { } TEST_F(ResolverBuiltinFloatTest, ModfScalar_f16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* call = Call("modf", 1_h); WrapInFunction(call); @@ -1262,7 +1262,7 @@ TEST_F(ResolverBuiltinFloatTest, ModfVector_f32) { } TEST_F(ResolverBuiltinFloatTest, ModfVector_f16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* call = Call("modf", vec3()); WrapInFunction(call); @@ -1372,7 +1372,7 @@ TEST_F(ResolverBuiltinFloatTest, Normalize_Vector_f32) { } TEST_F(ResolverBuiltinFloatTest, Normalize_Vector_f16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* call = Call("normalize", vec3(1_h, 1_h, 3_h)); WrapInFunction(call); @@ -1835,7 +1835,7 @@ TEST_F(ResolverBuiltinTest, Determinant_2x2_f32) { } TEST_F(ResolverBuiltinTest, Determinant_2x2_f16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); GlobalVar("var", ty.mat2x2(), type::AddressSpace::kPrivate); @@ -1861,7 +1861,7 @@ TEST_F(ResolverBuiltinTest, Determinant_3x3_f32) { } TEST_F(ResolverBuiltinTest, Determinant_3x3_f16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); GlobalVar("var", ty.mat3x3(), type::AddressSpace::kPrivate); @@ -1887,7 +1887,7 @@ TEST_F(ResolverBuiltinTest, Determinant_4x4_f32) { } TEST_F(ResolverBuiltinTest, Determinant_4x4_f16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); GlobalVar("var", ty.mat4x4(), type::AddressSpace::kPrivate); @@ -1948,7 +1948,7 @@ TEST_F(ResolverBuiltinTest, Dot_Vec2_f32) { } TEST_F(ResolverBuiltinTest, Dot_Vec2_f16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); GlobalVar("my_var", ty.vec2(), type::AddressSpace::kPrivate); diff --git a/src/tint/resolver/builtin_validation_test.cc b/src/tint/resolver/builtin_validation_test.cc index b9c31c9daa..22e13c2806 100644 --- a/src/tint/resolver/builtin_validation_test.cc +++ b/src/tint/resolver/builtin_validation_test.cc @@ -523,7 +523,7 @@ using ResolverDP4aExtensionValidationTest = ResolverTest; TEST_F(ResolverDP4aExtensionValidationTest, Dot4I8PackedWithExtension) { // enable chromium_experimental_dp4a; // fn func { return dot4I8Packed(1u, 2u); } - Enable(ast::Extension::kChromiumExperimentalDp4A); + Enable(builtin::Extension::kChromiumExperimentalDp4A); Func("func", utils::Empty, ty.i32(), utils::Vector{ @@ -551,7 +551,7 @@ TEST_F(ResolverDP4aExtensionValidationTest, Dot4I8PackedWithoutExtension) { TEST_F(ResolverDP4aExtensionValidationTest, Dot4U8PackedWithExtension) { // enable chromium_experimental_dp4a; // fn func { return dot4U8Packed(1u, 2u); } - Enable(ast::Extension::kChromiumExperimentalDp4A); + Enable(builtin::Extension::kChromiumExperimentalDp4A); Func("func", utils::Empty, ty.u32(), utils::Vector{ diff --git a/src/tint/resolver/call_test.cc b/src/tint/resolver/call_test.cc index e5b245c1f6..25f4814ccf 100644 --- a/src/tint/resolver/call_test.cc +++ b/src/tint/resolver/call_test.cc @@ -82,7 +82,7 @@ static constexpr Params all_param_types[] = { }; TEST_F(ResolverCallTest, Valid) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); utils::Vector params; utils::Vector args; diff --git a/src/tint/resolver/call_validation_test.cc b/src/tint/resolver/call_validation_test.cc index 07e2271826..b0b8cce1b0 100644 --- a/src/tint/resolver/call_validation_test.cc +++ b/src/tint/resolver/call_validation_test.cc @@ -165,7 +165,7 @@ TEST_F(ResolverCallValidationTest, // var v : S; // foo(&v.m); // } - Enable(ast::Extension::kChromiumExperimentalFullPtrParameters); + Enable(builtin::Extension::kChromiumExperimentalFullPtrParameters); auto* S = Structure("S", utils::Vector{ Member("m", ty.i32()), }); @@ -346,7 +346,7 @@ TEST_F(ResolverCallValidationTest, LetPointer_NotWholeVar_WithFullPtrParametersE // let p: ptr = &(v[0]); // x(p); // } - Enable(ast::Extension::kChromiumExperimentalFullPtrParameters); + Enable(builtin::Extension::kChromiumExperimentalFullPtrParameters); Func("foo", utils::Vector{ Param("p", ty.pointer(type::AddressSpace::kFunction)), @@ -437,7 +437,7 @@ TEST_F(ResolverCallValidationTest, ComplexPointerChain_NotWholeVar_WithFullPtrPa // let p3 = &(*p2)[0]; // foo(&*p); // } - Enable(ast::Extension::kChromiumExperimentalFullPtrParameters); + Enable(builtin::Extension::kChromiumExperimentalFullPtrParameters); Func("foo", utils::Vector{ Param("p", ty.pointer(type::AddressSpace::kFunction)), diff --git a/src/tint/resolver/const_eval_binary_op_test.cc b/src/tint/resolver/const_eval_binary_op_test.cc index e7f6f1473b..ef7453e6f5 100644 --- a/src/tint/resolver/const_eval_binary_op_test.cc +++ b/src/tint/resolver/const_eval_binary_op_test.cc @@ -83,7 +83,7 @@ std::ostream& operator<<(std::ostream& o, const ErrorCase& c) { using ResolverConstEvalBinaryOpTest = ResolverTestWithParam>; TEST_P(ResolverConstEvalBinaryOpTest, Test) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto op = std::get<0>(GetParam()); auto& c = std::get<1>(GetParam()); diff --git a/src/tint/resolver/const_eval_builtin_test.cc b/src/tint/resolver/const_eval_builtin_test.cc index 76f82383e7..4e3cb5a72d 100644 --- a/src/tint/resolver/const_eval_builtin_test.cc +++ b/src/tint/resolver/const_eval_builtin_test.cc @@ -142,7 +142,7 @@ static Case E(std::initializer_list sargs, std::string err) { using ResolverConstEvalBuiltinTest = ResolverTestWithParam>; TEST_P(ResolverConstEvalBuiltinTest, Test) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto builtin = std::get<0>(GetParam()); auto& c = std::get<1>(GetParam()); diff --git a/src/tint/resolver/const_eval_construction_test.cc b/src/tint/resolver/const_eval_construction_test.cc index fbf751535a..55c2cf5584 100644 --- a/src/tint/resolver/const_eval_construction_test.cc +++ b/src/tint/resolver/const_eval_construction_test.cc @@ -102,7 +102,7 @@ TEST_F(ResolverConstEvalTest, Scalar_f32) { } TEST_F(ResolverConstEvalTest, Scalar_f16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* expr = Expr(9.9_h); WrapInFunction(expr); @@ -146,7 +146,7 @@ Case C() { } using ResolverConstEvalZeroInitTest = ResolverTestWithParam; TEST_P(ResolverConstEvalZeroInitTest, Test) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto& param = GetParam(); auto ty = param.type(*this); auto* expr = Call(ty); @@ -316,7 +316,7 @@ TEST_F(ResolverConstEvalTest, Vec3_ZeroInit_f32) { } TEST_F(ResolverConstEvalTest, Vec3_ZeroInit_f16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* expr = vec3(); WrapInFunction(expr); @@ -483,7 +483,7 @@ TEST_F(ResolverConstEvalTest, Vec3_Splat_f32) { } TEST_F(ResolverConstEvalTest, Vec3_Splat_f16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* expr = vec3(9.9_h); WrapInFunction(expr); @@ -719,7 +719,7 @@ TEST_F(ResolverConstEvalTest, Vec3_FullConstruct_f32) { } TEST_F(ResolverConstEvalTest, Vec3_FullConstruct_f16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* expr = vec3(1_h, 2_h, 3_h); WrapInFunction(expr); @@ -1018,7 +1018,7 @@ TEST_F(ResolverConstEvalTest, Vec3_MixConstruct_f32_mixed_sign_0) { } TEST_F(ResolverConstEvalTest, Vec3_MixConstruct_f16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* expr = vec3(1_h, vec2(2_h, 3_h)); WrapInFunction(expr); @@ -1053,7 +1053,7 @@ TEST_F(ResolverConstEvalTest, Vec3_MixConstruct_f16) { } TEST_F(ResolverConstEvalTest, Vec3_MixConstruct_f16_all_10) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* expr = vec3(10_h, vec2(10_h, 10_h)); WrapInFunction(expr); @@ -1088,7 +1088,7 @@ TEST_F(ResolverConstEvalTest, Vec3_MixConstruct_f16_all_10) { } TEST_F(ResolverConstEvalTest, Vec3_MixConstruct_f16_all_positive_0) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* expr = vec3(0_h, vec2(0_h, 0_h)); WrapInFunction(expr); @@ -1123,7 +1123,7 @@ TEST_F(ResolverConstEvalTest, Vec3_MixConstruct_f16_all_positive_0) { } TEST_F(ResolverConstEvalTest, Vec3_MixConstruct_f16_all_negative_0) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* expr = vec3(vec2(-0_h, -0_h), -0_h); WrapInFunction(expr); @@ -1158,7 +1158,7 @@ TEST_F(ResolverConstEvalTest, Vec3_MixConstruct_f16_all_negative_0) { } TEST_F(ResolverConstEvalTest, Vec3_MixConstruct_f16_mixed_sign_0) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* expr = vec3(0_h, vec2(-0_h, 0_h)); WrapInFunction(expr); @@ -1341,7 +1341,7 @@ TEST_F(ResolverConstEvalTest, Mat2x3_ZeroInit_f32) { } TEST_F(ResolverConstEvalTest, Mat2x3_ZeroInit_f16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* expr = mat2x3(); WrapInFunction(expr); @@ -1704,7 +1704,7 @@ static std::ostream& operator<<(std::ostream& o, const Case& c) { using ResolverConstEvalArrayInitTest = ResolverTestWithParam; TEST_P(ResolverConstEvalArrayInitTest, Test) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto& param = GetParam(); auto* expr = param.input.Expr(*this); auto* a = Const("a", expr); @@ -1892,7 +1892,7 @@ TEST_F(ResolverConstEvalTest, Array_Struct_f32_Elements) { } TEST_F(ResolverConstEvalTest, Struct_ZeroInit) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* s = Structure("S", utils::Vector{ Member("a", ty.i32()), Member("b", ty.u32()), @@ -1937,7 +1937,7 @@ TEST_F(ResolverConstEvalTest, Struct_ZeroInit) { } TEST_F(ResolverConstEvalTest, Struct_Nested_ZeroInit) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* inner = Structure("Inner", utils::Vector{ Member("a", ty.i32()), Member("b", ty.u32()), @@ -2028,7 +2028,7 @@ TEST_F(ResolverConstEvalTest, Struct_I32s_ZeroInit) { } TEST_F(ResolverConstEvalTest, Struct_MixedScalars_ZeroInit) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); Structure("S", utils::Vector{ Member("m1", ty.i32()), @@ -2138,7 +2138,7 @@ TEST_F(ResolverConstEvalTest, Struct_VectorF32s_ZeroInit) { } TEST_F(ResolverConstEvalTest, Struct_MixedVectors_ZeroInit) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); Structure("S", utils::Vector{ Member("m1", ty.vec2()), @@ -2258,7 +2258,7 @@ TEST_F(ResolverConstEvalTest, Struct_Struct_ZeroInit) { } TEST_F(ResolverConstEvalTest, Struct_MixedScalars_Construct) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); Structure("S", utils::Vector{ Member("m1", ty.i32()), @@ -2315,7 +2315,7 @@ TEST_F(ResolverConstEvalTest, Struct_MixedScalars_Construct) { } TEST_F(ResolverConstEvalTest, Struct_MixedVectors_Construct) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); Structure("S", utils::Vector{ Member("m1", ty.vec2()), diff --git a/src/tint/resolver/const_eval_conversion_test.cc b/src/tint/resolver/const_eval_conversion_test.cc index e159b0eb53..bcad648f78 100644 --- a/src/tint/resolver/const_eval_conversion_test.cc +++ b/src/tint/resolver/const_eval_conversion_test.cc @@ -289,7 +289,7 @@ TEST_F(ResolverConstEvalTest, Vec3_Convert_u32_to_f32) { } TEST_F(ResolverConstEvalTest, Vec3_Convert_f16_to_i32) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* expr = vec3(vec3(1.1_h, 2.2_h, 3.3_h)); WrapInFunction(expr); @@ -324,7 +324,7 @@ TEST_F(ResolverConstEvalTest, Vec3_Convert_f16_to_i32) { } TEST_F(ResolverConstEvalTest, Vec3_Convert_u32_to_f16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* expr = vec3(vec3(10_u, 20_u, 30_u)); WrapInFunction(expr); @@ -425,7 +425,7 @@ TEST_F(ResolverConstEvalTest, Vec3_Convert_Large_f32_to_u32) { } TEST_F(ResolverConstEvalTest, Vec3_Convert_Large_f32_to_f16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* expr = vec3(Source{{12, 34}}, vec3(1e10_f, 0_f, 0_f)); WrapInFunction(expr); @@ -435,7 +435,7 @@ TEST_F(ResolverConstEvalTest, Vec3_Convert_Large_f32_to_f16) { } TEST_F(ResolverConstEvalTest, Vec3_Convert_Small_f32_to_f16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* expr = vec3(vec3(1e-20_f, -2e-30_f, 3e-40_f)); WrapInFunction(expr); diff --git a/src/tint/resolver/const_eval_indexing_test.cc b/src/tint/resolver/const_eval_indexing_test.cc index 9776674c8a..cfd7aa1c03 100644 --- a/src/tint/resolver/const_eval_indexing_test.cc +++ b/src/tint/resolver/const_eval_indexing_test.cc @@ -68,7 +68,7 @@ static std::ostream& operator<<(std::ostream& o, const Case& c) { using ResolverConstEvalSwizzleTest = ResolverTestWithParam; TEST_P(ResolverConstEvalSwizzleTest, Test) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto& param = GetParam(); auto* expr = MemberAccessor(param.input.Expr(*this), param.swizzle); auto* a = Const("a", expr); diff --git a/src/tint/resolver/const_eval_member_access_test.cc b/src/tint/resolver/const_eval_member_access_test.cc index e93d63b82d..4fcba8b893 100644 --- a/src/tint/resolver/const_eval_member_access_test.cc +++ b/src/tint/resolver/const_eval_member_access_test.cc @@ -263,7 +263,7 @@ static std::ostream& operator<<(std::ostream& o, const Case& c) { using ResolverConstEvalArrayAccessTest = ResolverTestWithParam; TEST_P(ResolverConstEvalArrayAccessTest, Test) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto& param = GetParam(); auto* expr = param.input.Expr(*this); @@ -338,7 +338,7 @@ static std::ostream& operator<<(std::ostream& o, const Case& c) { using ResolverConstEvalVectorAccessTest = ResolverTestWithParam; TEST_P(ResolverConstEvalVectorAccessTest, Test) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto& param = GetParam(); auto* expr = param.input.Expr(*this); diff --git a/src/tint/resolver/const_eval_unary_op_test.cc b/src/tint/resolver/const_eval_unary_op_test.cc index f9a1e578e9..8b9b7c8d63 100644 --- a/src/tint/resolver/const_eval_unary_op_test.cc +++ b/src/tint/resolver/const_eval_unary_op_test.cc @@ -42,7 +42,7 @@ Case C(T input, U expected) { using ResolverConstEvalUnaryOpTest = ResolverTestWithParam>; TEST_P(ResolverConstEvalUnaryOpTest, Test) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto op = std::get<0>(GetParam()); auto& c = std::get<1>(GetParam()); diff --git a/src/tint/resolver/dependency_graph_test.cc b/src/tint/resolver/dependency_graph_test.cc index 8d615997e0..31e484eec4 100644 --- a/src/tint/resolver/dependency_graph_test.cc +++ b/src/tint/resolver/dependency_graph_test.cc @@ -1094,7 +1094,7 @@ TEST_F(ResolverDependencyGraphOrderedGlobalsTest, DirectiveFirst) { // a transform may produce such a AST tree that has some declarations before directive nodes. // DependencyGraph should deal with these cases. auto* var_1 = GlobalVar("SYMBOL1", ty.i32()); - auto* enable = Enable(ast::Extension::kF16); + auto* enable = Enable(builtin::Extension::kF16); auto* var_2 = GlobalVar("SYMBOL2", ty.f32()); auto* diagnostic = DiagnosticDirective(ast::DiagnosticSeverity::kWarning, "foo"); diff --git a/src/tint/resolver/entry_point_validation_test.cc b/src/tint/resolver/entry_point_validation_test.cc index ebf2c93b6a..98012ad018 100644 --- a/src/tint/resolver/entry_point_validation_test.cc +++ b/src/tint/resolver/entry_point_validation_test.cc @@ -455,7 +455,7 @@ TEST_F(ResolverEntryPointValidationTest, VertexShaderMustReturnPosition) { TEST_F(ResolverEntryPointValidationTest, PushConstantAllowedWithEnable) { // enable chromium_experimental_push_constant; // var a : u32; - Enable(ast::Extension::kChromiumExperimentalPushConstant); + Enable(builtin::Extension::kChromiumExperimentalPushConstant); GlobalVar("a", ty.u32(), type::AddressSpace::kPushConstant); EXPECT_TRUE(r()->Resolve()); @@ -485,7 +485,7 @@ TEST_F(ResolverEntryPointValidationTest, PushConstantOneVariableUsedInEntryPoint // @compute @workgroup_size(1) fn main() { // _ = a; // } - Enable(ast::Extension::kChromiumExperimentalPushConstant); + Enable(builtin::Extension::kChromiumExperimentalPushConstant); GlobalVar("a", ty.u32(), type::AddressSpace::kPushConstant); Func("main", {}, ty.void_(), utils::Vector{Assign(Phony(), "a")}, @@ -503,7 +503,7 @@ TEST_F(ResolverEntryPointValidationTest, PushConstantTwoVariablesUsedInEntryPoin // _ = a; // _ = b; // } - Enable(ast::Extension::kChromiumExperimentalPushConstant); + Enable(builtin::Extension::kChromiumExperimentalPushConstant); GlobalVar(Source{{1, 2}}, "a", ty.u32(), type::AddressSpace::kPushConstant); GlobalVar(Source{{3, 4}}, "b", ty.u32(), type::AddressSpace::kPushConstant); @@ -534,7 +534,7 @@ TEST_F(ResolverEntryPointValidationTest, // uses_a(); // uses_b(); // } - Enable(ast::Extension::kChromiumExperimentalPushConstant); + Enable(builtin::Extension::kChromiumExperimentalPushConstant); GlobalVar(Source{{1, 2}}, "a", ty.u32(), type::AddressSpace::kPushConstant); GlobalVar(Source{{3, 4}}, "b", ty.u32(), type::AddressSpace::kPushConstant); @@ -567,7 +567,7 @@ TEST_F(ResolverEntryPointValidationTest, PushConstantTwoVariablesUsedInDifferent // @compute @workgroup_size(1) fn uses_b() { // _ = a; // } - Enable(ast::Extension::kChromiumExperimentalPushConstant); + Enable(builtin::Extension::kChromiumExperimentalPushConstant); GlobalVar("a", ty.u32(), type::AddressSpace::kPushConstant); GlobalVar("b", ty.u32(), type::AddressSpace::kPushConstant); @@ -624,7 +624,7 @@ TEST_P(TypeValidationTest, BareInputs) { // fn main(@location(0) @interpolate(flat) a : *) {} auto params = GetParam(); - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* a = Param("a", params.create_ast_type(*this), utils::Vector{ @@ -655,7 +655,7 @@ TEST_P(TypeValidationTest, StructInputs) { // fn main(a : Input) {} auto params = GetParam(); - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* input = Structure("Input", utils::Vector{ Member("a", params.create_ast_type(*this), @@ -685,7 +685,7 @@ TEST_P(TypeValidationTest, BareOutputs) { // } auto params = GetParam(); - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); Func(Source{{12, 34}}, "main", utils::Empty, params.create_ast_type(*this), utils::Vector{ @@ -715,7 +715,7 @@ TEST_P(TypeValidationTest, StructOutputs) { // } auto params = GetParam(); - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* output = Structure( "Output", utils::Vector{ diff --git a/src/tint/resolver/expression_kind_test.cc b/src/tint/resolver/expression_kind_test.cc index c8cea54e39..dc3d8a8d1b 100644 --- a/src/tint/resolver/expression_kind_test.cc +++ b/src/tint/resolver/expression_kind_test.cc @@ -220,7 +220,7 @@ TEST_P(ResolverExpressionKindTest, Test) { GlobalVar("v", ty("texture_storage_2d", "rgba8unorm", expr), Group(0_u), Binding(0_u)); break; case Use::kAddressSpace: - Enable(ast::Extension::kChromiumExperimentalFullPtrParameters); + Enable(builtin::Extension::kChromiumExperimentalFullPtrParameters); Func("f", utils::Vector{Param("p", ty("ptr", expr, ty.f32()))}, ty.void_(), utils::Empty); break; diff --git a/src/tint/resolver/f16_extension_test.cc b/src/tint/resolver/f16_extension_test.cc index f0d515f80f..d76791959d 100644 --- a/src/tint/resolver/f16_extension_test.cc +++ b/src/tint/resolver/f16_extension_test.cc @@ -27,7 +27,7 @@ using ResolverF16ExtensionTest = ResolverTest; TEST_F(ResolverF16ExtensionTest, TypeUsedWithExtension) { // enable f16; // var v : f16; - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); GlobalVar("v", ty.f16(), type::AddressSpace::kPrivate); @@ -45,7 +45,7 @@ TEST_F(ResolverF16ExtensionTest, TypeUsedWithoutExtension) { TEST_F(ResolverF16ExtensionTest, Vec2TypeUsedWithExtension) { // enable f16; // var v : vec2; - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); GlobalVar("v", ty.vec2(), type::AddressSpace::kPrivate); @@ -63,7 +63,7 @@ TEST_F(ResolverF16ExtensionTest, Vec2TypeUsedWithoutExtension) { TEST_F(ResolverF16ExtensionTest, Vec2TypeInitUsedWithExtension) { // enable f16; // var v = vec2(); - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); GlobalVar("v", vec2(), type::AddressSpace::kPrivate); @@ -81,7 +81,7 @@ TEST_F(ResolverF16ExtensionTest, Vec2TypeInitUsedWithoutExtension) { TEST_F(ResolverF16ExtensionTest, Vec2TypeConvUsedWithExtension) { // enable f16; // var v = vec2(vec2()); - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); GlobalVar("v", vec2(vec2()), type::AddressSpace::kPrivate); @@ -99,7 +99,7 @@ TEST_F(ResolverF16ExtensionTest, Vec2TypeConvUsedWithoutExtension) { TEST_F(ResolverF16ExtensionTest, F16LiteralUsedWithExtension) { // enable f16; // var v = 16h; - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); GlobalVar("v", Expr(16_h), type::AddressSpace::kPrivate); @@ -119,7 +119,7 @@ using ResolverF16ExtensionBuiltinTypeAliasTest = ResolverTestWithParam v : vec2h; - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); GlobalVar("v", ty(Source{{12, 34}}, GetParam()), type::AddressSpace::kPrivate); diff --git a/src/tint/resolver/function_validation_test.cc b/src/tint/resolver/function_validation_test.cc index 961511d2e4..7ef446ab71 100644 --- a/src/tint/resolver/function_validation_test.cc +++ b/src/tint/resolver/function_validation_test.cc @@ -1081,7 +1081,7 @@ TEST_P(ResolverFunctionParameterValidationTest, AddressSpaceWithExtension) { auto& param = GetParam(); auto ptr_type = ty("ptr", Ident(Source{{12, 34}}, param.address_space), ty.i32()); auto* arg = Param(Source{{12, 34}}, "p", ptr_type); - Enable(ast::Extension::kChromiumExperimentalFullPtrParameters); + Enable(builtin::Extension::kChromiumExperimentalFullPtrParameters); Func("f", utils::Vector{arg}, ty.void_(), utils::Empty); if (param.expectation == Expectation::kAlwaysPass || diff --git a/src/tint/resolver/host_shareable_validation_test.cc b/src/tint/resolver/host_shareable_validation_test.cc index f699135861..b518b57570 100644 --- a/src/tint/resolver/host_shareable_validation_test.cc +++ b/src/tint/resolver/host_shareable_validation_test.cc @@ -97,7 +97,7 @@ TEST_F(ResolverHostShareableValidationTest, NestedStructures) { } TEST_F(ResolverHostShareableValidationTest, NoError) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* i1 = Structure("I1", utils::Vector{ Member(Source{{1, 1}}, "w1", ty.f32()), diff --git a/src/tint/resolver/materialize_test.cc b/src/tint/resolver/materialize_test.cc index acd69a8c74..4824549342 100644 --- a/src/tint/resolver/materialize_test.cc +++ b/src/tint/resolver/materialize_test.cc @@ -312,7 +312,7 @@ using MaterializeAbstractNumericToConcreteType = MaterializeTest>; TEST_P(MaterializeAbstractNumericToConcreteType, Test) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); const auto& param = GetParam(); const auto& expectation = std::get<0>(param); @@ -1282,7 +1282,7 @@ TEST_F(MaterializeAbstractStructure, Modf_Vector_DefaultType) { TEST_F(MaterializeAbstractStructure, Modf_Scalar_ExplicitType) { // var v = modf(1_h); // v is __modf_result_f16 // v = modf(1); // __modf_result_f16 <- __modf_result_abstract - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* call = Call("modf", 1_a); WrapInFunction(Decl(Var("v", Call("modf", 1_h))), // Assign("v", call)); @@ -1301,7 +1301,7 @@ TEST_F(MaterializeAbstractStructure, Modf_Scalar_ExplicitType) { TEST_F(MaterializeAbstractStructure, Modf_Vector_ExplicitType) { // var v = modf(vec2(1_h)); // v is __modf_result_vec2_f16 // v = modf(vec2(1)); // __modf_result_vec2_f16 <- __modf_result_vec2_abstract - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* call = Call("modf", Call(ty.vec2(), 1_a)); WrapInFunction(Decl(Var("v", Call("modf", Call(ty.vec2(), 1_h)))), Assign("v", call)); ASSERT_TRUE(r()->Resolve()) << r()->error(); @@ -1363,7 +1363,7 @@ TEST_F(MaterializeAbstractStructure, Frexp_Vector_DefaultType) { TEST_F(MaterializeAbstractStructure, Frexp_Scalar_ExplicitType) { // var v = frexp(1_h); // v is __frexp_result_f16 // v = frexp(1); // __frexp_result_f16 <- __frexp_result_abstract - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* call = Call("frexp", 1_a); WrapInFunction(Decl(Var("v", Call("frexp", 1_h))), // Assign("v", call)); @@ -1384,7 +1384,7 @@ TEST_F(MaterializeAbstractStructure, Frexp_Scalar_ExplicitType) { TEST_F(MaterializeAbstractStructure, Frexp_Vector_ExplicitType) { // var v = frexp(vec2(1_h)); // v is __frexp_result_vec2_f16 // v = frexp(vec2(1)); // __frexp_result_vec2_f16 <- __frexp_result_vec2_abstract - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* call = Call("frexp", Call(ty.vec2(), 1_a)); WrapInFunction(Decl(Var("v", Call("frexp", Call(ty.vec2(), 1_h)))), Assign("v", call)); ASSERT_TRUE(r()->Resolve()) << r()->error(); diff --git a/src/tint/resolver/override_test.cc b/src/tint/resolver/override_test.cc index 2fd48ed7b6..a9518d27d4 100644 --- a/src/tint/resolver/override_test.cc +++ b/src/tint/resolver/override_test.cc @@ -103,7 +103,7 @@ TEST_F(ResolverOverrideTest, IdTooLarge) { } TEST_F(ResolverOverrideTest, F16_TemporallyBan) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); Override(Source{{12, 34}}, "a", ty.f16(), Expr(1_h), Id(1_u)); diff --git a/src/tint/resolver/resolver.cc b/src/tint/resolver/resolver.cc index 352c5e4fcc..8c36ad72e8 100644 --- a/src/tint/resolver/resolver.cc +++ b/src/tint/resolver/resolver.cc @@ -143,7 +143,7 @@ bool Resolver::Resolve() { if (result) { // Run the uniformity analysis, which requires a complete semantic module. - if (!enabled_extensions_.Contains(ast::Extension::kChromiumDisableUniformityAnalysis)) { + if (!enabled_extensions_.Contains(builtin::Extension::kChromiumDisableUniformityAnalysis)) { if (!AnalyzeUniformity(builder_, dependencies_)) { return false; } diff --git a/src/tint/resolver/resolver.h b/src/tint/resolver/resolver.h index c5223db3d6..003fa3d753 100644 --- a/src/tint/resolver/resolver.h +++ b/src/tint/resolver/resolver.h @@ -501,7 +501,7 @@ class Resolver { DependencyGraph dependencies_; SemHelper sem_; Validator validator_; - ast::Extensions enabled_extensions_; + builtin::Extensions enabled_extensions_; utils::Vector entry_points_; utils::Hashmap atomic_composite_info_; utils::Bitset<0> marked_; diff --git a/src/tint/resolver/side_effects_test.cc b/src/tint/resolver/side_effects_test.cc index b4770e41d6..456b37175d 100644 --- a/src/tint/resolver/side_effects_test.cc +++ b/src/tint/resolver/side_effects_test.cc @@ -15,6 +15,7 @@ #include "src/tint/resolver/resolver.h" #include "gtest/gtest.h" +#include "src/tint/builtin/extension.h" #include "src/tint/resolver/resolver_test_helper.h" #include "src/tint/sem/index_accessor_expression.h" #include "src/tint/sem/member_accessor_expression.h" @@ -160,7 +161,7 @@ static std::ostream& operator<<(std::ostream& o, const Case& c) { using SideEffectsBuiltinTest = resolver::ResolverTestWithParam; TEST_P(SideEffectsBuiltinTest, Test) { - Enable(ast::Extension::kChromiumExperimentalDp4A); + Enable(tint::builtin::Extension::kChromiumExperimentalDp4A); auto& c = GetParam(); uint32_t next_binding = 0; diff --git a/src/tint/resolver/struct_layout_test.cc b/src/tint/resolver/struct_layout_test.cc index 728844981a..33f759919b 100644 --- a/src/tint/resolver/struct_layout_test.cc +++ b/src/tint/resolver/struct_layout_test.cc @@ -55,7 +55,7 @@ TEST_F(ResolverStructLayoutTest, Scalars) { } TEST_F(ResolverStructLayoutTest, ScalarsWithF16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* s = Structure("S", utils::Vector{ Member("a", ty.f32()), @@ -134,7 +134,7 @@ TEST_F(ResolverStructLayoutTest, Alias) { } TEST_F(ResolverStructLayoutTest, ImplicitStrideArrayStaticSize) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* s = Structure("S", utils::Vector{ Member("a", ty.array()), @@ -174,7 +174,7 @@ TEST_F(ResolverStructLayoutTest, ImplicitStrideArrayStaticSize) { } TEST_F(ResolverStructLayoutTest, ExplicitStrideArrayStaticSize) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* s = Structure("S", utils::Vector{ Member("a", ty.array(utils::Vector{Stride(8)})), @@ -335,7 +335,7 @@ TEST_F(ResolverStructLayoutTest, Vector) { } TEST_F(ResolverStructLayoutTest, Matrix) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* s = Structure("S", utils::Vector{ Member("a_1", ty.mat2x2()), diff --git a/src/tint/resolver/type_initializer_validation_test.cc b/src/tint/resolver/type_initializer_validation_test.cc index 0f7144bbb4..dde1a2e969 100644 --- a/src/tint/resolver/type_initializer_validation_test.cc +++ b/src/tint/resolver/type_initializer_validation_test.cc @@ -85,7 +85,7 @@ TEST_P(InferTypeTest_FromInitializerExpression, All) { // } auto& params = GetParam(); - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* initializer_expr = params.create_rhs_ast_value(*this, 0); @@ -186,7 +186,7 @@ TEST_P(InferTypeTest_FromCallExpression, All) { // } auto& params = GetParam(); - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); Func("foo", utils::Empty, params.create_rhs_ast_type(*this), utils::Vector{Return(Call(params.create_rhs_ast_type(*this)))}, {}); @@ -343,7 +343,7 @@ using ConversionInitializerValidTest = ResolverTestWithParam; TEST_P(ConversionInitializerValidTest, All) { auto& params = GetParam(); - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); // var a : = (()); auto lhs_type1 = params.lhs_type(*this); @@ -449,7 +449,7 @@ TEST_P(ConversionInitializerInvalidTest, All) { << FriendlyName(rhs_type) << "())"; SCOPED_TRACE(ss.str()); - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* a = Var("a", lhs_type1, Call(lhs_type2, Call(rhs_type, rhs_value_expr))); @@ -944,7 +944,7 @@ TEST_F(ResolverTypeInitializerValidationTest, F32_Success) { } TEST_F(ResolverTypeInitializerValidationTest, F16_Success) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* expr = Call(Expr(1.5_h)); WrapInFunction(expr); @@ -1000,7 +1000,7 @@ TEST_F(ResolverTypeInitializerValidationTest, Convert_i32_to_u32_Success) { } TEST_F(ResolverTypeInitializerValidationTest, Convert_u32_to_f16_Success) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* expr = Call(123_u); WrapInFunction(expr); @@ -1020,7 +1020,7 @@ TEST_F(ResolverTypeInitializerValidationTest, Convert_u32_to_f16_Success) { } TEST_F(ResolverTypeInitializerValidationTest, Convert_f16_to_f32_Success) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* expr = Call(123_h); WrapInFunction(expr); @@ -1052,7 +1052,7 @@ TEST_F(ResolverTypeInitializerValidationTest, Vec2F32_Error_ScalarArgumentTypeMi } TEST_F(ResolverTypeInitializerValidationTest, Vec2F16_Error_ScalarArgumentTypeMismatch) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); WrapInFunction(vec2(Source{{12, 34}}, 1_h, 2_f)); @@ -1175,7 +1175,7 @@ TEST_F(ResolverTypeInitializerValidationTest, Vec2F32_Success_Scalar) { } TEST_F(ResolverTypeInitializerValidationTest, Vec2F16_Success_Scalar) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* tc = vec2(1_h, 1_h); WrapInFunction(tc); @@ -1309,7 +1309,7 @@ TEST_F(ResolverTypeInitializerValidationTest, Vec3F32_Error_ScalarArgumentTypeMi } TEST_F(ResolverTypeInitializerValidationTest, Vec3F16_Error_ScalarArgumentTypeMismatch) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); WrapInFunction(vec3(Source{{12, 34}}, 1_h, 2_h, 3_f)); @@ -1451,7 +1451,7 @@ TEST_F(ResolverTypeInitializerValidationTest, Vec3F32_Success_Scalar) { } TEST_F(ResolverTypeInitializerValidationTest, Vec3F16_Success_Scalar) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* tc = vec3(1_h, 1_h, 1_h); WrapInFunction(tc); @@ -1632,7 +1632,7 @@ TEST_F(ResolverTypeInitializerValidationTest, Vec4F32_Error_ScalarArgumentTypeMi } TEST_F(ResolverTypeInitializerValidationTest, Vec4F16_Error_ScalarArgumentTypeMismatch) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); WrapInFunction(vec4(Source{{12, 34}}, 1_h, 1_h, 1_f, 1_h)); @@ -1799,7 +1799,7 @@ TEST_F(ResolverTypeInitializerValidationTest, Vec4F32_Success_Scalar) { } TEST_F(ResolverTypeInitializerValidationTest, Vec4F16_Success_Scalar) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* tc = vec4(1_h, 1_h, 1_h, 1_h); WrapInFunction(tc); @@ -2035,7 +2035,7 @@ TEST_F(ResolverTypeInitializerValidationTest, Vector_ArgumentElementTypeAlias_Su } TEST_F(ResolverTypeInitializerValidationTest, InferVec2ElementTypeFromScalars) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* vec2_bool = vec2(true, false); auto* vec2_i32 = vec2(1_i, 2_i); @@ -2064,7 +2064,7 @@ TEST_F(ResolverTypeInitializerValidationTest, InferVec2ElementTypeFromScalars) { } TEST_F(ResolverTypeInitializerValidationTest, InferVec2ElementTypeFromVec2) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* vec2_bool = vec2(vec2(true, false)); auto* vec2_i32 = vec2(vec2(1_i, 2_i)); @@ -2093,7 +2093,7 @@ TEST_F(ResolverTypeInitializerValidationTest, InferVec2ElementTypeFromVec2) { } TEST_F(ResolverTypeInitializerValidationTest, InferVec3ElementTypeFromScalars) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* vec3_bool = vec3(Expr(true), Expr(false), Expr(true)); auto* vec3_i32 = vec3(Expr(1_i), Expr(2_i), Expr(3_i)); @@ -2122,7 +2122,7 @@ TEST_F(ResolverTypeInitializerValidationTest, InferVec3ElementTypeFromScalars) { } TEST_F(ResolverTypeInitializerValidationTest, InferVec3ElementTypeFromVec3) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* vec3_bool = vec3(vec3(true, false, true)); auto* vec3_i32 = vec3(vec3(1_i, 2_i, 3_i)); @@ -2151,7 +2151,7 @@ TEST_F(ResolverTypeInitializerValidationTest, InferVec3ElementTypeFromVec3) { } TEST_F(ResolverTypeInitializerValidationTest, InferVec3ElementTypeFromScalarAndVec2) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* vec3_bool = vec3(Expr(true), vec2(false, true)); auto* vec3_i32 = vec3(Expr(1_i), vec2(2_i, 3_i)); @@ -2180,7 +2180,7 @@ TEST_F(ResolverTypeInitializerValidationTest, InferVec3ElementTypeFromScalarAndV } TEST_F(ResolverTypeInitializerValidationTest, InferVec4ElementTypeFromScalars) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* vec4_bool = vec4(Expr(true), Expr(false), Expr(true), Expr(false)); auto* vec4_i32 = vec4(Expr(1_i), Expr(2_i), Expr(3_i), Expr(4_i)); @@ -2209,7 +2209,7 @@ TEST_F(ResolverTypeInitializerValidationTest, InferVec4ElementTypeFromScalars) { } TEST_F(ResolverTypeInitializerValidationTest, InferVec4ElementTypeFromVec4) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* vec4_bool = vec4(vec4(true, false, true, false)); auto* vec4_i32 = vec4(vec4(1_i, 2_i, 3_i, 4_i)); @@ -2238,7 +2238,7 @@ TEST_F(ResolverTypeInitializerValidationTest, InferVec4ElementTypeFromVec4) { } TEST_F(ResolverTypeInitializerValidationTest, InferVec4ElementTypeFromScalarAndVec3) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* vec4_bool = vec4(Expr(true), vec3(false, true, false)); auto* vec4_i32 = vec4(Expr(1_i), vec3(2_i, 3_i, 4_i)); @@ -2267,7 +2267,7 @@ TEST_F(ResolverTypeInitializerValidationTest, InferVec4ElementTypeFromScalarAndV } TEST_F(ResolverTypeInitializerValidationTest, InferVec4ElementTypeFromVec2AndVec2) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* vec4_bool = vec4(vec2(true, false), vec2(true, false)); auto* vec4_i32 = vec4(vec2(1_i, 2_i), vec2(3_i, 4_i)); @@ -2406,7 +2406,7 @@ TEST_P(MatrixInitializerTest, ColumnInitializer_Error_TooFewArguments) { const auto param = GetParam(); - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); const std::string element_type_name = param.get_element_type_name(); std::stringstream args_tys; @@ -2435,7 +2435,7 @@ TEST_P(MatrixInitializerTest, ElementInitializer_Error_TooFewArguments) { const auto param = GetParam(); - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); const std::string element_type_name = param.get_element_type_name(); std::stringstream args_tys; @@ -2463,7 +2463,7 @@ TEST_P(MatrixInitializerTest, ColumnInitializer_Error_TooManyArguments) { const auto param = GetParam(); - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); const std::string element_type_name = param.get_element_type_name(); std::stringstream args_tys; @@ -2492,7 +2492,7 @@ TEST_P(MatrixInitializerTest, ElementInitializer_Error_TooManyArguments) { const auto param = GetParam(); - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); const std::string element_type_name = param.get_element_type_name(); std::stringstream args_tys; @@ -2520,7 +2520,7 @@ TEST_P(MatrixInitializerTest, ColumnInitializer_Error_InvalidArgumentType) { const auto param = GetParam(); - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); std::stringstream args_tys; utils::Vector args; @@ -2548,7 +2548,7 @@ TEST_P(MatrixInitializerTest, ElementInitializer_Error_InvalidArgumentType) { const auto param = GetParam(); - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); std::stringstream args_tys; utils::Vector args; @@ -2580,7 +2580,7 @@ TEST_P(MatrixInitializerTest, ColumnInitializer_Error_TooFewRowsInVectorArgument return; } - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); const std::string element_type_name = param.get_element_type_name(); std::stringstream args_tys; @@ -2618,7 +2618,7 @@ TEST_P(MatrixInitializerTest, ColumnInitializer_Error_TooManyRowsInVectorArgumen return; } - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); const std::string element_type_name = param.get_element_type_name(); std::stringstream args_tys; @@ -2650,7 +2650,7 @@ TEST_P(MatrixInitializerTest, ZeroValue_Success) { const auto param = GetParam(); - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); ast::Type matrix_type = param.create_mat_ast_type(*this); auto* tc = Call(Source{{12, 40}}, matrix_type); @@ -2665,7 +2665,7 @@ TEST_P(MatrixInitializerTest, WithColumns_Success) { const auto param = GetParam(); - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); utils::Vector args; for (uint32_t i = 0; i < param.columns; i++) { @@ -2686,7 +2686,7 @@ TEST_P(MatrixInitializerTest, WithElements_Success) { const auto param = GetParam(); - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); utils::Vector args; for (uint32_t i = 0; i < param.columns * param.rows; i++) { @@ -2706,7 +2706,7 @@ TEST_P(MatrixInitializerTest, ElementTypeAlias_Error) { const auto param = GetParam(); - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* elem_type_alias = Alias("ElemType", param.create_element_ast_type(*this)); @@ -2736,7 +2736,7 @@ TEST_P(MatrixInitializerTest, ElementTypeAlias_Success) { const auto param = GetParam(); - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* elem_type_alias = Alias("ElemType", param.create_element_ast_type(*this)); @@ -2767,7 +2767,7 @@ TEST_F(ResolverTypeInitializerValidationTest, MatrixInitializer_ArgumentTypeAlia TEST_P(MatrixInitializerTest, ArgumentTypeAlias_Success) { const auto param = GetParam(); - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); ast::Type matrix_type = param.create_mat_ast_type(*this); ast::Type vec_type = param.create_column_ast_type(*this); @@ -2787,7 +2787,7 @@ TEST_P(MatrixInitializerTest, ArgumentTypeAlias_Success) { TEST_P(MatrixInitializerTest, ArgumentElementTypeAlias_Error) { const auto param = GetParam(); - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); ast::Type matrix_type = param.create_mat_ast_type(*this); auto* u32_type_alias = Alias("UnsignedInt", ty.u32()); @@ -2814,7 +2814,7 @@ TEST_P(MatrixInitializerTest, ArgumentElementTypeAlias_Error) { TEST_P(MatrixInitializerTest, ArgumentElementTypeAlias_Success) { const auto param = GetParam(); - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* elem_type_alias = Alias("ElemType", param.create_element_ast_type(*this)); @@ -2834,7 +2834,7 @@ TEST_P(MatrixInitializerTest, ArgumentElementTypeAlias_Success) { TEST_P(MatrixInitializerTest, InferElementTypeFromVectors) { const auto param = GetParam(); - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); utils::Vector args; for (uint32_t i = 0; i < param.columns; i++) { @@ -2851,7 +2851,7 @@ TEST_P(MatrixInitializerTest, InferElementTypeFromVectors) { TEST_P(MatrixInitializerTest, InferElementTypeFromScalars) { const auto param = GetParam(); - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); utils::Vector args; for (uint32_t i = 0; i < param.rows * param.columns; i++) { @@ -2867,7 +2867,7 @@ TEST_P(MatrixInitializerTest, InferElementTypeFromScalars) { TEST_P(MatrixInitializerTest, CannotInferElementTypeFromVectors_Mismatch) { const auto param = GetParam(); - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); std::stringstream err; err << "12:34 error: no matching initializer for mat" << param.columns << "x" << param.rows @@ -2898,7 +2898,7 @@ TEST_P(MatrixInitializerTest, CannotInferElementTypeFromVectors_Mismatch) { TEST_P(MatrixInitializerTest, CannotInferElementTypeFromScalars_Mismatch) { const auto param = GetParam(); - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); std::stringstream err; err << "12:34 error: no matching initializer for mat" << param.columns << "x" << param.rows @@ -2988,7 +2988,7 @@ TEST_P(StructInitializerInputsTest, TooFew) { auto& str_params = std::get<0>(param); uint32_t N = std::get<1>(param); - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); utils::Vector members; utils::Vector values; @@ -3013,7 +3013,7 @@ TEST_P(StructInitializerInputsTest, TooMany) { auto& str_params = std::get<0>(param); uint32_t N = std::get<1>(param); - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); utils::Vector members; utils::Vector values; @@ -3046,7 +3046,7 @@ TEST_P(StructInitializerTypeTest, AllTypes) { auto& ctor_params = std::get<1>(param); uint32_t N = std::get<2>(param); - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); if (str_params.ast == ctor_params.ast) { return; diff --git a/src/tint/resolver/type_validation_test.cc b/src/tint/resolver/type_validation_test.cc index 0e69da87fe..efc55f0b28 100644 --- a/src/tint/resolver/type_validation_test.cc +++ b/src/tint/resolver/type_validation_test.cc @@ -1005,7 +1005,7 @@ static constexpr TypeParams type_cases[] = { using SampledTextureTypeTest = ResolverTestWithParam; TEST_P(SampledTextureTypeTest, All) { auto& params = GetParam(); - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); GlobalVar( "a", ty.sampled_texture(Source{{12, 34}}, type::TextureDimension::k2d, params.type_func(*this)), @@ -1025,7 +1025,7 @@ INSTANTIATE_TEST_SUITE_P(ResolverTypeValidationTest, using MultisampledTextureTypeTest = ResolverTestWithParam; TEST_P(MultisampledTextureTypeTest, All) { auto& params = GetParam(); - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); GlobalVar("a", ty.multisampled_texture(Source{{12, 34}}, type::TextureDimension::k2d, params.type_func(*this)), @@ -1231,7 +1231,7 @@ TEST_P(ValidMatrixTypes, Okay) { // var a : matNxM; auto& params = GetParam(); - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); ast::Type el_ty = params.elem_ty(*this); @@ -1271,7 +1271,7 @@ TEST_P(InvalidMatrixElementTypes, InvalidElementType) { // var a : matNxM; auto& params = GetParam(); - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); ast::Type el_ty = params.elem_ty(*this); @@ -1316,7 +1316,7 @@ TEST_P(ValidVectorTypes, Okay) { // var a : vecN; auto& params = GetParam(); - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); GlobalVar("a", ty.vec(params.elem_ty(*this), params.width), type::AddressSpace::kPrivate); EXPECT_TRUE(r()->Resolve()) << r()->error(); @@ -1350,7 +1350,7 @@ TEST_P(InvalidVectorElementTypes, InvalidElementType) { // var a : vecN; auto& params = GetParam(); - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); GlobalVar("a", ty.vec(Source{{12, 34}}, params.elem_ty(*this), params.width), type::AddressSpace::kPrivate); @@ -1389,7 +1389,7 @@ TEST_P(BuiltinTypeAliasTest, CheckEquivalent) { // explicit = aliased; auto& params = GetParam(); - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); WrapInFunction(Decl(Var("aliased", ty(params.alias))), Decl(Var("explicit", params.type(*this))), // @@ -1401,7 +1401,7 @@ TEST_P(BuiltinTypeAliasTest, Construct) { // var v : vecN = vecTN(); auto& params = GetParam(); - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); WrapInFunction(Decl(Var("v", params.type(*this), Call(params.alias)))); EXPECT_TRUE(r()->Resolve()) << r()->error(); @@ -1449,7 +1449,7 @@ TEST_P(ResolverUntemplatedTypeUsedWithTemplateArgs, Builtin_UseWithTemplateArgs) // enable f16; // var v : f32; - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); GlobalVar("v", type::AddressSpace::kPrivate, ty(Source{{12, 34}}, GetParam(), true)); EXPECT_FALSE(r()->Resolve()); @@ -1462,7 +1462,7 @@ TEST_P(ResolverUntemplatedTypeUsedWithTemplateArgs, BuiltinAlias_UseWithTemplate // alias A = f32; // var v : A; - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); Alias(Source{{56, 78}}, "A", ty(GetParam())); GlobalVar("v", type::AddressSpace::kPrivate, ty(Source{{12, 34}}, "A", true)); diff --git a/src/tint/resolver/validator.cc b/src/tint/resolver/validator.cc index 2a73bead68..44d6c5b643 100644 --- a/src/tint/resolver/validator.cc +++ b/src/tint/resolver/validator.cc @@ -149,7 +149,7 @@ void TraverseCallChain(diag::List& diagnostics, Validator::Validator( ProgramBuilder* builder, SemHelper& sem, - const ast::Extensions& enabled_extensions, + const builtin::Extensions& enabled_extensions, const utils::Hashmap& atomic_composite_info, utils::Hashset& valid_type_storage_layouts) : symbols_(builder->Symbols()), @@ -829,7 +829,7 @@ bool Validator::Parameter(const ast::Function* func, const sem::Variable* var) c case type::AddressSpace::kUniform: case type::AddressSpace::kWorkgroup: ok = enabled_extensions_.Contains( - ast::Extension::kChromiumExperimentalFullPtrParameters); + builtin::Extension::kChromiumExperimentalFullPtrParameters); break; default: break; @@ -1653,7 +1653,7 @@ bool Validator::RequiredExtensionForBuiltinFunction(const sem::Call* call) const } const auto extension = builtin->RequiredExtension(); - if (extension == ast::Extension::kUndefined) { + if (extension == builtin::Extension::kUndefined) { return true; } @@ -1669,7 +1669,7 @@ bool Validator::RequiredExtensionForBuiltinFunction(const sem::Call* call) const bool Validator::CheckF16Enabled(const Source& source) const { // Validate if f16 type is allowed. - if (!enabled_extensions_.Contains(ast::Extension::kF16)) { + if (!enabled_extensions_.Contains(builtin::Extension::kF16)) { AddError("f16 type used without 'f16' extension enabled", source); return false; } @@ -1719,7 +1719,8 @@ bool Validator::FunctionCall(const sem::Call* call, sem::Statement* current_stat } if (param_type->Is() && - !enabled_extensions_.Contains(ast::Extension::kChromiumExperimentalFullPtrParameters)) { + !enabled_extensions_.Contains( + builtin::Extension::kChromiumExperimentalFullPtrParameters)) { // https://gpuweb.github.io/gpuweb/wgsl/#function-restriction // Each argument of pointer type to a user-defined function must have the same memory // view as its root identifier. @@ -2512,7 +2513,7 @@ bool Validator::CheckTypeAccessAddressSpace( } if (address_space == type::AddressSpace::kPushConstant && - !enabled_extensions_.Contains(ast::Extension::kChromiumExperimentalPushConstant) && + !enabled_extensions_.Contains(builtin::Extension::kChromiumExperimentalPushConstant) && IsValidationEnabled(attributes, ast::DisabledValidation::kIgnoreAddressSpace)) { AddError( "use of variable address space 'push_constant' requires enabling extension " diff --git a/src/tint/resolver/validator.h b/src/tint/resolver/validator.h index dc1bea64ef..499dcdac72 100644 --- a/src/tint/resolver/validator.h +++ b/src/tint/resolver/validator.h @@ -102,7 +102,7 @@ class Validator { /// @param valid_type_storage_layouts a set of validated type layouts by address space Validator(ProgramBuilder* builder, SemHelper& helper, - const ast::Extensions& enabled_extensions, + const builtin::Extensions& enabled_extensions, const utils::Hashmap& atomic_composite_info, utils::Hashset& valid_type_storage_layouts); ~Validator(); @@ -550,7 +550,7 @@ class Validator { diag::List& diagnostics_; SemHelper& sem_; DiagnosticFilterStack diagnostic_filters_; - const ast::Extensions& enabled_extensions_; + const builtin::Extensions& enabled_extensions_; const utils::Hashmap& atomic_composite_info_; utils::Hashset& valid_type_storage_layouts_; }; diff --git a/src/tint/resolver/variable_test.cc b/src/tint/resolver/variable_test.cc index c5af49ce44..2239945062 100644 --- a/src/tint/resolver/variable_test.cc +++ b/src/tint/resolver/variable_test.cc @@ -41,7 +41,7 @@ TEST_F(ResolverVariableTest, LocalVar_NoInitializer) { // var a : A; // } - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* S = Structure("S", utils::Vector{Member("i", ty.i32())}); auto* A = Alias("A", ty.Of(S)); @@ -106,7 +106,7 @@ TEST_F(ResolverVariableTest, LocalVar_WithInitializer) { // var a : A = A(1); // } - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* S = Structure("S", utils::Vector{Member("i", ty.i32())}); auto* A = Alias("A", ty.Of(S)); @@ -399,7 +399,7 @@ TEST_F(ResolverVariableTest, LocalLet) { // let p : pointer = &v; // } - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* S = Structure("S", utils::Vector{Member("i", ty.i32())}); auto* A = Alias("A", ty.Of(S)); diff --git a/src/tint/resolver/variable_validation_test.cc b/src/tint/resolver/variable_validation_test.cc index 2649562bd1..738d926992 100644 --- a/src/tint/resolver/variable_validation_test.cc +++ b/src/tint/resolver/variable_validation_test.cc @@ -488,7 +488,7 @@ TEST_F(ResolverVariableValidationTest, ConstInitWithOverrideExpr) { TEST_F(ResolverVariableValidationTest, GlobalVariable_PushConstantWithInitializer) { // enable chromium_experimental_push_constant; // var a : u32 = 0u; - Enable(ast::Extension::kChromiumExperimentalPushConstant); + Enable(builtin::Extension::kChromiumExperimentalPushConstant); GlobalVar(Source{{1u, 2u}}, "a", ty.u32(), type::AddressSpace::kPushConstant, Expr(Source{{3u, 4u}}, u32(0))); diff --git a/src/tint/sem/builtin.cc b/src/tint/sem/builtin.cc index 243e1b7250..7d13190e74 100644 --- a/src/tint/sem/builtin.cc +++ b/src/tint/sem/builtin.cc @@ -179,11 +179,11 @@ bool Builtin::HasSideEffects() const { return false; } -ast::Extension Builtin::RequiredExtension() const { +builtin::Extension Builtin::RequiredExtension() const { if (IsDP4a()) { - return ast::Extension::kChromiumExperimentalDp4A; + return builtin::Extension::kChromiumExperimentalDp4A; } - return ast::Extension::kUndefined; + return builtin::Extension::kUndefined; } } // namespace tint::sem diff --git a/src/tint/sem/builtin.h b/src/tint/sem/builtin.h index a733131f7c..71e54672f0 100644 --- a/src/tint/sem/builtin.h +++ b/src/tint/sem/builtin.h @@ -18,7 +18,7 @@ #include #include -#include "src/tint/ast/extension.h" +#include "src/tint/builtin/extension.h" #include "src/tint/sem/builtin_type.h" #include "src/tint/sem/call_target.h" #include "src/tint/sem/pipeline_stage_set.h" @@ -147,8 +147,8 @@ class Builtin final : public Castable { bool HasSideEffects() const; /// @returns the required extension of this builtin function. Returns - /// ast::Extension::kNone if no extension is required. - ast::Extension RequiredExtension() const; + /// builtin::Extension::kNone if no extension is required. + builtin::Extension RequiredExtension() const; private: const BuiltinType type_; diff --git a/src/tint/sem/module.cc b/src/tint/sem/module.cc index 38f0ec63ce..971c7f2b4a 100644 --- a/src/tint/sem/module.cc +++ b/src/tint/sem/module.cc @@ -21,7 +21,7 @@ TINT_INSTANTIATE_TYPEINFO(tint::sem::Module); namespace tint::sem { -Module::Module(utils::VectorRef dep_ordered_decls, ast::Extensions extensions) +Module::Module(utils::VectorRef dep_ordered_decls, builtin::Extensions extensions) : dep_ordered_decls_(std::move(dep_ordered_decls)), extensions_(std::move(extensions)) {} Module::~Module() = default; diff --git a/src/tint/sem/module.h b/src/tint/sem/module.h index 21b08f2ccc..6bcd802122 100644 --- a/src/tint/sem/module.h +++ b/src/tint/sem/module.h @@ -16,7 +16,7 @@ #define SRC_TINT_SEM_MODULE_H_ #include "src/tint/ast/diagnostic_control.h" -#include "src/tint/ast/extension.h" +#include "src/tint/builtin/extension.h" #include "src/tint/sem/node.h" #include "src/tint/utils/vector.h" @@ -34,7 +34,7 @@ class Module final : public Castable { /// Constructor /// @param dep_ordered_decls the dependency-ordered module-scope declarations /// @param extensions the list of enabled extensions in the module - Module(utils::VectorRef dep_ordered_decls, ast::Extensions extensions); + Module(utils::VectorRef dep_ordered_decls, builtin::Extensions extensions); /// Destructor ~Module() override; @@ -45,7 +45,7 @@ class Module final : public Castable { } /// @returns the list of enabled extensions in the module - const ast::Extensions& Extensions() const { return extensions_; } + const builtin::Extensions& Extensions() const { return extensions_; } /// Modifies the severity of a specific diagnostic rule for this module. /// @param rule the diagnostic rule @@ -61,7 +61,7 @@ class Module final : public Castable { private: const utils::Vector dep_ordered_decls_; - ast::Extensions extensions_; + builtin::Extensions extensions_; ast::DiagnosticRuleSeverities diagnostic_severities_; }; diff --git a/src/tint/transform/builtin_polyfill.cc b/src/tint/transform/builtin_polyfill.cc index e140fb34c7..917d418108 100644 --- a/src/tint/transform/builtin_polyfill.cc +++ b/src/tint/transform/builtin_polyfill.cc @@ -45,7 +45,7 @@ struct BuiltinPolyfill::State { State(CloneContext& c, Builtins p) : ctx(c), polyfill(p) { has_full_ptr_params = false; for (auto* enable : c.src->AST().Enables()) { - if (enable->extension == ast::Extension::kChromiumExperimentalFullPtrParameters) { + if (enable->extension == builtin::Extension::kChromiumExperimentalFullPtrParameters) { has_full_ptr_params = true; } } @@ -673,7 +673,7 @@ struct BuiltinPolyfill::State { /// @return the polyfill function name Symbol workgroupUniformLoad(const type::Type* type) { if (!has_full_ptr_params) { - b.Enable(ast::Extension::kChromiumExperimentalFullPtrParameters); + b.Enable(builtin::Extension::kChromiumExperimentalFullPtrParameters); has_full_ptr_params = true; } auto name = b.Symbols().New("tint_workgroupUniformLoad"); diff --git a/src/tint/transform/clamp_frag_depth.cc b/src/tint/transform/clamp_frag_depth.cc index feacf82f01..57d9a40a3c 100644 --- a/src/tint/transform/clamp_frag_depth.cc +++ b/src/tint/transform/clamp_frag_depth.cc @@ -117,7 +117,7 @@ Transform::ApplyResult ClampFragDepth::Apply(const Program* src, const DataMap&, // fn clamp_frag_depth(v : f32) -> f32 { // return clamp(v, frag_depth_clamp_args.min, frag_depth_clamp_args.max); // } - b.Enable(ast::Extension::kChromiumExperimentalPushConstant); + b.Enable(builtin::Extension::kChromiumExperimentalPushConstant); b.Structure(b.Symbols().New("FragDepthClampArgs"), utils::Vector{b.Member("min", b.ty.f32()), b.Member("max", b.ty.f32())}); diff --git a/src/tint/transform/direct_variable_access.cc b/src/tint/transform/direct_variable_access.cc index a8a1272f25..8ae3e22ef8 100644 --- a/src/tint/transform/direct_variable_access.cc +++ b/src/tint/transform/direct_variable_access.cc @@ -203,7 +203,7 @@ struct DirectVariableAccess::State { /// @returns the ApplyResult ApplyResult Run() { if (!ctx.src->Sem().Module()->Extensions().Contains( - ast::Extension::kChromiumExperimentalFullPtrParameters)) { + builtin::Extension::kChromiumExperimentalFullPtrParameters)) { // If the 'chromium_experimental_full_ptr_parameters' extension is not enabled, then // there's nothing for this transform to do. return SkipTransform; diff --git a/src/tint/transform/disable_uniformity_analysis.cc b/src/tint/transform/disable_uniformity_analysis.cc index ffd0b180c3..7c26fb8343 100644 --- a/src/tint/transform/disable_uniformity_analysis.cc +++ b/src/tint/transform/disable_uniformity_analysis.cc @@ -31,13 +31,13 @@ Transform::ApplyResult DisableUniformityAnalysis::Apply(const Program* src, const DataMap&, DataMap&) const { if (src->Sem().Module()->Extensions().Contains( - ast::Extension::kChromiumDisableUniformityAnalysis)) { + builtin::Extension::kChromiumDisableUniformityAnalysis)) { return SkipTransform; } ProgramBuilder b; CloneContext ctx{&b, src, /* auto_clone_symbols */ true}; - b.Enable(ast::Extension::kChromiumDisableUniformityAnalysis); + b.Enable(builtin::Extension::kChromiumDisableUniformityAnalysis); ctx.Clone(); return Program(std::move(b)); diff --git a/src/tint/transform/preserve_padding.cc b/src/tint/transform/preserve_padding.cc index 011e5c98db..ba30933291 100644 --- a/src/tint/transform/preserve_padding.cc +++ b/src/tint/transform/preserve_padding.cc @@ -66,7 +66,7 @@ struct PreservePadding::State { [&](const ast::Enable* enable) { // Check if the full pointer parameters extension is already enabled. if (enable->extension == - ast::Extension::kChromiumExperimentalFullPtrParameters) { + builtin::Extension::kChromiumExperimentalFullPtrParameters) { ext_enabled = true; } }); @@ -197,7 +197,7 @@ struct PreservePadding::State { /// Enable the full pointer parameters extension, if we have not already done so. void EnableExtension() { if (!ext_enabled) { - b.Enable(ast::Extension::kChromiumExperimentalFullPtrParameters); + b.Enable(builtin::Extension::kChromiumExperimentalFullPtrParameters); ext_enabled = true; } } diff --git a/src/tint/writer/check_supported_extensions.cc b/src/tint/writer/check_supported_extensions.cc index 3bb16bfb81..bde86a5385 100644 --- a/src/tint/writer/check_supported_extensions.cc +++ b/src/tint/writer/check_supported_extensions.cc @@ -26,8 +26,8 @@ namespace tint::writer { bool CheckSupportedExtensions(std::string_view writer_name, const ast::Module& module, diag::List& diags, - utils::VectorRef supported) { - utils::Hashset set; + utils::VectorRef supported) { + utils::Hashset set; for (auto ext : supported) { set.Add(ext); } diff --git a/src/tint/writer/check_supported_extensions.h b/src/tint/writer/check_supported_extensions.h index c1884d08b1..87761028e3 100644 --- a/src/tint/writer/check_supported_extensions.h +++ b/src/tint/writer/check_supported_extensions.h @@ -15,7 +15,7 @@ #ifndef SRC_TINT_WRITER_CHECK_SUPPORTED_EXTENSIONS_H_ #define SRC_TINT_WRITER_CHECK_SUPPORTED_EXTENSIONS_H_ -#include "src/tint/ast/extension.h" +#include "src/tint/builtin/extension.h" #include "src/tint/utils/vector.h" namespace tint::ast { @@ -36,7 +36,7 @@ namespace tint::writer { bool CheckSupportedExtensions(std::string_view writer_name, const ast::Module& module, diag::List& diags, - utils::VectorRef supported); + utils::VectorRef supported); } // namespace tint::writer diff --git a/src/tint/writer/check_supported_extensions_test.cc b/src/tint/writer/check_supported_extensions_test.cc index 97c3b32b8c..4d5690bc33 100644 --- a/src/tint/writer/check_supported_extensions_test.cc +++ b/src/tint/writer/check_supported_extensions_test.cc @@ -24,21 +24,21 @@ namespace { class CheckSupportedExtensionsTest : public ::testing::Test, public ProgramBuilder {}; TEST_F(CheckSupportedExtensionsTest, Supported) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); ASSERT_TRUE(CheckSupportedExtensions("writer", AST(), Diagnostics(), utils::Vector{ - ast::Extension::kF16, - ast::Extension::kChromiumExperimentalDp4A, + builtin::Extension::kF16, + builtin::Extension::kChromiumExperimentalDp4A, })); } TEST_F(CheckSupportedExtensionsTest, Unsupported) { - Enable(Source{{12, 34}}, ast::Extension::kF16); + Enable(Source{{12, 34}}, builtin::Extension::kF16); ASSERT_FALSE(CheckSupportedExtensions("writer", AST(), Diagnostics(), utils::Vector{ - ast::Extension::kChromiumExperimentalDp4A, + builtin::Extension::kChromiumExperimentalDp4A, })); EXPECT_EQ(Diagnostics().str(), "12:34 error: writer backend does not support extension 'f16'"); } diff --git a/src/tint/writer/glsl/generator_impl.cc b/src/tint/writer/glsl/generator_impl.cc index 1ea30d402c..a09af2f965 100644 --- a/src/tint/writer/glsl/generator_impl.cc +++ b/src/tint/writer/glsl/generator_impl.cc @@ -326,7 +326,7 @@ bool GeneratorImpl::Generate() { bool GeneratorImpl::RecordExtension(const ast::Enable* ext) { // Deal with extension node here, recording it within the generator for later emition. - if (ext->extension == ast::Extension::kF16) { + if (ext->extension == builtin::Extension::kF16) { requires_f16_extension_ = true; } diff --git a/src/tint/writer/glsl/generator_impl_binary_test.cc b/src/tint/writer/glsl/generator_impl_binary_test.cc index 884cba0d63..72eddc7dcc 100644 --- a/src/tint/writer/glsl/generator_impl_binary_test.cc +++ b/src/tint/writer/glsl/generator_impl_binary_test.cc @@ -69,7 +69,7 @@ TEST_P(GlslBinaryTest, Emit_f16) { return; } - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); GlobalVar("left", ty.f16(), type::AddressSpace::kPrivate); GlobalVar("right", ty.f16(), type::AddressSpace::kPrivate); @@ -167,7 +167,7 @@ TEST_F(GlslGeneratorImplTest_Binary, Multiply_VectorScalar_f32) { } TEST_F(GlslGeneratorImplTest_Binary, Multiply_VectorScalar_f16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); GlobalVar("a", vec3(1_h, 1_h, 1_h), type::AddressSpace::kPrivate); auto* lhs = Expr("a"); @@ -201,7 +201,7 @@ TEST_F(GlslGeneratorImplTest_Binary, Multiply_ScalarVector_f32) { } TEST_F(GlslGeneratorImplTest_Binary, Multiply_ScalarVector_f16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); GlobalVar("a", vec3(1_h, 1_h, 1_h), type::AddressSpace::kPrivate); auto* lhs = Expr(1_h); @@ -234,7 +234,7 @@ TEST_F(GlslGeneratorImplTest_Binary, Multiply_MatrixScalar_f32) { } TEST_F(GlslGeneratorImplTest_Binary, Multiply_MatrixScalar_f16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); GlobalVar("mat", ty.mat3x3(), type::AddressSpace::kPrivate); auto* lhs = Expr("mat"); @@ -266,7 +266,7 @@ TEST_F(GlslGeneratorImplTest_Binary, Multiply_ScalarMatrix_f32) { } TEST_F(GlslGeneratorImplTest_Binary, Multiply_ScalarMatrix_f16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); GlobalVar("mat", ty.mat3x3(), type::AddressSpace::kPrivate); auto* lhs = Expr(1_h); @@ -298,7 +298,7 @@ TEST_F(GlslGeneratorImplTest_Binary, Multiply_MatrixVector_f32) { } TEST_F(GlslGeneratorImplTest_Binary, Multiply_MatrixVector_f16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); GlobalVar("mat", ty.mat3x3(), type::AddressSpace::kPrivate); auto* lhs = Expr("mat"); @@ -330,7 +330,7 @@ TEST_F(GlslGeneratorImplTest_Binary, Multiply_VectorMatrix_f32) { } TEST_F(GlslGeneratorImplTest_Binary, Multiply_VectorMatrix_f16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); GlobalVar("mat", ty.mat3x3(), type::AddressSpace::kPrivate); auto* lhs = vec3(1_h, 1_h, 1_h); @@ -361,7 +361,7 @@ TEST_F(GlslGeneratorImplTest_Binary, Multiply_MatrixMatrix_f32) { } TEST_F(GlslGeneratorImplTest_Binary, Multiply_MatrixMatrix_f16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); GlobalVar("lhs", ty.mat3x3(), type::AddressSpace::kPrivate); GlobalVar("rhs", ty.mat3x3(), type::AddressSpace::kPrivate); @@ -391,7 +391,7 @@ TEST_F(GlslGeneratorImplTest_Binary, ModF32) { } TEST_F(GlslGeneratorImplTest_Binary, ModF16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); GlobalVar("a", ty.f16(), type::AddressSpace::kPrivate); GlobalVar("b", ty.f16(), type::AddressSpace::kPrivate); @@ -421,7 +421,7 @@ TEST_F(GlslGeneratorImplTest_Binary, ModVec3F32) { } TEST_F(GlslGeneratorImplTest_Binary, ModVec3F16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); GlobalVar("a", ty.vec3(), type::AddressSpace::kPrivate); GlobalVar("b", ty.vec3(), type::AddressSpace::kPrivate); @@ -451,7 +451,7 @@ TEST_F(GlslGeneratorImplTest_Binary, ModVec3F32ScalarF32) { } TEST_F(GlslGeneratorImplTest_Binary, ModVec3F16ScalarF16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); GlobalVar("a", ty.vec3(), type::AddressSpace::kPrivate); GlobalVar("b", ty.f16(), type::AddressSpace::kPrivate); @@ -481,7 +481,7 @@ TEST_F(GlslGeneratorImplTest_Binary, ModScalarF32Vec3F32) { } TEST_F(GlslGeneratorImplTest_Binary, ModScalarF16Vec3F16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); GlobalVar("a", ty.f16(), type::AddressSpace::kPrivate); GlobalVar("b", ty.vec3(), type::AddressSpace::kPrivate); @@ -539,7 +539,7 @@ void test_function() { } TEST_F(GlslGeneratorImplTest_Binary, ModMixedVec3ScalarF16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); GlobalVar("a", ty.vec3(), type::AddressSpace::kPrivate); GlobalVar("b", ty.f16(), type::AddressSpace::kPrivate); diff --git a/src/tint/writer/glsl/generator_impl_builtin_test.cc b/src/tint/writer/glsl/generator_impl_builtin_test.cc index 33d2fa70b5..7526494c04 100644 --- a/src/tint/writer/glsl/generator_impl_builtin_test.cc +++ b/src/tint/writer/glsl/generator_impl_builtin_test.cc @@ -196,7 +196,7 @@ TEST_P(GlslBuiltinTest, Emit) { auto param = GetParam(); if (param.type == CallParamType::kF16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); GlobalVar("h2", ty.vec2(), type::AddressSpace::kPrivate); GlobalVar("h3", ty.vec3(), type::AddressSpace::kPrivate); @@ -399,7 +399,7 @@ TEST_F(GlslGeneratorImplTest_Builtin, FMA_f32) { } TEST_F(GlslGeneratorImplTest_Builtin, FMA_f16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); GlobalVar("a", ty.vec3(), type::AddressSpace::kPrivate); GlobalVar("b", ty.vec3(), type::AddressSpace::kPrivate); @@ -451,7 +451,7 @@ void main() { } TEST_F(GlslGeneratorImplTest_Builtin, Runtime_Modf_Scalar_f16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); WrapInFunction(Decl(Let("f", Expr(1.5_h))), // Decl(Let("v", Call("modf", "f")))); @@ -522,7 +522,7 @@ void main() { } TEST_F(GlslGeneratorImplTest_Builtin, Runtime_Modf_Vector_f16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); WrapInFunction(Decl(Let("f", vec3(1.5_h, 2.5_h, 3.5_h))), // Decl(Let("v", Call("modf", "f")))); @@ -585,7 +585,7 @@ void main() { } TEST_F(GlslGeneratorImplTest_Builtin, Const_Modf_Scalar_f16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); WrapInFunction(Decl(Let("v", Call("modf", 1.5_h)))); @@ -640,7 +640,7 @@ void main() { } TEST_F(GlslGeneratorImplTest_Builtin, Const_Modf_Vector_f16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); WrapInFunction(Decl(Let("v", Call("modf", vec3(1.5_h, 2.5_h, 3.5_h))))); @@ -703,7 +703,7 @@ void main() { } TEST_F(GlslGeneratorImplTest_Builtin, Runtime_Frexp_Scalar_f16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); WrapInFunction(Var("f", Expr(1_h)), // Var("v", Call("frexp", "f"))); @@ -774,7 +774,7 @@ void main() { } TEST_F(GlslGeneratorImplTest_Builtin, Runtime_Frexp_Vector_f16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); WrapInFunction(Var("f", Expr(vec3())), // Var("v", Call("frexp", "f"))); @@ -837,7 +837,7 @@ void main() { } TEST_F(GlslGeneratorImplTest_Builtin, Const_Frexp_Scalar_f16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); WrapInFunction(Decl(Let("v", Call("frexp", 1_h)))); @@ -892,7 +892,7 @@ void main() { } TEST_F(GlslGeneratorImplTest_Builtin, Const_Frexp_Vector_f16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); WrapInFunction(Decl(Let("v", Call("frexp", vec3())))); @@ -977,7 +977,7 @@ void main() { } TEST_F(GlslGeneratorImplTest_Builtin, Degrees_Scalar_f16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* val = Var("val", ty.f16()); auto* call = Call("degrees", val); @@ -1008,7 +1008,7 @@ void main() { } TEST_F(GlslGeneratorImplTest_Builtin, Degrees_Vector_f16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* val = Var("val", ty.vec3()); auto* call = Call("degrees", val); @@ -1095,7 +1095,7 @@ void main() { } TEST_F(GlslGeneratorImplTest_Builtin, Radians_Scalar_f16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* val = Var("val", ty.f16()); auto* call = Call("radians", val); @@ -1126,7 +1126,7 @@ void main() { } TEST_F(GlslGeneratorImplTest_Builtin, Radians_Vector_f16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* val = Var("val", ty.vec3()); auto* call = Call("radians", val); diff --git a/src/tint/writer/glsl/generator_impl_initializer_test.cc b/src/tint/writer/glsl/generator_impl_initializer_test.cc index e9c4dc9c1d..d62942d143 100644 --- a/src/tint/writer/glsl/generator_impl_initializer_test.cc +++ b/src/tint/writer/glsl/generator_impl_initializer_test.cc @@ -62,7 +62,7 @@ TEST_F(GlslGeneratorImplTest_Initializer, EmitInitializer_Float) { } TEST_F(GlslGeneratorImplTest_Initializer, EmitInitializer_F16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); // Use a number close to 1<<16 but whose decimal representation ends in 0. WrapInFunction(Expr(f16((1 << 15) - 8))); @@ -83,7 +83,7 @@ TEST_F(GlslGeneratorImplTest_Initializer, EmitInitializer_Type_Float) { } TEST_F(GlslGeneratorImplTest_Initializer, EmitInitializer_Type_F16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); WrapInFunction(Call(-1.2e-3_h)); @@ -130,7 +130,7 @@ TEST_F(GlslGeneratorImplTest_Initializer, EmitInitializer_Type_Vec_F32) { } TEST_F(GlslGeneratorImplTest_Initializer, EmitInitializer_Type_Vec_F16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); WrapInFunction(vec3(1_h, 2_h, 3_h)); @@ -150,7 +150,7 @@ TEST_F(GlslGeneratorImplTest_Initializer, EmitInitializer_Type_Vec_Empty_F32) { } TEST_F(GlslGeneratorImplTest_Initializer, EmitInitializer_Type_Vec_Empty_F16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); WrapInFunction(vec3()); @@ -170,7 +170,7 @@ TEST_F(GlslGeneratorImplTest_Initializer, EmitInitializer_Type_Vec_SingleScalar_ } TEST_F(GlslGeneratorImplTest_Initializer, EmitInitializer_Type_Vec_SingleScalar_F16_Literal) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); WrapInFunction(vec3(2_h)); @@ -193,7 +193,7 @@ TEST_F(GlslGeneratorImplTest_Initializer, EmitInitializer_Type_Vec_SingleScalar_ } TEST_F(GlslGeneratorImplTest_Initializer, EmitInitializer_Type_Vec_SingleScalar_F16_Var) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* var = Var("v", Expr(2_h)); auto* cast = vec3(var); @@ -244,7 +244,7 @@ TEST_F(GlslGeneratorImplTest_Initializer, EmitInitializer_Type_Mat_F32) { } TEST_F(GlslGeneratorImplTest_Initializer, EmitInitializer_Type_Mat_F16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); WrapInFunction(mat2x3(vec3(1_h, 2_h, 3_h), vec3(3_h, 4_h, 5_h))); @@ -290,7 +290,7 @@ TEST_F(GlslGeneratorImplTest_Initializer, EmitInitializer_Type_Mat_Complex_F16) // vec4(7.0h), // vec4(vec4(42.0h, 21.0h, 6.0h, -5.0h)), // ); - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* vector_literal = vec4(Expr(f16(2.0)), Expr(f16(3.0)), Expr(f16(4.0)), Expr(f16(8.0))); @@ -324,7 +324,7 @@ TEST_F(GlslGeneratorImplTest_Initializer, EmitInitializer_Type_Mat_Empty_F32) { } TEST_F(GlslGeneratorImplTest_Initializer, EmitInitializer_Type_Mat_Empty_F16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); WrapInFunction(mat2x3()); @@ -360,7 +360,7 @@ TEST_F(GlslGeneratorImplTest_Initializer, EmitInitializer_Type_Mat_Identity_F16) // var m_2: mat4x4 = mat4x4(m_1); // } - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* m_1 = Var("m_1", ty.mat4x4(ty.f16()), mat4x4()); auto* m_2 = Var("m_2", ty.mat4x4(ty.f16()), mat4x4(m_1)); diff --git a/src/tint/writer/glsl/generator_impl_module_constant_test.cc b/src/tint/writer/glsl/generator_impl_module_constant_test.cc index 9f0985df84..dfbcecf0e2 100644 --- a/src/tint/writer/glsl/generator_impl_module_constant_test.cc +++ b/src/tint/writer/glsl/generator_impl_module_constant_test.cc @@ -133,7 +133,7 @@ void f() { } TEST_F(GlslGeneratorImplTest_ModuleConstant, Emit_GlobalConst_f16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* var = GlobalConst("G", Expr(1_h)); Func("f", utils::Empty, ty.void_(), @@ -216,7 +216,7 @@ void f() { } TEST_F(GlslGeneratorImplTest_ModuleConstant, Emit_GlobalConst_vec3_f16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* var = GlobalConst("G", vec3(1_h, 2_h, 3_h)); Func("f", utils::Empty, ty.void_(), @@ -279,7 +279,7 @@ void f() { } TEST_F(GlslGeneratorImplTest_ModuleConstant, Emit_GlobalConst_mat2x3_f16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* var = GlobalConst("G", mat2x3(1_h, 2_h, 3_h, 4_h, 5_h, 6_h)); Func("f", utils::Empty, ty.void_(), diff --git a/src/tint/writer/glsl/generator_impl_type_test.cc b/src/tint/writer/glsl/generator_impl_type_test.cc index 625c7d3067..b5389798d0 100644 --- a/src/tint/writer/glsl/generator_impl_type_test.cc +++ b/src/tint/writer/glsl/generator_impl_type_test.cc @@ -107,7 +107,7 @@ TEST_F(GlslGeneratorImplTest_Type, EmitType_F32) { } TEST_F(GlslGeneratorImplTest_Type, EmitType_F16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* f16 = create(); @@ -144,7 +144,7 @@ TEST_F(GlslGeneratorImplTest_Type, EmitType_Matrix_F32) { } TEST_F(GlslGeneratorImplTest_Type, EmitType_Matrix_F16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* f16 = create(); auto* vec3 = create(f16, 3u); @@ -255,7 +255,7 @@ TEST_F(GlslGeneratorImplTest_Type, EmitType_Vector_F32) { } TEST_F(GlslGeneratorImplTest_Type, EmitType_Vector_F16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* f16 = create(); auto* vec3 = create(f16, 3u); diff --git a/src/tint/writer/glsl/generator_impl_variable_decl_statement_test.cc b/src/tint/writer/glsl/generator_impl_variable_decl_statement_test.cc index 6511179f6a..a4d11cb663 100644 --- a/src/tint/writer/glsl/generator_impl_variable_decl_statement_test.cc +++ b/src/tint/writer/glsl/generator_impl_variable_decl_statement_test.cc @@ -170,7 +170,7 @@ void f() { } TEST_F(GlslGeneratorImplTest_VariableDecl, Emit_VariableDeclStatement_Const_f16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* C = Const("C", Expr(1_h)); Func("f", utils::Empty, ty.void_(), @@ -257,7 +257,7 @@ void f() { } TEST_F(GlslGeneratorImplTest_VariableDecl, Emit_VariableDeclStatement_Const_vec3_f16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* C = Const("C", vec3(1_h, 2_h, 3_h)); Func("f", utils::Empty, ty.void_(), @@ -323,7 +323,7 @@ void f() { } TEST_F(GlslGeneratorImplTest_VariableDecl, Emit_VariableDeclStatement_Const_mat2x3_f16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* C = Const("C", mat2x3(1_h, 2_h, 3_h, 4_h, 5_h, 6_h)); Func("f", utils::Empty, ty.void_(), @@ -501,7 +501,7 @@ TEST_F(GlslGeneratorImplTest_VariableDecl, Emit_VariableDeclStatement_Initialize } TEST_F(GlslGeneratorImplTest_VariableDecl, Emit_VariableDeclStatement_Initializer_ZeroVec_f16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* var = Var("a", ty.vec3(), vec3()); @@ -530,7 +530,7 @@ TEST_F(GlslGeneratorImplTest_VariableDecl, Emit_VariableDeclStatement_Initialize } TEST_F(GlslGeneratorImplTest_VariableDecl, Emit_VariableDeclStatement_Initializer_ZeroMat_f16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* var = Var("a", ty.mat2x3(), mat2x3()); diff --git a/src/tint/writer/hlsl/generator_impl.cc b/src/tint/writer/hlsl/generator_impl.cc index ad1d50dead..4c036f93b9 100644 --- a/src/tint/writer/hlsl/generator_impl.cc +++ b/src/tint/writer/hlsl/generator_impl.cc @@ -297,11 +297,11 @@ GeneratorImpl::~GeneratorImpl() = default; bool GeneratorImpl::Generate() { if (!CheckSupportedExtensions("HLSL", program_->AST(), diagnostics_, utils::Vector{ - ast::Extension::kChromiumDisableUniformityAnalysis, - ast::Extension::kChromiumExperimentalDp4A, - ast::Extension::kChromiumExperimentalFullPtrParameters, - ast::Extension::kChromiumExperimentalPushConstant, - ast::Extension::kF16, + builtin::Extension::kChromiumDisableUniformityAnalysis, + builtin::Extension::kChromiumExperimentalDp4A, + builtin::Extension::kChromiumExperimentalFullPtrParameters, + builtin::Extension::kChromiumExperimentalPushConstant, + builtin::Extension::kF16, })) { return false; } diff --git a/src/tint/writer/hlsl/generator_impl_binary_test.cc b/src/tint/writer/hlsl/generator_impl_binary_test.cc index afc6b8fa11..325ca67804 100644 --- a/src/tint/writer/hlsl/generator_impl_binary_test.cc +++ b/src/tint/writer/hlsl/generator_impl_binary_test.cc @@ -80,7 +80,7 @@ TEST_P(HlslBinaryTest, Emit_f16) { return; } - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); GlobalVar("left", ty.f16(), type::AddressSpace::kPrivate); GlobalVar("right", ty.f16(), type::AddressSpace::kPrivate); @@ -188,7 +188,7 @@ TEST_F(HlslGeneratorImplTest_Binary, Multiply_VectorScalar_f32) { } TEST_F(HlslGeneratorImplTest_Binary, Multiply_VectorScalar_f16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* lhs = vec3(1_h, 1_h, 1_h); auto* rhs = Expr(1_h); @@ -220,7 +220,7 @@ TEST_F(HlslGeneratorImplTest_Binary, Multiply_ScalarVector_f32) { } TEST_F(HlslGeneratorImplTest_Binary, Multiply_ScalarVector_f16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* lhs = Expr(1_h); auto* rhs = vec3(1_h, 1_h, 1_h); @@ -252,7 +252,7 @@ TEST_F(HlslGeneratorImplTest_Binary, Multiply_MatrixScalar_f32) { } TEST_F(HlslGeneratorImplTest_Binary, Multiply_MatrixScalar_f16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); GlobalVar("mat", ty.mat3x3(), type::AddressSpace::kPrivate); auto* lhs = Expr("mat"); @@ -284,7 +284,7 @@ TEST_F(HlslGeneratorImplTest_Binary, Multiply_ScalarMatrix_f32) { } TEST_F(HlslGeneratorImplTest_Binary, Multiply_ScalarMatrix_f16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); GlobalVar("mat", ty.mat3x3(), type::AddressSpace::kPrivate); auto* lhs = Expr(1_h); @@ -316,7 +316,7 @@ TEST_F(HlslGeneratorImplTest_Binary, Multiply_MatrixVector_f32) { } TEST_F(HlslGeneratorImplTest_Binary, Multiply_MatrixVector_f16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); GlobalVar("mat", ty.mat3x3(), type::AddressSpace::kPrivate); auto* lhs = Expr("mat"); @@ -348,7 +348,7 @@ TEST_F(HlslGeneratorImplTest_Binary, Multiply_VectorMatrix_f32) { } TEST_F(HlslGeneratorImplTest_Binary, Multiply_VectorMatrix_f16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); GlobalVar("mat", ty.mat3x3(), type::AddressSpace::kPrivate); auto* lhs = vec3(1_h, 1_h, 1_h); @@ -379,7 +379,7 @@ TEST_F(HlslGeneratorImplTest_Binary, Multiply_MatrixMatrix_f32) { } TEST_F(HlslGeneratorImplTest_Binary, Multiply_MatrixMatrix_f16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); GlobalVar("lhs", ty.mat3x3(), type::AddressSpace::kPrivate); GlobalVar("rhs", ty.mat3x3(), type::AddressSpace::kPrivate); diff --git a/src/tint/writer/hlsl/generator_impl_builtin_test.cc b/src/tint/writer/hlsl/generator_impl_builtin_test.cc index d5c418825d..9811b79eb2 100644 --- a/src/tint/writer/hlsl/generator_impl_builtin_test.cc +++ b/src/tint/writer/hlsl/generator_impl_builtin_test.cc @@ -195,7 +195,7 @@ TEST_P(HlslBuiltinTest, Emit) { auto param = GetParam(); if (param.type == CallParamType::kF16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); GlobalVar("h2", ty.vec2(), type::AddressSpace::kPrivate); GlobalVar("h3", ty.vec3(), type::AddressSpace::kPrivate); @@ -405,7 +405,7 @@ void test_function() { } TEST_F(HlslGeneratorImplTest_Builtin, Runtime_Modf_Scalar_f16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); WrapInFunction(Decl(Let("f", Expr(1.5_h))), // Decl(Let("v", Call("modf", "f")))); @@ -459,7 +459,7 @@ void test_function() { } TEST_F(HlslGeneratorImplTest_Builtin, Runtime_Modf_Vector_f16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); WrapInFunction(Decl(Let("f", vec3(1.5_h, 2.5_h, 3.5_h))), // Decl(Let("v", Call("modf", "f")))); @@ -505,7 +505,7 @@ void test_function() { } TEST_F(HlslGeneratorImplTest_Builtin, Const_Modf_Scalar_f16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); WrapInFunction(Decl(Let("v", Call("modf", 1.5_h)))); @@ -543,7 +543,7 @@ void test_function() { } TEST_F(HlslGeneratorImplTest_Builtin, Const_Modf_Vector_f16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); WrapInFunction(Decl(Let("v", Call("modf", vec3(1.5_h, 2.5_h, 3.5_h))))); @@ -616,7 +616,7 @@ void test_function() { } TEST_F(HlslGeneratorImplTest_Builtin, Runtime_Frexp_Scalar_f16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); WrapInFunction(Var("f", Expr(1_h)), // Var("v", Call("frexp", "f"))); @@ -672,7 +672,7 @@ void test_function() { } TEST_F(HlslGeneratorImplTest_Builtin, Runtime_Frexp_Vector_f16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); WrapInFunction(Var("f", Expr(vec3())), // Var("v", Call("frexp", "f"))); @@ -719,7 +719,7 @@ void test_function() { } TEST_F(HlslGeneratorImplTest_Builtin, Const_Frexp_Scalar_f16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); WrapInFunction(Decl(Let("v", Call("frexp", 1_h)))); @@ -757,7 +757,7 @@ void test_function() { } TEST_F(HlslGeneratorImplTest_Builtin, Const_Frexp_Vector_f16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); WrapInFunction(Decl(Let("v", Call("frexp", vec3())))); @@ -845,7 +845,7 @@ void test_function() { } TEST_F(HlslGeneratorImplTest_Builtin, Degrees_Scalar_f16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* val = Var("val", ty.f16()); auto* call = Call("degrees", val); @@ -868,7 +868,7 @@ void test_function() { } TEST_F(HlslGeneratorImplTest_Builtin, Degrees_Vector_f16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* val = Var("val", ty.vec3()); auto* call = Call("degrees", val); @@ -933,7 +933,7 @@ void test_function() { } TEST_F(HlslGeneratorImplTest_Builtin, Radians_Scalar_f16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* val = Var("val", ty.f16()); auto* call = Call("radians", val); @@ -956,7 +956,7 @@ void test_function() { } TEST_F(HlslGeneratorImplTest_Builtin, Radians_Vector_f16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* val = Var("val", ty.vec3()); auto* call = Call("radians", val); @@ -1047,7 +1047,7 @@ void test_function() { } TEST_F(HlslGeneratorImplTest_Builtin, Sign_Scalar_f16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* val = Var("val", ty.f16()); auto* call = Call("sign", val); @@ -1066,7 +1066,7 @@ void test_function() { } TEST_F(HlslGeneratorImplTest_Builtin, Sign_Vector_f16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* val = Var("val", ty.vec3()); auto* call = Call("sign", val); @@ -1351,7 +1351,7 @@ void main() { } TEST_F(HlslGeneratorImplTest_Builtin, Dot4I8Packed) { - Enable(ast::Extension::kChromiumExperimentalDp4A); + Enable(builtin::Extension::kChromiumExperimentalDp4A); auto* val1 = Var("val1", ty.u32()); auto* val2 = Var("val2", ty.u32()); @@ -1377,7 +1377,7 @@ void test_function() { } TEST_F(HlslGeneratorImplTest_Builtin, Dot4U8Packed) { - Enable(ast::Extension::kChromiumExperimentalDp4A); + Enable(builtin::Extension::kChromiumExperimentalDp4A); auto* val1 = Var("val1", ty.u32()); auto* val2 = Var("val2", ty.u32()); diff --git a/src/tint/writer/hlsl/generator_impl_initializer_test.cc b/src/tint/writer/hlsl/generator_impl_initializer_test.cc index 14f8c08ada..ebc206ae4b 100644 --- a/src/tint/writer/hlsl/generator_impl_initializer_test.cc +++ b/src/tint/writer/hlsl/generator_impl_initializer_test.cc @@ -62,7 +62,7 @@ TEST_F(HlslGeneratorImplTest_Initializer, EmitInitializer_Float) { } TEST_F(HlslGeneratorImplTest_Initializer, EmitInitializer_F16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); // Use a number close to 1<<16 but whose decimal representation ends in 0. WrapInFunction(Expr(f16((1 << 15) - 8))); @@ -83,7 +83,7 @@ TEST_F(HlslGeneratorImplTest_Initializer, EmitInitializer_Type_Float) { } TEST_F(HlslGeneratorImplTest_Initializer, EmitInitializer_Type_F16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); WrapInFunction(Call(-1.2e-3_h)); @@ -130,7 +130,7 @@ TEST_F(HlslGeneratorImplTest_Initializer, EmitInitializer_Type_Vec_F32) { } TEST_F(HlslGeneratorImplTest_Initializer, EmitInitializer_Type_Vec_F16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); WrapInFunction(vec3(1_h, 2_h, 3_h)); @@ -152,7 +152,7 @@ TEST_F(HlslGeneratorImplTest_Initializer, EmitInitializer_Type_Vec_Empty_F32) { } TEST_F(HlslGeneratorImplTest_Initializer, EmitInitializer_Type_Vec_Empty_F16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); WrapInFunction(vec3()); @@ -172,7 +172,7 @@ TEST_F(HlslGeneratorImplTest_Initializer, EmitInitializer_Type_Vec_SingleScalar_ } TEST_F(HlslGeneratorImplTest_Initializer, EmitInitializer_Type_Vec_SingleScalar_F16_Literal) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); WrapInFunction(vec3(2_h)); @@ -195,7 +195,7 @@ TEST_F(HlslGeneratorImplTest_Initializer, EmitInitializer_Type_Vec_SingleScalar_ } TEST_F(HlslGeneratorImplTest_Initializer, EmitInitializer_Type_Vec_SingleScalar_F16_Var) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* var = Var("v", Expr(2_h)); auto* cast = vec3(var); @@ -259,7 +259,7 @@ TEST_F(HlslGeneratorImplTest_Initializer, EmitInitializer_Type_Mat_F32) { } TEST_F(HlslGeneratorImplTest_Initializer, EmitInitializer_Type_Mat_F16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); WrapInFunction(mat2x3(vec3(1_h, 2_h, 3_h), vec3(3_h, 4_h, 5_h))); @@ -307,7 +307,7 @@ TEST_F(HlslGeneratorImplTest_Initializer, EmitInitializer_Type_Mat_Complex_F16) // vec4(7.0h), // vec4(vec4(42.0h, 21.0h, 6.0h, -5.0h)), // ); - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* vector_literal = vec4(Expr(f16(2.0)), Expr(f16(3.0)), Expr(f16(4.0)), Expr(f16(8.0))); @@ -344,7 +344,7 @@ TEST_F(HlslGeneratorImplTest_Initializer, EmitInitializer_Type_Mat_Empty_F32) { } TEST_F(HlslGeneratorImplTest_Initializer, EmitInitializer_Type_Mat_Empty_F16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); WrapInFunction(mat2x3()); @@ -380,7 +380,7 @@ TEST_F(HlslGeneratorImplTest_Initializer, EmitInitializer_Type_Mat_Identity_F16) // var m_2: mat4x4 = mat4x4(m_1); // } - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* m_1 = Var("m_1", ty.mat4x4(ty.f16()), mat4x4()); auto* m_2 = Var("m_2", ty.mat4x4(ty.f16()), mat4x4(m_1)); diff --git a/src/tint/writer/hlsl/generator_impl_member_accessor_test.cc b/src/tint/writer/hlsl/generator_impl_member_accessor_test.cc index 0bd7ae685e..f2607c552a 100644 --- a/src/tint/writer/hlsl/generator_impl_member_accessor_test.cc +++ b/src/tint/writer/hlsl/generator_impl_member_accessor_test.cc @@ -165,7 +165,7 @@ TEST_P(HlslGeneratorImplTest_MemberAccessor_StorageBufferLoad_ConstantOffset, Te auto p = GetParam(); - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); SetupStorageBuffer(utils::Vector{ Member("a", ty.i32()), @@ -300,7 +300,7 @@ TEST_P(HlslGeneratorImplTest_MemberAccessor_StorageBufferLoad_DynamicOffset, Tes auto p = GetParam(); - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* inner = Structure("Inner", utils::Vector{ Member("a", ty.i32()), @@ -439,7 +439,7 @@ TEST_P(HlslGeneratorImplTest_MemberAccessor_UniformBufferLoad_ConstantOffset, Te auto p = GetParam(); - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); SetupUniformBuffer(utils::Vector{ Member("a", ty.i32()), @@ -707,7 +707,7 @@ TEST_P(HlslGeneratorImplTest_MemberAccessor_UniformBufferLoad_DynamicOffset, Tes auto p = GetParam(); - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* inner = Structure("Inner", utils::Vector{ Member("a", ty.i32()), @@ -989,7 +989,7 @@ TEST_P(HlslGeneratorImplTest_MemberAccessor_StorageBufferStore, Test) { auto p = GetParam(); - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); SetupStorageBuffer(utils::Vector{ Member("a", ty.i32()), @@ -1192,7 +1192,7 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor, StorageBuffer_Load_Matrix_F16_Singl // var data : Data; // data.a[2i][1i]; - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); SetupStorageBuffer(utils::Vector{ Member("z", ty.f16()), @@ -1258,7 +1258,7 @@ TEST_F(HlslGeneratorImplTest_MemberAccessor, UniformBuffer_Load_Matrix_F16_Singl // var data : Data; // data.a[2i][1i]; - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); SetupUniformBuffer(utils::Vector{ Member("z", ty.f16()), diff --git a/src/tint/writer/hlsl/generator_impl_module_constant_test.cc b/src/tint/writer/hlsl/generator_impl_module_constant_test.cc index 62f1d8ee43..5a9327de23 100644 --- a/src/tint/writer/hlsl/generator_impl_module_constant_test.cc +++ b/src/tint/writer/hlsl/generator_impl_module_constant_test.cc @@ -93,7 +93,7 @@ TEST_F(HlslGeneratorImplTest_ModuleConstant, Emit_GlobalConst_f32) { } TEST_F(HlslGeneratorImplTest_ModuleConstant, Emit_GlobalConst_f16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* var = GlobalConst("G", Expr(1_h)); Func("f", utils::Empty, ty.void_(), utils::Vector{Decl(Let("l", Expr(var)))}); @@ -151,7 +151,7 @@ TEST_F(HlslGeneratorImplTest_ModuleConstant, Emit_GlobalConst_vec3_f32) { } TEST_F(HlslGeneratorImplTest_ModuleConstant, Emit_GlobalConst_vec3_f16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* var = GlobalConst("G", vec3(1_h, 2_h, 3_h)); Func("f", utils::Empty, ty.void_(), utils::Vector{Decl(Let("l", Expr(var)))}); @@ -195,7 +195,7 @@ TEST_F(HlslGeneratorImplTest_ModuleConstant, Emit_GlobalConst_mat2x3_f32) { } TEST_F(HlslGeneratorImplTest_ModuleConstant, Emit_GlobalConst_mat2x3_f16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* var = GlobalConst("G", mat2x3(1_h, 2_h, 3_h, 4_h, 5_h, 6_h)); Func("f", utils::Empty, ty.void_(), utils::Vector{Decl(Let("l", Expr(var)))}); diff --git a/src/tint/writer/hlsl/generator_impl_test.cc b/src/tint/writer/hlsl/generator_impl_test.cc index 1f3801f843..eeb9acba39 100644 --- a/src/tint/writer/hlsl/generator_impl_test.cc +++ b/src/tint/writer/hlsl/generator_impl_test.cc @@ -29,7 +29,7 @@ TEST_F(HlslGeneratorImplTest, InvalidProgram) { } TEST_F(HlslGeneratorImplTest, UnsupportedExtension) { - Enable(Source{{12, 34}}, ast::Extension::kUndefined); + Enable(Source{{12, 34}}, builtin::Extension::kUndefined); GeneratorImpl& gen = Build(); diff --git a/src/tint/writer/hlsl/generator_impl_variable_decl_statement_test.cc b/src/tint/writer/hlsl/generator_impl_variable_decl_statement_test.cc index 170d993ff5..fedf476b4c 100644 --- a/src/tint/writer/hlsl/generator_impl_variable_decl_statement_test.cc +++ b/src/tint/writer/hlsl/generator_impl_variable_decl_statement_test.cc @@ -155,7 +155,7 @@ TEST_F(HlslGeneratorImplTest_VariableDecl, Emit_VariableDeclStatement_Const_f32) } TEST_F(HlslGeneratorImplTest_VariableDecl, Emit_VariableDeclStatement_Const_f16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* C = Const("C", Expr(1_h)); Func("f", utils::Empty, ty.void_(), @@ -229,7 +229,7 @@ TEST_F(HlslGeneratorImplTest_VariableDecl, Emit_VariableDeclStatement_Const_vec3 } TEST_F(HlslGeneratorImplTest_VariableDecl, Emit_VariableDeclStatement_Const_vec3_f16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* C = Const("C", vec3(1_h, 2_h, 3_h)); Func("f", utils::Empty, ty.void_(), @@ -285,7 +285,7 @@ TEST_F(HlslGeneratorImplTest_VariableDecl, Emit_VariableDeclStatement_Const_mat2 } TEST_F(HlslGeneratorImplTest_VariableDecl, Emit_VariableDeclStatement_Const_mat2x3_f16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* C = Const("C", mat2x3(1_h, 2_h, 3_h, 4_h, 5_h, 6_h)); Func("f", utils::Empty, ty.void_(), @@ -383,7 +383,7 @@ TEST_F(HlslGeneratorImplTest_VariableDecl, Emit_VariableDeclStatement_Initialize } TEST_F(HlslGeneratorImplTest_VariableDecl, Emit_VariableDeclStatement_Initializer_ZeroVec_F16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* var = Var("a", ty.vec3(), vec3()); @@ -412,7 +412,7 @@ TEST_F(HlslGeneratorImplTest_VariableDecl, Emit_VariableDeclStatement_Initialize } TEST_F(HlslGeneratorImplTest_VariableDecl, Emit_VariableDeclStatement_Initializer_ZeroMat_F16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* var = Var("a", ty.mat2x3(), mat2x3()); diff --git a/src/tint/writer/msl/generator_impl.cc b/src/tint/writer/msl/generator_impl.cc index 243fb114ad..87928b436f 100644 --- a/src/tint/writer/msl/generator_impl.cc +++ b/src/tint/writer/msl/generator_impl.cc @@ -270,10 +270,10 @@ GeneratorImpl::~GeneratorImpl() = default; bool GeneratorImpl::Generate() { if (!CheckSupportedExtensions("MSL", program_->AST(), diagnostics_, utils::Vector{ - ast::Extension::kChromiumDisableUniformityAnalysis, - ast::Extension::kChromiumExperimentalFullPtrParameters, - ast::Extension::kChromiumExperimentalPushConstant, - ast::Extension::kF16, + builtin::Extension::kChromiumDisableUniformityAnalysis, + builtin::Extension::kChromiumExperimentalFullPtrParameters, + builtin::Extension::kChromiumExperimentalPushConstant, + builtin::Extension::kF16, })) { return false; } diff --git a/src/tint/writer/msl/generator_impl_binary_test.cc b/src/tint/writer/msl/generator_impl_binary_test.cc index 4916799235..7519b617de 100644 --- a/src/tint/writer/msl/generator_impl_binary_test.cc +++ b/src/tint/writer/msl/generator_impl_binary_test.cc @@ -155,7 +155,7 @@ TEST_F(MslBinaryTest, ModF32) { } TEST_F(MslBinaryTest, ModF16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* left = Var("left", ty.f16()); auto* right = Var("right", ty.f16()); @@ -183,7 +183,7 @@ TEST_F(MslBinaryTest, ModVec3F32) { } TEST_F(MslBinaryTest, ModVec3F16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* left = Var("left", ty.vec3()); auto* right = Var("right", ty.vec3()); diff --git a/src/tint/writer/msl/generator_impl_builtin_test.cc b/src/tint/writer/msl/generator_impl_builtin_test.cc index c0f0ff38d1..0eabc02c96 100644 --- a/src/tint/writer/msl/generator_impl_builtin_test.cc +++ b/src/tint/writer/msl/generator_impl_builtin_test.cc @@ -214,7 +214,7 @@ TEST_P(MslBuiltinTest, Emit) { auto param = GetParam(); if (param.type == CallParamType::kF16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); GlobalVar("h2", ty.vec2(), type::AddressSpace::kPrivate); GlobalVar("h3", ty.vec3(), type::AddressSpace::kPrivate); @@ -436,7 +436,7 @@ kernel void test_function() { } TEST_F(MslGeneratorImplTest, Runtime_Modf_Scalar_f16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); WrapInFunction(Decl(Let("f", Expr(1.5_h))), // Decl(Let("v", Call("modf", "f")))); @@ -498,7 +498,7 @@ kernel void test_function() { } TEST_F(MslGeneratorImplTest, Runtime_Modf_Vector_f16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); WrapInFunction(Decl(Let("f", vec3(1.5_h, 2.5_h, 3.5_h))), // Decl(Let("v", Call("modf", "f")))); @@ -552,7 +552,7 @@ kernel void test_function() { } TEST_F(MslGeneratorImplTest, Const_Modf_Scalar_f16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); WrapInFunction(Decl(Let("v", Call("modf", 1.5_h)))); @@ -598,7 +598,7 @@ kernel void test_function() { } TEST_F(MslGeneratorImplTest, Const_Modf_Vector_f16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); WrapInFunction(Decl(Let("v", Call("modf", vec3(1.5_h, 2.5_h, 3.5_h))))); @@ -652,7 +652,7 @@ kernel void test_function() { } TEST_F(MslGeneratorImplTest, Runtime_Frexp_Scalar_f16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); WrapInFunction(Var("f", Expr(1_h)), // Var("v", Call("frexp", "f"))); @@ -714,7 +714,7 @@ kernel void test_function() { } TEST_F(MslGeneratorImplTest, Runtime_Frexp_Vector_f16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); WrapInFunction(Var("f", Expr(vec3())), // Var("v", Call("frexp", "f"))); @@ -768,7 +768,7 @@ kernel void test_function() { } TEST_F(MslGeneratorImplTest, Const_Frexp_Scalar_f16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); WrapInFunction(Decl(Let("v", Call("frexp", 1_h)))); @@ -814,7 +814,7 @@ kernel void test_function() { } TEST_F(MslGeneratorImplTest, Const_Frexp_Vector_f16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); WrapInFunction(Decl(Let("v", Call("frexp", vec3())))); @@ -888,7 +888,7 @@ kernel void test_function() { } TEST_F(MslGeneratorImplTest, Degrees_Scalar_f16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* val = Var("val", ty.f16()); auto* call = Call("degrees", val); @@ -915,7 +915,7 @@ kernel void test_function() { } TEST_F(MslGeneratorImplTest, Degrees_Vector_f16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* val = Var("val", ty.vec3()); auto* call = Call("degrees", val); @@ -992,7 +992,7 @@ kernel void test_function() { } TEST_F(MslGeneratorImplTest, Radians_Scalar_f16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* val = Var("val", ty.f16()); auto* call = Call("radians", val); @@ -1019,7 +1019,7 @@ kernel void test_function() { } TEST_F(MslGeneratorImplTest, Radians_Vector_f16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* val = Var("val", ty.vec3()); auto* call = Call("radians", val); diff --git a/src/tint/writer/msl/generator_impl_initializer_test.cc b/src/tint/writer/msl/generator_impl_initializer_test.cc index bbcadfdb25..fbd1def306 100644 --- a/src/tint/writer/msl/generator_impl_initializer_test.cc +++ b/src/tint/writer/msl/generator_impl_initializer_test.cc @@ -62,7 +62,7 @@ TEST_F(MslGeneratorImplTest, EmitInitializer_Float) { } TEST_F(MslGeneratorImplTest, EmitInitializer_F16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); // Use a number close to 1<<16 but whose decimal representation ends in 0. WrapInFunction(Expr(f16((1 << 15) - 8))); @@ -83,7 +83,7 @@ TEST_F(MslGeneratorImplTest, EmitInitializer_Type_Float) { } TEST_F(MslGeneratorImplTest, EmitInitializer_Type_F16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); WrapInFunction(Call(-1.2e-3_h)); @@ -130,7 +130,7 @@ TEST_F(MslGeneratorImplTest, EmitInitializer_Type_Vec_F32) { } TEST_F(MslGeneratorImplTest, EmitInitializer_Type_Vec_F16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); WrapInFunction(vec3(1_h, 2_h, 3_h)); @@ -150,7 +150,7 @@ TEST_F(MslGeneratorImplTest, EmitInitializer_Type_Vec_Empty_F32) { } TEST_F(MslGeneratorImplTest, EmitInitializer_Type_Vec_Empty_F16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); WrapInFunction(vec3()); @@ -170,7 +170,7 @@ TEST_F(MslGeneratorImplTest, EmitInitializer_Type_Vec_SingleScalar_F32_Literal) } TEST_F(MslGeneratorImplTest, EmitInitializer_Type_Vec_SingleScalar_F16_Literal) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); WrapInFunction(vec3(2_h)); @@ -193,7 +193,7 @@ TEST_F(MslGeneratorImplTest, EmitInitializer_Type_Vec_SingleScalar_F32_Var) { } TEST_F(MslGeneratorImplTest, EmitInitializer_Type_Vec_SingleScalar_F16_Var) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* var = Var("v", Expr(2_h)); auto* cast = vec3(var); @@ -245,7 +245,7 @@ TEST_F(MslGeneratorImplTest, EmitInitializer_Type_Mat_F32) { } TEST_F(MslGeneratorImplTest, EmitInitializer_Type_Mat_F16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); WrapInFunction(mat2x3(vec3(1_h, 2_h, 3_h), vec3(3_h, 4_h, 5_h))); @@ -291,7 +291,7 @@ TEST_F(MslGeneratorImplTest, EmitInitializer_Type_Mat_Complex_F16) { // vec4(7.0h), // vec4(vec4(42.0h, 21.0h, 6.0h, -5.0h)), // ); - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* vector_literal = vec4(Expr(f16(2.0)), Expr(f16(3.0)), Expr(f16(4.0)), Expr(f16(8.0))); @@ -325,7 +325,7 @@ TEST_F(MslGeneratorImplTest, EmitInitializer_Type_Mat_Empty_F32) { } TEST_F(MslGeneratorImplTest, EmitInitializer_Type_Mat_Empty_F16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); WrapInFunction(mat2x3()); @@ -361,7 +361,7 @@ TEST_F(MslGeneratorImplTest, EmitInitializer_Type_Mat_Identity_F16) { // var m_2: mat4x4 = mat4x4(m_1); // } - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* m_1 = Var("m_1", ty.mat4x4(ty.f16()), mat4x4()); auto* m_2 = Var("m_2", ty.mat4x4(ty.f16()), mat4x4(m_1)); diff --git a/src/tint/writer/msl/generator_impl_module_constant_test.cc b/src/tint/writer/msl/generator_impl_module_constant_test.cc index e7983647e4..8a326e256a 100644 --- a/src/tint/writer/msl/generator_impl_module_constant_test.cc +++ b/src/tint/writer/msl/generator_impl_module_constant_test.cc @@ -113,7 +113,7 @@ void f() { } TEST_F(MslGeneratorImplTest, Emit_GlobalConst_f16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* var = GlobalConst("G", Expr(1_h)); Func("f", utils::Empty, ty.void_(), utils::Vector{Decl(Let("l", Expr(var)))}); @@ -187,7 +187,7 @@ void f() { } TEST_F(MslGeneratorImplTest, Emit_GlobalConst_vec3_f16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* var = GlobalConst("G", vec3(1_h, 2_h, 3_h)); Func("f", utils::Empty, ty.void_(), utils::Vector{Decl(Let("l", Expr(var)))}); @@ -243,7 +243,7 @@ void f() { } TEST_F(MslGeneratorImplTest, Emit_GlobalConst_mat2x3_f16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* var = GlobalConst("G", mat2x3(1_h, 2_h, 3_h, 4_h, 5_h, 6_h)); Func("f", utils::Empty, ty.void_(), utils::Vector{Decl(Let("l", Expr(var)))}); diff --git a/src/tint/writer/msl/generator_impl_test.cc b/src/tint/writer/msl/generator_impl_test.cc index a6d5cb7b25..71d58587d0 100644 --- a/src/tint/writer/msl/generator_impl_test.cc +++ b/src/tint/writer/msl/generator_impl_test.cc @@ -32,7 +32,7 @@ TEST_F(MslGeneratorImplTest, InvalidProgram) { } TEST_F(MslGeneratorImplTest, UnsupportedExtension) { - Enable(Source{{12, 34}}, ast::Extension::kUndefined); + Enable(Source{{12, 34}}, builtin::Extension::kUndefined); GeneratorImpl& gen = Build(); diff --git a/src/tint/writer/msl/generator_impl_variable_decl_statement_test.cc b/src/tint/writer/msl/generator_impl_variable_decl_statement_test.cc index 927ae2627d..1386abbde9 100644 --- a/src/tint/writer/msl/generator_impl_variable_decl_statement_test.cc +++ b/src/tint/writer/msl/generator_impl_variable_decl_statement_test.cc @@ -155,7 +155,7 @@ void f() { } TEST_F(MslGeneratorImplTest, Emit_VariableDeclStatement_Const_f16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* C = Const("C", Expr(1_h)); Func("f", utils::Empty, ty.void_(), utils::Vector{Decl(C), Decl(Let("l", Expr(C)))}); @@ -229,7 +229,7 @@ void f() { } TEST_F(MslGeneratorImplTest, Emit_VariableDeclStatement_Const_vec3_f16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* C = Const("C", vec3(1_h, 2_h, 3_h)); Func("f", utils::Empty, ty.void_(), utils::Vector{Decl(C), Decl(Let("l", Expr(C)))}); @@ -285,7 +285,7 @@ void f() { } TEST_F(MslGeneratorImplTest, Emit_VariableDeclStatement_Const_mat2x3_f16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* C = Const("C", mat2x3(1_h, 2_h, 3_h, 4_h, 5_h, 6_h)); Func("f", utils::Empty, ty.void_(), utils::Vector{Decl(C), Decl(Let("l", Expr(C)))}); @@ -415,7 +415,7 @@ TEST_F(MslGeneratorImplTest, Emit_VariableDeclStatement_Vector_f32) { } TEST_F(MslGeneratorImplTest, Emit_VariableDeclStatement_Vector_f16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* var = Var("a", ty.vec2()); auto* stmt = Decl(var); @@ -444,7 +444,7 @@ TEST_F(MslGeneratorImplTest, Emit_VariableDeclStatement_Matrix_f32) { } TEST_F(MslGeneratorImplTest, Emit_VariableDeclStatement_Matrix_f16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* var = Var("a", ty.mat3x2()); @@ -473,7 +473,7 @@ TEST_F(MslGeneratorImplTest, Emit_VariableDeclStatement_Initializer_ZeroVec_f32) } TEST_F(MslGeneratorImplTest, Emit_VariableDeclStatement_Initializer_ZeroVec_f16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* var = Var("a", ty.vec3(), vec3()); @@ -502,7 +502,7 @@ TEST_F(MslGeneratorImplTest, Emit_VariableDeclStatement_Initializer_ZeroMat_f32) } TEST_F(MslGeneratorImplTest, Emit_VariableDeclStatement_Initializer_ZeroMat_f16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* var = Var("a", ty.mat2x3(), mat2x3()); diff --git a/src/tint/writer/spirv/builder.cc b/src/tint/writer/spirv/builder.cc index 541bb371df..74825586d9 100644 --- a/src/tint/writer/spirv/builder.cc +++ b/src/tint/writer/spirv/builder.cc @@ -265,11 +265,11 @@ Builder::~Builder() = default; bool Builder::Build() { if (!CheckSupportedExtensions("SPIR-V", builder_.AST(), builder_.Diagnostics(), utils::Vector{ - ast::Extension::kChromiumDisableUniformityAnalysis, - ast::Extension::kChromiumExperimentalDp4A, - ast::Extension::kChromiumExperimentalFullPtrParameters, - ast::Extension::kChromiumExperimentalPushConstant, - ast::Extension::kF16, + builtin::Extension::kChromiumDisableUniformityAnalysis, + builtin::Extension::kChromiumExperimentalDp4A, + builtin::Extension::kChromiumExperimentalFullPtrParameters, + builtin::Extension::kChromiumExperimentalPushConstant, + builtin::Extension::kF16, })) { error_ = builder_.Diagnostics().str(); return false; @@ -394,14 +394,14 @@ void Builder::push_extension(const char* extension) { extensions_.push_back(Instruction{spv::Op::OpExtension, {Operand(extension)}}); } -bool Builder::GenerateExtension(ast::Extension extension) { +bool Builder::GenerateExtension(builtin::Extension extension) { switch (extension) { - case ast::Extension::kChromiumExperimentalDp4A: + case builtin::Extension::kChromiumExperimentalDp4A: push_extension("SPV_KHR_integer_dot_product"); push_capability(SpvCapabilityDotProductKHR); push_capability(SpvCapabilityDotProductInput4x8BitPackedKHR); break; - case ast::Extension::kF16: + case builtin::Extension::kF16: push_capability(SpvCapabilityFloat16); push_capability(SpvCapabilityUniformAndStorageBuffer16BitAccess); push_capability(SpvCapabilityStorageBuffer16BitAccess); diff --git a/src/tint/writer/spirv/builder.h b/src/tint/writer/spirv/builder.h index 9262e15f75..c56085a567 100644 --- a/src/tint/writer/spirv/builder.h +++ b/src/tint/writer/spirv/builder.h @@ -228,7 +228,7 @@ class Builder { /// not supported. /// @param ext the extension to generate /// @returns true on success. - bool GenerateExtension(ast::Extension ext); + bool GenerateExtension(builtin::Extension ext); /// Generates a label for the given id. Emits an error and returns false if /// we're currently outside a function. /// @param id the id to use for the label diff --git a/src/tint/writer/spirv/builder_binary_expression_test.cc b/src/tint/writer/spirv/builder_binary_expression_test.cc index ed8185d1d4..b6dfb6256c 100644 --- a/src/tint/writer/spirv/builder_binary_expression_test.cc +++ b/src/tint/writer/spirv/builder_binary_expression_test.cc @@ -248,7 +248,7 @@ INSTANTIATE_TEST_SUITE_P(BuilderTest, using BinaryArithF16Test = TestParamHelper; TEST_P(BinaryArithF16Test, Scalar) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto param = GetParam(); @@ -273,7 +273,7 @@ TEST_P(BinaryArithF16Test, Scalar) { } TEST_P(BinaryArithF16Test, Vector) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto param = GetParam(); @@ -543,7 +543,7 @@ INSTANTIATE_TEST_SUITE_P( using BinaryCompareF16Test = TestParamHelper; TEST_P(BinaryCompareF16Test, Scalar) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto param = GetParam(); @@ -569,7 +569,7 @@ TEST_P(BinaryCompareF16Test, Scalar) { } TEST_P(BinaryCompareF16Test, Vector) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto param = GetParam(); @@ -629,7 +629,7 @@ TEST_F(BuilderTest, Binary_Multiply_VectorScalar_F32) { } TEST_F(BuilderTest, Binary_Multiply_VectorScalar_F16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* lhs = vec3(1_h, 1_h, 1_h); auto* rhs = Expr(1_h); @@ -677,7 +677,7 @@ TEST_F(BuilderTest, Binary_Multiply_ScalarVector_F32) { } TEST_F(BuilderTest, Binary_Multiply_ScalarVector_F16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* lhs = Expr(1_h); auto* rhs = vec3(1_h, 1_h, 1_h); @@ -728,7 +728,7 @@ TEST_F(BuilderTest, Binary_Multiply_MatrixScalar_F32) { } TEST_F(BuilderTest, Binary_Multiply_MatrixScalar_F16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* var = Var("mat", ty.mat3x3()); auto* expr = create(ast::BinaryOp::kMultiply, Expr("mat"), Expr(1_h)); @@ -782,7 +782,7 @@ TEST_F(BuilderTest, Binary_Multiply_ScalarMatrix_F32) { } TEST_F(BuilderTest, Binary_Multiply_ScalarMatrix_F16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* var = Var("mat", ty.mat3x3()); auto* expr = create(ast::BinaryOp::kMultiply, Expr(1_h), Expr("mat")); @@ -838,7 +838,7 @@ TEST_F(BuilderTest, Binary_Multiply_MatrixVector_F32) { } TEST_F(BuilderTest, Binary_Multiply_MatrixVector_F16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* var = Var("mat", ty.mat3x3()); auto* rhs = vec3(1_h, 1_h, 1_h); @@ -896,7 +896,7 @@ TEST_F(BuilderTest, Binary_Multiply_VectorMatrix_F32) { } TEST_F(BuilderTest, Binary_Multiply_VectorMatrix_F16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* var = Var("mat", ty.mat3x3()); auto* lhs = vec3(1_h, 1_h, 1_h); @@ -953,7 +953,7 @@ TEST_F(BuilderTest, Binary_Multiply_MatrixMatrix_F32) { } TEST_F(BuilderTest, Binary_Multiply_MatrixMatrix_F16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* var = Var("mat", ty.mat3x3()); auto* expr = create(ast::BinaryOp::kMultiply, Expr("mat"), Expr("mat")); @@ -1341,7 +1341,7 @@ TEST_P(BinaryArithVectorScalarTest, VectorScalar) { auto& param = GetParam(); if (param.type == Type::f16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); } const ast::Expression* lhs = MakeVectorExpr(this, param.type); @@ -1393,7 +1393,7 @@ TEST_P(BinaryArithVectorScalarTest, ScalarVector) { auto& param = GetParam(); if (param.type == Type::f16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); } const ast::Expression* lhs = MakeScalarExpr(this, param.type); @@ -1473,7 +1473,7 @@ TEST_P(BinaryArithVectorScalarMultiplyTest, VectorScalar) { auto& param = GetParam(); if (param.type == Type::f16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); } const ast::Expression* lhs = MakeVectorExpr(this, param.type); @@ -1521,7 +1521,7 @@ TEST_P(BinaryArithVectorScalarMultiplyTest, ScalarVector) { auto& param = GetParam(); if (param.type == Type::f16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); } const ast::Expression* lhs = MakeScalarExpr(this, param.type); @@ -1636,7 +1636,7 @@ TEST_P(BinaryArithMatrixMatrix, AddOrSubtract) { auto& param = GetParam(); if (param.type == Type::f16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); } const ast::Expression* lhs = MakeMat3x4Expr(this, param.type); @@ -1699,7 +1699,7 @@ TEST_P(BinaryArithMatrixMatrixMultiply, Multiply) { auto& param = GetParam(); if (param.type == Type::f16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); } const ast::Expression* lhs = MakeMat3x4Expr(this, param.type); diff --git a/src/tint/writer/spirv/builder_builtin_test.cc b/src/tint/writer/spirv/builder_builtin_test.cc index 0bab161c76..693fdb1478 100644 --- a/src/tint/writer/spirv/builder_builtin_test.cc +++ b/src/tint/writer/spirv/builder_builtin_test.cc @@ -132,7 +132,7 @@ OpFunctionEnd } TEST_F(BuiltinBuilderTest, Call_GLSLMethod_WithLoad_f16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* var = GlobalVar("ident", ty.f16(), type::AddressSpace::kPrivate); auto* expr = Call("round", "ident"); @@ -516,7 +516,7 @@ OpFunctionEnd } TEST_P(Builtin_Builder_SingleParam_Float_Test, Call_Scalar_f16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto param = GetParam(); // Use a variable to prevent the function being evaluated as constant. @@ -599,7 +599,7 @@ OpFunctionEnd } TEST_P(Builtin_Builder_SingleParam_Float_Test, Call_Vector_f16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto param = GetParam(); @@ -705,7 +705,7 @@ OpFunctionEnd } TEST_F(BuiltinBuilderTest, Call_Length_Scalar_f16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* scalar = Var("a", Expr(1_h)); auto* expr = Call("length", scalar); @@ -779,7 +779,7 @@ OpFunctionEnd } TEST_F(BuiltinBuilderTest, Call_Length_Vector_f16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* vec = Var("a", vec2(1_h, 1_h)); auto* expr = Call("length", vec); @@ -855,7 +855,7 @@ OpFunctionEnd } TEST_F(BuiltinBuilderTest, Call_Normalize_f16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* vec = Var("a", vec2(1_h, 1_h)); auto* expr = Call("normalize", vec); @@ -934,7 +934,7 @@ OpFunctionEnd } TEST_P(Builtin_Builder_DualParam_Float_Test, Call_Scalar_f16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto param = GetParam(); auto* scalar = Var("scalar", Expr(1_h)); @@ -1016,7 +1016,7 @@ OpFunctionEnd } TEST_P(Builtin_Builder_DualParam_Float_Test, Call_Vector_f16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto param = GetParam(); auto* vec = Var("vec", vec2(1_h, 1_h)); @@ -1105,7 +1105,7 @@ OpFunctionEnd } TEST_F(BuiltinBuilderTest, Call_Reflect_Vector_f16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* vec = Var("vec", vec2(1_h, 1_h)); auto* expr = Call("reflect", vec, vec); @@ -1181,7 +1181,7 @@ OpFunctionEnd } TEST_F(BuiltinBuilderTest, Call_Distance_Scalar_f16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* scalar = Var("scalar", Expr(1_h)); auto* expr = Call("distance", scalar, scalar); @@ -1257,7 +1257,7 @@ OpFunctionEnd } TEST_F(BuiltinBuilderTest, Call_Distance_Vector_f16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* vec = Var("vec", vec2(1_h, 1_h)); auto* expr = Call("distance", vec, vec); @@ -1335,7 +1335,7 @@ OpFunctionEnd } TEST_F(BuiltinBuilderTest, Call_Cross_f16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* vec = Var("vec", vec3(1_h, 1_h, 1_h)); auto* expr = Call("cross", vec, vec); @@ -1416,7 +1416,7 @@ OpFunctionEnd } TEST_P(Builtin_Builder_ThreeParam_Float_Test, Call_Scalar_f16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto param = GetParam(); auto* scalar = Var("scalar", Expr(1_h)); @@ -1500,7 +1500,7 @@ OpFunctionEnd } TEST_P(Builtin_Builder_ThreeParam_Float_Test, Call_Vector_f16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto param = GetParam(); auto* vec = Var("vec", vec2(1_h, 1_h)); @@ -1591,7 +1591,7 @@ OpFunctionEnd } TEST_F(BuiltinBuilderTest, Call_FaceForward_Vector_f16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* vec = Var("vec", vec2(1_h, 1_h)); auto* expr = Call("faceForward", vec, vec, vec); @@ -1684,7 +1684,7 @@ OpFunctionEnd } TEST_F(BuiltinBuilderTest, Runtime_Call_Modf_f16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* vec = Var("vec", vec2(1_h, 2_h)); auto* expr = Call("modf", vec); @@ -1786,7 +1786,7 @@ OpFunctionEnd } TEST_F(BuiltinBuilderTest, Const_Call_Modf_f16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* expr = Call("modf", vec2(1_h, 2_h)); Func("a_func", utils::Empty, ty.void_(), @@ -1890,7 +1890,7 @@ OpFunctionEnd } TEST_F(BuiltinBuilderTest, Runtime_Call_Frexp_f16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* vec = Var("vec", vec2(1_h, 2_h)); auto* expr = Call("frexp", vec); @@ -1995,7 +1995,7 @@ OpFunctionEnd } TEST_F(BuiltinBuilderTest, Const_Call_Frexp_f16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); Func("a_func", utils::Empty, ty.void_(), utils::Vector{ @@ -3149,7 +3149,7 @@ OpFunctionEnd } TEST_F(BuiltinBuilderTest, Call_Determinant_f16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* var = GlobalVar("var", ty.mat3x3(), type::AddressSpace::kPrivate); auto* expr = Call("determinant", "var"); @@ -3222,7 +3222,7 @@ OpFunctionEnd } TEST_F(BuiltinBuilderTest, Call_Transpose_f16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* var = GlobalVar("var", ty.mat2x3(), type::AddressSpace::kPrivate); auto* expr = Call("transpose", "var"); @@ -3294,7 +3294,7 @@ OpReturn } TEST_F(BuiltinBuilderTest, Call_Dot_F16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* var = GlobalVar("v", ty.vec3(), type::AddressSpace::kPrivate); auto* expr = Call("dot", "v", "v"); @@ -4153,7 +4153,7 @@ namespace DP4A_builtin_tests { TEST_F(BuiltinBuilderTest, Call_Dot4I8Packed) { auto* ext = create(Source{Source::Range{Source::Location{10, 2}, Source::Location{10, 5}}}, - ast::Extension::kChromiumExperimentalDp4A); + builtin::Extension::kChromiumExperimentalDp4A); AST().AddEnable(ext); auto* val1 = Var("val1", ty.u32()); @@ -4193,7 +4193,7 @@ OpFunctionEnd TEST_F(BuiltinBuilderTest, Call_Dot4U8Packed) { auto* ext = create(Source{Source::Range{Source::Location{10, 2}, Source::Location{10, 5}}}, - ast::Extension::kChromiumExperimentalDp4A); + builtin::Extension::kChromiumExperimentalDp4A); AST().AddEnable(ext); auto* val1 = Var("val1", ty.u32()); diff --git a/src/tint/writer/spirv/builder_global_variable_test.cc b/src/tint/writer/spirv/builder_global_variable_test.cc index 2e586603a9..ea9c6a8f7e 100644 --- a/src/tint/writer/spirv/builder_global_variable_test.cc +++ b/src/tint/writer/spirv/builder_global_variable_test.cc @@ -119,7 +119,7 @@ TEST_F(BuilderTest, GlobalConst_Vec_Initializer) { TEST_F(BuilderTest, GlobalConst_Vec_F16_Initializer) { // const c = vec3(1h, 2h, 3h); // var v = c; - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* c = GlobalConst("c", vec3(1_h, 2_h, 3_h)); GlobalVar("v", type::AddressSpace::kPrivate, Expr(c)); diff --git a/src/tint/writer/spirv/builder_initializer_expression_test.cc b/src/tint/writer/spirv/builder_initializer_expression_test.cc index b78bd9d1bd..9fdc4fced4 100644 --- a/src/tint/writer/spirv/builder_initializer_expression_test.cc +++ b/src/tint/writer/spirv/builder_initializer_expression_test.cc @@ -213,7 +213,7 @@ TEST_F(SpvBuilderInitializerTest, Type_F32_With_F32) { } TEST_F(SpvBuilderInitializerTest, Type_F16_With_F16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* cast = Call(2_h); WrapInFunction(cast); @@ -288,7 +288,7 @@ TEST_F(SpvBuilderInitializerTest, Type_Vec2_With_F32_Literal) { } TEST_F(SpvBuilderInitializerTest, Type_Vec2_With_F16_Literal) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* cast = vec2(2_h); WrapInFunction(cast); @@ -332,7 +332,7 @@ TEST_F(SpvBuilderInitializerTest, Type_Vec2_With_F32_F32) { } TEST_F(SpvBuilderInitializerTest, Type_Vec2_With_F16_F16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* var = Decl(Var("x", ty.f16(), Expr(2_h))); auto* cast = vec2("x", "x"); @@ -377,7 +377,7 @@ TEST_F(SpvBuilderInitializerTest, Type_Vec2_With_F32_F32_Const) { } TEST_F(SpvBuilderInitializerTest, Type_Vec2_With_F16_F16_Const) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* cast = vec2(1_h, 2_h); WrapInFunction(cast); @@ -422,7 +422,7 @@ TEST_F(SpvBuilderInitializerTest, Type_Vec2_F32_With_Vec2) { } TEST_F(SpvBuilderInitializerTest, Type_Vec2_F16_With_Vec2) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* var = Decl(Var("x", ty.vec2(), vec2(1_h, 2_h))); auto* cast = vec2("x"); @@ -467,7 +467,7 @@ TEST_F(SpvBuilderInitializerTest, Type_Vec2_F32_With_Vec2_Const) { } TEST_F(SpvBuilderInitializerTest, Type_Vec2_F16_With_Vec2_Const) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* cast = vec2(vec2(1_h, 2_h)); WrapInFunction(cast); @@ -513,7 +513,7 @@ TEST_F(SpvBuilderInitializerTest, Type_Vec3_With_F32) { } TEST_F(SpvBuilderInitializerTest, Type_Vec3_With_F16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* var = Decl(Var("x", ty.f16(), Expr(2_h))); auto* cast = vec3("x", "x", "x"); @@ -560,7 +560,7 @@ TEST_F(SpvBuilderInitializerTest, Type_Vec3_With_F32_Const) { } TEST_F(SpvBuilderInitializerTest, Type_Vec3_With_F16_Const) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* cast = vec3(1_h, 2_h, 3_h); WrapInFunction(cast); @@ -651,7 +651,7 @@ TEST_F(SpvBuilderInitializerTest, Type_Vec3_With_F32_F32_F32) { } TEST_F(SpvBuilderInitializerTest, Type_Vec3_With_F16_F16_F16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* var = Decl(Var("x", ty.f16(), Expr(2_h))); auto* cast = vec3("x", "x", "x"); @@ -698,7 +698,7 @@ TEST_F(SpvBuilderInitializerTest, Type_Vec3_With_F32_F32_F32_Const) { } TEST_F(SpvBuilderInitializerTest, Type_Vec3_With_F16_F16_F16_Const) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* cast = vec3(1_h, 2_h, 3_h); WrapInFunction(cast); @@ -749,7 +749,7 @@ TEST_F(SpvBuilderInitializerTest, Type_Vec3_With_F32_Vec2) { } TEST_F(SpvBuilderInitializerTest, Type_Vec3_With_F16_Vec2) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* var = Decl(Var("x", ty.vec2(), vec2(2_h, 3_h))); auto* cast = vec3(1_h, "x"); @@ -800,7 +800,7 @@ TEST_F(SpvBuilderInitializerTest, Type_Vec3_With_F32_Vec2_Const) { } TEST_F(SpvBuilderInitializerTest, Type_Vec3_With_F16_Vec2_Const) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* cast = vec3(1_h, vec2(2_h, 3_h)); WrapInFunction(cast); @@ -851,7 +851,7 @@ TEST_F(SpvBuilderInitializerTest, Type_Vec3_With_Vec2_F32) { } TEST_F(SpvBuilderInitializerTest, Type_Vec3_With_Vec2_F16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* var = Decl(Var("x", ty.vec2(), vec2(1_h, 2_h))); auto* cast = vec3("x", 3_h); @@ -902,7 +902,7 @@ TEST_F(SpvBuilderInitializerTest, Type_Vec3_With_Vec2_F32_Const) { } TEST_F(SpvBuilderInitializerTest, Type_Vec3_With_Vec2_F16_Const) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* cast = vec3(vec2(1_h, 2_h), 3_h); WrapInFunction(cast); @@ -949,7 +949,7 @@ TEST_F(SpvBuilderInitializerTest, Type_Vec3_F32_With_Vec3) { } TEST_F(SpvBuilderInitializerTest, Type_Vec3_F16_With_Vec3) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* var = Decl(Var("x", ty.vec3(), vec3(1_h, 2_h, 3_h))); auto* cast = vec3("x"); @@ -996,7 +996,7 @@ TEST_F(SpvBuilderInitializerTest, Type_Vec3_F32_With_Vec3_Const) { } TEST_F(SpvBuilderInitializerTest, Type_Vec3_F16_With_Vec3_Const) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* cast = vec3(vec3(1_h, 2_h, 3_h)); WrapInFunction(cast); @@ -1082,7 +1082,7 @@ TEST_F(SpvBuilderInitializerTest, Type_Vec4_With_F32) { } TEST_F(SpvBuilderInitializerTest, Type_Vec4_With_F16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* var = Decl(Var("x", ty.f16(), Expr(2_h))); auto* cast = vec4("x"); @@ -1125,7 +1125,7 @@ TEST_F(SpvBuilderInitializerTest, Type_Vec4_With_F32_Const) { } TEST_F(SpvBuilderInitializerTest, Type_Vec4_With_F16_Const) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* cast = vec4(2_h); WrapInFunction(cast); @@ -1171,7 +1171,7 @@ TEST_F(SpvBuilderInitializerTest, Type_Vec4_With_F32_F32_F32_F32) { } TEST_F(SpvBuilderInitializerTest, Type_Vec4_With_F16_F16_F16_F16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* var = Decl(Var("x", ty.f16(), Expr(2_h))); auto* cast = vec4("x", "x", "x", "x"); @@ -1220,7 +1220,7 @@ TEST_F(SpvBuilderInitializerTest, Type_Vec4_With_F32_F32_F32_F32_Const) { } TEST_F(SpvBuilderInitializerTest, Type_Vec4_With_F16_F16_F16_F16_Const) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* cast = vec4(1_h, 2_h, 3_h, 4_h); WrapInFunction(cast); @@ -1271,7 +1271,7 @@ TEST_F(SpvBuilderInitializerTest, Type_Vec4_With_F32_F32_Vec2) { } TEST_F(SpvBuilderInitializerTest, Type_Vec4_With_F16_F16_Vec2) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* var = Decl(Var("x", ty.vec2(), vec2(1_h, 2_h))); auto* cast = vec4(1_h, 2_h, "x"); @@ -1322,7 +1322,7 @@ TEST_F(SpvBuilderInitializerTest, Type_Vec4_With_F32_F32_Vec2_Const) { } TEST_F(SpvBuilderInitializerTest, Type_Vec4_With_F16_F16_Vec2_Const) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* cast = vec4(1_h, 2_h, vec2(3_h, 4_h)); WrapInFunction(cast); @@ -1375,7 +1375,7 @@ TEST_F(SpvBuilderInitializerTest, Type_Vec4_With_F32_Vec2_F32) { } TEST_F(SpvBuilderInitializerTest, Type_Vec4_With_F16_Vec2_F16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* var = Decl(Var("x", ty.vec2(), vec2(2_h, 3_h))); auto* cast = vec4(1_h, "x", 4_h); @@ -1428,7 +1428,7 @@ TEST_F(SpvBuilderInitializerTest, Type_Vec4_With_F32_Vec2_F32_Const) { } TEST_F(SpvBuilderInitializerTest, Type_Vec4_With_F16_Vec2_F16_Const) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* cast = vec4(1_h, vec2(2_h, 3_h), 4_h); WrapInFunction(cast); @@ -1481,7 +1481,7 @@ TEST_F(SpvBuilderInitializerTest, Type_Vec4_With_Vec2_F32_F32) { } TEST_F(SpvBuilderInitializerTest, Type_Vec4_With_Vec2_F16_F16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* var = Decl(Var("x", ty.vec2(), vec2(1_h, 2_h))); auto* cast = vec4("x", 3_h, 4_h); @@ -1534,7 +1534,7 @@ TEST_F(SpvBuilderInitializerTest, Type_Vec4_With_Vec2_F32_F32_Const) { } TEST_F(SpvBuilderInitializerTest, Type_Vec4_With_Vec2_F16_F16_Const) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* cast = vec4(vec2(1_h, 2_h), 3_h, 4_h); WrapInFunction(cast); @@ -1588,7 +1588,7 @@ TEST_F(SpvBuilderInitializerTest, Type_Vec4_F32_With_Vec2_Vec2) { } TEST_F(SpvBuilderInitializerTest, Type_Vec4_F16_With_Vec2_Vec2) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* var = Decl(Var("x", ty.vec2(), vec2(1_h, 2_h))); auto* cast = vec4("x", "x"); @@ -1640,7 +1640,7 @@ TEST_F(SpvBuilderInitializerTest, Type_Vec4_F32_With_Vec2_Vec2_Const) { } TEST_F(SpvBuilderInitializerTest, Type_Vec4_F16_With_Vec2_Vec2_Const) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* cast = vec4(vec2(1_h, 2_h), vec2(1_h, 2_h)); WrapInFunction(cast); @@ -1689,7 +1689,7 @@ TEST_F(SpvBuilderInitializerTest, Type_Vec4_With_F32_Vec3) { } TEST_F(SpvBuilderInitializerTest, Type_Vec4_With_F16_Vec3) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* var = Decl(Var("x", ty.vec3(), vec3(2_h, 2_h, 2_h))); auto* cast = vec4(2_h, "x"); @@ -1737,7 +1737,7 @@ TEST_F(SpvBuilderInitializerTest, Type_Vec4_With_F32_Vec3_Const) { } TEST_F(SpvBuilderInitializerTest, Type_Vec4_With_F16_Vec3_Const) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* cast = vec4(2_h, vec3(2_h, 2_h, 2_h)); WrapInFunction(cast); @@ -1785,7 +1785,7 @@ TEST_F(SpvBuilderInitializerTest, Type_Vec4_With_Vec3_F32) { } TEST_F(SpvBuilderInitializerTest, Type_Vec4_With_Vec3_F16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* var = Decl(Var("x", ty.vec3(), vec3(2_h, 2_h, 2_h))); auto* cast = vec4("x", 2_h); @@ -1833,7 +1833,7 @@ TEST_F(SpvBuilderInitializerTest, Type_Vec4_With_Vec3_F32_Const) { } TEST_F(SpvBuilderInitializerTest, Type_Vec4_With_Vec3_F16_Const) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* cast = vec4(vec3(2_h, 2_h, 2_h), 2_h); WrapInFunction(cast); @@ -1870,7 +1870,7 @@ TEST_F(SpvBuilderInitializerTest, Type_Vec4_F32_With_Vec4) { } TEST_F(SpvBuilderInitializerTest, Type_Vec4_F16_With_Vec4) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* value = vec4(2_h, 2_h, 2_h, 2_h); auto* cast = vec4(value); @@ -1911,7 +1911,7 @@ OpReturn } TEST_F(SpvBuilderInitializerTest, Type_GlobalConst_F16_With_F16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* ctor = Call(2_h); GlobalConst("g", ty.f16(), ctor); @@ -1951,7 +1951,7 @@ TEST_F(SpvBuilderInitializerTest, Type_GlobalVar_F32_With_F32) { } TEST_F(SpvBuilderInitializerTest, Type_GlobalVar_F16_With_F16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* ctor = Call(2_h); GlobalVar("g", ty.f16(), type::AddressSpace::kPrivate, ctor); @@ -1991,7 +1991,7 @@ OpReturn } TEST_F(SpvBuilderInitializerTest, Type_GlobalConst_U32_With_F16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* ctor = Call(1.5_h); GlobalConst("g", ty.u32(), ctor); @@ -2031,7 +2031,7 @@ TEST_F(SpvBuilderInitializerTest, Type_GlobalVar_U32_With_F32) { } TEST_F(SpvBuilderInitializerTest, Type_GlobalVar_U32_With_F16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* ctor = Call(1.5_h); GlobalVar("g", ty.u32(), type::AddressSpace::kPrivate, ctor); @@ -2073,7 +2073,7 @@ OpReturn } TEST_F(SpvBuilderInitializerTest, Type_GlobalConst_Vec2_With_F16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* cast = vec2(2_h); GlobalConst("g", ty.vec2(), cast); @@ -2114,7 +2114,7 @@ TEST_F(SpvBuilderInitializerTest, Type_GlobalVar_Vec2_With_F32) { } TEST_F(SpvBuilderInitializerTest, Type_GlobalVar_Vec2_With_F16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* cast = vec2(2_h); auto* g = GlobalVar("g", ty.vec2(), type::AddressSpace::kPrivate, cast); @@ -2155,7 +2155,7 @@ OpReturn } TEST_F(SpvBuilderInitializerTest, Type_GlobalConst_Vec2_F16_With_Vec2) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* cast = vec2(vec2(2_h, 2_h)); GlobalConst("g", ty.vec2(), cast); @@ -2200,7 +2200,7 @@ TEST_F(SpvBuilderInitializerTest, Type_GlobalVar_Vec2_F32_With_Vec2) { } TEST_F(SpvBuilderInitializerTest, Type_GlobalVar_Vec2_F16_With_Vec2) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* cast = vec2(vec2(2_h, 2_h)); GlobalVar("a", ty.vec2(), type::AddressSpace::kPrivate, cast); @@ -2245,7 +2245,7 @@ OpReturn } TEST_F(SpvBuilderInitializerTest, Type_GlobalConst_Vec3_F16_With_Vec3) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* cast = vec3(vec3(2_h, 2_h, 2_h)); GlobalConst("g", ty.vec3(), cast); @@ -2290,7 +2290,7 @@ TEST_F(SpvBuilderInitializerTest, Type_GlobalVar_Vec3_F32_With_Vec3) { } TEST_F(SpvBuilderInitializerTest, Type_GlobalVar_Vec3_F16_With_Vec3) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* cast = vec3(vec3(2_h, 2_h, 2_h)); GlobalVar("a", ty.vec3(), type::AddressSpace::kPrivate, cast); @@ -2335,7 +2335,7 @@ OpReturn } TEST_F(SpvBuilderInitializerTest, Type_GlobalConst_Vec4_F16_With_Vec4) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* cast = vec4(vec4(2_h, 2_h, 2_h, 2_h)); GlobalConst("g", ty.vec4(), cast); @@ -2380,7 +2380,7 @@ TEST_F(SpvBuilderInitializerTest, Type_GlobalVar_Vec4_F32_With_Vec4) { } TEST_F(SpvBuilderInitializerTest, Type_GlobalVar_Vec4_F16_With_Vec4) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* cast = vec4(vec4(2_h, 2_h, 2_h, 2_h)); GlobalVar("a", ty.vec4(), type::AddressSpace::kPrivate, cast); @@ -2425,7 +2425,7 @@ OpReturn } TEST_F(SpvBuilderInitializerTest, Type_GlobalConst_Vec3_With_F16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* cast = vec3(2_h); GlobalConst("g", ty.vec3(), cast); @@ -2466,7 +2466,7 @@ TEST_F(SpvBuilderInitializerTest, Type_GlobalVar_Vec3_With_F32) { } TEST_F(SpvBuilderInitializerTest, Type_GlobalVar_Vec3_With_F16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* cast = vec3(2_h); auto* g = GlobalVar("g", ty.vec3(), type::AddressSpace::kPrivate, cast); @@ -2507,7 +2507,7 @@ OpReturn } TEST_F(SpvBuilderInitializerTest, Type_GlobalConst_Vec3_With_F16_Vec2) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* cast = vec3(2_h, vec2(2_h, 2_h)); GlobalConst("g", ty.vec3(), cast); @@ -2548,7 +2548,7 @@ TEST_F(SpvBuilderInitializerTest, Type_GlobalVar_Vec3_With_F32_Vec2) { } TEST_F(SpvBuilderInitializerTest, Type_GlobalVar_Vec3_With_F16_Vec2) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* cast = vec3(2_h, vec2(2_h, 2_h)); auto* g = GlobalVar("g", ty.vec3(), type::AddressSpace::kPrivate, cast); @@ -2589,7 +2589,7 @@ OpReturn } TEST_F(SpvBuilderInitializerTest, Type_GlobalConst_Vec3_With_Vec2_F16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* cast = vec3(vec2(2_h, 2_h), 2_h); GlobalConst("g", ty.vec3(), cast); @@ -2630,7 +2630,7 @@ TEST_F(SpvBuilderInitializerTest, Type_GlobalVar_Vec3_With_Vec2_F32) { } TEST_F(SpvBuilderInitializerTest, Type_GlobalVar_Vec3_With_Vec2_F16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* cast = vec3(vec2(2_h, 2_h), 2_h); auto* g = GlobalVar("g", ty.vec3(), type::AddressSpace::kPrivate, cast); @@ -2671,7 +2671,7 @@ OpReturn } TEST_F(SpvBuilderInitializerTest, Type_GlobalConst_Vec4_With_F16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* cast = vec4(2_h); GlobalConst("g", ty.vec4(), cast); @@ -2712,7 +2712,7 @@ TEST_F(SpvBuilderInitializerTest, Type_GlobalVar_Vec4_With_F32) { } TEST_F(SpvBuilderInitializerTest, Type_GlobalVar_Vec4_With_F16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* cast = vec4(2_h); auto* g = GlobalVar("g", ty.vec4(), type::AddressSpace::kPrivate, cast); @@ -2753,7 +2753,7 @@ OpReturn } TEST_F(SpvBuilderInitializerTest, Type_GlobalConst_Vec4_With_F16_F16_Vec2) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* cast = vec4(2_h, 2_h, vec2(2_h, 2_h)); GlobalConst("g", ty.vec4(), cast); @@ -2794,7 +2794,7 @@ TEST_F(SpvBuilderInitializerTest, Type_GlobalVar_Vec4_With_F32_F32_Vec2) { } TEST_F(SpvBuilderInitializerTest, Type_GlobalVar_Vec4_With_F16_F16_Vec2) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* cast = vec4(2_h, 2_h, vec2(2_h, 2_h)); auto* g = GlobalVar("g", ty.vec4(), type::AddressSpace::kPrivate, cast); @@ -2835,7 +2835,7 @@ OpReturn } TEST_F(SpvBuilderInitializerTest, Type_GlobalConst_Vec4_With_F16_Vec2_F16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* cast = vec4(2_h, vec2(2_h, 2_h), 2_h); GlobalConst("g", ty.vec4(), cast); @@ -2876,7 +2876,7 @@ TEST_F(SpvBuilderInitializerTest, Type_GlobalVar_Vec4_With_F32_Vec2_F32) { } TEST_F(SpvBuilderInitializerTest, Type_GlobalVar_Vec4_With_F16_Vec2_F16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* cast = vec4(2_h, vec2(2_h, 2_h), 2_h); auto* g = GlobalVar("g", ty.vec4(), type::AddressSpace::kPrivate, cast); @@ -2917,7 +2917,7 @@ OpReturn } TEST_F(SpvBuilderInitializerTest, Type_GlobalConst_Vec4_With_Vec2_F16_F16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* cast = vec4(vec2(2_h, 2_h), 2_h, 2_h); GlobalConst("g", ty.vec4(), cast); @@ -2958,7 +2958,7 @@ TEST_F(SpvBuilderInitializerTest, Type_GlobalVar_Vec4_With_Vec2_F32_F32) { } TEST_F(SpvBuilderInitializerTest, Type_GlobalVar_Vec4_With_Vec2_F16_F16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* cast = vec4(vec2(2_h, 2_h), 2_h, 2_h); auto* g = GlobalVar("g", ty.vec4(), type::AddressSpace::kPrivate, cast); @@ -2999,7 +2999,7 @@ OpReturn } TEST_F(SpvBuilderInitializerTest, Type_GlobalConst_Vec4_F16_With_Vec2_Vec2) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* cast = vec4(vec2(2_h, 2_h), vec2(2_h, 2_h)); GlobalConst("g", ty.vec4(), cast); @@ -3040,7 +3040,7 @@ TEST_F(SpvBuilderInitializerTest, Type_GlobalVar_Vec4_F32_With_Vec2_Vec2) { } TEST_F(SpvBuilderInitializerTest, Type_GlobalVar_Vec4_F16_With_Vec2_Vec2) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* cast = vec4(vec2(2_h, 2_h), vec2(2_h, 2_h)); auto* g = GlobalVar("g", ty.vec4(), type::AddressSpace::kPrivate, cast); @@ -3097,7 +3097,7 @@ TEST_F(SpvBuilderInitializerTest, Type_GlobalVar_Vec4_With_F32_Vec3) { } TEST_F(SpvBuilderInitializerTest, Type_GlobalVar_Vec4_With_F16_Vec3) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* cast = vec4(2_h, vec3(2_h, 2_h, 2_h)); auto* g = GlobalVar("g", ty.vec4(), type::AddressSpace::kPrivate, cast); @@ -3138,7 +3138,7 @@ OpReturn } TEST_F(SpvBuilderInitializerTest, Type_GlobalConst_Vec4_With_Vec3_F16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* cast = vec4(vec3(2_h, 2_h, 2_h), 2_h); GlobalConst("g", ty.vec4(), cast); @@ -3179,7 +3179,7 @@ TEST_F(SpvBuilderInitializerTest, Type_GlobalVar_Vec4_With_Vec3_F32) { } TEST_F(SpvBuilderInitializerTest, Type_GlobalVar_Vec4_With_Vec3_F16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* cast = vec4(vec3(2_h, 2_h, 2_h), 2_h); auto* g = GlobalVar("g", ty.vec4(), type::AddressSpace::kPrivate, cast); @@ -3215,7 +3215,7 @@ TEST_F(SpvBuilderInitializerTest, Type_Mat2x2_F32_With_Vec2_Vec2) { } TEST_F(SpvBuilderInitializerTest, Type_Mat2x2_F16_With_Vec2_Vec2) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* cast = mat2x2(vec2(2_h, 2_h), vec2(2_h, 2_h)); WrapInFunction(cast); @@ -3253,7 +3253,7 @@ TEST_F(SpvBuilderInitializerTest, Type_Mat3x2_F32_With_Vec2_Vec2_Vec2) { } TEST_F(SpvBuilderInitializerTest, Type_Mat3x2_F16_With_Vec2_Vec2_Vec2) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* cast = mat3x2(vec2(2_h, 2_h), vec2(2_h, 2_h), vec2(2_h, 2_h)); WrapInFunction(cast); @@ -3292,7 +3292,7 @@ TEST_F(SpvBuilderInitializerTest, Type_Mat4x2_F32_With_Vec2_Vec2_Vec2_Vec2) { } TEST_F(SpvBuilderInitializerTest, Type_Mat4x2_F16_With_Vec2_Vec2_Vec2_Vec2) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* cast = mat4x2(vec2(2_h, 2_h), vec2(2_h, 2_h), vec2(2_h, 2_h), vec2(2_h, 2_h)); @@ -3331,7 +3331,7 @@ TEST_F(SpvBuilderInitializerTest, Type_Mat2x3_F32_With_Vec3_Vec3) { } TEST_F(SpvBuilderInitializerTest, Type_Mat2x3_F16_With_Vec3_Vec3) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* cast = mat2x3(vec3(2_h, 2_h, 2_h), vec3(2_h, 2_h, 2_h)); WrapInFunction(cast); @@ -3370,7 +3370,7 @@ TEST_F(SpvBuilderInitializerTest, Type_Mat3x3_F32_With_Vec3_Vec3_Vec3) { } TEST_F(SpvBuilderInitializerTest, Type_Mat3x3_F16_With_Vec3_Vec3_Vec3) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* cast = mat3x3(vec3(2_h, 2_h, 2_h), vec3(2_h, 2_h, 2_h), vec3(2_h, 2_h, 2_h)); @@ -3410,7 +3410,7 @@ TEST_F(SpvBuilderInitializerTest, Type_Mat4x3_F32_With_Vec3_Vec3_Vec3_Vec3) { } TEST_F(SpvBuilderInitializerTest, Type_Mat4x3_F16_With_Vec3_Vec3_Vec3_Vec3) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* cast = mat4x3(vec3(2_h, 2_h, 2_h), vec3(2_h, 2_h, 2_h), vec3(2_h, 2_h, 2_h), vec3(2_h, 2_h, 2_h)); @@ -3449,7 +3449,7 @@ TEST_F(SpvBuilderInitializerTest, Type_Mat2x4_F32_With_Vec4_Vec4) { } TEST_F(SpvBuilderInitializerTest, Type_Mat2x4_F16_With_Vec4_Vec4) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* cast = mat2x4(vec4(2_h, 2_h, 2_h, 2_h), vec4(2_h, 2_h, 2_h, 2_h)); WrapInFunction(cast); @@ -3488,7 +3488,7 @@ TEST_F(SpvBuilderInitializerTest, Type_Mat3x4_F32_With_Vec4_Vec4_Vec4) { } TEST_F(SpvBuilderInitializerTest, Type_Mat3x4_F16_With_Vec4_Vec4_Vec4) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* cast = mat3x4(vec4(2_h, 2_h, 2_h, 2_h), vec4(2_h, 2_h, 2_h, 2_h), vec4(2_h, 2_h, 2_h, 2_h)); @@ -3528,7 +3528,7 @@ TEST_F(SpvBuilderInitializerTest, Type_Mat4x4_F32_With_Vec4_Vec4_Vec4_Vec4) { } TEST_F(SpvBuilderInitializerTest, Type_Mat4x4_F16_With_Vec4_Vec4_Vec4_Vec4) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* cast = mat4x4(vec4(2_h, 2_h, 2_h, 2_h), vec4(2_h, 2_h, 2_h, 2_h), vec4(2_h, 2_h, 2_h, 2_h), vec4(2_h, 2_h, 2_h, 2_h)); @@ -3567,7 +3567,7 @@ TEST_F(SpvBuilderInitializerTest, Type_Array_5_F32) { } TEST_F(SpvBuilderInitializerTest, Type_Array_5_F16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* cast = array(2_h, 2_h, 2_h, 2_h, 2_h); WrapInFunction(cast); @@ -3609,7 +3609,7 @@ TEST_F(SpvBuilderInitializerTest, Type_Array_2_Vec3_F32) { } TEST_F(SpvBuilderInitializerTest, Type_Array_2_Vec3_F16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* first = vec3(1_h, 2_h, 3_h); auto* second = vec3(1_h, 2_h, 3_h); @@ -3738,7 +3738,7 @@ TEST_F(SpvBuilderInitializerTest, Type_ZeroInit_F32) { } TEST_F(SpvBuilderInitializerTest, Type_ZeroInit_F16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* t = Call(); @@ -3845,7 +3845,7 @@ TEST_F(SpvBuilderInitializerTest, Type_ZeroInit_Matrix_F32) { } TEST_F(SpvBuilderInitializerTest, Type_ZeroInit_Matrix_F16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* t = mat4x2(); @@ -3952,7 +3952,7 @@ TEST_F(SpvBuilderInitializerTest, Type_Convert_F32_To_I32) { } TEST_F(SpvBuilderInitializerTest, Type_Convert_F16_To_I32) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* var = Decl(Var("x", ty.f16(), Expr(2.4_h))); auto* cast = Call("x"); @@ -4026,7 +4026,7 @@ TEST_F(SpvBuilderInitializerTest, Type_Convert_F32_To_U32) { } TEST_F(SpvBuilderInitializerTest, Type_Convert_F16_To_U32) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* var = Decl(Var("x", ty.f16(), Expr(2.4_h))); auto* cast = Call("x"); @@ -4100,7 +4100,7 @@ TEST_F(SpvBuilderInitializerTest, Type_Convert_U32_To_F32) { } TEST_F(SpvBuilderInitializerTest, Type_Convert_F16_To_F32) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* var = Decl(Var("x", ty.f16(), Expr(2_h))); auto* cast = Call("x"); @@ -4126,7 +4126,7 @@ TEST_F(SpvBuilderInitializerTest, Type_Convert_F16_To_F32) { } TEST_F(SpvBuilderInitializerTest, Type_Convert_I32_To_F16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* var = Decl(Var("x", ty.i32(), Expr(2_i))); auto* cast = Call("x"); @@ -4152,7 +4152,7 @@ TEST_F(SpvBuilderInitializerTest, Type_Convert_I32_To_F16) { } TEST_F(SpvBuilderInitializerTest, Type_Convert_U32_To_F16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* var = Decl(Var("x", ty.u32(), Expr(2_u))); auto* cast = Call("x"); @@ -4178,7 +4178,7 @@ TEST_F(SpvBuilderInitializerTest, Type_Convert_U32_To_F16) { } TEST_F(SpvBuilderInitializerTest, Type_Convert_F32_To_F16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* var = Decl(Var("x", ty.f32(), Expr(2_f))); auto* cast = Call("x"); @@ -4256,7 +4256,7 @@ TEST_F(SpvBuilderInitializerTest, Type_Convert_Vectors_F32_to_I32) { } TEST_F(SpvBuilderInitializerTest, Type_Convert_Vectors_F16_to_I32) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* var = GlobalVar("i", ty.vec3(), type::AddressSpace::kPrivate); @@ -4336,7 +4336,7 @@ TEST_F(SpvBuilderInitializerTest, Type_Convert_Vectors_F32_to_U32) { } TEST_F(SpvBuilderInitializerTest, Type_Convert_Vectors_F16_to_U32) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* var = GlobalVar("i", ty.vec3(), type::AddressSpace::kPrivate); @@ -4416,7 +4416,7 @@ TEST_F(SpvBuilderInitializerTest, Type_Convert_Vectors_U32_to_F32) { } TEST_F(SpvBuilderInitializerTest, Type_Convert_Vectors_F16_to_F32) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* var = GlobalVar("i", ty.vec3(), type::AddressSpace::kPrivate); @@ -4444,7 +4444,7 @@ TEST_F(SpvBuilderInitializerTest, Type_Convert_Vectors_F16_to_F32) { } TEST_F(SpvBuilderInitializerTest, Type_Convert_Vectors_I32_to_F16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* var = GlobalVar("i", ty.vec3(), type::AddressSpace::kPrivate); @@ -4472,7 +4472,7 @@ TEST_F(SpvBuilderInitializerTest, Type_Convert_Vectors_I32_to_F16) { } TEST_F(SpvBuilderInitializerTest, Type_Convert_Vectors_U32_to_F16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* var = GlobalVar("i", ty.vec3(), type::AddressSpace::kPrivate); @@ -4500,7 +4500,7 @@ TEST_F(SpvBuilderInitializerTest, Type_Convert_Vectors_U32_to_F16) { } TEST_F(SpvBuilderInitializerTest, Type_Convert_Vectors_F32_to_F16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* var = GlobalVar("i", ty.vec3(), type::AddressSpace::kPrivate); diff --git a/src/tint/writer/spirv/builder_literal_test.cc b/src/tint/writer/spirv/builder_literal_test.cc index 0d53237ecc..3a9ec29b54 100644 --- a/src/tint/writer/spirv/builder_literal_test.cc +++ b/src/tint/writer/spirv/builder_literal_test.cc @@ -164,7 +164,7 @@ TEST_F(BuilderTest, Literal_F32_Dedup) { } TEST_F(BuilderTest, Literal_F16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* i = create(23.245, ast::FloatLiteralExpression::Suffix::kH); WrapInFunction(i); @@ -181,7 +181,7 @@ TEST_F(BuilderTest, Literal_F16) { } TEST_F(BuilderTest, Literal_F16_Dedup) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* i1 = create(23.245, ast::FloatLiteralExpression::Suffix::kH); auto* i2 = create(23.245, ast::FloatLiteralExpression::Suffix::kH); diff --git a/src/tint/writer/spirv/builder_test.cc b/src/tint/writer/spirv/builder_test.cc index b3dce7e7b8..1c79988cd7 100644 --- a/src/tint/writer/spirv/builder_test.cc +++ b/src/tint/writer/spirv/builder_test.cc @@ -30,7 +30,7 @@ TEST_F(BuilderTest, InvalidProgram) { } TEST_F(BuilderTest, UnsupportedExtension) { - Enable(Source{{12, 34}}, ast::Extension::kUndefined); + Enable(Source{{12, 34}}, builtin::Extension::kUndefined); auto program = std::make_unique(std::move(*this)); auto result = Generate(program.get(), Options{}); diff --git a/src/tint/writer/spirv/builder_type_test.cc b/src/tint/writer/spirv/builder_type_test.cc index ad13e96675..cf3566294d 100644 --- a/src/tint/writer/spirv/builder_type_test.cc +++ b/src/tint/writer/spirv/builder_type_test.cc @@ -320,7 +320,7 @@ TEST_F(BuilderTest_Type, ReturnsGeneratedPtr) { } TEST_F(BuilderTest_Type, GenerateStruct) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* s = Structure("my_struct", utils::Vector{Member("a", ty.f32()), Member("b", ty.f16())}); @@ -341,7 +341,7 @@ OpMemberName %1 1 "b" } TEST_F(BuilderTest_Type, GenerateStruct_DecoratedMembers) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* s = Structure("S", utils::Vector{ Member("a", ty.f32()), @@ -374,7 +374,7 @@ OpMemberDecorate %1 3 Offset 18 } TEST_F(BuilderTest_Type, GenerateStruct_DecoratedMembers_Matrix) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* s = Structure("S", utils::Vector{ @@ -438,7 +438,7 @@ OpMemberDecorate %1 5 MatrixStride 8 } TEST_F(BuilderTest_Type, GenerateStruct_DecoratedMembers_ArraysOfMatrix) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto arr_mat2x2_f32 = ty.array(ty.mat2x2(), 1_u); // Singly nested array auto arr_mat2x2_f16 = ty.array(ty.mat2x2(), 1_u); // Singly nested array diff --git a/src/tint/writer/wgsl/generator_impl_cast_test.cc b/src/tint/writer/wgsl/generator_impl_cast_test.cc index b10fd8f849..66b7a2e37a 100644 --- a/src/tint/writer/wgsl/generator_impl_cast_test.cc +++ b/src/tint/writer/wgsl/generator_impl_cast_test.cc @@ -33,7 +33,7 @@ TEST_F(WgslGeneratorImplTest, EmitExpression_Cast_Scalar_F32_From_I32) { } TEST_F(WgslGeneratorImplTest, EmitExpression_Cast_Scalar_F16_From_I32) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* cast = Call(1_i); WrapInFunction(cast); @@ -57,7 +57,7 @@ TEST_F(WgslGeneratorImplTest, EmitExpression_Cast_Vector_F32_From_I32) { } TEST_F(WgslGeneratorImplTest, EmitExpression_Cast_Vector_F16_From_I32) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* cast = vec3(vec3(1_i, 2_i, 3_i)); WrapInFunction(cast); diff --git a/src/tint/writer/wgsl/generator_impl_enable_test.cc b/src/tint/writer/wgsl/generator_impl_enable_test.cc index 503a9a0022..739d893ad0 100644 --- a/src/tint/writer/wgsl/generator_impl_enable_test.cc +++ b/src/tint/writer/wgsl/generator_impl_enable_test.cc @@ -20,7 +20,7 @@ namespace { using WgslGeneratorImplTest = TestHelper; TEST_F(WgslGeneratorImplTest, Emit_Enable) { - auto* enable = Enable(ast::Extension::kF16); + auto* enable = Enable(builtin::Extension::kF16); GeneratorImpl& gen = Build(); diff --git a/src/tint/writer/wgsl/generator_impl_initializer_test.cc b/src/tint/writer/wgsl/generator_impl_initializer_test.cc index 87dddca778..0d5686ee2d 100644 --- a/src/tint/writer/wgsl/generator_impl_initializer_test.cc +++ b/src/tint/writer/wgsl/generator_impl_initializer_test.cc @@ -62,7 +62,7 @@ TEST_F(WgslGeneratorImplTest, EmitInitializer_F32) { } TEST_F(WgslGeneratorImplTest, EmitInitializer_F16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); // Use a number close to 1<<16 but whose decimal representation ends in 0. WrapInFunction(Expr(f16((1 << 15) - 8))); @@ -83,7 +83,7 @@ TEST_F(WgslGeneratorImplTest, EmitInitializer_Type_F32) { } TEST_F(WgslGeneratorImplTest, EmitInitializer_Type_F16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); WrapInFunction(Call(Expr(-1.2e-5_h))); @@ -130,7 +130,7 @@ TEST_F(WgslGeneratorImplTest, EmitInitializer_Type_Vec_F32) { } TEST_F(WgslGeneratorImplTest, EmitInitializer_Type_Vec_F16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); WrapInFunction(vec3(1_h, 2_h, 3_h)); @@ -151,7 +151,7 @@ TEST_F(WgslGeneratorImplTest, EmitInitializer_Type_Mat_F32) { } TEST_F(WgslGeneratorImplTest, EmitInitializer_Type_Mat_F16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); WrapInFunction(mat2x3(vec3(1_h, 2_h, 3_h), vec3(3_h, 4_h, 5_h))); diff --git a/src/tint/writer/wgsl/generator_impl_literal_test.cc b/src/tint/writer/wgsl/generator_impl_literal_test.cc index f96b09e1df..c660198282 100644 --- a/src/tint/writer/wgsl/generator_impl_literal_test.cc +++ b/src/tint/writer/wgsl/generator_impl_literal_test.cc @@ -155,7 +155,7 @@ INSTANTIATE_TEST_SUITE_P(Infinity, using WgslGenerator_F16LiteralTest = TestParamHelper; TEST_P(WgslGenerator_F16LiteralTest, Emit) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* v = Expr(GetParam().value); diff --git a/src/tint/writer/wgsl/generator_impl_type_test.cc b/src/tint/writer/wgsl/generator_impl_type_test.cc index 39322f23c4..4f8740c10c 100644 --- a/src/tint/writer/wgsl/generator_impl_type_test.cc +++ b/src/tint/writer/wgsl/generator_impl_type_test.cc @@ -88,7 +88,7 @@ TEST_F(WgslGeneratorImplTest, EmitType_F32) { } TEST_F(WgslGeneratorImplTest, EmitType_F16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto type = Alias("make_type_reachable", ty.f16())->type; @@ -120,7 +120,7 @@ TEST_F(WgslGeneratorImplTest, EmitType_Matrix_F32) { } TEST_F(WgslGeneratorImplTest, EmitType_Matrix_F16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto type = Alias("make_type_reachable", ty.mat2x3())->type; @@ -305,7 +305,7 @@ TEST_F(WgslGeneratorImplTest, EmitType_Vector_F32) { } TEST_F(WgslGeneratorImplTest, EmitType_Vector_F16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto type = Alias("make_type_reachable", ty.vec3())->type; diff --git a/src/tint/writer/wgsl/generator_impl_variable_decl_statement_test.cc b/src/tint/writer/wgsl/generator_impl_variable_decl_statement_test.cc index bf684201ac..f31aa652db 100644 --- a/src/tint/writer/wgsl/generator_impl_variable_decl_statement_test.cc +++ b/src/tint/writer/wgsl/generator_impl_variable_decl_statement_test.cc @@ -146,7 +146,7 @@ TEST_F(WgslGeneratorImplTest, Emit_VariableDeclStatement_Const_f32) { } TEST_F(WgslGeneratorImplTest, Emit_VariableDeclStatement_Const_f16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* C = Const("C", Expr(1_h)); Func("f", utils::Empty, ty.void_(), @@ -226,7 +226,7 @@ TEST_F(WgslGeneratorImplTest, Emit_VariableDeclStatement_Const_vec3_f32) { } TEST_F(WgslGeneratorImplTest, Emit_VariableDeclStatement_Const_vec3_f16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* C = Const("C", vec3(1_h, 2_h, 3_h)); Func("f", utils::Empty, ty.void_(), @@ -287,7 +287,7 @@ TEST_F(WgslGeneratorImplTest, Emit_VariableDeclStatement_Const_mat2x3_f32) { } TEST_F(WgslGeneratorImplTest, Emit_VariableDeclStatement_Const_mat2x3_f16) { - Enable(ast::Extension::kF16); + Enable(builtin::Extension::kF16); auto* C = Const("C", mat2x3(1_h, 2_h, 3_h, 4_h, 5_h, 6_h)); Func("f", utils::Empty, ty.void_(),