針對D3D11_RESOURCE_MISC_GDI_COMPATIBLE
創建的紋理,IDXGISurface1
GetDC/ReleaseDC
的線程安全規則是什麼?IDXGISurface1 GetDC/ReleaseDC的線程安全/同步規則?
我可以與另一個線程GetDC
和ReleaseDC
之間ID3D11Device
和ID3D11DeviceContext
互動,無需數據爭或因阻止隱式同步?或者我爲了避免GPU空閒,強制爲線程執行GDI渲染而創建單獨的D3D11Device
,然後通過複製到D3D11_RESOURCE_MISC_SHARED_KEYED_MUTEX
將其轉移回「主」D3D11Device
?
即下列有效?
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.