Fix incorrect casting of forward declared ID3D11Device. Refs #316

* After clang-format re-arranged headers, the definition of
  WrappedID3D11Device was no longer visible from d3d11_context.h, but
  instead just the pre-declared "class WrappedID3D11Device;"
* This meant the function didn't correctly upcast to the right parent
  type and left the return value with the wrong vtable which would crash
This commit is contained in:
baldurk
2016-08-05 09:39:26 +02:00
parent d6d36f6383
commit bf6a62c1b3
2 changed files with 7 additions and 5 deletions
+6
View File
@@ -210,6 +210,12 @@ WrappedID3D11DeviceContext::~WrappedID3D11DeviceContext()
RenderDoc::Inst().GetCrashHandler()->UnregisterMemoryRegion(this);
}
void WrappedID3D11DeviceContext::GetDevice(ID3D11Device **ppDevice)
{
*ppDevice = (ID3D11Device *)m_pDevice;
(*ppDevice)->AddRef();
}
const char *WrappedID3D11DeviceContext::GetChunkName(D3D11ChunkType idx)
{
return m_pDevice->GetChunkName(idx);
+1 -5
View File
@@ -359,11 +359,7 @@ public:
return m_pRealContext->GetPrivateData(Name, pDataSize, pData);
}
virtual void STDMETHODCALLTYPE GetDevice(ID3D11Device **ppDevice)
{
*ppDevice = (ID3D11Device *)m_pDevice;
(*ppDevice)->AddRef();
}
virtual void STDMETHODCALLTYPE GetDevice(ID3D11Device **ppDevice);
//////////////////////////////
// implement ID3D11DeviceContext