[quake3-bugzilla] [Bug 4316] New: SDL Gamma sometimes fails to initialize; must be asked twice

bugzilla-daemon at icculus.org bugzilla-daemon at icculus.org
Fri Oct 23 04:01:17 EDT 2009


http://bugzilla.icculus.org/show_bug.cgi?id=4316

           Summary: SDL Gamma sometimes fails to initialize; must be asked
                    twice
           Product: ioquake3
           Version: SVN HEAD
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: minor
          Priority: P3
         Component: Video
        AssignedTo: zakk at icculus.org
        ReportedBy: lakitu7 at gmail.com
         QAContact: quake3-bugzilla at icculus.org


Created an attachment (id=2185)
 --> (http://bugzilla.icculus.org/attachment.cgi?id=2185)
ask SDL_SetGamma nicely a second time to please work correctly

For some people with Nvidia cards in Windows, hardware gamma sometimes fails to
initialize. As a result, the user is stuck in software gamma, wondering why
nothing happens when they change r_gamma.

After finally getting more people than just myself who experience this pretty
rare issue, we narrowed down the common denominator to multiple monitors. You
can have any Nvidia card on any flavor of windows (actually, this problem has
followed me across motherboards and GPUs and from XP32 to Win7-64), but the
main narrowing constant between my setups and those of the others affected is
two monitors running in Dualview.

Anyhow, while this is clearly not a bug in ioq3, there is a workaround that can
be applied trivial that fixes the issue completely for all known affected users
while not affecting anyone else. Quite simply, the first request to
SDL_SetGamma is lazy and fails mysteriously without returning an error, but if
you ask it a second time, it complies. Thus, you simply take this line:

glConfig.deviceSupportsGamma = !!( SDL_SetGamma( 1.0f, 1.0f, 1.0f ) >= 0 );
and do it twice, to form:
glConfig.deviceSupportsGamma = !!( SDL_SetGamma( 1.0f, 1.0f, 1.0f ) >= 0 );
glConfig.deviceSupportsGamma = !!( SDL_SetGamma( 1.0f, 1.0f, 1.0f ) >= 0 );

A couple links have been found discussing the issue elsewhere that are
consistent with our findings:
http://cubeengine.com/forum.php4?action=display_thread&thread_id=1890&start=264
http://trac.wildfiregames.com/ticket/136

This workaround has been in widespread use in several popular unofficial builds
of Tremulous clients, without causing any ill effects. While I certainly
realize the problem is not IOQ3's and the "fix" is in fact a hacky workaround,
you could save a subset of users some hassle and confusion by applying it. And,
even if you choose not to, then at least this bug is here so it's known. 

Thank you to "Napkin," "TwoFacedRat", Timbo, and tjw for their help narrowing
this down.

-- 
Configure bugmail: http://bugzilla.icculus.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.


More information about the quake3-bugzilla mailing list