Skip to main content
GameDev.net gamedev.net
🔒 Locked

Unload dll

Started by sascoo Aug 20, 2008 at 7:54 PM 5 replies 1.2k views
Original Post
sascoo
sascoo
So I am currently debugging an OpenGL/DirectX game engine I have been working on for quite a while and have come up with a problem. I have the engine set up so that it can switch between the two modes at run-time and I noticed that for each time i switch from OpenGL to DirectX, a new thread gets spawned. I assume that the threads are slowing down my frame rate and are probably not good overall. I also found that this dll igdumd32.dll may be associated with the new threads. The dll has to do with graphics acceleration for an intel chipset. Is this dll my problem or is it a DirectX dll and if so, how can I unload them? Thanks, John
Evil Steve
Evil Steve
Sounds like a problem with your drivers to me. When you "switch between modes", do you properly release all memory associated with your OpenGL or Direct3D context? Do you have your OpenGL and D3D code in the one EXE, or are you using DLLs for renderers or something?
sascoo
sascoo
I am using a single exe. When I switch between OpenGL and DirectX I delete the graphics object associated with the renderer. With DirectX I release the LPDIRECT3DDEVICE9 and LPDIRECT3D9. In OpenGL I release HGLRC and HDC. I know the problem is with the DirectX because every time I switch to that, it adds a new thread.

This is what I ended up with when I stopped my program after switching back and forth a few times.
The thread 'Win32 Thread' (0x1f0) has exited with code 0 (0x0).The thread 'Win32 Thread' (0xa38) has exited with code 0 (0x0).The thread 'Win32 Thread' (0x13dc) has exited with code 0 (0x0).The thread 'Win32 Thread' (0xd14) has exited with code 0 (0x0).The thread 'Win32 Thread' (0x564) has exited with code 0 (0x0).The thread 'Win32 Thread' (0x1088) has exited with code 0 (0x0).The program '[3788] Engine.exe: Native' has exited with code 0 (0x0).


When I don't switch, it will only close two threads at the end of the execution...

Is there any way I can see what dll each thread is associated with?
Promit
Promit
How many processor cores does your system have? Also, can you see more and more threads appearing in the Threads debug window?
SlimDX | Ventspace Blog | Twitter | Diverse teams make better games. I am currently hiring capable C++ engine developers in Baltimore, MD.
sascoo
sascoo
Alright, I wasn't watching the output window during execution. It is closing most of the threads during run-time. It always closes with three threads when I switch to gl and back to dx. If I don't switch it closes with only two threads. I know that there is a problem because my framerate drops by 20 when I render with dx after switching. I am using a very low end system so I am wondering if I should even worry about this extra thread since during use, the probability of someone switching between gl and dx is very small...

I am using a core2 at 1.66 GHz, gig and a half of ram, Intel Mobile 945gm express for my graphics card -- smoking system eh? ;)
Promit
Promit
Well, I was curious because sometimes the graphics driver will create a thread behind your back to do some work (their way of trying to extract some parallelism from strictly single threaded games), I thought maybe that was what you were seeing.
SlimDX | Ventspace Blog | Twitter | Diverse teams make better games. I am currently hiring capable C++ engine developers in Baltimore, MD.
sascoo
sascoo
Yeah, that's what I am thinking it is, but it looks as if it is creating two instances... Whatever, I have much bigger issues to worry about right now then an extra graphics thread. Thanks for your help though.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.