What are the thread-safety rules for IDXGISurface1
GetDC/ReleaseDC
for textures created with D3D11_RESOURCE_MISC_GDI_COMPATIBLE
?
Can I interact with ID3D11Device
and ID3D11DeviceContext
between GetDC
and ReleaseDC
on another thread, without data-races or blocking due to implicit synchronization? Or am I in order avoid the GPU idling forced to create a separate D3D11Device
for the thread doing GDI rendering and then transferring it back to the "main"D3D11Device
by copying to a D3D11_RESOURCE_MISC_SHARED_KEYED_MUTEX
?
i.e. is the following valid?
thread 1:
D3D11Device::CreateTexture2D // Create texture 1
IDXGISurface1::GetDC // Get DC for texture 1
... // Draw to texture1 using GDI
IDXGISurtface1::ReleaseDC // Release DC for texture1
thread 2:
// Is this valid if thread 1 is drawing using GDI?
D3D11DeviceContext::OMSetRenderTargets
D3D11DeviceContext::Draw // Draw texture2.