Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Fixed bug 1161 (Setting GL_ACCELERATED_VISUAL to 1 forces software re…
Browse files Browse the repository at this point in the history
…ndering in Windows XP)

 Jesse Anders      2011-03-05 23:30:09 PST

It seems that in Windows XP, setting SDL_GL_ACCELERATED_VISUAL to 1 actually
disables hardware acceleration and puts OpenGL in software mode.

In the source code, the corresponding WGL attribute is first set here:

*iAttr++ = WGL_ACCELERATION_ARB;
*iAttr++ = WGL_FULL_ACCELERATION_ARB;

Later, this code:

if (_this->gl_config.accelerated >= 0) {
    *iAttr++ = WGL_ACCELERATION_ARB;
    *iAttr++ =
        (_this->gl_config.accelerated ? WGL_GENERIC_ACCELERATION_ARB :
         WGL_NO_ACCELERATION_ARB);
}

Sets it again if SDL_GL_ACCELERATED_VISUAL has a value other than the default.

More importantly, the documentation I found states that
WGL_GENERIC_ACCELERATION_ARB asks for an MDC driver, which, although I don't
know much about this topic, doesn't seem like the correct choice here. As
mentioned previously, the end effect is that requesting hardware acceleration
in Windows XP actually forces the renderer into software mode (on my system at
least), which I'm guessing isn't the desired behavior.
  • Loading branch information
slouken committed Mar 7, 2011
1 parent bbb2ead commit 32c3182
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions src/video/windows/SDL_windowsopengl.c
Expand Up @@ -409,8 +409,6 @@ WIN_GL_SetupWindow(_THIS, SDL_Window * window)

*iAttr++ = WGL_DRAW_TO_WINDOW_ARB;
*iAttr++ = GL_TRUE;
*iAttr++ = WGL_ACCELERATION_ARB;
*iAttr++ = WGL_FULL_ACCELERATION_ARB;
*iAttr++ = WGL_RED_BITS_ARB;
*iAttr++ = _this->gl_config.red_size;
*iAttr++ = WGL_GREEN_BITS_ARB;
Expand Down Expand Up @@ -469,12 +467,9 @@ WIN_GL_SetupWindow(_THIS, SDL_Window * window)
*iAttr++ = _this->gl_config.multisamplesamples;
}

if (_this->gl_config.accelerated >= 0) {
*iAttr++ = WGL_ACCELERATION_ARB;
*iAttr++ =
(_this->gl_config.accelerated ? WGL_GENERIC_ACCELERATION_ARB :
WGL_NO_ACCELERATION_ARB);
}
*iAttr++ = WGL_ACCELERATION_ARB;
*iAttr++ = (_this->gl_config.accelerated ? WGL_FULL_ACCELERATION_ARB :
WGL_NO_ACCELERATION_ARB);

*iAttr = 0;

Expand Down

0 comments on commit 32c3182

Please sign in to comment.