I am using a WPF application where upto 1000 images can be opened, each of them being rendered in separate user control. Currently, for each image, I am creating a new DX9 device i.e. if I am opening 1000 images simultaneously, I am creating 1000 DX9 devices, where each device contains the handle for its associated user control. Only on closing any image, its respective device gets disposed…
The App was working fine till NVIDIA driver version 518.03 and I was able to create upto 1000 devices. However, starting NVIDIA ver. 527.48, I can create only 420-430 devices, after which on creating a new device .ctor, it throws an exception {“D3DERR_NOTAVAILABLE: Not available (-2005530518)”}.
Here is the SlimDX9 C# code snippet for device .ctor which gets called in a loop depending on number of images-
try
{
d3d = new SlimDX.Direct3D9.Direct3D();
_pclsDevice = new Device(d3d, 0, DeviceType.Hardware, _clsManagedDirectXDeviceWrapper.Handle, _emCreateFlags, new PresentParameters { pclsPresentParams });
}
catch(Exception ex)
{}
Here, I am using createFlags and pclsPresentParams as below-
_emCreateFlags = CreateFlags.HardwareVertexProcessing | CreateFlags.PureDevice | CreateFlags.FpuPreserve;
pclsPresentParams.Windowed = true;
pclsPresentParams.BackBufferCount = 1;
pclsPresentParams.Multisample = MultisampleType.None;
pclsPresentParams.MultisampleQuality = 0;
pclsPresentParams.SwapEffect = SwapEffect.Discard;
pclsPresentParams.EnableAutoDepthStencil = true;
pclsPresentParams.AutoDepthStencilFormat = Format.D16;
pclsPresentParams.PresentFlags = PresentFlags.None;
pclsPresentParams.FullScreenRefreshRateInHertz = 0;
pclsPresentParams.PresentationInterval = PresentInterval.Immediate;
Not sure how latest NVIDIA drivers are impacting this device creation logic. .
Need some suggestion for resolving this issue. Any help would be appreciated.