Return a dummy ID3D10Multithreaded to stop D2D from whining. Refs #402

This commit is contained in:
baldurk
2016-10-30 17:23:51 +01:00
parent 8852b5f739
commit 4dc75a69fe
2 changed files with 64 additions and 0 deletions
+22
View File
@@ -336,6 +336,7 @@ WrappedID3D11Device::WrappedID3D11Device(ID3D11Device *realDevice, D3D11InitPara
m_Alive = true;
m_DummyInfoQueue.m_pDevice = this;
m_DummyD3D10Multithread.m_pDevice = this;
m_DummyDebug.m_pDevice = this;
m_WrappedDebug.m_pDevice = this;
@@ -530,6 +531,18 @@ void WrappedID3D11Device::CheckForDeath()
}
}
ULONG STDMETHODCALLTYPE DummyID3D10Multithread::AddRef()
{
m_pDevice->AddRef();
return 1;
}
ULONG STDMETHODCALLTYPE DummyID3D10Multithread::Release()
{
m_pDevice->Release();
return 1;
}
ULONG STDMETHODCALLTYPE DummyID3D11InfoQueue::AddRef()
{
m_pDevice->AddRef();
@@ -750,6 +763,15 @@ HRESULT WrappedID3D11Device::QueryInterface(REFIID riid, void **ppvObject)
return E_NOINTERFACE;
}
}
else if(riid == __uuidof(ID3D10Multithread))
{
RDCWARN(
"Returning a dummy ID3D10Multithread that does nothing. This ID3D10Multithread will not "
"work!");
*ppvObject = (ID3D10Multithread *)&m_DummyD3D10Multithread;
m_DummyD3D10Multithread.AddRef();
return S_OK;
}
else if(riid == ID3D11ShaderTraceFactory_uuid)
{
RDCWARN("Trying to get ID3D11ShaderTraceFactory. Not supported at this time.");
+42
View File
@@ -75,6 +75,47 @@ struct D3D11InitParams : public RDCInitParams
class WrappedID3D11Device;
class WrappedShader;
// declare this here as we don't want to pull in the whole D3D10 headers
MIDL_INTERFACE("9B7E4E00-342C-4106-A19F-4F2704F689F0")
ID3D10Multithread : public IUnknown
{
public:
virtual void STDMETHODCALLTYPE Enter(void) = 0;
virtual void STDMETHODCALLTYPE Leave(void) = 0;
virtual BOOL STDMETHODCALLTYPE SetMultithreadProtected(
/* [annotation] */
_In_ BOOL bMTProtect) = 0;
virtual BOOL STDMETHODCALLTYPE GetMultithreadProtected(void) = 0;
};
struct DummyID3D10Multithread : public ID3D10Multithread
{
WrappedID3D11Device *m_pDevice;
DummyID3D10Multithread() : m_pDevice(NULL) {}
//////////////////////////////
// implement IUnknown
HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void **ppvObject) { return E_NOINTERFACE; }
ULONG STDMETHODCALLTYPE AddRef();
ULONG STDMETHODCALLTYPE Release();
//////////////////////////////
// implement ID3D10Multithread
virtual void STDMETHODCALLTYPE Enter(void) { return; }
virtual void STDMETHODCALLTYPE Leave(void) { return; }
virtual BOOL STDMETHODCALLTYPE SetMultithreadProtected(
/* [annotation] */
_In_ BOOL bMTProtect)
{
return TRUE;
}
virtual BOOL STDMETHODCALLTYPE GetMultithreadProtected(void) { return TRUE; }
};
// We can pass through all calls to ID3D11Debug without intercepting, this
// struct isonly here so that we can intercept QueryInterface calls to return
// ID3D11InfoQueue
@@ -280,6 +321,7 @@ private:
D3D11Replay m_Replay;
DummyID3D10Multithread m_DummyD3D10Multithread;
DummyID3D11InfoQueue m_DummyInfoQueue;
DummyID3D11Debug m_DummyDebug;
WrappedID3D11Debug m_WrappedDebug;