SlimDX Device.Reset crashes with a "D3DERR_INVALIDCALL: Invalid call (-2005530516)" error
Asked Answered
C

3

7

We recently upgraded from VS 2005 to VS 2008 (Windows XP). We use SlimDx in one of our projects. All was working ok after the upgrade, except my Recover function, which gets called on devicelost/device reset which crashes with

D3DERR_INVALIDCALL: Invalid call (-2005530516)

I use Ctrl-Alt-Del and then Escape to simulate device lost.

void Recover()
{
  try
     {
         if (res.Code == D3DERR_DEVICENOTRESET)
         { 
           res = m_device.Reset(m_presentParams); //Crashes on this.
           if (res.IsSuccess)
           {
             m_deviceLost = false; 
            }
          }
     }
   catch(Exception e)
   {}
 }

Is this something to do with VS 2008, as it used to work nicely with VS 2005?

Cureall answered 23/3, 2010 at 4:47 Comment(4)
Anything in the debug spew that helps you?Virgenvirgie
A quick search for "D3DERR_INVALIDCALL Reset" lead to MSDN. "The method call is invalid. For example, a method's parameter may have an invalid value." So my suggestion would be to check m_presentParams; does it contain the information you expect it to?European
solved: some of the resources (stateblocks) were not disposed.Cureall
I had the same issue when using Axiom3D, a .NET implementation of Ogre that uses SlimDX for DirectX support. Unsolved in my case...Apoplectic
A
9

I found some helpful information in this forum post. Note the question on that forum related to VB but this is still good info. Full credit to Simon O'Connor.

Reformatted and edited slightly.

INVALIDCALL usually means that either a parameter you've passed to D3D is invalid or an operation you've requested isn't possible.

The easiest way to find out why a D3D call returned an INVALIDCALL error is to let it tell you:

  1. Make sure you're using the DEBUG version of the D3D runtime is installed (you were given the option when you installed the SDK).
  2. Make sure that the DEBUG version of the runtime is enabled. Go to the DirectX applet in the Control Panel and look under the Direct3D tab.
  3. Whilst in the DirectX control panel applet, increase the debug output level for Direct3D to maximum. I've not used Visual BASIC for over 10 years so I've forgotten what debugging support is available and I don't have it installed on this machine to check... If VB DOES have a debug output window:
  4. Run your program and let it fail with the INVALIDCALL error.
  5. Now look at all the text in your debug output window. D3D will log information, warnings, and importantly errors to that. It'll also explain the reason WHY a D3D call has failed.

If VB doesn't have a simple debug output window, download and run DebugView from http://www.sysinternals.com or use the command line debug viewer that comes with the DirectX SDK

Apoplectic answered 29/6, 2010 at 5:44 Comment(2)
dude, op solved the problem long time ago. See the comments ("some of the resources (stateblocks) were not disposed").Dustup
@SigTerm, yep, got that. In my case it has nothing to do with stateblocks. This is a generic error message, but this SO post has high google ranking for the error code, so I posed this answer in the hope that it might help someone else coming in via a search.Apoplectic
W
2

This usually happens when you didn't dispose all you resources (vertex buffer, texture, ...)

Wingfooted answered 15/10, 2012 at 17:23 Comment(0)
L
0
void Recover() 
{ 
   try { 
            if (res.Code == D3DERR_DEVICENOTRESET) 
            { 
                 res = m_device.Reset(m_presentParams); //Crashes on this. 
                 if (res.IsSuccess) 
                 { 
                      m_deviceLost = false; 
                 } 
            } 
   } catch(Exception e) {} 
}
Lifelike answered 12/7, 2013 at 15:7 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.