From 8a8d3c67d466211e46dbddbc23ad2cb7376a2011 Mon Sep 17 00:00:00 2001 From: "sudonim1@gmail.com" Date: Mon, 23 Jul 2012 16:39:56 +0000 Subject: [PATCH] GSDX: Removed the collapsing of ge/g and le/l alpha tests in the shader code and the supporting code in the C++. This was presumably intended to reduce the number of shaders needed but a) this was never actually implemented, b) a single developer will generally not mix the functionally equivalent (with a different AREF) greater/less than with greater/less than or equal to in GS techniques, c) it really wouldn't make much of a difference to performance anyway and d) it would make an experimental change I'm working with more complicated and slower. No change in functionality expected. git-svn-id: http://pcsx2.googlecode.com/svn/trunk@5343 96395faa-99c1-11dd-bbfe-3dabce05a288 --- plugins/GSdx/GSRendererDX.cpp | 33 +++------------------------------ plugins/GSdx/res/tfx.fx | 15 ++++++++++----- 2 files changed, 13 insertions(+), 35 deletions(-) diff --git a/plugins/GSdx/GSRendererDX.cpp b/plugins/GSdx/GSRendererDX.cpp index 9fb0f4aaf0..c137dd226b 100644 --- a/plugins/GSdx/GSRendererDX.cpp +++ b/plugins/GSdx/GSRendererDX.cpp @@ -252,26 +252,12 @@ void GSRendererDX::DrawPrims(GSTexture* rt, GSTexture* ds, GSTextureCache::Sourc } if(context->TEST.ATE) - { ps_sel.atst = context->TEST.ATST; - - switch(ps_sel.atst) - { - case ATST_LESS: - ps_cb.FogColor_AREF.a = (float)((int)context->TEST.AREF - 1); - break; - case ATST_GREATER: - ps_cb.FogColor_AREF.a = (float)((int)context->TEST.AREF + 1); - break; - default: - ps_cb.FogColor_AREF.a = (float)(int)context->TEST.AREF; - break; - } - } else - { ps_sel.atst = ATST_ALWAYS; - } + + if (context->TEST.ATE && context->TEST.ATST > 1) + ps_cb.FogColor_AREF.a = (float)context->TEST.AREF; if(tex) { @@ -376,19 +362,6 @@ void GSRendererDX::DrawPrims(GSTexture* rt, GSTexture* ds, GSTextureCache::Sourc ps_sel.atst = iatst[ps_sel.atst]; - switch(ps_sel.atst) - { - case ATST_LESS: - ps_cb.FogColor_AREF.a = (float)((int)context->TEST.AREF - 1); - break; - case ATST_GREATER: - ps_cb.FogColor_AREF.a = (float)((int)context->TEST.AREF + 1); - break; - default: - ps_cb.FogColor_AREF.a = (float)(int)context->TEST.AREF; - break; - } - dev->SetupPS(ps_sel, &ps_cb, ps_ssel); bool z = om_dssel.zwe; diff --git a/plugins/GSdx/res/tfx.fx b/plugins/GSdx/res/tfx.fx index 013080a810..cdd9ec4c47 100644 --- a/plugins/GSdx/res/tfx.fx +++ b/plugins/GSdx/res/tfx.fx @@ -519,19 +519,24 @@ void atst(float4 c) else if(PS_ATST == 2) // l { #if PS_SPRITEHACK == 0 - clip(AREF - a); + clip(AREF - a - 0.5f); #endif } else if(PS_ATST == 3) // le { - clip(AREF - a); + clip(AREF - a + 0.5f); } else if(PS_ATST == 4) // e { - clip(0.5f - abs(a - AREF)); } - else if(PS_ATST == 5 || PS_ATST == 6) // ge, g + clip(0.5f - abs(a - AREF)); + } + else if(PS_ATST == 5) // ge { - clip(a - AREF); + clip(a - AREF + 0.5f); + } + else if(PS_ATST == 6) // g + { + clip(a - AREF - 0.5f); } else if(PS_ATST == 7) // ne {