[d3d11] Move QueryInterface to D3D11CommonContext

This commit is contained in:
Philip Rebohle 2022-08-03 17:09:30 +02:00
parent 4af974768a
commit 10345d0063
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99
5 changed files with 46 additions and 45 deletions

View File

@ -32,46 +32,6 @@ namespace dxvk {
}
HRESULT STDMETHODCALLTYPE D3D11DeviceContext::QueryInterface(REFIID riid, void** ppvObject) {
if (ppvObject == nullptr)
return E_POINTER;
*ppvObject = nullptr;
if (riid == __uuidof(IUnknown)
|| riid == __uuidof(ID3D11DeviceChild)
|| riid == __uuidof(ID3D11DeviceContext)
|| riid == __uuidof(ID3D11DeviceContext1)
|| riid == __uuidof(ID3D11DeviceContext2)
|| riid == __uuidof(ID3D11DeviceContext3)
|| riid == __uuidof(ID3D11DeviceContext4)) {
*ppvObject = ref(this);
return S_OK;
}
if (riid == __uuidof(ID3D11VkExtContext)
|| riid == __uuidof(ID3D11VkExtContext1)) {
*ppvObject = ref(&m_contextExt);
return S_OK;
}
if (riid == __uuidof(ID3DUserDefinedAnnotation)
|| riid == __uuidof(IDXVKUserDefinedAnnotation)) {
*ppvObject = ref(&m_annotation);
return S_OK;
}
if (riid == __uuidof(ID3D10Multithread)) {
*ppvObject = ref(&m_multithread);
return S_OK;
}
Logger::warn("D3D11DeviceContext::QueryInterface: Unknown interface query");
Logger::warn(str::format(riid));
return E_NOINTERFACE;
}
void STDMETHODCALLTYPE D3D11DeviceContext::DiscardResource(ID3D11Resource* pResource) {
D3D10DeviceLock lock = LockContext();

View File

@ -32,10 +32,6 @@ namespace dxvk {
DxvkCsChunkFlags CsFlags);
~D3D11DeviceContext();
HRESULT STDMETHODCALLTYPE QueryInterface(
REFIID riid,
void** ppvObject);
void STDMETHODCALLTYPE DiscardResource(ID3D11Resource *pResource);
void STDMETHODCALLTYPE DiscardView(ID3D11View* pResourceView);

View File

@ -20,6 +20,47 @@ namespace dxvk {
}
template<typename ContextType>
HRESULT STDMETHODCALLTYPE D3D11CommonContext<ContextType>::QueryInterface(REFIID riid, void** ppvObject) {
if (ppvObject == nullptr)
return E_POINTER;
*ppvObject = nullptr;
if (riid == __uuidof(IUnknown)
|| riid == __uuidof(ID3D11DeviceChild)
|| riid == __uuidof(ID3D11DeviceContext)
|| riid == __uuidof(ID3D11DeviceContext1)
|| riid == __uuidof(ID3D11DeviceContext2)
|| riid == __uuidof(ID3D11DeviceContext3)
|| riid == __uuidof(ID3D11DeviceContext4)) {
*ppvObject = ref(this);
return S_OK;
}
if (riid == __uuidof(ID3D11VkExtContext)
|| riid == __uuidof(ID3D11VkExtContext1)) {
*ppvObject = ref(&m_contextExt);
return S_OK;
}
if (riid == __uuidof(ID3DUserDefinedAnnotation)
|| riid == __uuidof(IDXVKUserDefinedAnnotation)) {
*ppvObject = ref(&m_annotation);
return S_OK;
}
if (riid == __uuidof(ID3D10Multithread)) {
*ppvObject = ref(&m_multithread);
return S_OK;
}
Logger::warn("D3D11DeviceContext::QueryInterface: Unknown interface query");
Logger::warn(str::format(riid));
return E_NOINTERFACE;
}
template<typename ContextType>
void STDMETHODCALLTYPE D3D11CommonContext<ContextType>::UpdateSubresource(
ID3D11Resource* pDstResource,

View File

@ -64,6 +64,10 @@ namespace dxvk {
~D3D11CommonContext();
HRESULT STDMETHODCALLTYPE QueryInterface(
REFIID riid,
void** ppvObject);
void STDMETHODCALLTYPE UpdateSubresource(
ID3D11Resource* pDstResource,
UINT DstSubresource,

View File

@ -57,7 +57,7 @@ namespace dxvk {
return S_OK;
}
return D3D11DeviceContext::QueryInterface(riid, ppvObject);
return D3D11CommonContext<D3D11ImmediateContext>::QueryInterface(riid, ppvObject);
}