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 6059 a04171d6fa11
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
--- a/src/video/wincommon/SDL_wingl.c	Sun Nov 06 16:51:51 2011 -0500
+++ b/src/video/wincommon/SDL_wingl.c	Mon Nov 07 16:01:03 2011 -0500
@@ -176,6 +176,7 @@
 	int i;
 	int iAttribs[64];
 	int *iAttr;
+	int *iAccelAttr = NULL;
 	float fAttribs[1] = { 0 };
 	const GLubyte *(WINAPI *glGetStringFunc)(GLenum);
 	const char *wglext;
@@ -232,6 +233,7 @@
 	   probably what they wanted (and if you didn't care and got FULL, that's
 	   a perfectly valid result in any case. */
 	*iAttr++ = WGL_ACCELERATION_ARB;
+	iAccelAttr = iAttr;
 	if (this->gl_config.accelerated) {
 		*iAttr++ = WGL_FULL_ACCELERATION_ARB;
 	} else {
@@ -301,6 +303,12 @@
 
 		/* Choose and set the closest available pixel format */
 		pixel_format = ChoosePixelFormatARB(this, iAttribs, fAttribs);
+		/* App said "don't care about accel" and FULL accel failed. Try NO. */
+		if ( ( !pixel_format ) && ( this->gl_config.accelerated < 0 ) ) {
+			*iAccelAttr = WGL_NO_ACCELERATION_ARB;
+			pixel_format = ChoosePixelFormatARB(this, iAttribs, fAttribs);
+			*iAccelAttr = WGL_FULL_ACCELERATION_ARB;  /* if we try again. */
+		}
 		if ( !pixel_format ) {
 			pixel_format = ChoosePixelFormat(GL_hdc, &GL_pfd);
 		}