Solved

Get D3DERR_INVALIDCALL on directX new device

Posted on 2008-11-02
8
2,435 Views
Last Modified: 2013-12-17
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
Comment
Question by:OddisW
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
8 Comments
 
LVL 38

Assisted Solution

by:PaulHews
PaulHews earned 500 total points
ID: 22950030
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
 

Author Comment

by:OddisW
ID: 22971570
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
 
LVL 38

Expert Comment

by:PaulHews
ID: 22977022
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
Why You Need a DevOps Toolchain

IT needs to deliver services with more agility and velocity. IT must roll out application features and innovations faster to keep up with customer demands, which is where a DevOps toolchain steps in. View the infographic to see why you need a DevOps toolchain.

 

Author Comment

by:OddisW
ID: 22979394
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
 
LVL 38

Expert Comment

by:PaulHews
ID: 22979452
And are the video drivers all the same version?
0
 

Accepted Solution

by:
OddisW earned 0 total points
ID: 23225133
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

How our DevOps Teams Maximize Uptime

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us. Read the use case whitepaper.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Artificial Intelligence comes in many forms, and for game developers, Path-Finding is an important ability for making an NPC (Non-Playable Character) maneuver through terrain.  A* is a particularly easy way to approach it.  I’ll start with the algor…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

710 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question