mirror of https://github.com/PCSX2/pcsx2.git
gsdx hw: move try alpha test at the beginning
Will allow to use alpha test optimization to better optimize depth lookup Require to do clut handling before
This commit is contained in:
parent
dc365e066d
commit
c3ac3ecbe7
|
@ -406,6 +406,27 @@ void GSRendererHW::Draw()
|
|||
|
||||
GSDrawingEnvironment& env = m_env;
|
||||
GSDrawingContext* context = m_context;
|
||||
const GSLocalMemory::psm_t& tex_psm = GSLocalMemory::m_psm[m_context->TEX0.PSM];
|
||||
|
||||
// skip alpha test if possible
|
||||
// Note: do it first so we know if frame/depth writes are masked
|
||||
|
||||
GIFRegTEST TEST = context->TEST;
|
||||
GIFRegFRAME FRAME = context->FRAME;
|
||||
GIFRegZBUF ZBUF = context->ZBUF;
|
||||
|
||||
uint32 fm = context->FRAME.FBMSK;
|
||||
uint32 zm = context->ZBUF.ZMSK || context->TEST.ZTE == 0 ? 0xffffffff : 0;
|
||||
|
||||
// Note required to compute TryAlphaTest below. So do it now.
|
||||
if (PRIM->TME && tex_psm.pal > 0)
|
||||
m_mem.m_clut.Read32(context->TEX0, env.TEXA);
|
||||
|
||||
// Test if we can optimize Alpha Test as a NOP
|
||||
m_ATE = context->TEST.ATE && !GSRenderer::TryAlphaTest(fm, zm);
|
||||
|
||||
context->FRAME.FBMSK = fm;
|
||||
context->ZBUF.ZMSK = zm != 0;
|
||||
|
||||
// It is allowed to use the depth and rt at the same location. However at least 1 must
|
||||
// be disabled.
|
||||
|
@ -480,7 +501,6 @@ void GSRendererHW::Draw()
|
|||
|
||||
if(PRIM->TME)
|
||||
{
|
||||
const GSLocalMemory::psm_t& tex_psm = GSLocalMemory::m_psm[m_context->TEX0.PSM];
|
||||
int lod = 0;
|
||||
GIFRegCLAMP MIP_CLAMP = context->CLAMP;
|
||||
|
||||
|
@ -548,9 +568,6 @@ void GSRendererHW::Draw()
|
|||
|
||||
m_context->offset.tex = m_mem.GetOffset(TEX0.TBP0, TEX0.TBW, TEX0.PSM);
|
||||
|
||||
if(tex_psm.pal > 0)
|
||||
m_mem.m_clut.Read32(context->TEX0, env.TEXA);
|
||||
|
||||
GSVector4i r;
|
||||
|
||||
GetTextureMinMax(r, TEX0, MIP_CLAMP, m_vt.IsLinear());
|
||||
|
@ -661,21 +678,6 @@ void GSRendererHW::Draw()
|
|||
}
|
||||
}
|
||||
|
||||
// skip alpha test if possible
|
||||
|
||||
GIFRegTEST TEST = context->TEST;
|
||||
GIFRegFRAME FRAME = context->FRAME;
|
||||
GIFRegZBUF ZBUF = context->ZBUF;
|
||||
|
||||
uint32 fm = context->FRAME.FBMSK;
|
||||
uint32 zm = context->ZBUF.ZMSK || context->TEST.ZTE == 0 ? 0xffffffff : 0;
|
||||
|
||||
// Test if we can optimize Alpha Test as a NOP
|
||||
m_ATE = context->TEST.ATE && !GSRenderer::TryAlphaTest(fm, zm);
|
||||
|
||||
context->FRAME.FBMSK = fm;
|
||||
context->ZBUF.ZMSK = zm != 0;
|
||||
|
||||
// A couple of hack to avoid upscaling issue. So far it seems to impacts mostly sprite
|
||||
// Note: first hack corrects both position and texture coordinate
|
||||
// Note: second hack corrects only the texture coordinate
|
||||
|
|
Loading…
Reference in New Issue