How do I pass a handle of DXGI shared resource to another process?

倾然丶 夕夏残阳落幕 提交于 2019-12-14 03:20:38

问题


https://msdn.microsoft.com/en-us/library/windows/desktop/bb174562(v=vs.85).aspx

According to the documentation of IDXGIResource::GetSharedHandle, I should be able to "marshal this handle to another process to share a resource with a device in another process".

But it's not clear how to pass this handle. Can I just pass the value of this handle to another process? Or do I need some specific method?

Thanks!


回答1:


Yes, you can pass this handle directly to another process and access it via OpenSharedResource function.




回答2:


Microsoft's documentation now suggests using CreateSharedHandle() instead of GetSharedHandle() and creating the texture with D3D11_RESOURCE_MISC_SHARED_NTHANDLE. I had to call DuplicateHandle() in order to pass the created HANDLE to another process to be opened with OpenSharedResource1().



来源:https://stackoverflow.com/questions/42527906/how-do-i-pass-a-handle-of-dxgi-shared-resource-to-another-process

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!