From 39775cc904b34b7470abaef6c483eec5709c1471 Mon Sep 17 00:00:00 2001
From: Christoph Oelckers <coelckers@zdoom.fake>
Date: Wed, 21 May 2014 15:25:25 +0200
Subject: [PATCH] - mystery of desaturation shader solved: The old code passed
 '1-desaturation' to the shader, the new code 'desaturation', so for the 'mix'
 function to work its arguments must be swapped.

---
 wadsrc/static/shaders/glsl/main.fp | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/wadsrc/static/shaders/glsl/main.fp b/wadsrc/static/shaders/glsl/main.fp
index 35b355206..afd075984 100644
--- a/wadsrc/static/shaders/glsl/main.fp
+++ b/wadsrc/static/shaders/glsl/main.fp
@@ -31,13 +31,8 @@ vec4 desaturate(vec4 texel)
 {
 	if (uDesaturationFactor > 0.0)
 	{
-		float gray = (texel.r * 0.3 + texel.g * 0.56 + texel.b * 0.14) * uDesaturationFactor;	
-		
-		vec4 desaturated = vec4(gray,gray,gray,texel.a);
-		// I have absolutely no idea why this works and 'mix' doesn't...
-		texel *= (1.0-uDesaturationFactor);
-		return texel + desaturated;
-		//return mix (desaturated, texel, uDesaturationFactor);
+		float gray = (texel.r * 0.3 + texel.g * 0.56 + texel.b * 0.14);	
+		return mix (texel, vec4(gray,gray,gray,texel.a), uDesaturationFactor);
 	}
 	else
 	{