GSdx-d3d: Mask alpha channel on 24bit format.

dfmt is not supported but we can use the variable to select the
frame buffer format and later disable writting to the alpha channel.

MGS3 sees an improvement, and possibly other games as well.
So far didn't spot any regressions.
This commit is contained in:
lightningterror 2018-09-13 09:35:42 +02:00
parent f3d738d771
commit 8acc319a4a
4 changed files with 17 additions and 5 deletions

View File

@ -172,6 +172,7 @@ public:
// *** Word 1
// Format
uint32 fmt:4;
uint32 dfmt:2;
// Alpha extension/Correction
uint32 aem:1;
uint32 fba:1;
@ -203,7 +204,7 @@ public:
uint32 tcoffsethack:1;
uint32 point_sampler:1;
uint32 _free:32;
uint32 _free:30;
};
uint64 key;

View File

@ -475,6 +475,12 @@ void GSRendererDX::DrawPrims(GSTexture* rt, GSTexture* ds, GSTextureCache::Sourc
EmulateTextureShuffleAndFbmask();
if(m_ps_sel.dfmt == 1)
{
// Disable writing of the alpha channel
om_bsel.wa = 0;
}
if(DATE)
{
if(dev->HasStencil())

View File

@ -50,7 +50,7 @@ void GSRendererDX11::EmulateTextureShuffleAndFbmask()
// Note: D3D1011 is limited and can't read the current framebuffer so we can't have PS_FBMASK and PS_WRITE_RG shaders ported and working.
if (m_texture_shuffle) {
m_ps_sel.shuffle = 1;
m_ps_sel.fmt = 0;
m_ps_sel.dfmt = 0;
const GIFRegXYOFFSET& o = m_context->XYOFFSET;
@ -154,7 +154,7 @@ void GSRendererDX11::EmulateTextureShuffleAndFbmask()
}
} else {
//m_ps_sel.fmt = GSLocalMemory::m_psm[m_context->FRAME.PSM].fmt;
m_ps_sel.dfmt = GSLocalMemory::m_psm[m_context->FRAME.PSM].fmt;
om_bsel.wrgba = ~GSVector4i::load((int)m_context->FRAME.FBMSK).eq8(GSVector4i::xffffffff()).mask();
}

View File

@ -58,11 +58,16 @@ bool GSRendererDX9::CreateDevice(GSDevice* dev)
void GSRendererDX9::EmulateTextureShuffleAndFbmask()
{
if (m_texture_shuffle) {
if (m_texture_shuffle)
{
// We can do a partial port for D3D9 that skips the draw call to give it a slight improvement.
// It's still broken but more bearable. Broken effect is on the screen but fully instead of vertical lines.
throw GSDXRecoverableError();
} else {
}
else
{
m_ps_sel.dfmt = GSLocalMemory::m_psm[m_context->FRAME.PSM].fmt;
om_bsel.wrgba = ~GSVector4i::load((int)m_context->FRAME.FBMSK).eq8(GSVector4i::xffffffff()).mask();
}
}