From e0feccacafb0643fbaef8f807a9b76f1b9a97828 Mon Sep 17 00:00:00 2001 From: Ben Clayton Date: Tue, 26 Jan 2021 12:24:48 +0000 Subject: [PATCH] Migrate from tint::ast::Module to tint::Program Depends on: https://dawn-review.googlesource.com/c/tint/+/38556 Bug: tint:390 Change-Id: I12104d80370ddc1a3277770ca051cbd0992b758e Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/38522 Reviewed-by: Corentin Wallez Reviewed-by: dan sinclair Commit-Queue: Ben Clayton --- src/dawn_native/ShaderModule.cpp | 138 ++++++++++---------- src/dawn_native/ShaderModule.h | 16 +-- src/dawn_native/d3d12/ShaderModuleD3D12.cpp | 10 +- src/dawn_native/d3d12/ShaderModuleD3D12.h | 2 +- src/dawn_native/metal/ShaderModuleMTL.h | 2 +- src/dawn_native/metal/ShaderModuleMTL.mm | 14 +- src/dawn_native/opengl/ShaderModuleGL.cpp | 6 +- src/dawn_native/vulkan/ShaderModuleVk.cpp | 6 +- src/fuzzers/DawnSPIRVCrossFuzzer.cpp | 8 +- 9 files changed, 102 insertions(+), 100 deletions(-) diff --git a/src/dawn_native/ShaderModule.cpp b/src/dawn_native/ShaderModule.cpp index 3f4e4db69b..141a219fd7 100644 --- a/src/dawn_native/ShaderModule.cpp +++ b/src/dawn_native/ShaderModule.cpp @@ -179,7 +179,7 @@ namespace dawn_native { } #ifdef DAWN_ENABLE_WGSL - ResultOrError ParseWGSL(const tint::Source::File* file) { + ResultOrError ParseWGSL(const tint::Source::File* file) { std::ostringstream errorStream; errorStream << "Tint WGSL reader failure:" << std::endl; @@ -192,22 +192,23 @@ namespace dawn_native { return DAWN_VALIDATION_ERROR(errorStream.str().c_str()); } - tint::ast::Module module = parser.module(); - if (!module.IsValid()) { - errorStream << "Invalid module generated..." << std::endl; + tint::Program program = parser.program(); + if (!program.IsValid()) { + errorStream << "Invalid program generated..." << std::endl; return DAWN_VALIDATION_ERROR(errorStream.str().c_str()); } - tint::TypeDeterminer typeDeterminer(&module); - if (!typeDeterminer.Determine()) { - errorStream << "Type Determination: " << typeDeterminer.error(); + tint::diag::List diagnostics = tint::TypeDeterminer::Run(&program); + if (diagnostics.contains_errors()) { + std::string err = tint::diag::Formatter{}.format(diagnostics); + errorStream << "Type Determination: " << err; return DAWN_VALIDATION_ERROR(errorStream.str().c_str()); } - return std::move(module); + return std::move(program); } - ResultOrError ParseSPIRV(const std::vector& spirv) { + ResultOrError ParseSPIRV(const std::vector& spirv) { std::ostringstream errorStream; errorStream << "Tint SPIRV reader failure:" << std::endl; @@ -217,27 +218,28 @@ namespace dawn_native { return DAWN_VALIDATION_ERROR(errorStream.str().c_str()); } - tint::ast::Module module = parser.module(); - if (!module.IsValid()) { - errorStream << "Invalid module generated..." << std::endl; + tint::Program program = parser.program(); + if (!program.IsValid()) { + errorStream << "Invalid program generated..." << std::endl; return DAWN_VALIDATION_ERROR(errorStream.str().c_str()); } - tint::TypeDeterminer typeDeterminer(&module); - if (!typeDeterminer.Determine()) { - errorStream << "Type Determination: " << typeDeterminer.error(); + tint::diag::List diagnostics = tint::TypeDeterminer::Run(&program); + if (diagnostics.contains_errors()) { + std::string err = tint::diag::Formatter{}.format(diagnostics); + errorStream << "Type Determination: " << err; return DAWN_VALIDATION_ERROR(errorStream.str().c_str()); } - return std::move(module); + return std::move(program); } - MaybeError ValidateModule(tint::ast::Module* module) { + MaybeError ValidateModule(tint::Program* program) { std::ostringstream errorStream; - errorStream << "Tint module validation" << std::endl; + errorStream << "Tint program validation" << std::endl; tint::Validator validator; - if (!validator.Validate(module)) { + if (!validator.Validate(program)) { auto err = tint::diag::Formatter{}.format(validator.diagnostics()); errorStream << "Validation: " << err << std::endl; return DAWN_VALIDATION_ERROR(errorStream.str().c_str()); @@ -246,11 +248,11 @@ namespace dawn_native { return {}; } - ResultOrError> ModuleToSPIRV(tint::ast::Module module) { + ResultOrError> ModuleToSPIRV(tint::Program program) { std::ostringstream errorStream; errorStream << "Tint SPIR-V writer failure:" << std::endl; - tint::writer::spirv::Generator generator(std::move(module)); + tint::writer::spirv::Generator generator(&program); if (!generator.Generate()) { errorStream << "Generator: " << generator.error() << std::endl; return DAWN_VALIDATION_ERROR(errorStream.str().c_str()); @@ -691,14 +693,14 @@ namespace dawn_native { // PopulateMetadataUsingSPIRVCross will be removed. ResultOrError ReflectShaderUsingTint( DeviceBase*, - const tint::ast::Module& module) { - ASSERT(module.IsValid()); + const tint::Program& program) { + ASSERT(program.IsValid()); EntryPointMetadataTable result; std::ostringstream errorStream; errorStream << "Tint Reflection failure:" << std::endl; - tint::inspector::Inspector inspector(module); + tint::inspector::Inspector inspector(&program); auto entryPoints = inspector.GetEntryPoints(); if (inspector.has_error()) { errorStream << "Inspector: " << inspector.error() << std::endl; @@ -857,12 +859,12 @@ namespace dawn_native { std::vector spirv(spirvDesc->code, spirvDesc->code + spirvDesc->codeSize); if (device->IsToggleEnabled(Toggle::UseTintGenerator)) { #ifdef DAWN_ENABLE_WGSL - tint::ast::Module module; - DAWN_TRY_ASSIGN(module, ParseSPIRV(spirv)); + tint::Program program; + DAWN_TRY_ASSIGN(program, ParseSPIRV(spirv)); if (device->IsValidationEnabled()) { - DAWN_TRY(ValidateModule(&module)); + DAWN_TRY(ValidateModule(&program)); } - parseResult.tintModule = std::make_unique(std::move(module)); + parseResult.tintProgram = std::make_unique(std::move(program)); #else return DAWN_VALIDATION_ERROR("Using Tint is not enabled in this build."); #endif // DAWN_ENABLE_WGSL @@ -883,37 +885,37 @@ namespace dawn_native { tint::Source::File file("", wgslDesc->source); if (device->IsToggleEnabled(Toggle::UseTintGenerator)) { - tint::ast::Module module; - DAWN_TRY_ASSIGN(module, ParseWGSL(&file)); + tint::Program program; + DAWN_TRY_ASSIGN(program, ParseWGSL(&file)); if (device->IsValidationEnabled()) { - DAWN_TRY(ValidateModule(&module)); + DAWN_TRY(ValidateModule(&program)); } - parseResult.tintModule = std::make_unique(std::move(module)); + parseResult.tintProgram = std::make_unique(std::move(program)); } else { - tint::ast::Module module; - DAWN_TRY_ASSIGN(module, ParseWGSL(&file)); + tint::Program program; + DAWN_TRY_ASSIGN(program, ParseWGSL(&file)); { tint::transform::Manager transformManager; transformManager.append( std::make_unique()); - DAWN_TRY_ASSIGN(module, RunTransforms(&transformManager, &module)); + DAWN_TRY_ASSIGN(program, RunTransforms(&transformManager, &program)); } if (device->IsValidationEnabled()) { - DAWN_TRY(ValidateModule(&module)); + DAWN_TRY(ValidateModule(&program)); } - // Keep the Tint module around. The Metal backend will use it for vertex + // Keep the Tint program around. The Metal backend will use it for vertex // pulling since we can't go WGSL->point size transform->spirv->Tint. // Tint's spirv reader doesn't understand point size. crbug.com/tint/412. - auto tintModule = std::make_unique(module.Clone()); + auto tintProgram = std::make_unique(program.Clone()); std::vector spirv; - DAWN_TRY_ASSIGN(spirv, ModuleToSPIRV(std::move(module))); + DAWN_TRY_ASSIGN(spirv, ModuleToSPIRV(std::move(program))); DAWN_TRY(ValidateSpirv(spirv.data(), spirv.size())); - parseResult.tintModule = std::move(tintModule); + parseResult.tintProgram = std::move(tintProgram); parseResult.spirv = std::move(spirv); } break; @@ -940,19 +942,19 @@ namespace dawn_native { } #ifdef DAWN_ENABLE_WGSL - ResultOrError RunTransforms(tint::transform::Manager* manager, - tint::ast::Module* module) { - tint::transform::Transform::Output output = manager->Run(module); + ResultOrError RunTransforms(tint::transform::Manager* manager, + tint::Program* program) { + tint::transform::Transform::Output output = manager->Run(program); if (output.diagnostics.contains_errors()) { std::string err = "Tint transform failure: " + tint::diag::Formatter{}.format(output.diagnostics); return DAWN_VALIDATION_ERROR(err.c_str()); } - if (!output.module.IsValid()) { - return DAWN_VALIDATION_ERROR("Tint transform did not produce valid module."); + if (!output.program.IsValid()) { + return DAWN_VALIDATION_ERROR("Tint transform did not produce valid program."); } - return std::move(output.module); + return std::move(output.program); } std::unique_ptr MakeVertexPullingTransform( @@ -1080,14 +1082,14 @@ namespace dawn_native { const VertexStateDescriptor& vertexState, const std::string& entryPoint, BindGroupIndex pullingBufferBindingSet) const { - tint::ast::Module module; - DAWN_TRY_ASSIGN(module, ParseSPIRV(spirv)); + tint::Program program; + DAWN_TRY_ASSIGN(program, ParseSPIRV(spirv)); - return GeneratePullingSpirv(&module, vertexState, entryPoint, pullingBufferBindingSet); + return GeneratePullingSpirv(&program, vertexState, entryPoint, pullingBufferBindingSet); } ResultOrError> ShaderModuleBase::GeneratePullingSpirv( - tint::ast::Module* moduleIn, + tint::Program* programIn, const VertexStateDescriptor& vertexState, const std::string& entryPoint, BindGroupIndex pullingBufferBindingSet) const { @@ -1104,10 +1106,10 @@ namespace dawn_native { // transformManager.append(std::make_unique()); } - tint::ast::Module module; - DAWN_TRY_ASSIGN(module, RunTransforms(&transformManager, moduleIn)); + tint::Program program; + DAWN_TRY_ASSIGN(program, RunTransforms(&transformManager, programIn)); - tint::writer::spirv::Generator generator(std::move(module)); + tint::writer::spirv::Generator generator(&program); if (!generator.Generate()) { errorStream << "Generator: " << generator.error() << std::endl; return DAWN_VALIDATION_ERROR(errorStream.str().c_str()); @@ -1124,7 +1126,7 @@ namespace dawn_native { MaybeError ShaderModuleBase::InitializeBase(ShaderModuleParseResult* parseResult) { #ifdef DAWN_ENABLE_WGSL - tint::ast::Module* module = parseResult->tintModule.get(); + tint::Program* program = parseResult->tintProgram.get(); #endif mSpirv = std::move(parseResult->spirv); @@ -1142,13 +1144,15 @@ namespace dawn_native { std::vector localSpirv; if (GetDevice()->IsToggleEnabled(Toggle::UseTintGenerator)) { #ifdef DAWN_ENABLE_WGSL - ASSERT(module != nullptr); - tint::ast::Module clonedModule = module->Clone(); - tint::TypeDeterminer typeDeterminer(&clonedModule); - if (!typeDeterminer.Determine()) { - return DAWN_VALIDATION_ERROR(typeDeterminer.error().c_str()); + ASSERT(program != nullptr); + tint::Program clonedProgram = program->Clone(); + + tint::diag::List diagnostics = tint::TypeDeterminer::Run(&clonedProgram); + if (diagnostics.contains_errors()) { + std::string err = tint::diag::Formatter{}.format(diagnostics); + return DAWN_VALIDATION_ERROR(err.c_str()); } - DAWN_TRY_ASSIGN(localSpirv, ModuleToSPIRV(std::move(clonedModule))); + DAWN_TRY_ASSIGN(localSpirv, ModuleToSPIRV(std::move(clonedProgram))); DAWN_TRY(ValidateSpirv(localSpirv.data(), localSpirv.size())); spirvPtr = &localSpirv; #else @@ -1158,18 +1162,18 @@ namespace dawn_native { if (GetDevice()->IsToggleEnabled(Toggle::UseTintInspector)) { #ifdef DAWN_ENABLE_WGSL - tint::ast::Module localModule; + tint::Program localProgram; - tint::ast::Module* modulePtr = module; + tint::Program* programPtr = program; if (!GetDevice()->IsToggleEnabled(Toggle::UseTintGenerator)) { - // We have mSpirv, but no Tint module - DAWN_TRY_ASSIGN(localModule, ParseSPIRV(mSpirv)); - DAWN_TRY(ValidateModule(&localModule)); - modulePtr = &localModule; + // We have mSpirv, but no Tint program + DAWN_TRY_ASSIGN(localProgram, ParseSPIRV(mSpirv)); + DAWN_TRY(ValidateModule(&localProgram)); + programPtr = &localProgram; } EntryPointMetadataTable table; - DAWN_TRY_ASSIGN(table, ReflectShaderUsingTint(GetDevice(), *modulePtr)); + DAWN_TRY_ASSIGN(table, ReflectShaderUsingTint(GetDevice(), *programPtr)); DAWN_TRY(PopulateMetadataUsingSPIRVCross(GetDevice(), *spirvPtr, &table)); mEntryPoints = std::move(table); #else diff --git a/src/dawn_native/ShaderModule.h b/src/dawn_native/ShaderModule.h index bedeb22227..217e2ddb14 100644 --- a/src/dawn_native/ShaderModule.h +++ b/src/dawn_native/ShaderModule.h @@ -33,9 +33,7 @@ namespace tint { - namespace ast { - class Module; - } // namespace ast + class Program; namespace transform { class Manager; @@ -63,7 +61,7 @@ namespace dawn_native { ShaderModuleParseResult& operator=(ShaderModuleParseResult&& rhs); #ifdef DAWN_ENABLE_WGSL - std::unique_ptr tintModule; + std::unique_ptr tintProgram; #endif std::vector spirv; }; @@ -78,8 +76,8 @@ namespace dawn_native { RequiredBufferSizes ComputeRequiredBufferSizesForLayout(const EntryPointMetadata& entryPoint, const PipelineLayoutBase* layout); #ifdef DAWN_ENABLE_WGSL - ResultOrError RunTransforms(tint::transform::Manager* manager, - tint::ast::Module* module); + ResultOrError RunTransforms(tint::transform::Manager* manager, + tint::Program* program); std::unique_ptr MakeVertexPullingTransform( const VertexStateDescriptor& vertexState, @@ -88,7 +86,7 @@ namespace dawn_native { #endif // Contains all the reflection data for a valid (ShaderModule, entryPoint, stage). They are - // stored in the ShaderModuleBase and destroyed only when the shader module is destroyed so + // stored in the ShaderModuleBase and destroyed only when the shader program is destroyed so // pointers to EntryPointMetadata are safe to store as long as you also keep a Ref to the // ShaderModuleBase. struct EntryPointMetadata { @@ -132,7 +130,7 @@ namespace dawn_native { static ShaderModuleBase* MakeError(DeviceBase* device); - // Return true iff the module has an entrypoint called `entryPoint`. + // Return true iff the program has an entrypoint called `entryPoint`. bool HasEntryPoint(const std::string& entryPoint) const; // Returns the metadata for the given `entryPoint`. HasEntryPoint with the same argument @@ -156,7 +154,7 @@ namespace dawn_native { BindGroupIndex pullingBufferBindingSet) const; ResultOrError> GeneratePullingSpirv( - tint::ast::Module* module, + tint::Program* program, const VertexStateDescriptor& vertexState, const std::string& entryPoint, BindGroupIndex pullingBufferBindingSet) const; diff --git a/src/dawn_native/d3d12/ShaderModuleD3D12.cpp b/src/dawn_native/d3d12/ShaderModuleD3D12.cpp index b91450f823..0f7be68766 100644 --- a/src/dawn_native/d3d12/ShaderModuleD3D12.cpp +++ b/src/dawn_native/d3d12/ShaderModuleD3D12.cpp @@ -188,7 +188,7 @@ namespace dawn_native { namespace d3d12 { MaybeError ShaderModule::Initialize(ShaderModuleParseResult* parseResult) { DAWN_TRY(InitializeBase(parseResult)); #ifdef DAWN_ENABLE_WGSL - mTintModule = std::move(parseResult->tintModule); + mTintProgram = std::move(parseResult->tintProgram); #endif return {}; } @@ -217,8 +217,8 @@ namespace dawn_native { namespace d3d12 { transformManager.append(std::move(transformer)); } - tint::ast::Module module; - DAWN_TRY_ASSIGN(module, RunTransforms(&transformManager, mTintModule.get())); + tint::Program program; + DAWN_TRY_ASSIGN(program, RunTransforms(&transformManager, mTintProgram.get())); if (firstOffsetTransform != nullptr) { // Functions are only available after transform has been performed @@ -235,10 +235,10 @@ namespace dawn_native { namespace d3d12 { } ASSERT(remappedEntryPointName != nullptr); - tint::inspector::Inspector inspector(module); + tint::inspector::Inspector inspector(&program); *remappedEntryPointName = inspector.GetRemappedNameForEntryPoint(entryPointName); - tint::writer::hlsl::Generator generator(std::move(module)); + tint::writer::hlsl::Generator generator(&program); // TODO: Switch to GenerateEntryPoint once HLSL writer supports it. if (!generator.Generate()) { errorStream << "Generator: " << generator.error() << std::endl; diff --git a/src/dawn_native/d3d12/ShaderModuleD3D12.h b/src/dawn_native/d3d12/ShaderModuleD3D12.h index ed8e1e8636..b3850bca25 100644 --- a/src/dawn_native/d3d12/ShaderModuleD3D12.h +++ b/src/dawn_native/d3d12/ShaderModuleD3D12.h @@ -78,7 +78,7 @@ namespace dawn_native { namespace d3d12 { uint64_t GetD3DCompilerVersion() const; #ifdef DAWN_ENABLE_WGSL - std::unique_ptr mTintModule; + std::unique_ptr mTintProgram; #endif }; diff --git a/src/dawn_native/metal/ShaderModuleMTL.h b/src/dawn_native/metal/ShaderModuleMTL.h index 1729fda04f..621c198c3c 100644 --- a/src/dawn_native/metal/ShaderModuleMTL.h +++ b/src/dawn_native/metal/ShaderModuleMTL.h @@ -71,7 +71,7 @@ namespace dawn_native { namespace metal { MaybeError Initialize(ShaderModuleParseResult* parseResult); #ifdef DAWN_ENABLE_WGSL - std::unique_ptr mTintModule; + std::unique_ptr mTintProgram; #endif }; diff --git a/src/dawn_native/metal/ShaderModuleMTL.mm b/src/dawn_native/metal/ShaderModuleMTL.mm index b0958ecad4..11241e9cd1 100644 --- a/src/dawn_native/metal/ShaderModuleMTL.mm +++ b/src/dawn_native/metal/ShaderModuleMTL.mm @@ -50,7 +50,7 @@ namespace dawn_native { namespace metal { MaybeError ShaderModule::Initialize(ShaderModuleParseResult* parseResult) { DAWN_TRY(InitializeBase(parseResult)); #ifdef DAWN_ENABLE_WGSL - mTintModule = std::move(parseResult->tintModule); + mTintProgram = std::move(parseResult->tintProgram); #endif return {}; } @@ -88,14 +88,14 @@ namespace dawn_native { namespace metal { } transformManager.append(std::make_unique()); - tint::ast::Module module; - DAWN_TRY_ASSIGN(module, RunTransforms(&transformManager, mTintModule.get())); + tint::Program program; + DAWN_TRY_ASSIGN(program, RunTransforms(&transformManager, mTintProgram.get())); ASSERT(remappedEntryPointName != nullptr); - tint::inspector::Inspector inspector(module); + tint::inspector::Inspector inspector(&program); *remappedEntryPointName = inspector.GetRemappedNameForEntryPoint(entryPointName); - tint::writer::msl::Generator generator(std::move(module)); + tint::writer::msl::Generator generator(&program); if (!generator.Generate()) { errorStream << "Generator: " << generator.error() << std::endl; return DAWN_VALIDATION_ERROR(errorStream.str().c_str()); @@ -123,9 +123,9 @@ namespace dawn_native { namespace metal { std::vector pullingSpirv; if (GetDevice()->IsToggleEnabled(Toggle::MetalEnableVertexPulling) && stage == SingleShaderStage::Vertex) { - if (mTintModule) { + if (mTintProgram) { DAWN_TRY_ASSIGN(pullingSpirv, - GeneratePullingSpirv(mTintModule.get(), + GeneratePullingSpirv(mTintProgram.get(), *renderPipeline->GetVertexStateDescriptor(), entryPointName, kPullingBufferBindingSet)); } else { diff --git a/src/dawn_native/opengl/ShaderModuleGL.cpp b/src/dawn_native/opengl/ShaderModuleGL.cpp index ab8ae71fc0..916027ddc3 100644 --- a/src/dawn_native/opengl/ShaderModuleGL.cpp +++ b/src/dawn_native/opengl/ShaderModuleGL.cpp @@ -82,7 +82,7 @@ namespace dawn_native { namespace opengl { DAWN_TRY(InitializeBase(parseResult)); if (GetDevice()->IsToggleEnabled(Toggle::UseTintGenerator)) { #ifdef DAWN_ENABLE_WGSL - tint::ast::Module module = std::move(*parseResult->tintModule.release()); + tint::Program program = std::move(*parseResult->tintProgram.release()); std::ostringstream errorStream; errorStream << "Tint SPIR-V (for GLSL) writer failure:" << std::endl; @@ -91,9 +91,9 @@ namespace dawn_native { namespace opengl { transformManager.append(std::make_unique()); transformManager.append(std::make_unique()); - DAWN_TRY_ASSIGN(module, RunTransforms(&transformManager, &module)); + DAWN_TRY_ASSIGN(program, RunTransforms(&transformManager, &program)); - tint::writer::spirv::Generator generator(std::move(module)); + tint::writer::spirv::Generator generator(&program); if (!generator.Generate()) { errorStream << "Generator: " << generator.error() << std::endl; return DAWN_VALIDATION_ERROR(errorStream.str().c_str()); diff --git a/src/dawn_native/vulkan/ShaderModuleVk.cpp b/src/dawn_native/vulkan/ShaderModuleVk.cpp index b0edeb64b0..61c7f1ca53 100644 --- a/src/dawn_native/vulkan/ShaderModuleVk.cpp +++ b/src/dawn_native/vulkan/ShaderModuleVk.cpp @@ -53,7 +53,7 @@ namespace dawn_native { namespace vulkan { const std::vector* spirvPtr; if (GetDevice()->IsToggleEnabled(Toggle::UseTintGenerator)) { #ifdef DAWN_ENABLE_WGSL - tint::ast::Module module = std::move(*std::move(parseResult->tintModule).release()); + tint::Program program = std::move(*std::move(parseResult->tintProgram).release()); std::ostringstream errorStream; errorStream << "Tint SPIR-V writer failure:" << std::endl; @@ -62,9 +62,9 @@ namespace dawn_native { namespace vulkan { transformManager.append(std::make_unique()); transformManager.append(std::make_unique()); - DAWN_TRY_ASSIGN(module, RunTransforms(&transformManager, &module)); + DAWN_TRY_ASSIGN(program, RunTransforms(&transformManager, &program)); - tint::writer::spirv::Generator generator(std::move(module)); + tint::writer::spirv::Generator generator(&program); if (!generator.Generate()) { errorStream << "Generator: " << generator.error() << std::endl; return DAWN_VALIDATION_ERROR(errorStream.str().c_str()); diff --git a/src/fuzzers/DawnSPIRVCrossFuzzer.cpp b/src/fuzzers/DawnSPIRVCrossFuzzer.cpp index 1bac958ad3..649c92615d 100644 --- a/src/fuzzers/DawnSPIRVCrossFuzzer.cpp +++ b/src/fuzzers/DawnSPIRVCrossFuzzer.cpp @@ -79,17 +79,17 @@ namespace DawnSPIRVCrossFuzzer { return 0; } - tint::ast::Module module = parser.module(); - if (!module.IsValid()) { + tint::Program program = parser.program(); + if (!program.IsValid()) { return 0; } - tint::TypeDeterminer type_determiner(&module); + tint::TypeDeterminer type_determiner(&program); if (!type_determiner.Determine()) { return 0; } - tint::writer::spirv::Generator generator(std::move(module)); + tint::writer::spirv::Generator generator(&program); if (!generator.Generate()) { return 0; }