ShaderModule: Deprecate dump_translated_shaders for dump_shaders
And print the WGSL program even when !force_wgsl_step Shaders are often built through string concatenation. Being able to always dump this is useful. Change-Id: I5da3866b333e8a80931c7c2837f0247e8f38213d Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/57380 Reviewed-by: Austin Eng <enga@chromium.org> Commit-Queue: Ben Clayton <bclayton@google.com>
This commit is contained in:
parent
b81021dc82
commit
d9d6e7fc40
|
@ -1126,12 +1126,6 @@ namespace dawn_native {
|
|||
newWgslCode = std::move(result.wgsl);
|
||||
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;
|
||||
}
|
||||
|
@ -1155,6 +1149,12 @@ namespace dawn_native {
|
|||
} else if (wgslDesc) {
|
||||
auto tintSource = std::make_unique<TintSource>("", wgslDesc->source);
|
||||
|
||||
if (device->IsToggleEnabled(Toggle::DumpShaders)) {
|
||||
std::ostringstream dumpedMsg;
|
||||
dumpedMsg << "// Dumped WGSL:" << std::endl << wgslDesc->source;
|
||||
device->EmitLog(WGPULoggingType_Info, dumpedMsg.str().c_str());
|
||||
}
|
||||
|
||||
tint::Program program;
|
||||
DAWN_TRY_ASSIGN(program, ParseWGSL(&tintSource->file, outMessages));
|
||||
|
||||
|
|
|
@ -189,12 +189,15 @@ 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 "
|
||||
{Toggle::DumpShaders,
|
||||
{"dump_shaders",
|
||||
"Dump shaders for debugging purposes. Dumped shaders will be log via "
|
||||
"EmitLog, thus printed in Chrome console or consumed by user-defined callback "
|
||||
"function.",
|
||||
"https://crbug.com/dawn/792"}},
|
||||
{Toggle::DEPRECATED_DumpTranslatedShaders,
|
||||
{"dump_translated_shaders", "Deprecated. Use dump_shaders",
|
||||
"https://crbug.com/dawn/792"}},
|
||||
{Toggle::ForceWGSLStep,
|
||||
{"force_wgsl_step",
|
||||
"When ingesting SPIR-V shaders, force a first conversion to WGSL. This allows "
|
||||
|
@ -206,12 +209,19 @@ namespace dawn_native {
|
|||
} // anonymous namespace
|
||||
|
||||
void TogglesSet::Set(Toggle toggle, bool enabled) {
|
||||
if (toggle == Toggle::DEPRECATED_DumpTranslatedShaders) {
|
||||
Set(Toggle::DumpShaders, enabled);
|
||||
return;
|
||||
}
|
||||
ASSERT(toggle != Toggle::InvalidEnum);
|
||||
const size_t toggleIndex = static_cast<size_t>(toggle);
|
||||
toggleBitset.set(toggleIndex, enabled);
|
||||
}
|
||||
|
||||
bool TogglesSet::Has(Toggle toggle) const {
|
||||
if (toggle == Toggle::DEPRECATED_DumpTranslatedShaders) {
|
||||
return Has(Toggle::DumpShaders);
|
||||
}
|
||||
ASSERT(toggle != Toggle::InvalidEnum);
|
||||
const size_t toggleIndex = static_cast<size_t>(toggle);
|
||||
return toggleBitset.test(toggleIndex);
|
||||
|
|
|
@ -53,7 +53,8 @@ namespace dawn_native {
|
|||
UseTempBufferInSmallFormatTextureToTextureCopyFromGreaterToLessMipLevel,
|
||||
EmitHLSLDebugSymbols,
|
||||
DisallowSpirv,
|
||||
DumpTranslatedShaders,
|
||||
DumpShaders,
|
||||
DEPRECATED_DumpTranslatedShaders, // Use DumpShaders
|
||||
ForceWGSLStep,
|
||||
|
||||
EnumCount,
|
||||
|
|
|
@ -395,7 +395,7 @@ namespace dawn_native { namespace d3d12 {
|
|||
entryPointName = "main";
|
||||
}
|
||||
|
||||
if (device->IsToggleEnabled(Toggle::DumpTranslatedShaders)) {
|
||||
if (device->IsToggleEnabled(Toggle::DumpShaders)) {
|
||||
std::ostringstream dumpedMsg;
|
||||
dumpedMsg << "/* Dumped generated HLSL */" << std::endl << hlslSource;
|
||||
GetDevice()->EmitLog(WGPULoggingType_Info, dumpedMsg.str().c_str());
|
||||
|
|
|
@ -310,7 +310,7 @@ namespace dawn_native { namespace metal {
|
|||
#endif
|
||||
)" + msl;
|
||||
|
||||
if (GetDevice()->IsToggleEnabled(Toggle::DumpTranslatedShaders)) {
|
||||
if (GetDevice()->IsToggleEnabled(Toggle::DumpShaders)) {
|
||||
std::ostringstream dumpedMsg;
|
||||
dumpedMsg << "/* Dumped generated MSL */" << std::endl << msl;
|
||||
GetDevice()->EmitLog(WGPULoggingType_Info, dumpedMsg.str().c_str());
|
||||
|
|
Loading…
Reference in New Issue