D3D12: dump disassembled DXBC when dump_shaders is enabled
Useful for debugging FXC bugs. Bug: dawn:1162 Change-Id: If4fc7d0f16370d15235a6c872309fe1536dd9edc Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/66900 Commit-Queue: Antonio Maiorano <amaiorano@google.com> Reviewed-by: Austin Eng <enga@chromium.org>
This commit is contained in:
parent
e9cbd4896a
commit
1bf932e7b4
|
@ -233,10 +233,12 @@ namespace dawn_native { namespace d3d12 {
|
|||
MaybeError PlatformFunctions::LoadFXCompiler() {
|
||||
#if DAWN_PLATFORM_WINUWP
|
||||
d3dCompile = &D3DCompile;
|
||||
d3dDisassemble = &D3DDisassemble;
|
||||
#else
|
||||
std::string error;
|
||||
if (!mFXCompilerLib.Open("d3dcompiler_47.dll", &error) ||
|
||||
!mFXCompilerLib.GetProc(&d3dCompile, "D3DCompile", &error)) {
|
||||
!mFXCompilerLib.GetProc(&d3dCompile, "D3DCompile", &error) ||
|
||||
!mFXCompilerLib.GetProc(&d3dDisassemble, "D3DDisassemble", &error)) {
|
||||
return DAWN_INTERNAL_ERROR(error.c_str());
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -65,6 +65,7 @@ namespace dawn_native { namespace d3d12 {
|
|||
|
||||
// Functions from d3d3compiler.dll
|
||||
pD3DCompile d3dCompile = nullptr;
|
||||
pD3DDisassemble d3dDisassemble = nullptr;
|
||||
|
||||
// Functions from WinPixEventRuntime.dll
|
||||
using PFN_PIX_END_EVENT_ON_COMMAND_LIST =
|
||||
|
|
|
@ -461,6 +461,22 @@ namespace dawn_native { namespace d3d12 {
|
|||
break;
|
||||
}
|
||||
|
||||
if (dumpShaders && request.compiler == ShaderCompilationRequest::Compiler::FXC) {
|
||||
std::ostringstream dumpedMsg;
|
||||
dumpedMsg << "/* Dumped disassembled DXBC */" << std::endl;
|
||||
|
||||
ComPtr<ID3DBlob> disassembly;
|
||||
if (FAILED(functions->d3dDisassemble(
|
||||
compiledShader->compiledFXCShader->GetBufferPointer(),
|
||||
compiledShader->compiledFXCShader->GetBufferSize(), 0, nullptr,
|
||||
&disassembly))) {
|
||||
dumpedMsg << "D3D disassemble failed" << std::endl;
|
||||
} else {
|
||||
dumpedMsg << reinterpret_cast<const char*>(disassembly->GetBufferPointer());
|
||||
}
|
||||
DumpShadersEmitLog(WGPULoggingType_Info, dumpedMsg.str().c_str());
|
||||
}
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue