diff options
author | 2016-12-15 09:50:31 -0800 | |
---|---|---|
committer | 2016-12-15 09:50:31 -0800 | |
commit | 8c7b83b2d26594671b0c0352dedb7d56be4ce1f7 (patch) | |
tree | bf8496f51e9d4499a660d3cd9fe5862fedbe3b09 /hlsl | |
parent | 01d9e9734216bbcffd6c76f9db57018ce54bd12f (diff) | |
parent | 23df89c965cdf9422f2effbd33a87aeebc735d20 (diff) |
Merge https://github.com/mamedev/mame
Diffstat (limited to 'hlsl')
-rw-r--r-- | hlsl/phosphor.fx | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/hlsl/phosphor.fx b/hlsl/phosphor.fx index 7d665b44749..d78473a2c6e 100644 --- a/hlsl/phosphor.fx +++ b/hlsl/phosphor.fx @@ -94,19 +94,23 @@ VS_OUTPUT vs_main(VS_INPUT Input) //----------------------------------------------------------------------------- uniform float3 Phosphor = float3(0.0f, 0.0f, 0.0f); +uniform float DeltaTime = 0.0f; +static const float F = 30.0f; float4 ps_main(PS_INPUT Input) : COLOR { float4 CurrPix = tex2D(DiffuseSampler, Input.TexCoord); - float3 PrevPix = tex2D(PreviousSampler, Input.PrevCoord).rgb * float3(Phosphor.r, Phosphor.g, Phosphor.b); + float3 PrevPix = tex2D(PreviousSampler, Input.PrevCoord).rgb; + PrevPix.r *= Phosphor.r == 0 ? 0 : pow(Phosphor.r, F * DeltaTime); + PrevPix.g *= Phosphor.g == 0 ? 0 : pow(Phosphor.g, F * DeltaTime); + PrevPix.b *= Phosphor.b == 0 ? 0 : pow(Phosphor.b, F * DeltaTime); float RedMax = max(CurrPix.r, PrevPix.r); float GreenMax = max(CurrPix.g, PrevPix.g); float BlueMax = max(CurrPix.b, PrevPix.b); - return Passthrough - ? CurrPix - : float4(RedMax, GreenMax, BlueMax, CurrPix.a); + return Passthrough ? + CurrPix : float4(RedMax, GreenMax, BlueMax, CurrPix.a); } //----------------------------------------------------------------------------- |