Windows: If we don't care about OpenGL accel and FULL fails, try NO accel. SDL-1.2
authorRyan C. Gordon <icculus@icculus.org>
Mon, 07 Nov 2011 16:01:03 -0500
branchSDL-1.2
changeset 6059a04171d6fa11
parent 6058 6144843db128
child 6081 895486678126
Windows: If we don't care about OpenGL accel and FULL fails, try NO accel.
src/video/wincommon/SDL_wingl.c
     1.1 --- a/src/video/wincommon/SDL_wingl.c	Sun Nov 06 16:51:51 2011 -0500
     1.2 +++ b/src/video/wincommon/SDL_wingl.c	Mon Nov 07 16:01:03 2011 -0500
     1.3 @@ -176,6 +176,7 @@
     1.4  	int i;
     1.5  	int iAttribs[64];
     1.6  	int *iAttr;
     1.7 +	int *iAccelAttr = NULL;
     1.8  	float fAttribs[1] = { 0 };
     1.9  	const GLubyte *(WINAPI *glGetStringFunc)(GLenum);
    1.10  	const char *wglext;
    1.11 @@ -232,6 +233,7 @@
    1.12  	   probably what they wanted (and if you didn't care and got FULL, that's
    1.13  	   a perfectly valid result in any case. */
    1.14  	*iAttr++ = WGL_ACCELERATION_ARB;
    1.15 +	iAccelAttr = iAttr;
    1.16  	if (this->gl_config.accelerated) {
    1.17  		*iAttr++ = WGL_FULL_ACCELERATION_ARB;
    1.18  	} else {
    1.19 @@ -301,6 +303,12 @@
    1.20  
    1.21  		/* Choose and set the closest available pixel format */
    1.22  		pixel_format = ChoosePixelFormatARB(this, iAttribs, fAttribs);
    1.23 +		/* App said "don't care about accel" and FULL accel failed. Try NO. */
    1.24 +		if ( ( !pixel_format ) && ( this->gl_config.accelerated < 0 ) ) {
    1.25 +			*iAccelAttr = WGL_NO_ACCELERATION_ARB;
    1.26 +			pixel_format = ChoosePixelFormatARB(this, iAttribs, fAttribs);
    1.27 +			*iAccelAttr = WGL_FULL_ACCELERATION_ARB;  /* if we try again. */
    1.28 +		}
    1.29  		if ( !pixel_format ) {
    1.30  			pixel_format = ChoosePixelFormat(GL_hdc, &GL_pfd);
    1.31  		}