Add support for dump_translated_shaders to the Metal backend
Bug: None Change-Id: Icecbe221970ec10e6497309108dec5ccefc0a944 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/57060 Commit-Queue: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Ben Clayton <bclayton@google.com> Auto-Submit: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Ben Clayton <bclayton@google.com>
This commit is contained in:
parent
2583b8d459
commit
f78c28dcb7
|
@ -122,9 +122,12 @@ 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>();
|
||||||
transformManager.Add<tint::transform::Renamer>();
|
|
||||||
transformManager.Add<tint::transform::Msl>();
|
transformManager.Add<tint::transform::Msl>();
|
||||||
|
|
||||||
|
if (!GetDevice()->IsToggleEnabled(Toggle::DumpTranslatedShaders)) {
|
||||||
|
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),
|
||||||
/* mayCollide */ true);
|
/* mayCollide */ true);
|
||||||
|
@ -143,7 +146,11 @@ namespace dawn_native { namespace metal {
|
||||||
}
|
}
|
||||||
*remappedEntryPointName = it->second;
|
*remappedEntryPointName = it->second;
|
||||||
} else {
|
} 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.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (auto* data = transformOutputs.Get<tint::transform::Msl::Result>()) {
|
if (auto* data = transformOutputs.Get<tint::transform::Msl::Result>()) {
|
||||||
|
@ -312,6 +319,12 @@ namespace dawn_native { namespace metal {
|
||||||
#endif
|
#endif
|
||||||
)" + msl;
|
)" + msl;
|
||||||
|
|
||||||
|
if (GetDevice()->IsToggleEnabled(Toggle::DumpTranslatedShaders)) {
|
||||||
|
std::ostringstream dumpedMsg;
|
||||||
|
dumpedMsg << "/* Dumped generated MSL */" << std::endl << msl;
|
||||||
|
GetDevice()->EmitLog(WGPULoggingType_Info, dumpedMsg.str().c_str());
|
||||||
|
}
|
||||||
|
|
||||||
NSRef<NSString> mslSource = AcquireNSRef([[NSString alloc] initWithUTF8String:msl.c_str()]);
|
NSRef<NSString> mslSource = AcquireNSRef([[NSString alloc] initWithUTF8String:msl.c_str()]);
|
||||||
|
|
||||||
auto mtlDevice = ToBackend(GetDevice())->GetMTLDevice();
|
auto mtlDevice = ToBackend(GetDevice())->GetMTLDevice();
|
||||||
|
|
Loading…
Reference in New Issue