Fix dump_shaders not working for DXC DXIL output
This broke when we moved from using the old IDxcCompiler interface to
IDxcCompiler3. The new interface wants an IDxcResult object.
Change-Id: I6f56e092bdfb0b4a24fbd7d9578a8548b6c96fac
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/155760
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
diff --git a/src/dawn/native/d3d12/ShaderModuleD3D12.cpp b/src/dawn/native/d3d12/ShaderModuleD3D12.cpp
index 965bd31..654e280 100644
--- a/src/dawn/native/d3d12/ShaderModuleD3D12.cpp
+++ b/src/dawn/native/d3d12/ShaderModuleD3D12.cpp
@@ -58,16 +58,28 @@
dumpedMsg << "/* DXC compile flags */ " << std::endl
<< dawn::native::d3d::CompileFlagsToString(compileFlags) << std::endl;
dumpedMsg << "/* Dumped disassembled DXIL */" << std::endl;
- ComPtr<IDxcBlobEncoding> disassembly;
DxcBuffer dxcBuffer;
dxcBuffer.Encoding = DXC_CP_UTF8;
dxcBuffer.Ptr = shaderBlob.Data();
dxcBuffer.Size = shaderBlob.Size();
- if (FAILED(device->GetDxcCompiler()->Disassemble(&dxcBuffer, IID_PPV_ARGS(&disassembly)))) {
- dumpedMsg << "DXC disassemble failed" << std::endl;
- } else {
+
+ ComPtr<IDxcResult> dxcResult;
+ device->GetDxcCompiler()->Disassemble(&dxcBuffer, IID_PPV_ARGS(&dxcResult));
+
+ ComPtr<IDxcBlobEncoding> disassembly;
+ if (dxcResult && dxcResult->HasOutput(DXC_OUT_DISASSEMBLY) &&
+ SUCCEEDED(
+ dxcResult->GetOutput(DXC_OUT_DISASSEMBLY, IID_PPV_ARGS(&disassembly), nullptr))) {
dumpedMsg << std::string_view(static_cast<const char*>(disassembly->GetBufferPointer()),
disassembly->GetBufferSize());
+ } else {
+ dumpedMsg << "DXC disassemble failed" << std::endl;
+ ComPtr<IDxcBlobEncoding> errors;
+ if (dxcResult && dxcResult->HasOutput(DXC_OUT_ERRORS) &&
+ SUCCEEDED(dxcResult->GetOutput(DXC_OUT_ERRORS, IID_PPV_ARGS(&errors), nullptr))) {
+ dumpedMsg << std::string_view(static_cast<const char*>(errors->GetBufferPointer()),
+ errors->GetBufferSize());
+ }
}
}