sean
sean

Reputation: 478

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

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!

Upvotes: 2

Views: 2618

Answers (2)

BradGrantham
BradGrantham

Reputation: 31

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().

Upvotes: 3

VuVirt
VuVirt

Reputation: 1917

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

Upvotes: 2

Related Questions