From 978c2e010508426c9be9b4d3a2ff8d1c7ac6c4a3 Mon Sep 17 00:00:00 2001 From: Antonio Maiorano Date: Thu, 8 Apr 2021 19:50:07 +0000 Subject: [PATCH] Remove usage of tint::Validator Validation is now automatically performed, and the Validator class is now redundant and will soon be removed from Tint. Bug: tint:642 Change-Id: I9ddbe523d85e2a4dfeff6d08324a6ca368d6cc74 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/47124 Reviewed-by: Corentin Wallez Commit-Queue: Antonio Maiorano --- src/dawn_native/ShaderModule.cpp | 29 ----------------------------- 1 file changed, 29 deletions(-) diff --git a/src/dawn_native/ShaderModule.cpp b/src/dawn_native/ShaderModule.cpp index af6b2d7b1e..9090119ef0 100644 --- a/src/dawn_native/ShaderModule.cpp +++ b/src/dawn_native/ShaderModule.cpp @@ -428,25 +428,6 @@ namespace dawn_native { return std::move(program); } - MaybeError ValidateModule(const tint::Program* program, - OwnedCompilationMessages* outMessages) { - std::ostringstream errorStream; - errorStream << "Tint program validation" << std::endl; - - tint::Validator validator; - bool isValid = validator.Validate(program); - if (outMessages != nullptr) { - outMessages->AddMessages(validator.diagnostics()); - } - if (!isValid) { - auto err = validator.diagnostics().str(); - errorStream << "Validation: " << err << std::endl; - return DAWN_VALIDATION_ERROR(errorStream.str().c_str()); - } - - return {}; - } - ResultOrError> ModuleToSPIRV(const tint::Program* program) { std::ostringstream errorStream; errorStream << "Tint SPIR-V writer failure:" << std::endl; @@ -1093,9 +1074,6 @@ namespace dawn_native { if (device->IsToggleEnabled(Toggle::UseTintGenerator)) { tint::Program program; DAWN_TRY_ASSIGN(program, ParseSPIRV(spirv, outMessages)); - if (device->IsValidationEnabled()) { - DAWN_TRY(ValidateModule(&program, outMessages)); - } parseResult->tintProgram = std::make_unique(std::move(program)); } else { if (device->IsValidationEnabled()) { @@ -1116,9 +1094,6 @@ namespace dawn_native { DAWN_TRY_ASSIGN(program, ParseWGSL(&file, outMessages)); if (device->IsToggleEnabled(Toggle::UseTintGenerator)) { - if (device->IsValidationEnabled()) { - DAWN_TRY(ValidateModule(&program, outMessages)); - } parseResult->tintProgram = std::make_unique(std::move(program)); } else { tint::transform::Manager transformManager; @@ -1128,10 +1103,6 @@ namespace dawn_native { DAWN_TRY_ASSIGN(program, RunTransforms(&transformManager, &program, outMessages)); - if (device->IsValidationEnabled()) { - DAWN_TRY(ValidateModule(&program, outMessages)); - } - std::vector spirv; DAWN_TRY_ASSIGN(spirv, ModuleToSPIRV(&program)); DAWN_TRY(ValidateSpirv(spirv.data(), spirv.size()));