From b3aff7cd2e42eef54f83d37ac946b7e5f6a2b590 Mon Sep 17 00:00:00 2001 From: Philip Rebohle Date: Thu, 22 Mar 2018 13:40:45 +0100 Subject: [PATCH] [d3d11] Fix immediate context initialization The old initialization code did not take either CSMT or Deferred Contexts into account and could lead to illegal calls to beginRecording. Fixes a hang encountered in Dishonored 2. --- src/d3d11/d3d11_context.cpp | 20 -------------------- src/d3d11/d3d11_context_imm.cpp | 4 ++++ 2 files changed, 4 insertions(+), 20 deletions(-) diff --git a/src/d3d11/d3d11_context.cpp b/src/d3d11/d3d11_context.cpp index 918b47ecc..1d9f31001 100644 --- a/src/d3d11/d3d11_context.cpp +++ b/src/d3d11/d3d11_context.cpp @@ -31,26 +31,6 @@ namespace dxvk { m_defaultBlendState = static_cast (defaultBlendState.ptr()); m_defaultDepthStencilState = static_cast(defaultDepthStencilState.ptr()); m_defaultRasterizerState = static_cast (defaultRasterizerState.ptr()); - - EmitCs([ - dev = m_device, - bsState = m_defaultBlendState, - dsState = m_defaultDepthStencilState, - rsState = m_defaultRasterizerState, - blendConst = DxvkBlendConstants { - m_state.om.blendFactor[0], m_state.om.blendFactor[1], - m_state.om.blendFactor[2], m_state.om.blendFactor[3] }, - stencilRef = m_state.om.stencilRef - ] (DxvkContext* ctx) { - ctx->beginRecording(dev->createCommandList()); - - bsState->BindToContext(ctx, 0xFFFFFFFF); - dsState->BindToContext(ctx); - rsState->BindToContext(ctx); - - ctx->setBlendConstants (blendConst); - ctx->setStencilReference(stencilRef); - }); } diff --git a/src/d3d11/d3d11_context_imm.cpp b/src/d3d11/d3d11_context_imm.cpp index ded6eea66..7642ec69e 100644 --- a/src/d3d11/d3d11_context_imm.cpp +++ b/src/d3d11/d3d11_context_imm.cpp @@ -10,7 +10,11 @@ namespace dxvk { Rc Device) : D3D11DeviceContext(pParent, Device), m_csThread(Device->createContext()) { + EmitCs([cDevice = m_device] (DxvkContext* ctx) { + ctx->beginRecording(cDevice->createCommandList()); + }); + ClearState(); }