SlimDX Device.Reset 崩溃并显示“D3DERR_INVALIDCALL:无效调用 (-2005530516)”错误

发布于 2024-08-26 04:25:43 字数 724 浏览 9 评论 0原文

我们最近从 VS 2005 升级到 VS 2008 (Windows XP)。我们在一个项目中使用了 SlimDx。升级后一切正常,除了我的恢复功能,该功能在设备丢失/设备重置时被调用,并崩溃

D3DERR_INVALIDCALL:无效调用 (-2005530516)

我使用 Ctrl-Alt-Del 然后使用 Escape 来模拟设备丢失。

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)
   {}
 }

这是否与 VS 2008 有关,因为它曾经与 VS 2005 配合得很好?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

小姐丶请自重 2024-09-02 04:25:43

我在此论坛帖子中找到了一些有用的信息。请注意该论坛上与 VB 相关的问题,但这仍然是很好的信息。完全归功于Simon O'Connor

重新格式化并稍加编辑。

INVALIDCALL 通常意味着您传递给 D3D 的参数无效或您请求的操作不可能。

找出 D3D 调用返回 INVALIDCALL 错误原因的最简单方法是让它告诉您:

  1. 确保您使用的是已安装的 D3D 运行时调试版本(安装 SDK 时会向您提供该选项)。
  2. 确保启用运行时的 DEBUG 版本。转到控制面板中的 DirectX 小程序,然后在 Direct3D 选项卡下查看。
  3. 在 DirectX 控制面板小程序中,将 Direct3D 的调试输出级别增加到最大。
    我已经 10 多年没有使用 Visual BASIC,所以我忘记了有哪些调试支持可用,而且我没有在这台机器上安装它来检查...如果 VB 确实有调试输出窗口:
  4. 运行您的程序并让它失败并出现 INVALIDCALL 错误。
  5. 现在查看调试输出窗口中的所有文本。 D3D 将记录信息、警告和重要的错误。它还将解释 D3D 调用失败的原因。

如果 VB 没有简单的调试输出窗口,请从 http://www.sysinternals.com 下载并运行 DebugView 或使用 DirectX SDK 附带的命令行调试查看器

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

兲鉂ぱ嘚淚 2024-09-02 04:25:43

当您没有处理所有资源(顶点缓冲区、纹理等)时,通常会发生这种情况

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

小女人ら 2024-09-02 04:25:43
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) {} 
}
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) {} 
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文