From af09d7e063786406b093f96f0b8de0875e78d579 Mon Sep 17 00:00:00 2001 From: refractionpcsx2 Date: Wed, 10 Jun 2015 19:09:24 +0100 Subject: [PATCH] GSdx-DX: Modified shader slightly as some bits were incorrect. --- plugins/GSdx/res/tfx.fx | 55 ++++++++++++++++++++++------------------- 1 file changed, 30 insertions(+), 25 deletions(-) diff --git a/plugins/GSdx/res/tfx.fx b/plugins/GSdx/res/tfx.fx index c868c7cdf5..518e884a6e 100644 --- a/plugins/GSdx/res/tfx.fx +++ b/plugins/GSdx/res/tfx.fx @@ -714,32 +714,37 @@ PS_OUTPUT ps_main(PS_INPUT input) PS_OUTPUT output; -#if PS_SHUFFLE - int4 denorm_c = int4(c * 255.0f + 0.5f); - int2 denorm_TA = int2(int2(TA.xy) * 255.0f + 0.5f); + if (PS_SHUFFLE){ + uint4 denorm_c = uint4(c * 255.0f + 0.5f); + uint2 denorm_TA = uint2(float2(TA.xy) * 255.0f + 0.5f); - // Mask will take care of the correct destination -#if PS_READ_BA - c.rb = c.bb; -#else - c.rb = c.rr; -#endif - -#if PS_READ_BA - if (denorm_c.a & 0x80) - c.ga = int2(float((denorm_c.a & 0x7Fu) | (denorm_TA.y & 0x80u)) / 255.0f); - else - c.ga = int2(float((denorm_c.a & 0x7Fu) | (denorm_TA.x & 0x80u)) / 255.0f); -#else - if (denorm_c.g & 0x80) - c.a = float((denorm_c.g & 0x7Fu) | (denorm_TA.y & 0x80u)) / 255.0f; - else - c.a = float((denorm_c.g & 0x7Fu) | (denorm_TA.x & 0x80u)) / 255.0f; -#endif - //Probably not right :/ - c.g = c.b; - -#endif + // Mask will take care of the correct destination + if (PS_READ_BA){ + c.rb = c.bb; + } + else { + c.rb = c.rr; + } + c.g = c.a; + if (PS_READ_BA){ + if (denorm_c.a & 0x80) + c.a = float((denorm_c.a & 0x7Fu) | (denorm_TA.y & 0x80u)) / 255.0f; + else + c.a = float((denorm_c.a & 0x7Fu) | (denorm_TA.x & 0x80u)) / 255.0f; + + //c.g = c.a; + } + else { + if (denorm_c.g & 0x80) + c.a = float((denorm_c.g & 0x7Fu) | (denorm_TA.y & 0x80u)) / 255.0f; + else + c.a = float((denorm_c.g & 0x7Fu) | (denorm_TA.x & 0x80u)) / 255.0f; + + //c.g = c.a; + } + //Probably not right :/ + //c.g = c.b; + } output.c1 = c.a * 2; // used for alpha blending