Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2457
  • Last Modified:

Get D3DERR_INVALIDCALL on directX new device

Can anyone please help me with this problem. I look at simmilar questions, but the code is too different from mine to use the solution I found from other got the same error. It's only happens on some computers. Directx work with other programs on the computers my program is not working on.

This is the error message:
-2005530516 (D3DERR_INVALIDCALL)
   at Microsoft.DirectX.Direct3D.Device..ctor(Int32 adapter, DeviceType deviceType, Control renderWindow, CreateFlags behaviorFlags, PresentParameters[] presentationParameters)

Thanks for your help!
void init()
        {
            _wnd = new Form();
            _wnd.FormBorderStyle = FormBorderStyle.None;
            _wnd.Text = "RenderWindow";
            _wnd.Size = _fullScreenSize;
            _wnd.BackColor = Color.Black;
            //_wnd.Show();
            Application.DoEvents();
 
//this line is causing the error
            _device = new D3D.Device(  _screen, D3D.DeviceType.Hardware, _wnd, CreateFlags.MixedVertexProcessing | CreateFlags.FpuPreserve, getPresentParams() );
            _device.DeviceLost += new EventHandler(_device_DeviceLost);
            _rt = _device.GetRenderTarget(0);
            _frameInterval = TimeSpan.FromSeconds( 1.0 / _device.DisplayMode.RefreshRate );
                      
 
            _keyboard = new DI.Device( SystemGuid.Keyboard );
            _keyboard.SetCooperativeLevel( _wnd, CooperativeLevelFlags.Foreground | CooperativeLevelFlags.Exclusive | CooperativeLevelFlags.NoWindowsKey );
 
            QueryPerformanceFrequency( out _timerFrequency );
            QueryPerformanceCounter( out _timerBaseline );
            _timeBaseline = DateTime.Now;
        }

Open in new window

0
OddisW
Asked:
OddisW
  • 3
  • 3
2 Solutions
 
PaulHewsCommented:
A couple of thoughts just thrown out there.

-Do the samples from the DirectX SDK work properly?  Look in <DirectX SDK install folder>\Samples\Managed\Direct3D
-What does the call to getPresentParams return?

0
 
OddisWAuthor Commented:
The sample DirectX work properly on the macines where it failed. In fact my customer have tested it on 5 machines, and it only worked on one. DxDiag work on all of them.

The getPresentParams return:
MultiSampleQuality: 0
PresentationInterval: Default
FullScreenRefreshRateInHz: 0
PresentFlag: None
AutoDepthStencilFormat: Unknown
EnableAutoDepthStencil: False
Windowed: True
DeviceWindowHandle: 0
DeviceWindow:
SwapEffect: Discard
MultiSample: None
BackBufferCount: 0
BackBufferFormat: Unknown
BackBufferHeight: 0
BackBufferWidth: 0
ForceNoMultiThreadedFlag: False


0
 
PaulHewsCommented:
The PresentParams look okay, and everything looks pretty generic.  Try passing 0 instead of _screen.

Do the affected computers have the right version of DirectX?  Do they have up to date drivers?

0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
OddisWAuthor Commented:
Thanks for your response Paul.

The _screen was already 0 at the time new Device is called.

The other computers has the latest build of DX 9. We have double checked that it's the same versions. The program was initially wroten for about 3 years ago when DX 9 was new, but then it was not thouroughly tested.
0
 
PaulHewsCommented:
And are the video drivers all the same version?
0
 
OddisWAuthor Commented:
I ended up rewritting the entire code and used an example from microsoft to initialize the directx with the correct parameters. It seems like it was some of the graphics drivers that didn't worked with vertex processing in hardware mode.
0

Featured Post

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now