diff options
author | 2016-12-16 14:42:14 -0800 | |
---|---|---|
committer | 2016-12-29 14:57:31 -0800 | |
commit | 43d7ab36632d01856f2d272dbd831b27242f7cd7 (patch) | |
tree | 9e98061e6e1f36e7ec5bee86df1609cc1134df3d /hlsl/phosphor.fx | |
parent | 0b6f935443d2fa048a9b2f9db8b00cf6cb8e7078 (diff) |
Implement LCD persistence shader.
hlsl/phosphor.fx: Do LCD persistence effect using boolean LCD.
LCD persistence is monochrome and thus does not have separate components
like phosphor persistence.
src/osd/modules/render/d3d/d3dhlsl.cpp: Add slider for LCD
games.
src/osd/modules/render/d3d/d3dhlsl.h: (BP) Add options for LCD
games.
src/osd/windows/winmain.cpp: (BP) Add options for LCD games.
src/osd/windows/winmain.h: (BP) Add options for LCD games.
Diffstat (limited to 'hlsl/phosphor.fx')
-rw-r--r-- | hlsl/phosphor.fx | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/hlsl/phosphor.fx b/hlsl/phosphor.fx index c6614d09520..874d67dfded 100644 --- a/hlsl/phosphor.fx +++ b/hlsl/phosphor.fx @@ -93,8 +93,10 @@ VS_OUTPUT vs_main(VS_INPUT Input) // Phosphor Pixel Shader //----------------------------------------------------------------------------- -uniform float DeltaTime = 0.0f; +uniform bool LCD = false; uniform int Mode = 0; +uniform float DeltaTime = 0.0f; +uniform float LCDTau = 0.0f; uniform float3 Tau = { 0.0f, 0.0f, 0.0f }; uniform float3 Beta = { 0.0f, 0.0f, 0.0f }; uniform float3 Gamma = { 0.0f, 0.0f, 0.0f }; @@ -107,15 +109,20 @@ float4 ps_main(PS_INPUT Input) : COLOR float g = PrevPix.g; float b = PrevPix.b; - if (Mode == 0) { + if (LCD) { + r *= LCDTau == 0 ? 0 : exp(-DeltaTime / LCDTau); + g *= LCDTau == 0 ? 0 : exp(-DeltaTime / LCDTau); + b *= LCDTau == 0 ? 0 : exp(-DeltaTime / LCDTau); + } + else if (Mode == 0) { r = 0; g = 0; b = 0; } else if (Mode == 1) { - r *= exp(-DeltaTime / Tau.r); - g *= exp(-DeltaTime / Tau.g); - b *= exp(-DeltaTime / Tau.b); + r *= Tau.r == 0 ? 0 : exp(-DeltaTime / Tau.r); + g *= Tau.g == 0 ? 0 : exp(-DeltaTime / Tau.g); + b *= Tau.b == 0 ? 0 : exp(-DeltaTime / Tau.b); } else { if (r != 0.0f) |