mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-08 13:14:56 +00:00
Add type determiner infrastructure.
This CL adds the Context object, variable ScopeStack and a Function map into the type determiner. The sample app is also updated to verify the module produced before passing to the type determiner. Bug: tint:5 Change-Id: Ib4af4e4305ee8a306f48e1bd328eaf3ad006fd9a Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/18823 Reviewed-by: David Neto <dneto@google.com>
This commit is contained in:
committed by
dan sinclair
parent
a32315cb73
commit
fa9dbf0dda
@@ -292,22 +292,27 @@ int main(int argc, const char** argv) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
auto module = reader->module();
|
||||
auto mod = reader->module();
|
||||
if (options.dump_ast) {
|
||||
std::cout << std::endl << module.to_str() << std::endl;
|
||||
std::cout << std::endl << mod.to_str() << std::endl;
|
||||
}
|
||||
if (options.parse_only) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
tint::TypeDeterminer td;
|
||||
if (!td.Determine(&module)) {
|
||||
if (!mod.IsValid()) {
|
||||
std::cerr << "Invalid module generated..." << std::endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
tint::TypeDeterminer td(&ctx);
|
||||
if (!td.Determine(&mod)) {
|
||||
std::cerr << td.error() << std::endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
tint::Validator v;
|
||||
if (!v.Validate(module)) {
|
||||
if (!v.Validate(mod)) {
|
||||
std::cerr << v.error() << std::endl;
|
||||
return 1;
|
||||
}
|
||||
@@ -316,14 +321,13 @@ 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(module));
|
||||
writer = std::make_unique<tint::writer::spirv::Generator>(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(module));
|
||||
writer = std::make_unique<tint::writer::wgsl::Generator>(std::move(mod));
|
||||
}
|
||||
#endif // TINT_BUILD_WGSL_WRITER
|
||||
|
||||
|
||||
Reference in New Issue
Block a user