tint/transform: Reduce verbosity of TINT_PRINT_PROGRAM_FOR_EACH_TRANSFORM

Print the input program, and the output of each run transform.

Significantly reduces stdout spam, and also shows you transform input - which is what you really want.

Issue: tint:1853
Change-Id: Iaea0dc16de63daffcf0b0c715af14d194b700468
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/122480
Reviewed-by: James Price <jrprice@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
This commit is contained in:
Ben Clayton 2023-03-03 18:38:38 +00:00 committed by Dawn LUCI CQ
parent 1fb13a7fd4
commit 67e1de42c2
1 changed files with 6 additions and 5 deletions

View File

@ -19,6 +19,7 @@
#define TINT_PRINT_PROGRAM_FOR_EACH_TRANSFORM 0 #define TINT_PRINT_PROGRAM_FOR_EACH_TRANSFORM 0
#if TINT_PRINT_PROGRAM_FOR_EACH_TRANSFORM #if TINT_PRINT_PROGRAM_FOR_EACH_TRANSFORM
#include <iostream>
#define TINT_IF_PRINT_PROGRAM(x) x #define TINT_IF_PRINT_PROGRAM(x) x
#else // TINT_PRINT_PROGRAM_FOR_EACH_TRANSFORM #else // TINT_PRINT_PROGRAM_FOR_EACH_TRANSFORM
#define TINT_IF_PRINT_PROGRAM(x) #define TINT_IF_PRINT_PROGRAM(x)
@ -52,9 +53,9 @@ Transform::ApplyResult Manager::Apply(const Program* program,
std::optional<Program> output; std::optional<Program> output;
for (const auto& transform : transforms_) { TINT_IF_PRINT_PROGRAM(print_program("Input of", this));
TINT_IF_PRINT_PROGRAM(print_program("Input to", transform.get()));
for (const auto& transform : transforms_) {
if (auto result = transform->Apply(program, inputs, outputs)) { if (auto result = transform->Apply(program, inputs, outputs)) {
output.emplace(std::move(result.value())); output.emplace(std::move(result.value()));
program = &output.value(); program = &output.value();
@ -64,15 +65,15 @@ Transform::ApplyResult Manager::Apply(const Program* program,
break; break;
} }
if (transform == transforms_.back()) { TINT_IF_PRINT_PROGRAM(print_program("Output of", transform.get()));
TINT_IF_PRINT_PROGRAM(print_program("Output of", transform.get()));
}
} else { } else {
TINT_IF_PRINT_PROGRAM(std::cout << "Skipped " << transform->TypeInfo().name TINT_IF_PRINT_PROGRAM(std::cout << "Skipped " << transform->TypeInfo().name
<< std::endl); << std::endl);
} }
} }
TINT_IF_PRINT_PROGRAM(print_program("Final output of", this));
return output; return output;
} }