From 43d7ab36632d01856f2d272dbd831b27242f7cd7 Mon Sep 17 00:00:00 2001 From: "Westley M. Martinez" Date: Fri, 16 Dec 2016 14:42:14 -0800 Subject: 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. --- hlsl/phosphor.fx | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'hlsl/phosphor.fx') 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) -- cgit v1.2.3-70-g09d2