diff --git a/src/tint/lang/wgsl/ast/transform/renamer.cc b/src/tint/lang/wgsl/ast/transform/renamer.cc index 414721c773..6b977362fe 100644 --- a/src/tint/lang/wgsl/ast/transform/renamer.cc +++ b/src/tint/lang/wgsl/ast/transform/renamer.cc @@ -43,7 +43,6 @@ #include "src/tint/utils/text/unicode.h" TINT_INSTANTIATE_TYPEINFO(tint::ast::transform::Renamer); -TINT_INSTANTIATE_TYPEINFO(tint::ast::transform::Renamer::Data); TINT_INSTANTIATE_TYPEINFO(tint::ast::transform::Renamer::Config); namespace tint::ast::transform { @@ -1262,12 +1261,6 @@ const char* const kReservedKeywordsMSL[] = { } // namespace -Renamer::Data::Data(Remappings&& r) : remappings(std::move(r)) {} - -Renamer::Data::Data(const Data&) = default; - -Renamer::Data::~Data() = default; - Renamer::Config::Config() = default; Renamer::Config::Config(Target t) : target(t) {} @@ -1282,9 +1275,7 @@ Renamer::Config::~Config() = default; Renamer::Renamer() = default; Renamer::~Renamer() = default; -Transform::ApplyResult Renamer::Apply(const Program& src, - const DataMap& inputs, - DataMap& outputs) const { +Transform::ApplyResult Renamer::Apply(const Program& src, const DataMap& inputs, DataMap&) const { Hashset global_decls; for (auto* decl : src.AST().TypeDecls()) { global_decls.Add(decl->name->symbol); @@ -1430,12 +1421,6 @@ Transform::ApplyResult Renamer::Apply(const Program& src, ctx.Clone(); - Remappings out; - for (auto& it : remappings) { - out[it.key->Name()] = it.value.Name(); - } - outputs.Add(std::move(out)); - return resolver::Resolve(b); } diff --git a/src/tint/lang/wgsl/ast/transform/renamer.h b/src/tint/lang/wgsl/ast/transform/renamer.h index bafd3ecd3d..8c1ff262f6 100644 --- a/src/tint/lang/wgsl/ast/transform/renamer.h +++ b/src/tint/lang/wgsl/ast/transform/renamer.h @@ -42,23 +42,6 @@ class Renamer final : public Castable { /// Remappings is a map of old symbol name to new symbol name using Remappings = std::unordered_map; - /// Data is outputted by the Renamer transform. - /// Data holds information about shader usage and constant buffer offsets. - struct Data final : public Castable { - /// Constructor - /// @param remappings the symbol remappings - explicit Data(Remappings&& remappings); - - /// Copy constructor - Data(const Data&); - - /// Destructor - ~Data() override; - - /// A map of old symbol name to new symbol name - const Remappings remappings; - }; - /// Target is an enumerator of rename targets that can be used enum class Target { /// Rename every symbol. diff --git a/src/tint/lang/wgsl/ast/transform/renamer_test.cc b/src/tint/lang/wgsl/ast/transform/renamer_test.cc index 7c3f13d276..38c58ab7bf 100644 --- a/src/tint/lang/wgsl/ast/transform/renamer_test.cc +++ b/src/tint/lang/wgsl/ast/transform/renamer_test.cc @@ -56,10 +56,6 @@ TEST_F(RenamerTest, EmptyModule) { auto got = Run(src); EXPECT_EQ(expect, str(got)); - - auto* data = got.data.Get(); - - ASSERT_EQ(data->remappings.size(), 0u); } TEST_F(RenamerTest, BasicModuleVertexIndex) { @@ -91,16 +87,6 @@ fn tint_symbol_2(@builtin(vertex_index) tint_symbol_1 : u32) -> @builtin(positio auto got = Run(src); EXPECT_EQ(expect, str(got)); - - auto* data = got.data.Get(); - - ASSERT_NE(data, nullptr); - Renamer::Remappings expected_remappings = { - {"vert_idx", "tint_symbol_1"}, - {"test", "tint_symbol"}, - {"entry", "tint_symbol_2"}, - }; - EXPECT_THAT(data->remappings, ContainerEq(expected_remappings)); } TEST_F(RenamerTest, RequestedNamesWithRenameAll) { @@ -158,16 +144,6 @@ fn tint_symbol_2(@builtin(vertex_index) tint_symbol_3 : u32) -> tint_symbol { auto got = Run(src, inputs); EXPECT_EQ(expect, str(got)); - - auto* data = got.data.Get(); - - ASSERT_NE(data, nullptr); - Renamer::Remappings expected_remappings = { - {"pos", "tint_symbol_1"}, {"vert_idx", "tint_symbol_3"}, {"ShaderIO", "tint_symbol"}, - {"shaderIO", "tint_symbol_4"}, {"main", "tint_symbol_2"}, {"var1", "user_var1"}, - {"var3", "user_var3"}, - }; - EXPECT_THAT(data->remappings, ContainerEq(expected_remappings)); } using RenamerTestRequestedNamesWithoutRenameAll = TransformTestWithParam; @@ -227,15 +203,6 @@ fn entry_point(@builtin(vertex_index) vert_idx : u32) -> ShaderIO { auto got = Run(src, inputs); EXPECT_EQ(expect, str(got)); - - auto* data = got.data.Get(); - - ASSERT_NE(data, nullptr); - Renamer::Remappings expected_remappings = { - {"var1", "user_var1"}, - {"var3", "user_var3"}, - }; - EXPECT_THAT(data->remappings, ContainerEq(expected_remappings)); } INSTANTIATE_TEST_SUITE_P(RenamerTestRequestedNamesWithoutRenameAll, @@ -270,15 +237,6 @@ fn tint_symbol() -> @builtin(position) vec4 { auto got = Run(src); EXPECT_EQ(expect, str(got)); - - auto* data = got.data.Get(); - - ASSERT_NE(data, nullptr); - Renamer::Remappings expected_remappings = { - {"entry", "tint_symbol"}, {"v", "tint_symbol_1"}, {"rgba", "tint_symbol_2"}, - {"xyzw", "tint_symbol_3"}, {"z", "tint_symbol_4"}, - }; - EXPECT_THAT(data->remappings, ContainerEq(expected_remappings)); } TEST_F(RenamerTest, PreserveSwizzles_ThroughMaterialize) { @@ -296,15 +254,6 @@ const tint_symbol_1 = (tint_symbol.x * 2u); auto got = Run(src); EXPECT_EQ(expect, str(got)); - - auto* data = got.data.Get(); - - ASSERT_NE(data, nullptr); - Renamer::Remappings expected_remappings = { - {"v", "tint_symbol"}, - {"x", "tint_symbol_1"}, - }; - EXPECT_THAT(data->remappings, ContainerEq(expected_remappings)); } TEST_F(RenamerTest, PreserveBuiltins) { @@ -327,15 +276,6 @@ fn tint_symbol() -> @builtin(position) vec4 { auto got = Run(src); EXPECT_EQ(expect, str(got)); - - auto* data = got.data.Get(); - - ASSERT_NE(data, nullptr); - Renamer::Remappings expected_remappings = { - {"entry", "tint_symbol"}, - {"blah", "tint_symbol_1"}, - }; - EXPECT_THAT(data->remappings, ContainerEq(expected_remappings)); } TEST_F(RenamerTest, PreserveBuiltinTypes) { @@ -362,15 +302,6 @@ fn tint_symbol() { auto got = Run(src); EXPECT_EQ(expect, str(got)); - - auto* data = got.data.Get(); - - ASSERT_NE(data, nullptr); - Renamer::Remappings expected_remappings = { - {"entry", "tint_symbol"}, {"a", "tint_symbol_1"}, {"b", "tint_symbol_2"}, - {"c", "tint_symbol_3"}, {"d", "tint_symbol_4"}, - }; - EXPECT_THAT(data->remappings, ContainerEq(expected_remappings)); } TEST_F(RenamerTest, PreserveBuiltinTypes_ViaPointerDot) { @@ -406,16 +337,6 @@ fn tint_symbol() { auto got = Run(src); EXPECT_EQ(expect, str(got)); - - auto* data = got.data.Get(); - - ASSERT_NE(data, nullptr); - Renamer::Remappings expected_remappings = { - {"entry", "tint_symbol"}, {"m", "tint_symbol_1"}, {"p1", "tint_symbol_2"}, - {"f", "tint_symbol_3"}, {"p2", "tint_symbol_4"}, {"a", "tint_symbol_5"}, - {"b", "tint_symbol_6"}, {"c", "tint_symbol_7"}, {"d", "tint_symbol_8"}, - }; - EXPECT_THAT(data->remappings, ContainerEq(expected_remappings)); } TEST_F(RenamerTest, PreserveCoreDiagnosticRuleName) { @@ -449,15 +370,6 @@ fn tint_symbol(@location(0) tint_symbol_1 : f32) -> @location(0) f32 { auto got = Run(src); EXPECT_EQ(expect, str(got)); - - auto* data = got.data.Get(); - - ASSERT_NE(data, nullptr); - Renamer::Remappings expected_remappings = { - {"entry", "tint_symbol"}, - {"value", "tint_symbol_1"}, - }; - EXPECT_THAT(data->remappings, ContainerEq(expected_remappings)); } TEST_F(RenamerTest, AttemptSymbolCollision) { @@ -484,17 +396,6 @@ fn tint_symbol() -> @builtin(position) vec4 { auto got = Run(src); EXPECT_EQ(expect, str(got)); - - auto* data = got.data.Get(); - - ASSERT_NE(data, nullptr); - Renamer::Remappings expected_remappings = { - {"entry", "tint_symbol"}, - {"tint_symbol", "tint_symbol_1"}, - {"tint_symbol_2", "tint_symbol_2"}, - {"tint_symbol_4", "tint_symbol_3"}, - }; - EXPECT_THAT(data->remappings, ContainerEq(expected_remappings)); } TEST_F(RenamerTest, PreserveTexelFormatAndAccess) {