Place the namer into the context object.

This CL moves the namer into the context object and makes it a parameter
to the various generators. The old constructor is maintained until we've
updated downstream repos.

Bug: tint:273
Change-Id: I49b2519c4250be21fb73374b16e7c702b727078f
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/32580
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Reviewed-by: David Neto <dneto@google.com>
This commit is contained in:
dan sinclair
2020-11-13 18:13:24 +00:00
committed by Commit Bot service account
parent 8ca4561b25
commit 196e097730
144 changed files with 1636 additions and 2730 deletions

View File

@@ -418,7 +418,7 @@ int main(int argc, const char** argv) {
options.format = Format::kSpvAsm;
}
tint::Context ctx;
tint::Context ctx(std::make_unique<tint::NoopNamer>());
std::unique_ptr<tint::reader::Reader> reader;
std::unique_ptr<tint::Source::File> source_file;
@@ -532,25 +532,29 @@ int main(int argc, const char** argv) {
#if TINT_BUILD_SPV_WRITER
if (options.format == Format::kSpirv || options.format == Format::kSpvAsm) {
writer = std::make_unique<tint::writer::spirv::Generator>(std::move(mod));
writer =
std::make_unique<tint::writer::spirv::Generator>(&ctx, std::move(mod));
}
#endif // TINT_BUILD_SPV_WRITER
#if TINT_BUILD_WGSL_WRITER
if (options.format == Format::kWgsl) {
writer = std::make_unique<tint::writer::wgsl::Generator>(std::move(mod));
writer =
std::make_unique<tint::writer::wgsl::Generator>(&ctx, std::move(mod));
}
#endif // TINT_BUILD_WGSL_WRITER
#if TINT_BUILD_MSL_WRITER
if (options.format == Format::kMsl) {
writer = std::make_unique<tint::writer::msl::Generator>(std::move(mod));
writer =
std::make_unique<tint::writer::msl::Generator>(&ctx, std::move(mod));
}
#endif // TINT_BUILD_MSL_WRITER
#if TINT_BUILD_HLSL_WRITER
if (options.format == Format::kHlsl) {
writer = std::make_unique<tint::writer::hlsl::Generator>(std::move(mod));
writer =
std::make_unique<tint::writer::hlsl::Generator>(&ctx, std::move(mod));
}
#endif // TINT_BUILD_HLSL_WRITER