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>
This commit is contained in:
dan sinclair 2020-12-03 15:46:17 +00:00 committed by Commit Bot service account
parent 5d8a071433
commit 0d1c17363d
3 changed files with 19 additions and 26 deletions

View File

@ -177,9 +177,8 @@ namespace dawn_native {
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 @@ namespace dawn_native {
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 @@ namespace dawn_native {
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 @@ namespace dawn_native {
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 @@ namespace dawn_native {
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 @@ namespace dawn_native {
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 @@ namespace dawn_native {
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 @@ namespace dawn_native {
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 @@ namespace dawn_native {
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 @@ namespace dawn_native {
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;

View File

@ -196,8 +196,7 @@ namespace dawn_native { namespace d3d12 {
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 @@ namespace dawn_native { namespace d3d12 {
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 @@ namespace dawn_native { namespace d3d12 {
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());

View File

@ -73,8 +73,7 @@ namespace DawnSPIRVCrossFuzzer {
// 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 @@ namespace DawnSPIRVCrossFuzzer {
return 0;
}
tint::TypeDeterminer type_determiner(&context, &module);
tint::TypeDeterminer type_determiner(&module);
if (!type_determiner.Determine()) {
return 0;
}