Jump to content
  • Advertisement
Sign in to follow this  
ScEngMan

Crash in Direct3DCreate9

This topic is 3656 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello, I'm developing an application that uses Direct3D to unwrap a mesh with UVAtlas. In my development machine everything works fine, but in the testing machine it crashes when calling Direct3DCreate9. The testing machine is a fresh WinXP Pro SP2 32bits with Direct3D June 2008 (tests succeed). The simplest command line Direct3D console application also runs fine! The Direct3DCreate9 call is in a DLL (sceng_uvatlas.dll) that is loaded by a Lua module (sceng_base.dll) from Lua: Lua5.1.exe > sceng_base.dll > sceng_uvatlas.dll Is it possible that I'm missing some redistributables? Or that I have to install something else in the testing machine? Many Thanks!

Share this post


Link to post
Share on other sites
Advertisement
I know if you're using VS2005 or 2008 they come with needed VC_redristributables, DX also has a redristributable, but if you have DX installed shouldn't be a problem aslong as the versions are the same or better.

Does your app have any debugging that could help pin point the problem?

Share this post


Link to post
Share on other sites
What do you mean it "crashes"? Access violation? What's the exact error? How do you know it's Direct3DCreate9() that's causing the problem?

Share this post


Link to post
Share on other sites
Yes, the tool is being developed with VC++ 2005.

The application crashes in my testing machine, where I haven't installed Visual Studio, so there is no debugger on it, but I have a logging mechanism that prints a lines to a file.. these are the lines commands in the section where it crashes:

ScEng::SceneEngine::log.Write("DirectXUVAtlas::CreateDirect3D try Direct3DCreate9\n");
IDirect3D9 * d3d9 = Direct3DCreate9( D3D_SDK_VERSION );
ScEng::SceneEngine::log.Write("DirectXUVAtlas::CreateDirect3D created d3d9\n");

The whole file is here:
http://sceneengine.svn.sourceforge.net/viewvc/sceneengine/trunk/SceneEngine/plugins/UVAtlas/src/DXUVAtlas.cpp?view=markup

And this is the last line the log prints:

DirectXUVAtlas::CreateDirect3D try Direct3DCreate9

About how it crashes, I don't really know... Is there a way to know what crashes an application without installing a debugger? I'm afraid that installing visual studio would fix the problem because it works correctly in all the systems with Visual Studio that I have tested it.

Thanks for your help!

Diego
SceneEngine (http://www.sceneengine.org)
Open source 3D production library

Share this post


Link to post
Share on other sites
The Windows crash reporting tool (DrWatson.exe), that pops up after unhandled native exceptions, can give the exact exception code even though a specialized debugger is not installed (as it is actually a rudimentary debugger itself).

You should check that the D3D initialization actually succeeds before you try to create your device. A possible cause of failure in this point is the lack of a suitable hardware and/or driver to run D3D9. In the event of said failure, calling CreateDevice on the D3D factory interface will result in access violation (0xc0000005) at kernel. As for the actual check, initialize the IDirect3D9 pointer to zero and check if it is still zero (failure condition) after you've tried to create it.

In general, it is recommended that you check for error conditions after each and every API call your program makes. This way, you will avoid potential catastrophy (system-wide crash/malfunction on a mission critical system, for example), and debugging without dedicated tools is a lot easier (just log the failures).

Share this post


Link to post
Share on other sites
Hi Nik02

The crash isn't caught by DrWatson, the application (Lua console) just closes without any message box or warning.

The application closes in line 51 of this source file:

http://sceneengine.svn.sourceforge.net/viewvc/sceneengine/trunk/SceneEngine/plugins/UVAtlas/src/DXUVAtlas.cpp?view=markup
51 : m_d3d9 = Direct3DCreate9( D3D_SDK_VERSION );

Which is actually the first Direct3D call it makes... It's actually creating the Direct3D instance object.

I have just released a new beta version of SceneEngine which includes the UVAtlas plugin with the issue for if anyone is willing to test it.

http://www.sceneengine.org/download.html

Thank you very much for your help!

Diego
SceneEngine (http://www.sceneengine.org)
Open source 3D production library

Share this post


Link to post
Share on other sites
You don't need to install Visual Studio to debug a process...you can just use one of the available Windows Debugging Tools, such as WinDbg. If you attach it to the process, you'll be able to break on any exceptions that occur in the code before they get handled.

Share this post


Link to post
Share on other sites
Obvious one to try just in case: Make sure if your building a debug build that the test machine has the debug DLL's installed. The other thing is to make sure that all the DLL's your DLL requires are installed. You can use a tool like http://www.dependencywalker.com/ to check what your DLL may be missing.

Share this post


Link to post
Share on other sites
It's not a dependancy issue, since if it was the application would either fail to start, or LoadLibrary would fail (If you use dynamic linking). Unless you're using late binding...

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!