PDA

View Full Version : Multi process opengl (SHELL+GAME) free resources, performance issue



Arnaud Maye
03-11-2007, 06:22 AM
Hi Guys,

I am finishing a diploma project. The project is a game, which having a shell as well as a game. The point is having a system "arcade game" a like.

The shell is using opengl to render various user interface menus and displays as well as processing inputs (coin insertion, start game botton, other buttons, operator menus and such).

When a "start button" is pressed, I launch the game as a separate process, and minimizing the shell window to stop rendering. At this time the shell is on sleep mode , as the game sent a VM_SLEEP custom message. When message WM_WAKE up is received from the game, the shell start to render again on full screen. This gets no cpu usage for the shell while the game process is running.

The problem is that resource are still used by the shell (ie Rendering context still active and not destroyed ) which causes perforances issues in the game obviously.

I would like to know if there is a way to "sleep" the rendering on my shell without the delete the rendering context and destroy the window.

If I destroy the rendering context, obviously I need to reload all texture and providing various inits.

If I close the window, obviously I will not receive the VM_WAKEUP signal from the game.

If I could "sleep" the resource used by the shell till the WM_WAKEUP message is received, I would not have performance issues on the game anymore.

Does anyone has ideas, pointers or clue in how to achieve this?

Kind Regards

Zengar
03-11-2007, 08:39 AM
This is not possible with GL AFAK, you will have to delete the context if you want to free resources while your application is minimized.

knackered
03-11-2007, 11:34 AM
You should have no performance problems if you've stopped the shell process from rendering. Make the rendering context not current, and stop rendering...the driver should eventually page out all the card resident resources as the game allocates its own resources.

Arnaud Maye
03-12-2007, 09:47 AM
Hi Guys,

thank you for your answers.

as an answer to knackered, I would give some details about the three steps he referred:

stopped the shell process from rendering :
------------------------------------------

So this is achieved, while application is minimized, the shell runs into the "Message pump" without to reach the game process main loop rendering.

Make the rendering context not current:
---------------------------------------

This I achieved right now after reading your answer, I did add a wglMakeCurrent(NULL, NULL); when entering sleep mode.

stop rendering :
----------------

About this one, am unsure. If the shell process doesnt render anymore and the context is not current, is there any thing else to do to stop rendering?

At this time, the performance are already much better, but still not as high as game itself without shell.

As both shell and game works on two monitors output (shell1+2, game1+2) during game is running I have four GL windows openned, I tried to destroy both shell windows (shell output 1 and shell output 2). Of course the shell cannot wake up anymore, but in this case game performance are 100%

Maybe this is releated to the third step you suggered?

Destroying windows and reinit both of them is quite heavy and I would like to avoid this.

Thanks again

Warm regards!