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:
parent
a7b4c29957
commit
18450f4643
@ -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;
|
||||
|
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user