Various ClearScreen fixes.

Will fix some games and break some others.
Assist trophies in SSBB work fine now, Super Mario Sunshine is a little broken again.
Still needs some more work...

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6627 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
NeoBrainX
2010-12-20 16:57:29 +00:00
parent 83868566ea
commit 9ebf507a55
4 changed files with 92 additions and 29 deletions

View File

@ -462,9 +462,12 @@ bool Renderer::SetScissorRect()
void Renderer::SetColorMask()
{
// Only enable alpha channel if it's supported by the current EFB format
UINT8 color_mask = 0;
if (bpmem.blendmode.alphaupdate) color_mask |= D3D11_COLOR_WRITE_ENABLE_ALPHA;
if (bpmem.blendmode.colorupdate) color_mask |= D3D11_COLOR_WRITE_ENABLE_RED | D3D11_COLOR_WRITE_ENABLE_GREEN | D3D11_COLOR_WRITE_ENABLE_BLUE;
if (bpmem.blendmode.alphaupdate && (bpmem.zcontrol.pixel_format == PIXELFMT_RGBA6_Z24))
color_mask = D3D11_COLOR_WRITE_ENABLE_ALPHA;
if (bpmem.blendmode.colorupdate)
color_mask |= D3D11_COLOR_WRITE_ENABLE_RED | D3D11_COLOR_WRITE_ENABLE_GREEN | D3D11_COLOR_WRITE_ENABLE_BLUE;
D3D::gfxstate->SetRenderTargetWriteMask(color_mask);
}
@ -688,14 +691,15 @@ void Renderer::ClearScreen(const EFBRectangle& rc, bool colorEnable, bool alphaE
{
ResetAPIState();
if (bpmem.blendmode.colorupdate && bpmem.blendmode.alphaupdate) D3D::stateman->PushBlendState(clearblendstates[0]);
else if (bpmem.blendmode.colorupdate) D3D::stateman->PushBlendState(clearblendstates[1]);
else if (bpmem.blendmode.alphaupdate) D3D::stateman->PushBlendState(clearblendstates[2]);
if (colorEnable && alphaEnable) D3D::stateman->PushBlendState(clearblendstates[0]);
else if (colorEnable) D3D::stateman->PushBlendState(clearblendstates[1]);
else if (alphaEnable) D3D::stateman->PushBlendState(clearblendstates[2]);
else D3D::stateman->PushBlendState(clearblendstates[3]);
if (!bpmem.zmode.testenable) D3D::stateman->PushDepthState(cleardepthstates[0]);
else if (bpmem.zmode.updateenable) D3D::stateman->PushDepthState(cleardepthstates[1]);
else /*if (!bpmem.zmode.updateenable)*/ D3D::stateman->PushDepthState(cleardepthstates[2]);
// TODO: Should we enable Z testing here?
/*if (!bpmem.zmode.testenable) D3D::stateman->PushDepthState(cleardepthstates[0]);
else */if (zEnable) D3D::stateman->PushDepthState(cleardepthstates[1]);
else /*if (!zEnable)*/ D3D::stateman->PushDepthState(cleardepthstates[2]);
// Update the view port for clearing the picture
TargetRectangle targetRc = Renderer::ConvertEFBRectangle(rc);
@ -1120,4 +1124,4 @@ void Renderer::SetInterlacingMode()
// TODO
}
}
}