Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
Lock the d3d10 device during presentation #833
The D3D10Device uses a mutex to avoid accessing the D3D11ImmediateContext from multiple threads at the same time. The new D3D11Swapchain needs to be locked as well because with D3D10 it's not guaranteed that the game only accesses the ImmediateContext from the render thread.
This fixes Just Cause 2 for me. I haven't done that much testing, just 5 minutes of running around an shooting things.
In theory D3D11VkInterop has the same issue because it also accesses the ImmediateContext.
Interesting, although I'm not sure if this is really the best way to fix this since this thread safety issue is not necessarily exclusive to D3D10. Can you test if this patch works as well?
I think the whole D3D10 thread safety thing needs some work anyway since currently both the D3D11 context and D3D10 device use a mutex, which should be redundant since the D3D10 code itself doesn't really do anything.