From 86327b52a99a283e0e8be672b0026bc4daab270a Mon Sep 17 00:00:00 2001 From: lightningterror Date: Fri, 11 Jan 2019 18:20:04 +0100 Subject: [PATCH] convert.fx: Update main4 shader to better support hdr colclip. --- plugins/GSdx/res/convert.fx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/plugins/GSdx/res/convert.fx b/plugins/GSdx/res/convert.fx index 814b179b47..6c3b7d7997 100644 --- a/plugins/GSdx/res/convert.fx +++ b/plugins/GSdx/res/convert.fx @@ -131,8 +131,13 @@ PS_OUTPUT ps_main3(PS_INPUT input) PS_OUTPUT ps_main4(PS_INPUT input) { PS_OUTPUT output; - - output.c = fmod(sample_c(input.t) * 255 + 0.5f, 256) / 255; + + float4 c = round(sample_c(input.t) * 255); + // We use 2 fmod to avoid negative value. + float4 fmod1 = fmod(c, 256) + 256; + float4 fmod2 = fmod(fmod1, 256); + + output.c = fmod2 / 255.0f; return output; }