Remove tint context.
This CL removes all references to the tint context object which is going
away.
Bug: None
Change-Id: I3b74a8a65b89ba2236cfa71e7551756c8624e2a4
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/34725
Auto-Submit: dan sinclair <dsinclair@chromium.org>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
diff --git a/src/dawn_native/ShaderModule.cpp b/src/dawn_native/ShaderModule.cpp
index c7f5472..cba7da7 100644
--- a/src/dawn_native/ShaderModule.cpp
+++ b/src/dawn_native/ShaderModule.cpp
@@ -177,9 +177,8 @@
std::ostringstream errorStream;
errorStream << "Tint WGSL failure:" << std::endl;
- tint::Context context;
tint::Source::File file("", source);
- tint::reader::wgsl::Parser parser(&context, &file);
+ tint::reader::wgsl::Parser parser(&file);
if (!parser.Parse()) {
errorStream << "Parser: " << parser.error() << std::endl;
@@ -192,7 +191,7 @@
return DAWN_VALIDATION_ERROR(errorStream.str().c_str());
}
- tint::TypeDeterminer type_determiner(&context, &module);
+ tint::TypeDeterminer type_determiner(&module);
if (!type_determiner.Determine()) {
errorStream << "Type Determination: " << type_determiner.error();
return DAWN_VALIDATION_ERROR(errorStream.str().c_str());
@@ -211,9 +210,8 @@
std::ostringstream errorStream;
errorStream << "Tint WGSL->SPIR-V failure:" << std::endl;
- tint::Context context;
tint::Source::File file("", source);
- tint::reader::wgsl::Parser parser(&context, &file);
+ tint::reader::wgsl::Parser parser(&file);
// TODO: This is a duplicate parse with ValidateWGSL, need to store
// state between calls to avoid this.
@@ -228,7 +226,7 @@
return DAWN_VALIDATION_ERROR(errorStream.str().c_str());
}
- tint::TypeDeterminer type_determiner(&context, &module);
+ tint::TypeDeterminer type_determiner(&module);
if (!type_determiner.Determine()) {
errorStream << "Type Determination: " << type_determiner.error();
return DAWN_VALIDATION_ERROR(errorStream.str().c_str());
@@ -255,9 +253,8 @@
std::ostringstream errorStream;
errorStream << "Tint WGSL->SPIR-V failure:" << std::endl;
- tint::Context context;
tint::Source::File file("", source);
- tint::reader::wgsl::Parser parser(&context, &file);
+ tint::reader::wgsl::Parser parser(&file);
// TODO: This is a duplicate parse with ValidateWGSL, need to store
// state between calls to avoid this.
@@ -272,10 +269,9 @@
return DAWN_VALIDATION_ERROR(errorStream.str().c_str());
}
- tint::transform::Manager transformManager(&context, &module);
+ tint::transform::Manager transformManager;
{
- auto transform =
- std::make_unique<tint::transform::VertexPullingTransform>(&context, &module);
+ auto transform = std::make_unique<tint::transform::VertexPullingTransform>(&module);
auto state = std::make_unique<tint::transform::VertexStateDescriptor>();
for (uint32_t i = 0; i < vertexState.vertexBufferCount; ++i) {
auto& vertexBuffer = vertexState.vertexBuffers[i];
@@ -301,12 +297,12 @@
transformManager.append(std::move(transform));
}
- if (!transformManager.Run()) {
+ if (!transformManager.Run(&module)) {
errorStream << "Vertex pulling transform: " << transformManager.error();
return DAWN_VALIDATION_ERROR(errorStream.str().c_str());
}
- tint::TypeDeterminer type_determiner(&context, &module);
+ tint::TypeDeterminer type_determiner(&module);
if (!type_determiner.Determine()) {
errorStream << "Type Determination: " << type_determiner.error();
return DAWN_VALIDATION_ERROR(errorStream.str().c_str());
@@ -752,8 +748,7 @@
std::ostringstream errorStream;
errorStream << "Tint Reflection failure:" << std::endl;
- tint::Context context;
- tint::reader::spirv::Parser parser(&context, spirv);
+ tint::reader::spirv::Parser parser(spirv);
if (!parser.Parse()) {
errorStream << "Parser: " << parser.error() << std::endl;
@@ -766,7 +761,7 @@
return DAWN_VALIDATION_ERROR(errorStream.str().c_str());
}
- tint::TypeDeterminer typeDeterminer(&context, &module);
+ tint::TypeDeterminer typeDeterminer(&module);
if (!typeDeterminer.Determine()) {
errorStream << "Type Determination: " << typeDeterminer.error();
return DAWN_VALIDATION_ERROR(errorStream.str().c_str());
@@ -778,7 +773,7 @@
return DAWN_VALIDATION_ERROR(errorStream.str().c_str());
}
- tint::inspector::Inspector inspector(&context, module);
+ tint::inspector::Inspector inspector(module);
auto entryPoints = inspector.GetEntryPoints();
if (inspector.has_error()) {
errorStream << "Inspector: " << inspector.error() << std::endl;
diff --git a/src/dawn_native/d3d12/ShaderModuleD3D12.cpp b/src/dawn_native/d3d12/ShaderModuleD3D12.cpp
index f437626..cd62651 100644
--- a/src/dawn_native/d3d12/ShaderModuleD3D12.cpp
+++ b/src/dawn_native/d3d12/ShaderModuleD3D12.cpp
@@ -196,8 +196,7 @@
errorStream << "Tint HLSL failure:" << std::endl;
// TODO: Remove redundant SPIRV step between WGSL and HLSL.
- tint::Context context;
- tint::reader::spirv::Parser parser(&context, GetSpirv());
+ tint::reader::spirv::Parser parser(GetSpirv());
if (!parser.Parse()) {
errorStream << "Parser: " << parser.error() << std::endl;
@@ -210,7 +209,7 @@
return DAWN_VALIDATION_ERROR(errorStream.str().c_str());
}
- tint::TypeDeterminer typeDeterminer(&context, &module);
+ tint::TypeDeterminer typeDeterminer(&module);
if (!typeDeterminer.Determine()) {
errorStream << "Type Determination: " << typeDeterminer.error();
return DAWN_VALIDATION_ERROR(errorStream.str().c_str());
@@ -222,10 +221,10 @@
return DAWN_VALIDATION_ERROR(errorStream.str().c_str());
}
- tint::transform::Manager transformManager(&context, &module);
+ tint::transform::Manager transformManager;
transformManager.append(
- std::make_unique<tint::transform::BoundArrayAccessorsTransform>(&context, &module));
- if (!transformManager.Run()) {
+ std::make_unique<tint::transform::BoundArrayAccessorsTransform>(&module));
+ if (!transformManager.Run(&module)) {
errorStream << "Bound Array Accessors Transform: " << transformManager.error()
<< std::endl;
return DAWN_VALIDATION_ERROR(errorStream.str().c_str());
diff --git a/src/fuzzers/DawnSPIRVCrossFuzzer.cpp b/src/fuzzers/DawnSPIRVCrossFuzzer.cpp
index 90c4b2b..1bac958 100644
--- a/src/fuzzers/DawnSPIRVCrossFuzzer.cpp
+++ b/src/fuzzers/DawnSPIRVCrossFuzzer.cpp
@@ -73,8 +73,7 @@
// Using Tint SPIRV->SPIRV to normalize inputs if supported.
#ifdef DAWN_ENABLE_WGSL
- tint::Context context;
- tint::reader::spirv::Parser parser(&context, input);
+ tint::reader::spirv::Parser parser(input);
if (!parser.Parse()) {
return 0;
@@ -85,7 +84,7 @@
return 0;
}
- tint::TypeDeterminer type_determiner(&context, &module);
+ tint::TypeDeterminer type_determiner(&module);
if (!type_determiner.Determine()) {
return 0;
}