Skip to content

Commit

Permalink
[dxgi] Store device pointer in DxgiSwapChainDispatcher
Browse files Browse the repository at this point in the history
  • Loading branch information
Paul Gofman authored and doitsujin committed Oct 20, 2022
1 parent 53a0c37 commit e311f25
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/dxgi/dxgi_factory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ namespace dxvk {
}

// Wrap object in swap chain dispatcher
*ppSwapChain = new DxgiSwapChainDispatcher(frontendSwapChain.ref());
*ppSwapChain = new DxgiSwapChainDispatcher(frontendSwapChain.ref(), pDevice);
return S_OK;
}

Expand Down
9 changes: 7 additions & 2 deletions src/dxgi/dxgi_swapchain_dispatcher.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ namespace dxvk {

public:

DxgiSwapChainDispatcher(IDXGISwapChain4* dispatch)
: m_dispatch(dispatch) {
DxgiSwapChainDispatcher(IDXGISwapChain4* dispatch, IUnknown* device)
: m_device(device),
m_dispatch(dispatch) {
}

virtual ~DxgiSwapChainDispatcher() {
Expand Down Expand Up @@ -296,6 +297,10 @@ namespace dxvk {

private:

// m_device is not used or reference counted, provided for compatibility with mod engines
// which expect to find device pointer in the memory after swapchain interface.
IUnknown* m_device;

IDXGISwapChain4* m_dispatch;

};
Expand Down

0 comments on commit e311f25

Please sign in to comment.