|
@@ -26,6 +26,7 @@
|
|
|
#include "llvm/Support/raw_ostream.h"
|
|
|
|
|
|
#include "dxc/dxcapi.h"
|
|
|
+#include "dxc/dxcapi.internal.h"
|
|
|
#include "dxc/dxcpix.h"
|
|
|
#include "dxc/Support/microcom.h"
|
|
|
#include "dxc/DxilContainer/DxilContainer.h"
|
|
@@ -260,6 +261,10 @@ private:
|
|
|
std::string m_VersionCommitSha;
|
|
|
std::string m_VersionString;
|
|
|
|
|
|
+ // NOTE: This is not set to null by Reset() since it doesn't
|
|
|
+ // necessarily change across different PDBs.
|
|
|
+ CComPtr<IDxcCompiler3> m_pCompiler;
|
|
|
+
|
|
|
struct ArgPair {
|
|
|
std::wstring Name;
|
|
|
std::wstring Value;
|
|
@@ -570,24 +575,25 @@ public:
|
|
|
}
|
|
|
|
|
|
HRESULT STDMETHODCALLTYPE Load(_In_ IDxcBlob *pPdbOrDxil) override {
|
|
|
- DxcThreadMalloc TM(m_pMalloc);
|
|
|
-
|
|
|
- ::llvm::sys::fs::MSFileSystem *msfPtr = nullptr;
|
|
|
- IFT(CreateMSFileSystemForDisk(&msfPtr));
|
|
|
- std::unique_ptr<::llvm::sys::fs::MSFileSystem> msf(msfPtr);
|
|
|
-
|
|
|
- ::llvm::sys::fs::AutoPerThreadSystem pts(msf.get());
|
|
|
- IFTLLVM(pts.error_code());
|
|
|
|
|
|
if (!pPdbOrDxil)
|
|
|
return E_POINTER;
|
|
|
|
|
|
- // Remove all the data
|
|
|
- Reset();
|
|
|
+ try {
|
|
|
+ DxcThreadMalloc TM(m_pMalloc);
|
|
|
|
|
|
- m_InputBlob = pPdbOrDxil;
|
|
|
+ ::llvm::sys::fs::MSFileSystem *msfPtr = nullptr;
|
|
|
+ IFT(CreateMSFileSystemForDisk(&msfPtr));
|
|
|
+ std::unique_ptr<::llvm::sys::fs::MSFileSystem> msf(msfPtr);
|
|
|
+
|
|
|
+ ::llvm::sys::fs::AutoPerThreadSystem pts(msf.get());
|
|
|
+ IFTLLVM(pts.error_code());
|
|
|
+
|
|
|
+ // Remove all the data
|
|
|
+ Reset();
|
|
|
+
|
|
|
+ m_InputBlob = pPdbOrDxil;
|
|
|
|
|
|
- try {
|
|
|
CComPtr<IStream> pStream;
|
|
|
IFR(hlsl::CreateReadOnlyBlobStream(pPdbOrDxil, &pStream));
|
|
|
|
|
@@ -715,8 +721,8 @@ public:
|
|
|
return m_InputBlob.QueryInterface(ppFullPDB);
|
|
|
}
|
|
|
|
|
|
- CComPtr<IDxcCompiler3> pCompiler;
|
|
|
- IFR(DxcCreateInstance2(m_pMalloc, CLSID_DxcCompiler, IID_PPV_ARGS(&pCompiler)));
|
|
|
+ if (!m_pCompiler)
|
|
|
+ IFR(DxcCreateInstance2(m_pMalloc, CLSID_DxcCompiler, IID_PPV_ARGS(&m_pCompiler)));
|
|
|
|
|
|
DxcThreadMalloc TM(m_pMalloc);
|
|
|
|
|
@@ -754,7 +760,7 @@ public:
|
|
|
IFR(main_file->GetEncoding(&bEndodingKnown, &source_buf.Encoding));
|
|
|
|
|
|
CComPtr<IDxcResult> pResult;
|
|
|
- IFR(pCompiler->Compile(&source_buf, new_args.data(), new_args.size(), pIncludeHandler, IID_PPV_ARGS(&pResult)));
|
|
|
+ IFR(m_pCompiler->Compile(&source_buf, new_args.data(), new_args.size(), pIncludeHandler, IID_PPV_ARGS(&pResult)));
|
|
|
|
|
|
CComPtr<IDxcOperationResult> pOperationResult;
|
|
|
IFR(pResult.QueryInterface(&pOperationResult));
|
|
@@ -832,6 +838,11 @@ public:
|
|
|
*ppVersionInfo = result.Detach();
|
|
|
return S_OK;
|
|
|
}
|
|
|
+
|
|
|
+ virtual HRESULT STDMETHODCALLTYPE SetCompiler(_In_ IDxcCompiler3 *pCompiler) override {
|
|
|
+ m_pCompiler = pCompiler;
|
|
|
+ return S_OK;
|
|
|
+ }
|
|
|
};
|
|
|
|
|
|
HRESULT CreateDxcPdbUtils(_In_ REFIID riid, _Out_ LPVOID *ppv) {
|