revert last commit, add CheckInvalidState to VideoBackend
This commit is contained in:
parent
ffddfd8662
commit
bd0abb3d2f
|
@ -137,6 +137,8 @@ public:
|
||||||
|
|
||||||
// the implementation needs not do synchronization logic, because calls to it are surrounded by PauseAndLock now
|
// the implementation needs not do synchronization logic, because calls to it are surrounded by PauseAndLock now
|
||||||
virtual void DoState(PointerWrap &p) = 0;
|
virtual void DoState(PointerWrap &p) = 0;
|
||||||
|
|
||||||
|
virtual void CheckInvalidState() = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern std::vector<VideoBackend*> g_available_video_backends;
|
extern std::vector<VideoBackend*> g_available_video_backends;
|
||||||
|
@ -177,8 +179,14 @@ class VideoBackendHardware : public VideoBackend
|
||||||
void PauseAndLock(bool doLock, bool unpauseOnUnlock=true);
|
void PauseAndLock(bool doLock, bool unpauseOnUnlock=true);
|
||||||
void DoState(PointerWrap &p);
|
void DoState(PointerWrap &p);
|
||||||
|
|
||||||
|
bool m_invalid;
|
||||||
|
|
||||||
|
public:
|
||||||
|
void CheckInvalidState();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void InitializeShared();
|
void InitializeShared();
|
||||||
|
void InvalidState();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -37,7 +37,6 @@ using namespace BPFunctions;
|
||||||
static u32 mapTexAddress;
|
static u32 mapTexAddress;
|
||||||
static bool mapTexFound;
|
static bool mapTexFound;
|
||||||
static int numWrites;
|
static int numWrites;
|
||||||
static bool s_invalid;
|
|
||||||
|
|
||||||
extern volatile bool g_bSkipCurrentFrame;
|
extern volatile bool g_bSkipCurrentFrame;
|
||||||
|
|
||||||
|
@ -57,7 +56,6 @@ void BPInit()
|
||||||
mapTexAddress = 0;
|
mapTexAddress = 0;
|
||||||
numWrites = 0;
|
numWrites = 0;
|
||||||
mapTexFound = false;
|
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)
|
void RenderToXFB(const BPCmd &bp, const EFBRectangle &rc, float yScale, float xfbLines, u32 xfbAddr, const u32 dstWidth, const u32 dstHeight, float gamma)
|
||||||
|
@ -85,7 +83,7 @@ void BPWritten(const BPCmd& bp)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// check for invalid state, else unneeded configuration are built
|
// check for invalid state, else unneeded configuration are built
|
||||||
BPReload();
|
g_video_backend->CheckInvalidState();
|
||||||
|
|
||||||
// Debugging only, this lets you skip a bp update
|
// Debugging only, this lets you skip a bp update
|
||||||
//static int times = 0;
|
//static int times = 0;
|
||||||
|
@ -685,9 +683,6 @@ void BPWritten(const BPCmd& bp)
|
||||||
// Called when loading a saved state.
|
// Called when loading a saved state.
|
||||||
void BPReload()
|
void BPReload()
|
||||||
{
|
{
|
||||||
if(s_invalid) {
|
|
||||||
s_invalid = false;
|
|
||||||
|
|
||||||
// restore anything that goes straight to the renderer.
|
// restore anything that goes straight to the renderer.
|
||||||
// let's not risk actually replaying any writes.
|
// let's not risk actually replaying any writes.
|
||||||
// note that PixelShaderManager is already covered since it has its own DoState.
|
// note that PixelShaderManager is already covered since it has its own DoState.
|
||||||
|
@ -716,11 +711,4 @@ void BPReload()
|
||||||
BPCmd bp = {BPMEM_FIELDMODE, 0xFFFFFF, static_cast<int>(((u32*)&bpmem)[BPMEM_FIELDMODE])};
|
BPCmd bp = {BPMEM_FIELDMODE, 0xFFFFFF, static_cast<int>(((u32*)&bpmem)[BPMEM_FIELDMODE])};
|
||||||
SetInterlacingMode(bp);
|
SetInterlacingMode(bp);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void BPInvalidate()
|
|
||||||
{
|
|
||||||
s_invalid = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,5 @@
|
||||||
void BPInit();
|
void BPInit();
|
||||||
void LoadBPReg(u32 value0);
|
void LoadBPReg(u32 value0);
|
||||||
void BPReload();
|
void BPReload();
|
||||||
void BPInvalidate();
|
|
||||||
|
|
||||||
#endif // _BPSTRUCTS_H_
|
#endif // _BPSTRUCTS_H_
|
||||||
|
|
|
@ -180,6 +180,7 @@ void VideoBackendHardware::InitializeShared()
|
||||||
memset((void*)&s_beginFieldArgs, 0, sizeof(s_beginFieldArgs));
|
memset((void*)&s_beginFieldArgs, 0, sizeof(s_beginFieldArgs));
|
||||||
memset(&s_accessEFBArgs, 0, sizeof(s_accessEFBArgs));
|
memset(&s_accessEFBArgs, 0, sizeof(s_accessEFBArgs));
|
||||||
s_AccessEFBResult = 0;
|
s_AccessEFBResult = 0;
|
||||||
|
m_invalid = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Run from the CPU thread
|
// Run from the CPU thread
|
||||||
|
@ -198,16 +199,25 @@ void VideoBackendHardware::DoState(PointerWrap& p)
|
||||||
// Refresh state.
|
// Refresh state.
|
||||||
if (p.GetMode() == PointerWrap::MODE_READ)
|
if (p.GetMode() == PointerWrap::MODE_READ)
|
||||||
{
|
{
|
||||||
BPInvalidate();
|
m_invalid = true;
|
||||||
RecomputeCachedArraybases();
|
RecomputeCachedArraybases();
|
||||||
|
|
||||||
// Clear all caches that touch RAM
|
// Clear all caches that touch RAM
|
||||||
// (? these don't appear to touch any emulation state that gets saved. moved to on load only.)
|
// (? these don't appear to touch any emulation state that gets saved. moved to on load only.)
|
||||||
TextureCache::InvalidateHashes();
|
|
||||||
VertexLoaderManager::MarkAllDirty();
|
VertexLoaderManager::MarkAllDirty();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void VideoBackendHardware::CheckInvalidState() {
|
||||||
|
if (m_invalid)
|
||||||
|
{
|
||||||
|
m_invalid = false;
|
||||||
|
|
||||||
|
BPReload();
|
||||||
|
TextureCache::Invalidate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void VideoBackendHardware::PauseAndLock(bool doLock, bool unpauseOnUnlock)
|
void VideoBackendHardware::PauseAndLock(bool doLock, bool unpauseOnUnlock)
|
||||||
{
|
{
|
||||||
Fifo_PauseAndLock(doLock, unpauseOnUnlock);
|
Fifo_PauseAndLock(doLock, unpauseOnUnlock);
|
||||||
|
|
|
@ -72,18 +72,6 @@ void TextureCache::Invalidate()
|
||||||
textures.clear();
|
textures.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
// this function is dirty hack to work around a OGL bug.
|
|
||||||
// it is only used on loading states. It will work for normal textures,
|
|
||||||
// but for efb2ram, it wouldn't be checked. So there may be glitches on loading
|
|
||||||
void TextureCache::InvalidateHashes()
|
|
||||||
{
|
|
||||||
TexCache::iterator
|
|
||||||
iter = textures.begin(),
|
|
||||||
tcend = textures.end();
|
|
||||||
for (; iter != tcend; ++iter)
|
|
||||||
iter->second->hash = TEXHASH_INVALID;
|
|
||||||
}
|
|
||||||
|
|
||||||
TextureCache::~TextureCache()
|
TextureCache::~TextureCache()
|
||||||
{
|
{
|
||||||
Invalidate();
|
Invalidate();
|
||||||
|
|
|
@ -106,7 +106,6 @@ public:
|
||||||
static void Cleanup();
|
static void Cleanup();
|
||||||
|
|
||||||
static void Invalidate();
|
static void Invalidate();
|
||||||
static void InvalidateHashes();
|
|
||||||
static void InvalidateRange(u32 start_address, u32 size);
|
static void InvalidateRange(u32 start_address, u32 size);
|
||||||
static void MakeRangeDynamic(u32 start_address, u32 size);
|
static void MakeRangeDynamic(u32 start_address, u32 size);
|
||||||
static void ClearRenderTargets(); // currently only used by OGL
|
static void ClearRenderTargets(); // currently only used by OGL
|
||||||
|
|
|
@ -161,7 +161,7 @@ void VertexManager::AddVertices(int primitive, int numVertices)
|
||||||
void VertexManager::Flush()
|
void VertexManager::Flush()
|
||||||
{
|
{
|
||||||
// loading a state will invalidate BP, so check for it
|
// loading a state will invalidate BP, so check for it
|
||||||
BPReload();
|
g_video_backend->CheckInvalidState();
|
||||||
|
|
||||||
g_vertex_manager->vFlush();
|
g_vertex_manager->vFlush();
|
||||||
}
|
}
|
||||||
|
|
|
@ -95,6 +95,11 @@ void VideoSoftware::DoState(PointerWrap&)
|
||||||
// NYI
|
// NYI
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void VideoSoftware::CheckInvalidState()
|
||||||
|
{
|
||||||
|
// there is no state to invalidate
|
||||||
|
}
|
||||||
|
|
||||||
void VideoSoftware::PauseAndLock(bool doLock, bool unpauseOnUnlock)
|
void VideoSoftware::PauseAndLock(bool doLock, bool unpauseOnUnlock)
|
||||||
{
|
{
|
||||||
if (doLock)
|
if (doLock)
|
||||||
|
|
|
@ -50,6 +50,9 @@ class VideoSoftware : public VideoBackend
|
||||||
|
|
||||||
void PauseAndLock(bool doLock, bool unpauseOnUnlock=true);
|
void PauseAndLock(bool doLock, bool unpauseOnUnlock=true);
|
||||||
void DoState(PointerWrap &p);
|
void DoState(PointerWrap &p);
|
||||||
|
|
||||||
|
public:
|
||||||
|
void CheckInvalidState();
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue