|
@@ -10,8 +10,6 @@
|
|
// //
|
|
// //
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
-#ifdef _WIN32
|
|
|
|
-
|
|
|
|
#include "dxc/Support/Global.h"
|
|
#include "dxc/Support/Global.h"
|
|
#include "dxc/Support/WinIncludes.h"
|
|
#include "dxc/Support/WinIncludes.h"
|
|
#include "dxc/Support/dxcapi.use.h"
|
|
#include "dxc/Support/dxcapi.use.h"
|
|
@@ -27,7 +25,6 @@
|
|
|
|
|
|
#include "dxc/dxcapi.h"
|
|
#include "dxc/dxcapi.h"
|
|
#include "dxc/dxcapi.internal.h"
|
|
#include "dxc/dxcapi.internal.h"
|
|
-#include "dxc/dxcpix.h"
|
|
|
|
#include "dxc/Support/microcom.h"
|
|
#include "dxc/Support/microcom.h"
|
|
#include "dxc/DxilContainer/DxilContainer.h"
|
|
#include "dxc/DxilContainer/DxilContainer.h"
|
|
#include "dxc/DXIL/DxilUtil.h"
|
|
#include "dxc/DXIL/DxilUtil.h"
|
|
@@ -48,7 +45,11 @@
|
|
#include <locale>
|
|
#include <locale>
|
|
#include <codecvt>
|
|
#include <codecvt>
|
|
#include <string>
|
|
#include <string>
|
|
|
|
+
|
|
|
|
+#ifdef _WIN32
|
|
|
|
+#include "dxc/dxcpix.h"
|
|
#include <dia2.h>
|
|
#include <dia2.h>
|
|
|
|
+#endif
|
|
|
|
|
|
using namespace dxc;
|
|
using namespace dxc;
|
|
using namespace llvm;
|
|
using namespace llvm;
|
|
@@ -94,13 +95,13 @@ public:
|
|
return S_OK;
|
|
return S_OK;
|
|
}
|
|
}
|
|
|
|
|
|
- virtual HRESULT STDMETHODCALLTYPE GetFlags(_Out_ UINT32 *pFlags) {
|
|
|
|
|
|
+ virtual HRESULT STDMETHODCALLTYPE GetFlags(_Out_ UINT32 *pFlags) override {
|
|
if (!pFlags) return E_POINTER;
|
|
if (!pFlags) return E_POINTER;
|
|
*pFlags = m_Version.VersionFlags;
|
|
*pFlags = m_Version.VersionFlags;
|
|
return S_OK;
|
|
return S_OK;
|
|
}
|
|
}
|
|
|
|
|
|
- virtual HRESULT STDMETHODCALLTYPE GetCommitInfo(_Out_ UINT32 *pCommitCount, _Outptr_result_z_ char **pCommitHash) {
|
|
|
|
|
|
+ virtual HRESULT STDMETHODCALLTYPE GetCommitInfo(_Out_ UINT32 *pCommitCount, _Outptr_result_z_ char **pCommitHash) override {
|
|
if (!pCommitHash)
|
|
if (!pCommitHash)
|
|
return E_POINTER;
|
|
return E_POINTER;
|
|
|
|
|
|
@@ -110,7 +111,7 @@ public:
|
|
return S_OK;
|
|
return S_OK;
|
|
}
|
|
}
|
|
|
|
|
|
- virtual HRESULT STDMETHODCALLTYPE GetCustomVersionString(_Outptr_result_z_ char **pVersionString) {
|
|
|
|
|
|
+ virtual HRESULT STDMETHODCALLTYPE GetCustomVersionString(_Outptr_result_z_ char **pVersionString) override {
|
|
if (!pVersionString)
|
|
if (!pVersionString)
|
|
return E_POINTER;
|
|
return E_POINTER;
|
|
IFR(CopyStringToOutStringPtr(m_VersionString, pVersionString));
|
|
IFR(CopyStringToOutStringPtr(m_VersionString, pVersionString));
|
|
@@ -143,7 +144,7 @@ public:
|
|
ULONG STDMETHODCALLTYPE Release() override {
|
|
ULONG STDMETHODCALLTYPE Release() override {
|
|
return m_pImpl->Release();
|
|
return m_pImpl->Release();
|
|
}
|
|
}
|
|
- HRESULT STDMETHODCALLTYPE QueryInterface(REFIID iid, void **ppvObject) {
|
|
|
|
|
|
+ HRESULT STDMETHODCALLTYPE QueryInterface(REFIID iid, void **ppvObject) override {
|
|
return m_pImpl->QueryInterface(iid, ppvObject);
|
|
return m_pImpl->QueryInterface(iid, ppvObject);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -207,7 +208,7 @@ public:
|
|
IFR(m_pImpl->GetEntryPoint(&pBlob));
|
|
IFR(m_pImpl->GetEntryPoint(&pBlob));
|
|
return CopyBlobWideToBSTR(pBlob, pResult);
|
|
return CopyBlobWideToBSTR(pBlob, pResult);
|
|
}
|
|
}
|
|
- virtual HRESULT STDMETHODCALLTYPE GetMainFileName(_Outptr_result_z_ BSTR *pResult) {
|
|
|
|
|
|
+ virtual HRESULT STDMETHODCALLTYPE GetMainFileName(_Outptr_result_z_ BSTR *pResult) override {
|
|
CComPtr<IDxcBlobWide> pBlob;
|
|
CComPtr<IDxcBlobWide> pBlob;
|
|
IFR(m_pImpl->GetMainFileName(&pBlob));
|
|
IFR(m_pImpl->GetMainFileName(&pBlob));
|
|
return CopyBlobWideToBSTR(pBlob, pResult);
|
|
return CopyBlobWideToBSTR(pBlob, pResult);
|
|
@@ -225,7 +226,7 @@ public:
|
|
return E_NOTIMPL;
|
|
return E_NOTIMPL;
|
|
}
|
|
}
|
|
|
|
|
|
- virtual HRESULT STDMETHODCALLTYPE CompileForFullPDB(_COM_Outptr_ IDxcResult **ppResult) {
|
|
|
|
|
|
+ virtual HRESULT STDMETHODCALLTYPE CompileForFullPDB(_COM_Outptr_ IDxcResult **ppResult) override {
|
|
return E_NOTIMPL;
|
|
return E_NOTIMPL;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -243,7 +244,7 @@ public:
|
|
return CopyBlobWideToBSTR(pBlob, pResult);
|
|
return CopyBlobWideToBSTR(pBlob, pResult);
|
|
}
|
|
}
|
|
|
|
|
|
- virtual HRESULT STDMETHODCALLTYPE GetVersionInfo(_COM_Outptr_ IDxcVersionInfo **ppVersionInfo) {
|
|
|
|
|
|
+ virtual HRESULT STDMETHODCALLTYPE GetVersionInfo(_COM_Outptr_ IDxcVersionInfo **ppVersionInfo) override {
|
|
return m_pImpl->GetVersionInfo(ppVersionInfo);
|
|
return m_pImpl->GetVersionInfo(ppVersionInfo);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -252,7 +253,11 @@ public:
|
|
}
|
|
}
|
|
};
|
|
};
|
|
|
|
|
|
-struct DxcPdbUtils : public IDxcPdbUtils2, public IDxcPixDxilDebugInfoFactory
|
|
|
|
|
|
+struct DxcPdbUtils : public IDxcPdbUtils2
|
|
|
|
+#ifdef _WIN32
|
|
|
|
+ // Skip Pix debug info on linux for dia dependence.
|
|
|
|
+, public IDxcPixDxilDebugInfoFactory
|
|
|
|
+#endif
|
|
{
|
|
{
|
|
private:
|
|
private:
|
|
// Making the adapter and this interface the same object and share reference counting.
|
|
// Making the adapter and this interface the same object and share reference counting.
|
|
@@ -694,7 +699,7 @@ private:
|
|
case hlsl::DFCC_ShaderDebugName:
|
|
case hlsl::DFCC_ShaderDebugName:
|
|
{
|
|
{
|
|
const hlsl::DxilShaderDebugName *name_header = (const hlsl::DxilShaderDebugName *)(part+1);
|
|
const hlsl::DxilShaderDebugName *name_header = (const hlsl::DxilShaderDebugName *)(part+1);
|
|
- const char *ptr = (char *)(name_header+1);
|
|
|
|
|
|
+ const char *ptr = (const char *)(name_header+1);
|
|
IFR(Utf8ToBlobWide(ptr, &m_Name));
|
|
IFR(Utf8ToBlobWide(ptr, &m_Name));
|
|
} break;
|
|
} break;
|
|
|
|
|
|
@@ -794,10 +799,16 @@ public:
|
|
DXC_MICROCOM_TM_ADDREF_RELEASE_IMPL()
|
|
DXC_MICROCOM_TM_ADDREF_RELEASE_IMPL()
|
|
DXC_MICROCOM_TM_ALLOC(DxcPdbUtils)
|
|
DXC_MICROCOM_TM_ALLOC(DxcPdbUtils)
|
|
|
|
|
|
- DxcPdbUtils(IMalloc *pMalloc) : m_dwRef(0), m_pMalloc(pMalloc), m_Adapter(this) {}
|
|
|
|
|
|
+ DxcPdbUtils(IMalloc *pMalloc) : m_Adapter(this), m_dwRef(0), m_pMalloc(pMalloc) {}
|
|
|
|
|
|
HRESULT STDMETHODCALLTYPE QueryInterface(REFIID iid, void **ppvObject) override {
|
|
HRESULT STDMETHODCALLTYPE QueryInterface(REFIID iid, void **ppvObject) override {
|
|
- HRESULT hr = DoBasicQueryInterface<IDxcPdbUtils2, IDxcPixDxilDebugInfoFactory>(this, iid, ppvObject);
|
|
|
|
|
|
+#ifdef _WIN32
|
|
|
|
+ HRESULT hr =
|
|
|
|
+ DoBasicQueryInterface<IDxcPdbUtils2, IDxcPixDxilDebugInfoFactory>(
|
|
|
|
+ this, iid, ppvObject);
|
|
|
|
+#else
|
|
|
|
+ HRESULT hr = DoBasicQueryInterface<IDxcPdbUtils2>(this, iid, ppvObject);
|
|
|
|
+#endif
|
|
if (FAILED(hr)) {
|
|
if (FAILED(hr)) {
|
|
return DoBasicQueryInterface<IDxcPdbUtils>(&m_Adapter, iid, ppvObject);
|
|
return DoBasicQueryInterface<IDxcPdbUtils>(&m_Adapter, iid, ppvObject);
|
|
}
|
|
}
|
|
@@ -933,7 +944,7 @@ public:
|
|
virtual HRESULT STDMETHODCALLTYPE GetEntryPoint(_COM_Outptr_ IDxcBlobWide **ppResult) override {
|
|
virtual HRESULT STDMETHODCALLTYPE GetEntryPoint(_COM_Outptr_ IDxcBlobWide **ppResult) override {
|
|
return CopyBlobWide(m_EntryPoint, ppResult);
|
|
return CopyBlobWide(m_EntryPoint, ppResult);
|
|
}
|
|
}
|
|
- virtual HRESULT STDMETHODCALLTYPE GetMainFileName(_COM_Outptr_ IDxcBlobWide **ppResult) {
|
|
|
|
|
|
+ virtual HRESULT STDMETHODCALLTYPE GetMainFileName(_COM_Outptr_ IDxcBlobWide **ppResult) override {
|
|
return CopyBlobWide(m_MainFileName, ppResult);
|
|
return CopyBlobWide(m_MainFileName, ppResult);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -962,7 +973,7 @@ public:
|
|
return E_FAIL;
|
|
return E_FAIL;
|
|
}
|
|
}
|
|
|
|
|
|
- virtual HRESULT STDMETHODCALLTYPE GetWholeDxil(_COM_Outptr_result_maybenull_ IDxcBlob **ppResult) {
|
|
|
|
|
|
+ virtual HRESULT STDMETHODCALLTYPE GetWholeDxil(_COM_Outptr_result_maybenull_ IDxcBlob **ppResult) override {
|
|
if (!ppResult) return E_POINTER;
|
|
if (!ppResult) return E_POINTER;
|
|
*ppResult = nullptr;
|
|
*ppResult = nullptr;
|
|
if (m_WholeDxil)
|
|
if (m_WholeDxil)
|
|
@@ -974,6 +985,7 @@ public:
|
|
return CopyBlobWide(m_Name, ppResult);
|
|
return CopyBlobWide(m_Name, ppResult);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+#ifdef _WIN32
|
|
virtual STDMETHODIMP NewDxcPixDxilDebugInfo(
|
|
virtual STDMETHODIMP NewDxcPixDxilDebugInfo(
|
|
_COM_Outptr_ IDxcPixDxilDebugInfo **ppDxilDebugInfo) override
|
|
_COM_Outptr_ IDxcPixDxilDebugInfo **ppDxilDebugInfo) override
|
|
{
|
|
{
|
|
@@ -1005,7 +1017,9 @@ public:
|
|
return E_NOTIMPL;
|
|
return E_NOTIMPL;
|
|
}
|
|
}
|
|
|
|
|
|
- virtual HRESULT STDMETHODCALLTYPE GetVersionInfo(_COM_Outptr_result_maybenull_ IDxcVersionInfo **ppVersionInfo) {
|
|
|
|
|
|
+#endif
|
|
|
|
+
|
|
|
|
+ virtual HRESULT STDMETHODCALLTYPE GetVersionInfo(_COM_Outptr_result_maybenull_ IDxcVersionInfo **ppVersionInfo) override {
|
|
if (!ppVersionInfo)
|
|
if (!ppVersionInfo)
|
|
return E_POINTER;
|
|
return E_POINTER;
|
|
|
|
|
|
@@ -1089,15 +1103,3 @@ HRESULT CreateDxcPdbUtils(_In_ REFIID riid, _Out_ LPVOID *ppv) {
|
|
}
|
|
}
|
|
return E_NOINTERFACE;
|
|
return E_NOINTERFACE;
|
|
}
|
|
}
|
|
-
|
|
|
|
-#else
|
|
|
|
-
|
|
|
|
-#include "dxc/Support/WinIncludes.h"
|
|
|
|
-
|
|
|
|
-HRESULT CreateDxcPdbUtils(_In_ REFIID riid, _Out_ LPVOID *ppv) {
|
|
|
|
- return E_NOTIMPL;
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-#endif
|
|
|
|
-
|
|
|
|
-
|
|
|