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 <noreply+kokoro@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
This commit is contained in:
Ben Clayton 2022-01-28 16:49:46 +00:00
parent df9900c43e
commit c28f5926be
1 changed files with 3 additions and 3 deletions

View File

@ -33,9 +33,11 @@ Manager::Manager() = default;
Manager::~Manager() = default; Manager::~Manager() = default;
Output Manager::Run(const Program* program, const DataMap& data) const { Output Manager::Run(const Program* program, const DataMap& data) const {
const Program* in = program;
#if TINT_PRINT_PROGRAM_FOR_EACH_TRANSFORM #if TINT_PRINT_PROGRAM_FOR_EACH_TRANSFORM
auto print_program = [&](const char* msg, const Transform* transform) { auto print_program = [&](const char* msg, const Transform* transform) {
auto wgsl = Program::printer(program); auto wgsl = Program::printer(in);
std::cout << "---------------------------------------------------------" std::cout << "---------------------------------------------------------"
<< std::endl; << std::endl;
std::cout << "-- " << msg << " " << transform->TypeInfo().name << ":" std::cout << "-- " << msg << " " << transform->TypeInfo().name << ":"
@ -49,8 +51,6 @@ Output Manager::Run(const Program* program, const DataMap& data) const {
}; };
#endif #endif
const Program* in = program;
Output out; Output out;
for (const auto& transform : transforms_) { for (const auto& transform : transforms_) {
if (!transform->ShouldRun(in, data)) { if (!transform->ShouldRun(in, data)) {