【发布时间】:2010-07-07 18:00:46
【问题描述】:
我正在试用 DX10 的共享资源功能,因为我的一个项目需要这个功能。但我找不到太多示例或代码,尤其是使用 SlimDX。根据 DX10 文档,我只需要将资源指定为共享,然后我可以使用来自另一个应用程序的 OpenSharedResource() 打开它。在 SlimDX 中使用一个简单的测试应用程序,我做了以下操作
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);
但我不断收到此错误
E_INVALIDARG: An invalid parameter was passed to the returning function (-2147024809)
我似乎无法弄清楚出了什么问题,因为 tex.ComPointer 可能不是 OpenSharedResource 的正确指针,或者不支持 Texture2D(文档中没有明确提到它不在)
通过指定 pHandle 传递给 CreateTexture 函数的另一种选择在 SlimDX 中不可用,或者我不知道。
有人试过这个成功吗?一些帮助将不胜感激。
谢谢
【问题讨论】:
标签: directx direct3d slimdx direct3d10