Add 'immediate xfb' which reduces xfb latency at the cost of graphical errors

This commit is contained in:
iwubcode
2017-08-12 23:10:21 -05:00
parent a71bc9ebbf
commit 7f0834c919
20 changed files with 55 additions and 6 deletions

View File

@ -12,6 +12,7 @@
#include "Common/StringUtil.h"
#include "Common/Thread.h"
#include "Core/ConfigManager.h"
#include "Core/CoreTiming.h"
#include "Core/FifoPlayer/FifoPlayer.h"
#include "Core/FifoPlayer/FifoRecorder.h"
#include "Core/HW/Memmap.h"
@ -266,9 +267,17 @@ static void BPWritten(const BPCmd& bp)
// This stays in to signal end of a "frame"
g_renderer->RenderToXFB(destAddr, srcRect, destStride, height, s_gammaLUT[PE_copy.gamma]);
if (FifoPlayer::GetInstance().IsRunningWithFakeVideoInterfaceUpdates())
if (g_ActiveConfig.bImmediateXFB)
{
VideoInterface::FakeVIUpdate(destAddr, srcRect.GetWidth(), height);
// below div two to convert from bytes to pixels - it expects width, not stride
g_renderer->Swap(destAddr, destStride / 2, destStride / 2, height, false, srcRect, CoreTiming::GetTicks(), s_gammaLUT[PE_copy.gamma]);
}
else
{
if (FifoPlayer::GetInstance().IsRunningWithFakeVideoInterfaceUpdates())
{
VideoInterface::FakeVIUpdate(destAddr, srcRect.GetWidth(), height);
}
}
}

View File

@ -49,7 +49,7 @@ void VideoBackendBase::Video_ExitLoop()
void VideoBackendBase::Video_BeginField(u32 xfbAddr, u32 fbWidth, u32 fbStride, u32 fbHeight,
u64 ticks)
{
if (m_initialized && g_renderer)
if (m_initialized && g_renderer && !g_ActiveConfig.bImmediateXFB)
{
Fifo::SyncGPU(Fifo::SyncGPUReason::Swap);

View File

@ -37,7 +37,6 @@
#include "Core/Config/SYSCONFSettings.h"
#include "Core/ConfigManager.h"
#include "Core/Core.h"
#include "Core/CoreTiming.h"
#include "Core/FifoPlayer/FifoRecorder.h"
#include "Core/HW/VideoInterface.h"
#include "Core/Host.h"
@ -337,7 +336,7 @@ void Renderer::DrawDebugText()
"Speed Limit: Unlimited" :
StringFromFormat("Speed Limit: %li%%",
std::lround(SConfig::GetInstance().m_EmulationSpeed * 100.f)),
std::string("Copy XFB: ") + xfbcopy_text,
std::string("Copy XFB: ") + xfbcopy_text + (g_ActiveConfig.bImmediateXFB ? " (Immediate)" : ""),
};
enum

View File

@ -137,6 +137,7 @@ void VideoConfig::Refresh()
bForceProgressive = Config::Get(Config::GFX_HACK_FORCE_PROGRESSIVE);
bSkipEFBCopyToRam = Config::Get(Config::GFX_HACK_SKIP_EFB_COPY_TO_RAM);
bSkipXFBCopyToRam = Config::Get(Config::GFX_HACK_SKIP_XFB_COPY_TO_RAM);
bImmediateXFB = Config::Get(Config::GFX_HACK_IMMEDIATE_XFB);
bCopyEFBScaled = Config::Get(Config::GFX_HACK_COPY_EFB_ENABLED);
bEFBEmulateFormatChanges = Config::Get(Config::GFX_HACK_EFB_EMULATE_FORMAT_CHANGES);
bVertexRounding = Config::Get(Config::GFX_HACK_VERTEX_ROUDING);

View File

@ -118,6 +118,7 @@ struct VideoConfig final
bool bEFBEmulateFormatChanges;
bool bSkipEFBCopyToRam;
bool bSkipXFBCopyToRam;
bool bImmediateXFB;
bool bCopyEFBScaled;
int iSafeTextureCache_ColorSamples;
ProjectionHackConfig phack;