1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2024-11-30 13:24:10 +01:00

[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.
This commit is contained in:
Philip Rebohle 2018-03-22 13:40:45 +01:00
parent 7f6c8dff95
commit b3aff7cd2e
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99
2 changed files with 4 additions and 20 deletions

View File

@ -31,26 +31,6 @@ namespace dxvk {
m_defaultBlendState = static_cast<D3D11BlendState*> (defaultBlendState.ptr());
m_defaultDepthStencilState = static_cast<D3D11DepthStencilState*>(defaultDepthStencilState.ptr());
m_defaultRasterizerState = static_cast<D3D11RasterizerState*> (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);
});
}

View File

@ -10,7 +10,11 @@ namespace dxvk {
Rc<DxvkDevice> Device)
: D3D11DeviceContext(pParent, Device),
m_csThread(Device->createContext()) {
EmitCs([cDevice = m_device] (DxvkContext* ctx) {
ctx->beginRecording(cDevice->createCommandList());
});
ClearState();
}