Dump translated HLSL shaders if the toggle enabled
Add a toggle named "dump_translated_shaders", and when this toggle is enabled, translated HLSL shaders will be dumped and log via Device::EmitLog in the kInfo logging level. BUG: dawn:792 Change-Id: Ia5ccc96019c32b43aa315f080f80a26919b441e3 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/53580 Commit-Queue: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Austin Eng <enga@chromium.org>
This commit is contained in:
parent
0f9ea803cc
commit
e557296b08
|
@ -189,6 +189,12 @@ namespace dawn_native {
|
|||
"This is useful to prevent a Chromium renderer process from successfully sending"
|
||||
"SPIR-V code to be compiled in the GPU process.",
|
||||
"https://crbug.com/1214923"}},
|
||||
{Toggle::DumpTranslatedShaders,
|
||||
{"dump_translated_shaders",
|
||||
"Dump generated shaders for debug propose, dumped shaders will be log via "
|
||||
"EmitLog, thus printed in Chrome console or consumed by user-defined callback "
|
||||
"function.",
|
||||
"https://crbug.com/dawn/792"}}
|
||||
// Dummy comment to separate the }} so it is clearer what to copy-paste to add a toggle.
|
||||
}};
|
||||
} // anonymous namespace
|
||||
|
|
|
@ -53,6 +53,7 @@ namespace dawn_native {
|
|||
UseTempBufferInSmallFormatTextureToTextureCopyFromGreaterToLessMipLevel,
|
||||
EmitHLSLDebugSymbols,
|
||||
DisallowSpirv,
|
||||
DumpTranslatedShaders,
|
||||
|
||||
EnumCount,
|
||||
InvalidEnum = EnumCount,
|
||||
|
|
|
@ -393,6 +393,12 @@ namespace dawn_native { namespace d3d12 {
|
|||
entryPointName = "main";
|
||||
}
|
||||
|
||||
if (device->IsToggleEnabled(Toggle::DumpTranslatedShaders)) {
|
||||
std::ostringstream dumpedMsg;
|
||||
dumpedMsg << "/* Dumped generated HLSL */" << std::endl << hlslSource;
|
||||
GetDevice()->EmitLog(WGPULoggingType_Info, dumpedMsg.str().c_str());
|
||||
}
|
||||
|
||||
// Use HLSL source as the input for the key since it does need to know about the pipeline
|
||||
// layout. The pipeline layout is only required if we key from WGSL: two different pipeline
|
||||
// layouts could be used to produce different shader blobs and the wrong shader blob could
|
||||
|
|
Loading…
Reference in New Issue