From c28f5926bea6003788124bb9bcea53cfed0e708b Mon Sep 17 00:00:00 2001 From: Ben Clayton Date: Fri, 28 Jan 2022 16:49:46 +0000 Subject: [PATCH] transform: Fix `TINT_PRINT_PROGRAM_FOR_EACH_TRANSFORM` In recent optimizations, this got broken: when enabled the input program was printed over and over again, instead of the current transformed program. Change-Id: I0c5acaf40a88ac759d0114f85febc052d577a698 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/78540 Kokoro: Kokoro Reviewed-by: Antonio Maiorano --- src/transform/manager.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/transform/manager.cc b/src/transform/manager.cc index 8f0a78fed3..672d6297bd 100644 --- a/src/transform/manager.cc +++ b/src/transform/manager.cc @@ -33,9 +33,11 @@ Manager::Manager() = default; Manager::~Manager() = default; Output Manager::Run(const Program* program, const DataMap& data) const { + const Program* in = program; + #if TINT_PRINT_PROGRAM_FOR_EACH_TRANSFORM auto print_program = [&](const char* msg, const Transform* transform) { - auto wgsl = Program::printer(program); + auto wgsl = Program::printer(in); std::cout << "---------------------------------------------------------" << std::endl; std::cout << "-- " << msg << " " << transform->TypeInfo().name << ":" @@ -49,8 +51,6 @@ Output Manager::Run(const Program* program, const DataMap& data) const { }; #endif - const Program* in = program; - Output out; for (const auto& transform : transforms_) { if (!transform->ShouldRun(in, data)) {