1
0
mirror of https://github.com/EduApps-CDG/OpenDX synced 2024-12-30 09:45:37 +01:00

[d3d11] Lock immediate context when submitting presentation commands

Otherwise, a race condition occurs if a game submits rendering commands
at the same time as presenting the swap chain image. Only works if
multithreaded protection is enabled, but according to MSDN, it is
illegal to use DXGI commands and the immediate context in parallel.

Fixes stability issues in Tales of Vesperia.
This commit is contained in:
Philip Rebohle 2020-01-15 23:41:09 +01:00
parent a7b4c29957
commit 18450f4643
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99
2 changed files with 6 additions and 4 deletions

View File

@ -700,6 +700,10 @@ namespace dxvk {
VkImageLayout OldLayout,
VkImageLayout NewLayout);
D3D10DeviceLock LockContext() {
return m_multithread.AcquireLock();
}
protected:
D3D11Device* const m_parent;
@ -917,10 +921,6 @@ namespace dxvk {
return pShader != nullptr ? pShader->GetCommonShader() : nullptr;
}
D3D10DeviceLock LockContext() {
return m_multithread.AcquireLock();
}
template<typename Cmd>
void EmitCs(Cmd&& command) {
m_cmdData = nullptr;

View File

@ -368,6 +368,8 @@ namespace dxvk {
D3D11ImmediateContext* pContext,
const vk::PresenterSync& Sync,
uint32_t FrameId) {
auto lock = pContext->LockContext();
// Present from CS thread so that we don't
// have to synchronize with it first.
m_presentStatus.result = VK_NOT_READY;