D3D12: Improve dump_translated_shaders debugging
If enabled: * Don't enable the renamer transform. Helps with readability. * Emit the produced WGSL when combined with --force_wgsl_step Change-Id: I336de6e6a4eee08805eee82847bd97cd5a942306 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/57040 Auto-Submit: Ben Clayton <bclayton@google.com> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Ben Clayton <bclayton@google.com>
This commit is contained in:
parent
6ceaac3436
commit
2583b8d459
|
@ -1124,6 +1124,12 @@ namespace dawn_native {
|
|||
newWgslCode = generator.result();
|
||||
newWgslDesc.source = newWgslCode.c_str();
|
||||
|
||||
if (device->IsToggleEnabled(Toggle::DumpTranslatedShaders)) {
|
||||
std::ostringstream dumpedMsg;
|
||||
dumpedMsg << "// Dumped generated WGSL" << std::endl << newWgslCode;
|
||||
device->EmitLog(WGPULoggingType_Info, dumpedMsg.str().c_str());
|
||||
}
|
||||
|
||||
spirvDesc = nullptr;
|
||||
wgslDesc = &newWgslDesc;
|
||||
}
|
||||
|
|
|
@ -258,9 +258,12 @@ namespace dawn_native { namespace d3d12 {
|
|||
layout->GetFirstIndexOffsetRegisterSpace());
|
||||
}
|
||||
transformManager.Add<tint::transform::BindingRemapper>();
|
||||
transformManager.Add<tint::transform::Renamer>();
|
||||
transformManager.Add<tint::transform::Hlsl>();
|
||||
|
||||
if (!GetDevice()->IsToggleEnabled(Toggle::DumpTranslatedShaders)) {
|
||||
transformManager.Add<tint::transform::Renamer>();
|
||||
}
|
||||
|
||||
// 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.
|
||||
const bool mayCollide = true;
|
||||
|
@ -290,7 +293,11 @@ namespace dawn_native { namespace d3d12 {
|
|||
}
|
||||
*remappedEntryPointName = it->second;
|
||||
} else {
|
||||
return DAWN_VALIDATION_ERROR("Transform output missing renamer data.");
|
||||
if (GetDevice()->IsToggleEnabled(Toggle::DumpTranslatedShaders)) {
|
||||
*remappedEntryPointName = entryPointName;
|
||||
} else {
|
||||
return DAWN_VALIDATION_ERROR("Transform output missing renamer data.");
|
||||
}
|
||||
}
|
||||
|
||||
tint::writer::hlsl::Generator generator(&program);
|
||||
|
|
Loading…
Reference in New Issue