From 2df0c31d13372bc29d488cf7e80d4adb9cf28b46 Mon Sep 17 00:00:00 2001 From: degasus Date: Fri, 21 Dec 2012 21:04:53 +0100 Subject: add invalid flag for BPStructs (fix issue 5790) this flag will be set on loading a state and checked before every rendering. --- Source/Core/VideoCommon/Src/BPStructs.cpp | 75 ++++++++++++++++++------------- 1 file changed, 45 insertions(+), 30 deletions(-) (limited to 'Source/Core/VideoCommon/Src/BPStructs.cpp') diff --git a/Source/Core/VideoCommon/Src/BPStructs.cpp b/Source/Core/VideoCommon/Src/BPStructs.cpp index 179196e412..1e13a36f96 100644 --- a/Source/Core/VideoCommon/Src/BPStructs.cpp +++ b/Source/Core/VideoCommon/Src/BPStructs.cpp @@ -34,9 +34,10 @@ using namespace BPFunctions; -u32 mapTexAddress; -bool mapTexFound; -int numWrites; +static u32 mapTexAddress; +static bool mapTexFound; +static int numWrites; +static bool s_invalid; extern volatile bool g_bSkipCurrentFrame; @@ -56,6 +57,7 @@ void BPInit() mapTexAddress = 0; numWrites = 0; mapTexFound = false; + s_invalid = false; } void RenderToXFB(const BPCmd &bp, const EFBRectangle &rc, float yScale, float xfbLines, u32 xfbAddr, const u32 dstWidth, const u32 dstHeight, float gamma) @@ -81,6 +83,9 @@ void BPWritten(const BPCmd& bp) just stuff geometry in them and don't put state changes there ---------------------------------------------------------------------------------------------------------------- */ + + // check for invalid state, else unneeded configuration are built + BPReload(); // Debugging only, this lets you skip a bp update //static int times = 0; @@ -680,32 +685,42 @@ void BPWritten(const BPCmd& bp) // Called when loading a saved state. void BPReload() { - // restore anything that goes straight to the renderer. - // let's not risk actually replaying any writes. - // note that PixelShaderManager is already covered since it has its own DoState. - SetGenerationMode(); - SetScissor(); - SetLineWidth(); - SetDepthMode(); - SetLogicOpMode(); - SetDitherMode(); - SetBlendMode(); - SetColorMask(); - OnPixelFormatChange(); - { - BPCmd bp = {BPMEM_TX_SETMODE0, 0xFFFFFF, static_cast(((u32*)&bpmem)[BPMEM_TX_SETMODE0])}; - SetTextureMode(bp); - } - { - BPCmd bp = {BPMEM_TX_SETMODE0_4, 0xFFFFFF, static_cast(((u32*)&bpmem)[BPMEM_TX_SETMODE0_4])}; - SetTextureMode(bp); - } - { - BPCmd bp = {BPMEM_FIELDMASK, 0xFFFFFF, static_cast(((u32*)&bpmem)[BPMEM_FIELDMASK])}; - SetInterlacingMode(bp); - } - { - BPCmd bp = {BPMEM_FIELDMODE, 0xFFFFFF, static_cast(((u32*)&bpmem)[BPMEM_FIELDMODE])}; - SetInterlacingMode(bp); + if(s_invalid) { + s_invalid = false; + + // restore anything that goes straight to the renderer. + // let's not risk actually replaying any writes. + // note that PixelShaderManager is already covered since it has its own DoState. + SetGenerationMode(); + SetScissor(); + SetLineWidth(); + SetDepthMode(); + SetLogicOpMode(); + SetDitherMode(); + SetBlendMode(); + SetColorMask(); + OnPixelFormatChange(); + { + BPCmd bp = {BPMEM_TX_SETMODE0, 0xFFFFFF, static_cast(((u32*)&bpmem)[BPMEM_TX_SETMODE0])}; + SetTextureMode(bp); + } + { + BPCmd bp = {BPMEM_TX_SETMODE0_4, 0xFFFFFF, static_cast(((u32*)&bpmem)[BPMEM_TX_SETMODE0_4])}; + SetTextureMode(bp); + } + { + BPCmd bp = {BPMEM_FIELDMASK, 0xFFFFFF, static_cast(((u32*)&bpmem)[BPMEM_FIELDMASK])}; + SetInterlacingMode(bp); + } + { + BPCmd bp = {BPMEM_FIELDMODE, 0xFFFFFF, static_cast(((u32*)&bpmem)[BPMEM_FIELDMODE])}; + SetInterlacingMode(bp); + } } } + +void BPInvalidate() +{ + s_invalid = true; +} + -- cgit v1.2.3