|
@@ -264,6 +264,7 @@ private:
|
|
|
hlsl::DxilCompilerVersion m_VersionInfo;
|
|
|
std::string m_VersionCommitSha;
|
|
|
std::string m_VersionString;
|
|
|
+ CComPtr<IDxcResult> m_pCachedRecompileResult;
|
|
|
|
|
|
// NOTE: This is not set to null by Reset() since it doesn't
|
|
|
// necessarily change across different PDBs.
|
|
@@ -293,6 +294,7 @@ private:
|
|
|
m_VersionCommitSha.clear();
|
|
|
m_VersionString.clear();
|
|
|
m_ArgPairs.clear();
|
|
|
+ m_pCachedRecompileResult = nullptr;
|
|
|
}
|
|
|
|
|
|
bool HasSources() const {
|
|
@@ -717,18 +719,15 @@ public:
|
|
|
return m_pDebugProgramBlob != nullptr;
|
|
|
}
|
|
|
|
|
|
- virtual HRESULT STDMETHODCALLTYPE GetFullPDB(_COM_Outptr_ IDxcBlob **ppFullPDB) override {
|
|
|
+ virtual HRESULT STDMETHODCALLTYPE CompileForFullPDB(_COM_Outptr_ IDxcResult **ppResult) {
|
|
|
+ if (!ppResult) return E_POINTER;
|
|
|
+ *ppResult = nullptr;
|
|
|
+
|
|
|
if (!m_InputBlob)
|
|
|
return E_FAIL;
|
|
|
|
|
|
- if (!ppFullPDB) return E_POINTER;
|
|
|
-
|
|
|
- *ppFullPDB = nullptr;
|
|
|
-
|
|
|
- // If we are already a full pdb, just return the input blob
|
|
|
- if (IsFullPDB()) {
|
|
|
- return m_InputBlob.QueryInterface(ppFullPDB);
|
|
|
- }
|
|
|
+ if (m_pCachedRecompileResult)
|
|
|
+ return m_pCachedRecompileResult.QueryInterface(ppResult);
|
|
|
|
|
|
if (!m_pCompiler)
|
|
|
IFR(DxcCreateInstance2(m_pMalloc, CLSID_DxcCompiler, IID_PPV_ARGS(&m_pCompiler)));
|
|
@@ -769,7 +768,25 @@ public:
|
|
|
IFR(main_file->GetEncoding(&bEndodingKnown, &source_buf.Encoding));
|
|
|
|
|
|
CComPtr<IDxcResult> pResult;
|
|
|
- IFR(m_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(&m_pCachedRecompileResult)));
|
|
|
+
|
|
|
+ CComPtr<IDxcOperationResult> pOperationResult;
|
|
|
+ return m_pCachedRecompileResult.QueryInterface(ppResult);
|
|
|
+ }
|
|
|
+
|
|
|
+ virtual HRESULT STDMETHODCALLTYPE GetFullPDB(_COM_Outptr_ IDxcBlob **ppFullPDB) override {
|
|
|
+ if (!m_InputBlob)
|
|
|
+ return E_FAIL;
|
|
|
+ if (!ppFullPDB) return E_POINTER;
|
|
|
+ *ppFullPDB = nullptr;
|
|
|
+ // If we are already a full pdb, just return the input blob
|
|
|
+ if (IsFullPDB()) {
|
|
|
+ return m_InputBlob.QueryInterface(ppFullPDB);
|
|
|
+ }
|
|
|
+
|
|
|
+ CComPtr<IDxcResult> pResult;
|
|
|
+
|
|
|
+ IFR(CompileForFullPDB(&pResult));
|
|
|
|
|
|
CComPtr<IDxcOperationResult> pOperationResult;
|
|
|
IFR(pResult.QueryInterface(&pOperationResult));
|
|
@@ -850,6 +867,7 @@ public:
|
|
|
|
|
|
virtual HRESULT STDMETHODCALLTYPE SetCompiler(_In_ IDxcCompiler3 *pCompiler) override {
|
|
|
m_pCompiler = pCompiler;
|
|
|
+ m_pCachedRecompileResult = nullptr; // Clear the previously compiled result
|
|
|
return S_OK;
|
|
|
}
|
|
|
};
|