I have a need to have create a swapchain with the usage flag DXGI_USAGE_SHARED. I am able to successfully create the swap chain and have no problems using the swapchain regular. However, when I try to access the shared handle, I get S_OK and a NULL shared handle.
Here is the code.
// Get the swapchain's back buffer
IDXGIResource * SharedBackBuffer;
SwapChain->GetBuffer(0, __uuidof(IDXGIResource), reinterpret_cast<void**>(&SharedBackBuffer));
// Obtain the handle to the surface
HANDLE SharedHandle;
SharedBackBuffer->GetSharedHandle(&SharedHandle);
// Open the resource in our device and create the view to use the object
ID3D10Texture2D * BackBuffer;
m_Device->OpenSharedResource(SharedHandle, __uuidof(ID3D10Texture2D), reinterpret_cast<void**>(&BackBuffer));
m_Device->CreateRenderTargetView(BackBuffer, NULL, &Data->BackbufferView);
SharedHandle is NULL and the return value of GetSharedHandle is S_OK.
Any help here would be much appreciated.