[dxgi] Query device interface from the presenter

Removes the coupling between IDXGISwapChain and IDXGIDevice.
This is necessary because D3D12 devices don't support IDXGIDevice.
This commit is contained in:
Philip Rebohle 2018-10-24 15:52:09 +02:00
parent 7b9726fd93
commit 589229f4ca
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99
5 changed files with 16 additions and 3 deletions

View File

@ -73,6 +73,13 @@ namespace dxvk {
} }
HRESULT STDMETHODCALLTYPE D3D11SwapChain::GetDevice(
REFIID riid,
void** ppDevice) {
return m_parent->QueryInterface(riid, ppDevice);
}
HRESULT STDMETHODCALLTYPE D3D11SwapChain::GetImage( HRESULT STDMETHODCALLTYPE D3D11SwapChain::GetImage(
UINT BufferId, UINT BufferId,
REFIID riid, REFIID riid,

View File

@ -40,6 +40,10 @@ namespace dxvk {
HRESULT STDMETHODCALLTYPE GetDesc( HRESULT STDMETHODCALLTYPE GetDesc(
DXGI_SWAP_CHAIN_DESC1* pDesc); DXGI_SWAP_CHAIN_DESC1* pDesc);
HRESULT STDMETHODCALLTYPE GetDevice(
REFIID riid,
void** ppDevice);
HRESULT STDMETHODCALLTYPE GetImage( HRESULT STDMETHODCALLTYPE GetImage(
UINT BufferId, UINT BufferId,
REFIID riid, REFIID riid,

View File

@ -29,6 +29,10 @@ IDXGIVkSwapChain : public IUnknown {
virtual HRESULT STDMETHODCALLTYPE GetDesc( virtual HRESULT STDMETHODCALLTYPE GetDesc(
DXGI_SWAP_CHAIN_DESC1* pDesc) = 0; DXGI_SWAP_CHAIN_DESC1* pDesc) = 0;
virtual HRESULT STDMETHODCALLTYPE GetDevice(
REFIID riid,
void** ppDevice) = 0;
virtual HRESULT STDMETHODCALLTYPE GetImage( virtual HRESULT STDMETHODCALLTYPE GetImage(
UINT BufferId, UINT BufferId,

View File

@ -35,7 +35,6 @@ namespace dxvk {
if (FAILED(device->GetAdapter(&adapter))) if (FAILED(device->GetAdapter(&adapter)))
throw DxvkError("DXGI: DxgiSwapChain: Failed to retrieve adapter"); throw DxvkError("DXGI: DxgiSwapChain: Failed to retrieve adapter");
m_device = static_cast<DxgiDevice*>(device.ptr());
m_adapter = static_cast<DxgiAdapter*>(adapter.ptr()); m_adapter = static_cast<DxgiAdapter*>(adapter.ptr());
// Initialize frame statistics // Initialize frame statistics
@ -93,7 +92,7 @@ namespace dxvk {
HRESULT STDMETHODCALLTYPE DxgiSwapChain::GetDevice(REFIID riid, void** ppDevice) { HRESULT STDMETHODCALLTYPE DxgiSwapChain::GetDevice(REFIID riid, void** ppDevice) {
return m_device->QueryInterface(riid, ppDevice); return m_presenter->GetDevice(riid, ppDevice);
} }

View File

@ -136,7 +136,6 @@ namespace dxvk {
Com<DxgiFactory> m_factory; Com<DxgiFactory> m_factory;
Com<DxgiAdapter> m_adapter; Com<DxgiAdapter> m_adapter;
Com<DxgiDevice> m_device;
HWND m_window; HWND m_window;
DXGI_SWAP_CHAIN_DESC1 m_desc; DXGI_SWAP_CHAIN_DESC1 m_desc;