From c223e356084a7f6702d7a073651d2b04960d465e Mon Sep 17 00:00:00 2001 From: Philip Rebohle Date: Sun, 5 Aug 2018 16:40:03 +0200 Subject: [PATCH] [d3d11] Do not keep a strong reference to the swap chain back buffer Fixes crash in Yakuza 0 with fullscreen mode enabled. SEGA, please, stop being lazy and learn to use reference counting correctly. --- src/d3d11/d3d11_present.cpp | 11 +++++++++++ src/d3d11/d3d11_present.h | 6 +++--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/d3d11/d3d11_present.cpp b/src/d3d11/d3d11_present.cpp index 181de151..f88e0a7d 100644 --- a/src/d3d11/d3d11_present.cpp +++ b/src/d3d11/d3d11_present.cpp @@ -4,6 +4,17 @@ namespace dxvk { + D3D11VkBackBuffer::D3D11VkBackBuffer(D3D11Texture2D* pTexture) + : m_texture(pTexture) { + m_texture->AddRefPrivate(); + } + + + D3D11VkBackBuffer::~D3D11VkBackBuffer() { + m_texture->ReleasePrivate(); + } + + HRESULT STDMETHODCALLTYPE D3D11VkBackBuffer::QueryInterface(REFIID riid, void** ppvObject) { return m_texture->QueryInterface(riid, ppvObject); } diff --git a/src/d3d11/d3d11_present.h b/src/d3d11/d3d11_present.h index 9c7063f1..a543ddbb 100644 --- a/src/d3d11/d3d11_present.h +++ b/src/d3d11/d3d11_present.h @@ -14,8 +14,8 @@ namespace dxvk { public: - D3D11VkBackBuffer(D3D11Texture2D* pTexture) - : m_texture(pTexture) { } + D3D11VkBackBuffer(D3D11Texture2D* pTexture); + ~D3D11VkBackBuffer(); HRESULT STDMETHODCALLTYPE QueryInterface( REFIID riid, @@ -25,7 +25,7 @@ namespace dxvk { public: - Com m_texture; + D3D11Texture2D* m_texture; };