I use Direct2D with DirectX11 via KeyedMutex. Everything works great if I am using a Hardware device. As soon as I default to Warp device I have a problem when I go to create a Texture2D object, I get the error message "Direct3D11Exception: E_OUTOFMEMORY: Ran out of memory"
These are the lines that are responsible:
[source lang="csharp"]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);[/source]
Again, everything works great using a Hardware device, just not Warp. When I run it against PIX I see this:
<0x09033390> ID3D11Device:CreateTexture2D(0x0FD1E330, NULL, 0x0FD1E32C --> NULL)
That's using the Warp driver, but when I use Hardware that last NULL is not NULL, it's an actual pointer which points to a D3D11 Texture2D object. I've tried modifying the parameters of tds every way thinkable.
Any thoughts? I know I haven't included much code here but I was hoping someone would know what this was without having to post the whole DX routine. I will if requested.
SlimDX Warp Device using KeyedMutex
I suppose it's possible that the Warp device is returning a new texture every time you call Texture2D.FromSwapChain, instead of reusing the previous one. In that case you'd have to Dispose() of the returned texture after you got its description. It'd be quite annoying if that were true.
Even if I switch to:
SlimDX.Direct3D11.Texture2DDescription tds = new Texture2DDescription();
I still get the out of memory error. I just thought I could save steps by using FromSwapChain by not having to supply parameters like height, width, format, etc...
I am using either DX 10.1 or DX10.0. Here is the entire debug output:
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)
BTW, what is the best method to dispose of the swapchain texture then? I've been using this:
using (Texture2D texture = Texture2D.FromSwapChain<Texture2D>(swapChain, 0))
texture.Dispose();
Will that just be creating a new one and disposing it?
SlimDX.Direct3D11.Texture2DDescription tds = new Texture2DDescription();
I still get the out of memory error. I just thought I could save steps by using FromSwapChain by not having to supply parameters like height, width, format, etc...
I am using either DX 10.1 or DX10.0. Here is the entire debug output:
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)
BTW, what is the best method to dispose of the swapchain texture then? I've been using this:
using (Texture2D texture = Texture2D.FromSwapChain<Texture2D>(swapChain, 0))
texture.Dispose();
Will that just be creating a new one and disposing it?
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement