问题
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