Re-enable CPU swap on XFB mode only, to avoid flickering in a couple of games

Fix for a dumb mistake from r4042 and doing it lazy-right :p

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4063 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
sl1nk3.s 2009-08-25 18:30:15 +00:00
parent 63213dfb09
commit 5831c95151
6 changed files with 11 additions and 20 deletions

View File

@ -315,7 +315,7 @@ void CISOProperties::CreateGUIControls(bool IsWad)
ForceFiltering = new wxCheckBox(m_GameConfig, ID_FORCEFILTERING, _("Force Filtering"), wxDefaultPosition, wxDefaultSize, wxCHK_3STATE|wxCHK_ALLOW_3RD_STATE_FOR_USER, wxDefaultValidator); ForceFiltering = new wxCheckBox(m_GameConfig, ID_FORCEFILTERING, _("Force Filtering"), wxDefaultPosition, wxDefaultSize, wxCHK_3STATE|wxCHK_ALLOW_3RD_STATE_FOR_USER, wxDefaultValidator);
EFBCopyDisable = new wxCheckBox(m_GameConfig, ID_EFBCOPYDISABLE, _("Disable Copy to EFB"), wxDefaultPosition, wxDefaultSize, wxCHK_3STATE|wxCHK_ALLOW_3RD_STATE_FOR_USER, wxDefaultValidator); EFBCopyDisable = new wxCheckBox(m_GameConfig, ID_EFBCOPYDISABLE, _("Disable Copy to EFB"), wxDefaultPosition, wxDefaultSize, wxCHK_3STATE|wxCHK_ALLOW_3RD_STATE_FOR_USER, wxDefaultValidator);
EFBCopyDisableHotKey = new wxCheckBox(m_GameConfig, ID_EFBCOPYDISABLEHOTKEY, _("With Hotkey E"), wxDefaultPosition, wxDefaultSize, wxCHK_3STATE|wxCHK_ALLOW_3RD_STATE_FOR_USER, wxDefaultValidator); EFBCopyDisableHotKey = new wxCheckBox(m_GameConfig, ID_EFBCOPYDISABLEHOTKEY, _("With Hotkey E"), wxDefaultPosition, wxDefaultSize, wxCHK_3STATE|wxCHK_ALLOW_3RD_STATE_FOR_USER, wxDefaultValidator);
EFBToTextureEnable = new wxCheckBox(m_GameConfig, ID_EFBTOTEXTUREENABLE, _("Enable EFB To Texture"), wxDefaultPosition, wxDefaultSize, wxCHK_3STATE|wxCHK_ALLOW_3RD_STATE_FOR_USER, wxDefaultValidator); EFBToTextureEnable = new wxCheckBox(m_GameConfig, ID_EFBTOTEXTUREENABLE, _("Enable EFB To RAM"), wxDefaultPosition, wxDefaultSize, wxCHK_3STATE|wxCHK_ALLOW_3RD_STATE_FOR_USER, wxDefaultValidator);
SafeTextureCache = new wxCheckBox(m_GameConfig, ID_SAFETEXTURECACHE, _("Safe Texture Cache"), wxDefaultPosition, wxDefaultSize, wxCHK_3STATE|wxCHK_ALLOW_3RD_STATE_FOR_USER, wxDefaultValidator); SafeTextureCache = new wxCheckBox(m_GameConfig, ID_SAFETEXTURECACHE, _("Safe Texture Cache"), wxDefaultPosition, wxDefaultSize, wxCHK_3STATE|wxCHK_ALLOW_3RD_STATE_FOR_USER, wxDefaultValidator);
DstAlphaPass = new wxCheckBox(m_GameConfig, ID_DSTALPHAPASS, _("Distance Alpha Pass"), wxDefaultPosition, wxDefaultSize, wxCHK_3STATE|wxCHK_ALLOW_3RD_STATE_FOR_USER, wxDefaultValidator); DstAlphaPass = new wxCheckBox(m_GameConfig, ID_DSTALPHAPASS, _("Distance Alpha Pass"), wxDefaultPosition, wxDefaultSize, wxCHK_3STATE|wxCHK_ALLOW_3RD_STATE_FOR_USER, wxDefaultValidator);
UseXFB = new wxCheckBox(m_GameConfig, ID_USEXFB, _("Use XFB"), wxDefaultPosition, wxDefaultSize, wxCHK_3STATE|wxCHK_ALLOW_3RD_STATE_FOR_USER, wxDefaultValidator); UseXFB = new wxCheckBox(m_GameConfig, ID_USEXFB, _("Use XFB"), wxDefaultPosition, wxDefaultSize, wxCHK_3STATE|wxCHK_ALLOW_3RD_STATE_FOR_USER, wxDefaultValidator);

View File

@ -123,8 +123,7 @@ void PixelShaderManager::SetConstants()
if (s_bZBiasChanged || s_bDepthRangeChanged) if (s_bZBiasChanged || s_bDepthRangeChanged)
{ {
//ERROR_LOG("pixel=%x,%x, bias=%x\n", bpmem.zcontrol.pixel_format, bpmem.ztex2.type, lastZBias); //ERROR_LOG("pixel=%x,%x, bias=%x\n", bpmem.zcontrol.pixel_format, bpmem.ztex2.type, lastZBias);
// TODO : Should this use 16777216.0f or 16777215.0f ? SetPSConstant4f(C_ZBIAS+1, lastDepthRange[0] / 16777215.0f, lastDepthRange[1] / 16777215.0f, 0, (float)( (((int)lastZBias<<8)>>8))/16777215.0f);
SetPSConstant4f(C_ZBIAS+1, lastDepthRange[0] / 16777216.0f, lastDepthRange[1] / 16777216.0f, 0, (float)( (((int)lastZBias<<8)>>8))/16777216.0f);
s_bZBiasChanged = s_bDepthRangeChanged = false; s_bZBiasChanged = s_bDepthRangeChanged = false;
} }

View File

@ -260,7 +260,7 @@ void CUCode_Zelda::RenderVoice_AFC(ZeldaVoicePB &PB, s16 *_Buffer, int _Size)
const u8 *source; const u8 *source;
u32 ram_mask = 1024 * 1024 * 16 - 1; u32 ram_mask = 1024 * 1024 * 16 - 1;
if (m_CRC == 0xD643001F) { if (IsDMAVersion()) {
source = g_dspInitialize.pGetMemoryPointer(m_DMABaseAddr); source = g_dspInitialize.pGetMemoryPointer(m_DMABaseAddr);
ram_mask = 1024 * 1024 * 64 - 1; ram_mask = 1024 * 1024 * 64 - 1;
} }

View File

@ -107,10 +107,8 @@ void Config::GameIniLoad()
if (iniFile->Exists("Video", "EFBCopyDisableHotKey")) if (iniFile->Exists("Video", "EFBCopyDisableHotKey"))
iniFile->Get("Video", "EFBCopyDisableHotKey", &bEFBCopyDisableHotKey, 0); iniFile->Get("Video", "EFBCopyDisableHotKey", &bEFBCopyDisableHotKey, 0);
if (iniFile->Exists("Video", "EFBToTextureEnable")) if (iniFile->Exists("Video", "EFBToRAMEnable"))
iniFile->Get("Video", "EFBToTextureEnable", &bCopyEFBToRAM, 0); iniFile->Get("Video", "EFBToRAMEnable", &bCopyEFBToRAM, 0);
bCopyEFBToRAM = !bCopyEFBToRAM;
if (iniFile->Exists("Video", "SafeTextureCache")) if (iniFile->Exists("Video", "SafeTextureCache"))
iniFile->Get("Video", "SafeTextureCache", &bSafeTextureCache, false); iniFile->Get("Video", "SafeTextureCache", &bSafeTextureCache, false);

View File

@ -587,6 +587,7 @@ u32 Renderer::AccessEFB(EFBAccessType type, int x, int y)
// Scale the 32-bit value returned by glReadPixels to a 24-bit // Scale the 32-bit value returned by glReadPixels to a 24-bit
// value (GC uses a 24-bit Z-buffer). // value (GC uses a 24-bit Z-buffer).
// TODO: in RE0 this value is often off by one, which causes lighting to disappear
return z >> 8; return z >> 8;
} }
@ -807,11 +808,10 @@ void Renderer::RenderToXFB(u32 xfbAddr, u32 fbWidth, u32 fbHeight, const EFBRect
// TODO: Find better name for this because I don't know if it means what it says. // TODO: Find better name for this because I don't know if it means what it says.
g_VideoInitialize.pCopiedToXFB(false); g_VideoInitialize.pCopiedToXFB(false);
#ifndef XXX_ENABLE_CPU_CONTROLLED_SWAPPING
// XXX: Without the VI, how would we know what kind of field this is? So // XXX: Without the VI, how would we know what kind of field this is? So
// just use progressive. // just use progressive.
Renderer::Swap(xfbAddr, FIELD_PROGRESSIVE, fbWidth, fbHeight); if (!g_Config.bUseXFB)
#endif Renderer::Swap(xfbAddr, FIELD_PROGRESSIVE, fbWidth, fbHeight);
} }
// This function has the final picture. We adjust the aspect ratio here. // This function has the final picture. We adjust the aspect ratio here.

View File

@ -465,15 +465,11 @@ void VideoFifo_CheckSwapRequest()
{ {
if (Common::AtomicLoadAcquire(s_swapRequested)) if (Common::AtomicLoadAcquire(s_swapRequested))
{ {
#ifdef XXX_ENABLE_CPU_CONTROLLED_SWAPPING if (ForceSwap || g_Config.bUseXFB)
Renderer::Swap(s_beginFieldArgs.xfbAddr, s_beginFieldArgs.field, s_beginFieldArgs.fbWidth, s_beginFieldArgs.fbHeight);
#else
if (ForceSwap)
{ {
Renderer::Swap(s_beginFieldArgs.xfbAddr, s_beginFieldArgs.field, s_beginFieldArgs.fbWidth, s_beginFieldArgs.fbHeight); Renderer::Swap(s_beginFieldArgs.xfbAddr, s_beginFieldArgs.field, s_beginFieldArgs.fbWidth, s_beginFieldArgs.fbHeight);
g_VideoInitialize.pCopiedToXFB(false); g_VideoInitialize.pCopiedToXFB(false);
} }
#endif
// TODO : This just updates the frame counter, so we may change this func's name as well // TODO : This just updates the frame counter, so we may change this func's name as well
g_VideoInitialize.pCopiedToXFB(true); g_VideoInitialize.pCopiedToXFB(true);
@ -490,8 +486,7 @@ inline bool addrRangesOverlap(u32 aLower, u32 aUpper, u32 bLower, u32 bUpper)
// Run from the graphics thread (from Fifo.cpp) // Run from the graphics thread (from Fifo.cpp)
void VideoFifo_CheckSwapRequestAt(u32 xfbAddr, u32 fbWidth, u32 fbHeight) void VideoFifo_CheckSwapRequestAt(u32 xfbAddr, u32 fbWidth, u32 fbHeight)
{ {
#ifdef XXX_ENABLE_CPU_CONTROLLED_SWAPPING if (Common::AtomicLoadAcquire(s_swapRequested) && g_Config.bUseXFB)
if (Common::AtomicLoadAcquire(s_swapRequested))
{ {
u32 aLower = xfbAddr; u32 aLower = xfbAddr;
u32 aUpper = xfbAddr + 2 * fbWidth * fbHeight; u32 aUpper = xfbAddr + 2 * fbWidth * fbHeight;
@ -501,9 +496,8 @@ void VideoFifo_CheckSwapRequestAt(u32 xfbAddr, u32 fbWidth, u32 fbHeight)
if (addrRangesOverlap(aLower, aUpper, bLower, bUpper)) if (addrRangesOverlap(aLower, aUpper, bLower, bUpper))
VideoFifo_CheckSwapRequest(); VideoFifo_CheckSwapRequest();
} }
#else
ForceSwap = false; ForceSwap = false;
#endif
} }
// Run from the CPU thread (from VideoInterface.cpp) // Run from the CPU thread (from VideoInterface.cpp)