summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatarGravatar Westley M. Martinez <anikom15@gmail.com>2016-12-30 10:46:44 -0800
committerGravatarGravatar Westley M. Martinez <anikom15@gmail.com>2016-12-30 10:46:44 -0800
commitf1da2ecffa66ffa0162be5a74f4609fecdf35882 (patch) (github)
treef6b02c9a497a96e1e6c531fc1f197d6a218d459e
parentbe14994ab48122410dbdfbeeff40e31f539fccbd (diff)
downloadmame-f1da2ecffa66ffa0162be5a74f4609fecdf35882.tar.bz2
mame-f1da2ecffa66ffa0162be5a74f4609fecdf35882.zip
Remove phosphor burn-in.
-rw-r--r--hlsl/phosphor.fx7
1 files changed, 7 insertions, 0 deletions
diff --git a/hlsl/phosphor.fx b/hlsl/phosphor.fx
index 874d67dfded..488b1d37dca 100644
--- a/hlsl/phosphor.fx
+++ b/hlsl/phosphor.fx
@@ -132,6 +132,13 @@ float4 ps_main(PS_INPUT Input) : COLOR
if (b != 0.0f)
b = pow(Gamma.b * DeltaTime + pow(1 / b, 1 / Beta.b), -Beta.b);
}
+ // Prevent burn-in
+ if (DeltaTime > 0.0f) {
+ float threshold = 0.5f / 255.0f; // Half-color increment
+ r = max(0.0f, r - threshold);
+ g = max(0.0f, g - threshold);
+ b = max(0.0f, b - threshold);
+ }
float RedMax = max(CurrPix.r, r);
float GreenMax = max(CurrPix.g, g);
float BlueMax = max(CurrPix.b, b);