The purpose is to try and share surface between two different d3d devices of different version, one being d3d9, the other being d3d9Ex or higher.
Based on the MSDN documentation where it states you can do so from link.
Direct3D resources can now be shared between devices or processes. This applies to any Direct3D resource including textures, vertex buffers, index buffers, or surfaces (such as render targets, depth stencil buffers or off-screen plain surfaces).
Also based on MSDN documentation where it states you can't do so from another link
Direct3D 10.0, Direct3D 9c, and older Direct3D runtimes do not support shared surfaces. System memory copies will continue to be used for interoperability with GDI or DXGI-based APIs.
To verify is to try it myself, thus the code:
HANDLE SharedHandle = NULL;
IDirect3DTexture9 *d3d9Tex;
pD3D9Dev->CreateTexture(Width, Height, 1, D3DUSAGE_RENDERTARGET, Format, D3DPOOL_DEFAULT, &d3d9Tex, &SharedHanlde);
if(FAILED(hr))
{
LOG("failed %s %s", GetD3DErrorString(hr), CNGetErrorString(GetLastError()));
}
IDirect3DTexture9 *d3d9ExTex;
pD3D9DevEx->CreateTexture(Width, Height, 1, D3DUSAGE_RENDERTARGET, Format, D3DPOOL_DEFAULT, &d3d9ExTex, &SharedHanlde);
if(FAILED(hr))
{
LOG("failed %s %s", GetD3DErrorString(hr), CNGetErrorString(GetLastError()));
}
Which gives:
Direct3D9: (ERROR) :Device is not capable of sharing resource. CreateTexture fails.
CreateRenderTarget gives same results.
Much disappointed with the result, my question is, is resource sharing suppose to work for d3d9 at all, or am I missing something that I should have do?