Gamma messed up upon closing GZDoom for the first time

Bugs that have been investigated and resolved somehow.

Moderator: GZDoom Developers

Forum rules
Please don't bump threads here if you have a problem - it will often be forgotten about if you do. Instead, make a new thread here.
Post Reply
User avatar
Jekyll Grim Payne
 
 
Posts: 1065
Joined: Mon Jul 21, 2008 4:08 am
Preferred Pronouns: He/Him
Graphics Processor: nVidia (Modern GZDoom)
Contact:

Gamma messed up upon closing GZDoom for the first time

Post by Jekyll Grim Payne »

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
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49056
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

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

Post by Graf Zahl »

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
Rachael
Posts: 13530
Joined: Tue Jan 13, 2004 1:31 pm
Preferred Pronouns: She/Her
Contact:

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

Post by Rachael »

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.
_mental_
 
 
Posts: 3812
Joined: Sun Aug 07, 2011 4:32 am

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

Post by _mental_ »

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.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49056
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

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

Post by Graf Zahl »

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
Jekyll Grim Payne
 
 
Posts: 1065
Joined: Mon Jul 21, 2008 4:08 am
Preferred Pronouns: He/Him
Graphics Processor: nVidia (Modern GZDoom)
Contact:

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

Post by Jekyll Grim Payne »

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 9:51 am, edited 1 time in total.
User avatar
Rachael
Posts: 13530
Joined: Tue Jan 13, 2004 1:31 pm
Preferred Pronouns: She/Her
Contact:

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

Post by Rachael »

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
Posts: 13530
Joined: Tue Jan 13, 2004 1:31 pm
Preferred Pronouns: She/Her
Contact:

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

Post by Rachael »

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
Posts: 13530
Joined: Tue Jan 13, 2004 1:31 pm
Preferred Pronouns: She/Her
Contact:

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

Post by Rachael »

With the complete removal of the system gamma setter, this should no longer cause problems. Closing.
Post Reply

Return to “Closed Bugs [GZDoom]”