100% CPU usage and crash in windowed mode? Nvidia Bug?

Hi all,

Just come across this bug which is giving me a bit of a headache. One of my testers began playing GuildWars recently and strangely my application stopped working on his machine.

The application window would start, but the CPU usage would spike and the buffer swap would stop working resulting eventually in a crash. Now… we traced this down to a certain sequence of events. I’m not sure if it works with other apps but in GW when you go from fullscreen to windowed then back to fullscreen, then exit the app sometime later. If you then try to create a windowed opengl context you get this 100% CPU usage and eventual crash bug.

I’ve included the source of a simple test example (using SDL for simplicity, but I’ve tested using GLQuake as an example and that too crashes when being launched in windowed mode). I discovered strangely that if you launch a fullscreen opengl app after doing the above sequence of events this works fine and effectively ‘clears’ the bug from happening till you do the sequence again.

Can someone test this sequence of events with another DirectX application (GW is directx based), going fullscreen->windowed->fullscreen then try running a windowed opengl app. This only appears to manifest itself on Nvidia drivers as well.

So, any suggestions/workarounds guys? Or is this down to Nvidia or the Guildwars developers? Is this a common directx-opengl interaction bug?

Hope you can help…


Benjamin Delarre

#include <SDL/SDL.h>
#include <iostream>
#include <fstream>

#define WITH_OPENGL 

#ifdef WITH_OPENGL
#include <SDL/SDL_opengl.h>
#endif

using namespace std;

void process_events()
{
    SDL_Event event;

    // grab all the events off the queue
    while(SDL_PollEvent(&event))
	{
        switch(event.type)
		{
		case SDL_QUIT:
			// exit program and pass on error code to system
			exit( 0 );
            break;
        }
    }
}

int main( int argc, char* argv[] )
{
    const SDL_VideoInfo* info = NULL;
    
    int bpp = 0; // bpp for window
    int flags = 0; // sdl flags

    // initialize SDL's video subsystem
    if( SDL_Init( SDL_INIT_VIDEO ) < 0 ) {
        // failed so exit
        cerr << "Video initialization failed: " << SDL_GetError() << endl;
        return -1;
    }

	 // get video info
    info = SDL_GetVideoInfo( );

	 if( !info ) {
        // summat really bad happened
        cerr << "Video query failed: " << SDL_GetError() << endl;
       return -1;
    }

    bpp = info->vfmt->BitsPerPixel;

#ifdef WITH_OPENGL
	// request format for opengl window (5bits each for rgb, and a double buffer setup)
    SDL_GL_SetAttribute( SDL_GL_RED_SIZE, 5 );
    SDL_GL_SetAttribute( SDL_GL_GREEN_SIZE, 5 );
    SDL_GL_SetAttribute( SDL_GL_BLUE_SIZE, 5 );
    SDL_GL_SetAttribute( SDL_GL_DEPTH_SIZE, 16 );
    SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 );

	flags = SDL_OPENGL | SDL_RESIZABLE;  //| SDL_FULLSCREEN; // use fullscreen to clear the crash error
#else
	flags = SDL_RESIZABLE;
#endif

	SDL_WM_SetCaption("OpenGL Test",NULL);

	// set video mode
    if( SDL_SetVideoMode( 640, 480, bpp, flags ) == 0 ) {
        // failed to get requested video mode
        cerr << "Video mode set failed: " << SDL_GetError() << endl;
        return -1;
    }

	while(1)
	{

		process_events();

#ifdef WITH_OPENGL
		SDL_GL_SwapBuffers( );
#endif

		SDL_Delay(1);
    }

	SDL_Quit( );

    return 0;
}

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.