[Fixed] Gamma messed up upon closing GZDoom for the first time

Bugs that have been investigated and resolved somehow.

Moderator: GZDoom Developers

Gamma messed up upon closing GZDoom for the first time

Postby Jekyll Grim Payne » Sat Jan 12, 2019 5:47 am

I can't help but posting it here because GZDoom is the only application that causes it and none of the suggestions I've received seem to work.

The bug: regardless of the gamma or windowed/fullscreen settings in GZDoom, whenenever I launch it (nothing happens at that stage) and then close it, my system colors get messed up.

I can reset them back to normal simply by launching any gamma software (such as NVidia Control Panel) and just changing anyhing (e.g. dragging the gamma slider and cancelling the change is enough). After that I can start GZDoom as many times as I want, before the system reset the bug won't reoccur.

I'm on Windows 10. This has been happening in all versions since I moved to W10 (which was about 3 months ago). The standard NVidia solutions (disabling Night Light, Microsoft Game Bar, whatever) have no effect; no other applications cause this gamma change.
User avatar
Jekyll Grim Payne
 
Joined: 21 Jul 2008

Re: Gamma messed up upon closing GZDoom for the first time

Postby Graf Zahl » Sat Jan 12, 2019 6:46 am

Windows's gamma setting is a bit unreliable when uses with OpenGL, the only way around it is to force shader-based gamma correction in postprocessing at the cost of slightly reduced color resolution.
User avatar
Graf Zahl
Lead GZDoom Developer
Lead GZDoom Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: Gamma messed up upon closing GZDoom for the first time

Postby Rachael » Sat Jan 12, 2019 7:01 am

Is there any way to force GZDoom to never touch the gamma settings at all? That might be worthwhile to implement, especially for more modern systems.

@ OP: I am no expert but what seems to be happening is GZDoom is reading desktop gamma settings different than what they actually are when it first starts. AFAIK this is provided by your driver. When GZDoom exits, it resets the gamma to those settings it found on startup. When you change the gamma back, it changes the settings that GZDoom gets when it starts again. Not 100% certain about this, but I am reasonably confident that it's what's happening here.
User avatar
Rachael
Webmaster
 
Joined: 13 Jan 2004
Discord: Rachael#3767
Twitch ID: madamerachelle
Github ID: madame-rachelle

Re: Gamma messed up upon closing GZDoom for the first time

Postby _mental_ » Sat Jan 12, 2019 7:42 am

Rachael wrote:Is there any way to force GZDoom to never touch the gamma settings at all?

Sure, we can remove/disable vid_hwgamma CVAR (with corresponding platform-specific code) and change remaining logic to behave like it is set to 1, i.e. hardware gamma off, i.e. use a shader to do gamma correction.
While I'm fine with this change, some people may complain a lot about reduced image quality.
_mental_
 
 
 
Joined: 07 Aug 2011

Re: Gamma messed up upon closing GZDoom for the first time

Postby Graf Zahl » Sat Jan 12, 2019 7:57 am

That CVAR won't get removed. I have no issues with it on my Windows 8.1 system. But its default should be changed to 0, if this really shows issues on Windows 10.

This may be removed when the industry finally moves to panels with higher color resolution even for low end displays, but as long as they are still selling 6 bit with dithering it is not a working proposition to compromise the output.

From what I remember in the past, with my previous monitor, the NVidia gamma control does not integrate well with the system's gamma management, they were frequently at odds with each other and that monitor was dark enough that I couldn't use it without color correction in the driver.
User avatar
Graf Zahl
Lead GZDoom Developer
Lead GZDoom Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: Gamma messed up upon closing GZDoom for the first time

Postby Jekyll Grim Payne » Sat Jan 12, 2019 8:56 am

I actually do not use NVidia settings. I.e. in Nvidia Control Panel it's set to be controlled by the system. I only mentioned in it as an example of software that can be used to control gamma. I can achieve the same with native Windows color calibration settings.

upd: I do use Windows gamma settings though, because my monitors don't have any kind of gamma adjustment (only brightness/contrast), and that gamma doesn't look right at all. So GZdoom seems to restore Windows gamma to default.
Last edited by Jekyll Grim Payne on Sun Jan 13, 2019 10:51 am, edited 1 time in total.
User avatar
Jekyll Grim Payne
 
Joined: 21 Jul 2008

Re: Gamma messed up upon closing GZDoom for the first time

Postby Rachael » Sat Jan 12, 2019 2:01 pm

I'm not talking about removing any CVARs. I'm just talking about a CVAR that would block all calls to SetDeviceGammaRamp or any other related functions.

It might be better to simply fix it to not call that function on exit if vid_hwgamma somehow currently disables gamma, though. OpenGLFrameBuffer::SetGamma() has a bool for useHWGamma that can be used to check for this condition - it should not touch the gamma if it's already been reset, previously, or if it has never been touched in the first place.
User avatar
Rachael
Webmaster
 
Joined: 13 Jan 2004
Discord: Rachael#3767
Twitch ID: madamerachelle
Github ID: madame-rachelle

Re: Gamma messed up upon closing GZDoom for the first time

Postby Rachael » Sat Jan 19, 2019 9:21 am

https://github.com/coelckers/gzdoom/pull/712

Fixed via pull request. I would prefer this to be approved for the 3.7.2 release, if possible, but I'm doing it this way to ensure that I've done it correctly. I can assert that this works correctly in Windows, so far, that I tested. I did not find any related calls in the Mac code, so I don't know how it works there - so I did not touch the Mac code at all for this. (edit: created a new version that has the same edit on all 3 platforms)
User avatar
Rachael
Webmaster
 
Joined: 13 Jan 2004
Discord: Rachael#3767
Twitch ID: madamerachelle
Github ID: madame-rachelle

Re: Gamma messed up upon closing GZDoom for the first time

Postby Rachael » Wed Jan 23, 2019 5:17 am

With the complete removal of the system gamma setter, this should no longer cause problems. Closing.
User avatar
Rachael
Webmaster
 
Joined: 13 Jan 2004
Discord: Rachael#3767
Twitch ID: madamerachelle
Github ID: madame-rachelle


Return to Closed Bugs

Who is online

Users browsing this forum: No registered users and 2 guests