diff --git a/libobs-d3d11/d3d11-rebuild.cpp b/libobs-d3d11/d3d11-rebuild.cpp index bdce20c95..6912cf764 100644 --- a/libobs-d3d11/d3d11-rebuild.cpp +++ b/libobs-d3d11/d3d11-rebuild.cpp @@ -89,6 +89,15 @@ void gs_texture_2d::Rebuild(ID3D11Device *dev) if (FAILED(hr)) throw HRError("Failed to create GDI surface", hr); } + + acquired = false; + + if ((td.MiscFlags & D3D11_RESOURCE_MISC_SHARED_KEYEDMUTEX) != 0) { + ComQIPtr dxgi_res(texture); + if (dxgi_res) + GetSharedHandle(dxgi_res); + device_texture_acquire_sync(this, 0, INFINITE); + } } void gs_texture_2d::RebuildNV12_Y(ID3D11Device *dev) @@ -108,6 +117,15 @@ void gs_texture_2d::RebuildNV12_Y(ID3D11Device *dev) InitRenderTargets(); tex_uv->RebuildNV12_UV(dev); + + acquired = false; + + if ((td.MiscFlags & D3D11_RESOURCE_MISC_SHARED_KEYEDMUTEX) != 0) { + ComQIPtr dxgi_res(texture); + if (dxgi_res) + GetSharedHandle(dxgi_res); + device_texture_acquire_sync(this, 0, INFINITE); + } } void gs_texture_2d::RebuildNV12_UV(ID3D11Device *dev)