virtual void STDMETHODCALLTYPE CopyResource(
/* [annotation] */
_In_ ID3D11Resource *pDstResource,
/* [annotation] */
_In_ ID3D11Resource *pSrcResource);
I have questions about this function, especially when there are read and write operations immediately on pDstResource, such as the following code, because of asynchronous, Can I ensure that every time pDstResource is a newly rendered image instead of black_color?
This suspicion is because before using IDXGIOutputDuplication::AcquireNextFrame to get the first frame and calling CopyResource, it takes a short time to Sleep before you can see that pDstResource is copied (judging from the rendering output).
Refer to performance considerations, I still don’t know the principle here, whether it is when WinB wants to access pDstResource_shared, Direct3D will be synchronized internally (that is, executing the CopyResource command)? Worried about misunderstanding.
for(;;) { 1, WinA_Clear(black_color) 2, WinA_DrawRedTriangleOnTexture(pSrcResource) 3, WinA_CopyResource(pDstResource_shared, pSrcResource) 4, WinB_Clear(white_color) 5, WinB_RenderTexture(pDstResource_shared) }