Always run the Tint renamer, even with dump_translated_shaders

Not running the renamer can produce code that fails to compile
on the backend, resulting in device lost errors.

Change-Id: I4a841a281142bb8eda1402e1ebd6a5d23b77bfe0
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/57745
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Austin Eng <enga@chromium.org>
This commit is contained in:
Austin Eng 2021-07-13 15:34:46 +00:00 committed by Dawn LUCI CQ
parent 4773e8d0f9
commit 0a58972309
2 changed files with 4 additions and 18 deletions

View File

@ -258,10 +258,7 @@ namespace dawn_native { namespace d3d12 {
layout->GetFirstIndexOffsetRegisterSpace()); layout->GetFirstIndexOffsetRegisterSpace());
} }
transformManager.Add<tint::transform::BindingRemapper>(); transformManager.Add<tint::transform::BindingRemapper>();
if (!GetDevice()->IsToggleEnabled(Toggle::DumpTranslatedShaders)) {
transformManager.Add<tint::transform::Renamer>(); transformManager.Add<tint::transform::Renamer>();
}
// D3D12 registers like `t3` and `c3` have the same bindingOffset number in the // D3D12 registers like `t3` and `c3` have the same bindingOffset number in the
// remapping but should not be considered a collision because they have different types. // remapping but should not be considered a collision because they have different types.
@ -291,13 +288,9 @@ namespace dawn_native { namespace d3d12 {
return DAWN_VALIDATION_ERROR("Could not find remapped name for entry point."); return DAWN_VALIDATION_ERROR("Could not find remapped name for entry point.");
} }
*remappedEntryPointName = it->second; *remappedEntryPointName = it->second;
} else {
if (GetDevice()->IsToggleEnabled(Toggle::DumpTranslatedShaders)) {
*remappedEntryPointName = entryPointName;
} else { } else {
return DAWN_VALIDATION_ERROR("Transform output missing renamer data."); return DAWN_VALIDATION_ERROR("Transform output missing renamer data.");
} }
}
tint::writer::hlsl::Options options; tint::writer::hlsl::Options options;
auto result = tint::writer::hlsl::Generate(&program, options); auto result = tint::writer::hlsl::Generate(&program, options);

View File

@ -123,10 +123,7 @@ namespace dawn_native { namespace metal {
transformManager.Add<tint::transform::BoundArrayAccessors>(); transformManager.Add<tint::transform::BoundArrayAccessors>();
} }
transformManager.Add<tint::transform::BindingRemapper>(); transformManager.Add<tint::transform::BindingRemapper>();
if (!GetDevice()->IsToggleEnabled(Toggle::DumpTranslatedShaders)) {
transformManager.Add<tint::transform::Renamer>(); transformManager.Add<tint::transform::Renamer>();
}
transformInputs.Add<BindingRemapper::Remappings>(std::move(bindingPoints), transformInputs.Add<BindingRemapper::Remappings>(std::move(bindingPoints),
std::move(accessControls), std::move(accessControls),
@ -143,13 +140,9 @@ namespace dawn_native { namespace metal {
return DAWN_VALIDATION_ERROR("Could not find remapped name for entry point."); return DAWN_VALIDATION_ERROR("Could not find remapped name for entry point.");
} }
*remappedEntryPointName = it->second; *remappedEntryPointName = it->second;
} else {
if (GetDevice()->IsToggleEnabled(Toggle::DumpTranslatedShaders)) {
*remappedEntryPointName = entryPointName;
} else { } else {
return DAWN_VALIDATION_ERROR("Transform output missing renamer data."); return DAWN_VALIDATION_ERROR("Transform output missing renamer data.");
} }
}
tint::writer::msl::Options options; tint::writer::msl::Options options;
options.buffer_size_ubo_index = kBufferLengthBufferSlot; options.buffer_size_ubo_index = kBufferLengthBufferSlot;