]> de.git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
glsl doesn't allow dividing by zero (result is undefined, although sane on nvidia...
authordivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Mon, 28 May 2007 13:35:07 +0000 (13:35 +0000)
committerdivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Mon, 28 May 2007 13:35:07 +0000 (13:35 +0000)
-"      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

index 8243ef922522c66c10c6af88509f6542718c9b1a..fb2fc69839a76bcd46b30701e54ab5dfab358dd7 100644 (file)
@@ -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"