I'm trying out the shared resources feature of DX10, as I needed this for one of my project. But I'm can't find much sample or code especially using SlimDX. According to DX10 documentation, I just need to specified the resources as Shared, then I can open it using OpenSharedResource() from another application. With a simple test application in SlimDX, I did the following
Texture2D tex = new Texture2D(device, new Texture2DDescription()
{
ArraySize = 1,
BindFlags = BindFlags.RenderTarget | BindFlags.ShaderResource,
CpuAccessFlags = CpuAccessFlags.None,
Format = Format.B8G8R8A8_UNorm,
Height = 128,
Width = 128,
MipLevels = 1,
OptionFlags = ResourceOptionFlags.Shared,
SampleDescription = new SampleDescription(1, 0),
Usage = ResourceUsage.Default,
});
Texture2D tex2 = device.OpenSharedResource<Texture2D>(tex.ComPointer);
But I keep getting this error
E_INVALIDARG: An invalid parameter was passed to the returning function (-2147024809)
I can't seems to figure out what went wrong, as the tex.ComPointer might not be the right pointer for OpenSharedResource or Texture2D is not supported (it's not clearly mentioned that it isn't in the documentation)
The other alternative by specifying pHandle to be passed into the CreateTexture function is not available in SlimDX or I'm not aware of it.
Has anyone who has tried this successfully? Some help would be grateful.
Thanks