diff --git a/src/d3d11/d3d11_context_imm.cpp b/src/d3d11/d3d11_context_imm.cpp index 3c92379f..0523cc5f 100644 --- a/src/d3d11/d3d11_context_imm.cpp +++ b/src/d3d11/d3d11_context_imm.cpp @@ -15,7 +15,7 @@ namespace dxvk { D3D11Device* pParent, const Rc& Device) : D3D11DeviceContext(pParent, Device, DxvkCsChunkFlag::SingleUse), - m_csThread(Device->createContext()), + m_csThread(Device, Device->createContext()), m_videoContext(this, Device) { EmitCs([ cDevice = m_device, diff --git a/src/d3d9/d3d9_device.cpp b/src/d3d9/d3d9_device.cpp index b3baee71..b531f46a 100644 --- a/src/d3d9/d3d9_device.cpp +++ b/src/d3d9/d3d9_device.cpp @@ -48,7 +48,7 @@ namespace dxvk { , m_d3d9Options ( dxvkDevice, pParent->GetInstance()->config() ) , m_multithread ( BehaviorFlags & D3DCREATE_MULTITHREADED ) , m_isSWVP ( (BehaviorFlags & D3DCREATE_SOFTWARE_VERTEXPROCESSING) ? true : false ) - , m_csThread ( dxvkDevice->createContext() ) + , m_csThread ( dxvkDevice, dxvkDevice->createContext() ) , m_csChunk ( AllocCsChunk() ) { // If we can SWVP, then we use an extended constant set // as SWVP has many more slots available than HWVP. diff --git a/src/dxvk/dxvk_cs.cpp b/src/dxvk/dxvk_cs.cpp index 5b70c725..7f1678c0 100644 --- a/src/dxvk/dxvk_cs.cpp +++ b/src/dxvk/dxvk_cs.cpp @@ -95,8 +95,11 @@ namespace dxvk { } - DxvkCsThread::DxvkCsThread(const Rc& context) - : m_context(context), m_thread([this] { threadFunc(); }) { + DxvkCsThread::DxvkCsThread( + const Rc& device, + const Rc& context) + : m_device(device), m_context(context), + m_thread([this] { threadFunc(); }) { } diff --git a/src/dxvk/dxvk_cs.h b/src/dxvk/dxvk_cs.h index b59873a7..77d5ad8d 100644 --- a/src/dxvk/dxvk_cs.h +++ b/src/dxvk/dxvk_cs.h @@ -6,6 +6,8 @@ #include #include "../util/thread.h" + +#include "dxvk_device.h" #include "dxvk_context.h" namespace dxvk { @@ -382,7 +384,9 @@ namespace dxvk { constexpr static uint64_t SynchronizeAll = ~0ull; - DxvkCsThread(const Rc& context); + DxvkCsThread( + const Rc& device, + const Rc& context); ~DxvkCsThread(); /** @@ -418,7 +422,8 @@ namespace dxvk { private: - const Rc m_context; + Rc m_device; + Rc m_context; std::atomic m_chunksDispatched = { 0ull }; std::atomic m_chunksExecuted = { 0ull };