From cbf992aa69db144bffd4bd16d8339ba808fcaddc Mon Sep 17 00:00:00 2001 From: divverent Date: Mon, 28 May 2007 13:35:07 +0000 Subject: [PATCH] glsl doesn't allow dividing by zero (result is undefined, although sane on nvidia), so... -" color.rgb = SceneBrightness / (ContrastBoostCoeff + 1 / color.rgb);\n" +" color.rgb = color.rgb * SceneBrightness / (ContrastBoostCoeff * color.rgb + 1);\n" also gains some fps apparently (7600GT here) Weirdly, *= seems to be by 3fps slower than using = and * git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@7378 d7cf8633-e32d-0410-b094-e92efae38249 --- gl_rmain.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gl_rmain.c b/gl_rmain.c index 8243ef92..fb2fc698 100644 --- a/gl_rmain.c +++ b/gl_rmain.c @@ -656,7 +656,10 @@ static const char *builtinshaderstring = "#endif\n" "\n" "#ifdef USECONTRASTBOOST\n" -" color.rgb = SceneBrightness / (ContrastBoostCoeff + 1 / color.rgb);\n" +//" color.rgb = SceneBrightness / (ContrastBoostCoeff + 1 / color.rgb);\n" +//" color.rgb *= SceneBrightness / (ContrastBoostCoeff * color.rgb + 1);\n" +" color.rgb = color.rgb * SceneBrightness / (ContrastBoostCoeff * color.rgb + 1);\n" +//" color.rgb *= SceneBrightness; color.rgb /= ContrastBoostCoeff * color.rgb + 1;\n" "#else\n" " color.rgb *= SceneBrightness;\n" "#endif\n" -- 2.39.2