mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-08 13:14:56 +00:00
Use a context object instead of a singleton
This Cl replaces the TypeManager singleton with a context object. Bug: tint:29 Change-Id: Ia662709db1b562c34955633977ce4363f28f238e Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/17780 Reviewed-by: David Neto <dneto@google.com>
This commit is contained in:
committed by
dan sinclair
parent
0984214d8b
commit
9981b63fa4
@@ -17,8 +17,10 @@
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
#include "src/context.h"
|
||||
#include "src/reader/reader.h"
|
||||
#include "src/type_determiner.h"
|
||||
#include "src/type_manager.h"
|
||||
#include "src/validator.h"
|
||||
#include "src/writer/writer.h"
|
||||
|
||||
@@ -250,6 +252,11 @@ int main(int argc, const char** argv) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
tint::TypeManager type_manager;
|
||||
|
||||
tint::Context ctx;
|
||||
ctx.type_mgr = &type_manager;
|
||||
|
||||
std::unique_ptr<tint::reader::Reader> reader;
|
||||
#if TINT_BUILD_WGSL_READER
|
||||
if (options.input_filename.size() > 5 &&
|
||||
@@ -260,7 +267,7 @@ int main(int argc, const char** argv) {
|
||||
return 1;
|
||||
}
|
||||
reader = std::make_unique<tint::reader::wgsl::Parser>(
|
||||
std::string(data.begin(), data.end()));
|
||||
ctx, std::string(data.begin(), data.end()));
|
||||
}
|
||||
#endif // TINT_BUILD_WGSL_READER
|
||||
|
||||
@@ -272,7 +279,7 @@ int main(int argc, const char** argv) {
|
||||
if (!ReadFile<uint32_t>(options.input_filename, &data)) {
|
||||
return 1;
|
||||
}
|
||||
reader = std::make_unique<tint::reader::spirv::Parser>(data);
|
||||
reader = std::make_unique<tint::reader::spirv::Parser>(ctx, data);
|
||||
}
|
||||
#endif // TINT_BUILD_SPV_READER
|
||||
|
||||
|
||||
Reference in New Issue
Block a user