使用KeyedMutex的SlimDX Warp设备

时间:2012-10-02 21:24:06

标签: slimdx direct2d direct3d11 warp

我通过KeyedMutex将Direct2D与DirectX11一起使用。如果我使用硬件设备,一切都很好。一旦我默认使用Warp设备,当我创建一个Texture2D对象时遇到问题,我收到错误消息“Direct3D11Exception:E_OUTOFMEMORY:Ran out of memory”

这些是负责的行:

    SlimDX.Direct3D11.Texture2DDescription tds = SlimDX.Direct3D11.Texture2D.FromSwapChain(swapChain, 0).Description;
    tds.BindFlags |= BindFlags.ShaderResource;
    tds.SampleDescription = new SampleDescription(1, 0);
    tds.OptionFlags |= ResourceOptionFlags.KeyedMutex;
    textureD3D11 = new SlimDX.Direct3D11.Texture2D(device, tds);

同样,使用硬件设备一切都很好,而不是Warp。当我对PIX运行时,我看到了这一点:

< 0x09033390> ID3D11Device:CreateTexture2D(0x0FD1E330,NULL,0x0FD1E32C - > NULL)

那是使用Warp驱动程序,但是当我使用硬件时,最后一个NULL不是NULL,它是一个指向D3D11 Texture2D对象的实际指针。

有什么想法?我知道我这里没有包含太多代码,但我希望有人知道这是什么,而不必发布整个DX例程。如果需要,我会。

我使用调试和10.1 DX。调试输出如下:

DXX32: Warn: Registry value too long: MainVideo_SET in SYSTEM\ControlSet001\Control\Class\{4D36E968-E325-11CE-BFC1-08002BE10318}\0000\UMD
DXX32: Warn: Registry value too long: MainVideo_SET in SYSTEM\ControlSet001\Control\Class\{4D36E968-E325-11CE-BFC1-08002BE10318}\0000\UMD
D3D11: WARNING: ID3D11Device::SetPrivateData: Possible re-use of existing private data GUID for different data (size has changed). [ STATE_SETTING WARNING #55: SETPRIVATEDATA_CHANGINGPARAMS ]
D3D11: WARNING: ID3D11Texture2D::SetPrivateData: Existing private data of same name with different size found! [ STATE_SETTING WARNING #55: SETPRIVATEDATA_CHANGINGPARAMS ]
Unable to load D2D debug layer
First-chance exception at 0x7558d36f in nART.exe: Microsoft C++ exception: _com_error at memory location 0x068ec964..
First-chance exception at 0x7558d36f in nART.exe: Microsoft C++ exception: _com_error at memory location 0x068eccf8..
First-chance exception at 0x7558d36f in nART.exe: Microsoft C++ exception: _com_error at memory location 0x068ece3c..
First-chance exception at 0x7558d36f in nART.exe: Microsoft C++ exception: _com_error at memory location 0x068edfb4..
D3D11: ERROR: ID3D11Device::CreateTexture2D: Returning E_OUTOFMEMORY, meaning memory was exhausted. [ STATE_CREATION ERROR #105: CREATETEXTURE2D_OUTOFMEMORY_RETURN ]
D3D11: WARNING: Live Device: Name="device", Addr=0x00097D58, ExtRef=4 [ STATE_CREATION WARNING #2097297: LIVE_DEVICE ]
D3D11: WARNING: Live Device Child Summary: Device Addr=0x00097D58
Using ID3D11Debug::ReportLiveDeviceObjects with D3D11_RLDO_DETAIL will help drill into object lifetimes. Objects with ExtRef=0 and IntRef=0 will be eventually destroyed through typical Immediate Context usage. However, if the application requires these objects to be destroyed sooner, ClearState followed by Flush on the Immediate Context will realize their destruction.
Live              Context:      1
Live               Buffer:      0
Live            Texture1D:      0
Live            Texture2D:      1
Live            Texture3D:      0
Live   ShaderResourceView:      0
Live     RenderTargetView:      1
Live     DepthStencilView:      0
Live         VertexShader:      0
Live       GeometryShader:      0
Live          PixelShader:      0
Live          InputLayout:      0
Live              Sampler:      1
Live           BlendState:      1
Live    DepthStencilState:      1
Live      RasterizerState:      1
Live                Query:      1
Live            Predicate:      0
Live              Counter:      0
Live          CommandList:      0
Live           HullShader:      0
Live         DomainShader:      0
Live        ClassInstance:      0
Live         ClassLinkage:      0
Live        ComputeShader:      0
Live  UnorderedAccessView:      0
 [ STATE_CREATION WARNING #2097298: LIVE_OBJECT_SUMMARY ]
A first chance exception of type 'SlimDX.Direct3D11.Direct3D11Exception' occurred in SlimDX.dll
An unhandled exception of type 'SlimDX.Direct3D11.Direct3D11Exception' occurred in SlimDX.dll

Additional information: E_OUTOFMEMORY: Ran out of memory (-2147024882)

1 个答案:

答案 0 :(得分:0)

Warp设备最多只能支持Windows 7中的功能级别10.1。

http://msdn.microsoft.com/en-us/library/windows/desktop/ff728764(v=vs.85).aspx

此外,如果您想获得正确的错误消息,请使用Debug选项标志创建您的设备。

然后在项目属性的调试选项卡中,勾选“启用非托管代码调试”

现在调试你的将在Debug输出中有更清晰的通知。