2012-10-02 72 views
0

我通過KeyedMutex將Direct2D與DirectX11一起使用。如果我使用硬件設備,一切正常。當我默認爲經線設備我有一個問題,當我去創造一個Texture2D對象,我得到錯誤信息「Direct3D11Exception:E_OUTOFMEMORY:用完了內存」使用KeyedMutex的SlimDX Warp設備

這是負責的線路:

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); 

再次,一切都很好使用硬件設備,而不是變形。當我運行它針對PIX我看到這一點:

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

這是使用經驅動程序,但是當我使用的硬件,去年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) 

回答

0

經編設備只能支持在Windows 7

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

此外,如果你想擁有正確的錯誤消息,擁有10.1的水平,創建你的設備與調試選項標誌。

然後在你的項目屬性的調試選項卡,勾選「啓用非託管代碼調試」

現在您調試將在您的調試輸出更清晰的通知。

+0

我把整個調試輸出在我原來的問題。我正在使用DX10.1或10.0通過featurelevel進行warp。 – FrozT

+0

似乎很奇怪,因爲你似乎沒有太多的記憶。出於興趣,你爲什麼需要一個扭曲裝置? :) – catflier

+0

爲防萬一用戶不能支持硬件DX10,我創建了一個warp設備。這不是一款遊戲,它打算成爲一款低功耗應用程序,更適合商業用途。 – FrozT