summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon/MainBase.cpp
diff options
context:
space:
mode:
authorPierre Bourdon <delroth@gmail.com>2016-06-24 10:43:46 +0200
committerPierre Bourdon <delroth@gmail.com>2016-06-24 10:43:46 +0200
commit3570c7f03a2aa90aa634f96c0af1969af610f14d (patch)
tree4252e03c0e853ba7cffe022937698c854ad0eaa9 /Source/Core/VideoCommon/MainBase.cpp
parent2115e8a4a6814e32107b5205ff5c95bbd3c6e99c (diff)
Reformat all the things. Have fun with merge conflicts.
Diffstat (limited to 'Source/Core/VideoCommon/MainBase.cpp')
-rw-r--r--Source/Core/VideoCommon/MainBase.cpp249
1 files changed, 126 insertions, 123 deletions
diff --git a/Source/Core/VideoCommon/MainBase.cpp b/Source/Core/VideoCommon/MainBase.cpp
index 9280a31074..6b2e3c91c3 100644
--- a/Source/Core/VideoCommon/MainBase.cpp
+++ b/Source/Core/VideoCommon/MainBase.cpp
@@ -23,172 +23,175 @@ static Common::Flag s_FifoShuttingDown;
static volatile struct
{
- u32 xfbAddr;
- u32 fbWidth;
- u32 fbStride;
- u32 fbHeight;
+ u32 xfbAddr;
+ u32 fbWidth;
+ u32 fbStride;
+ u32 fbHeight;
} s_beginFieldArgs;
void VideoBackendBase::Video_ExitLoop()
{
- Fifo::ExitGpuLoop();
- s_FifoShuttingDown.Set();
+ Fifo::ExitGpuLoop();
+ s_FifoShuttingDown.Set();
}
// Run from the CPU thread (from VideoInterface.cpp)
void VideoBackendBase::Video_BeginField(u32 xfbAddr, u32 fbWidth, u32 fbStride, u32 fbHeight)
{
- if (m_initialized && g_ActiveConfig.bUseXFB)
- {
- s_beginFieldArgs.xfbAddr = xfbAddr;
- s_beginFieldArgs.fbWidth = fbWidth;
- s_beginFieldArgs.fbStride = fbStride;
- s_beginFieldArgs.fbHeight = fbHeight;
- }
+ if (m_initialized && g_ActiveConfig.bUseXFB)
+ {
+ s_beginFieldArgs.xfbAddr = xfbAddr;
+ s_beginFieldArgs.fbWidth = fbWidth;
+ s_beginFieldArgs.fbStride = fbStride;
+ s_beginFieldArgs.fbHeight = fbHeight;
+ }
}
// Run from the CPU thread (from VideoInterface.cpp)
void VideoBackendBase::Video_EndField()
{
- if (m_initialized && g_ActiveConfig.bUseXFB && g_renderer)
- {
- Fifo::SyncGPU(Fifo::SYNC_GPU_SWAP);
-
- AsyncRequests::Event e;
- e.time = 0;
- e.type = AsyncRequests::Event::SWAP_EVENT;
-
- e.swap_event.xfbAddr = s_beginFieldArgs.xfbAddr;
- e.swap_event.fbWidth = s_beginFieldArgs.fbWidth;
- e.swap_event.fbStride = s_beginFieldArgs.fbStride;
- e.swap_event.fbHeight = s_beginFieldArgs.fbHeight;
- AsyncRequests::GetInstance()->PushEvent(e, false);
- }
+ if (m_initialized && g_ActiveConfig.bUseXFB && g_renderer)
+ {
+ Fifo::SyncGPU(Fifo::SYNC_GPU_SWAP);
+
+ AsyncRequests::Event e;
+ e.time = 0;
+ e.type = AsyncRequests::Event::SWAP_EVENT;
+
+ e.swap_event.xfbAddr = s_beginFieldArgs.xfbAddr;
+ e.swap_event.fbWidth = s_beginFieldArgs.fbWidth;
+ e.swap_event.fbStride = s_beginFieldArgs.fbStride;
+ e.swap_event.fbHeight = s_beginFieldArgs.fbHeight;
+ AsyncRequests::GetInstance()->PushEvent(e, false);
+ }
}
u32 VideoBackendBase::Video_AccessEFB(EFBAccessType type, u32 x, u32 y, u32 InputData)
{
- if (!g_ActiveConfig.bEFBAccessEnable)
- {
- return 0;
- }
-
- if (type == POKE_COLOR || type == POKE_Z)
- {
- AsyncRequests::Event e;
- e.type = type == POKE_COLOR ? AsyncRequests::Event::EFB_POKE_COLOR : AsyncRequests::Event::EFB_POKE_Z;
- e.time = 0;
- e.efb_poke.data = InputData;
- e.efb_poke.x = x;
- e.efb_poke.y = y;
- AsyncRequests::GetInstance()->PushEvent(e, false);
- return 0;
- }
- else
- {
- AsyncRequests::Event e;
- u32 result;
- e.type = type == PEEK_COLOR ? AsyncRequests::Event::EFB_PEEK_COLOR : AsyncRequests::Event::EFB_PEEK_Z;
- e.time = 0;
- e.efb_peek.x = x;
- e.efb_peek.y = y;
- e.efb_peek.data = &result;
- AsyncRequests::GetInstance()->PushEvent(e, true);
- return result;
- }
+ if (!g_ActiveConfig.bEFBAccessEnable)
+ {
+ return 0;
+ }
+
+ if (type == POKE_COLOR || type == POKE_Z)
+ {
+ AsyncRequests::Event e;
+ e.type = type == POKE_COLOR ? AsyncRequests::Event::EFB_POKE_COLOR :
+ AsyncRequests::Event::EFB_POKE_Z;
+ e.time = 0;
+ e.efb_poke.data = InputData;
+ e.efb_poke.x = x;
+ e.efb_poke.y = y;
+ AsyncRequests::GetInstance()->PushEvent(e, false);
+ return 0;
+ }
+ else
+ {
+ AsyncRequests::Event e;
+ u32 result;
+ e.type = type == PEEK_COLOR ? AsyncRequests::Event::EFB_PEEK_COLOR :
+ AsyncRequests::Event::EFB_PEEK_Z;
+ e.time = 0;
+ e.efb_peek.x = x;
+ e.efb_peek.y = y;
+ e.efb_peek.data = &result;
+ AsyncRequests::GetInstance()->PushEvent(e, true);
+ return result;
+ }
}
u32 VideoBackendBase::Video_GetQueryResult(PerfQueryType type)
{
- if (!g_perf_query->ShouldEmulate())
- {
- return 0;
- }
+ if (!g_perf_query->ShouldEmulate())
+ {
+ return 0;
+ }
- Fifo::SyncGPU(Fifo::SYNC_GPU_PERFQUERY);
+ Fifo::SyncGPU(Fifo::SYNC_GPU_PERFQUERY);
- AsyncRequests::Event e;
- e.time = 0;
- e.type = AsyncRequests::Event::PERF_QUERY;
+ AsyncRequests::Event e;
+ e.time = 0;
+ e.type = AsyncRequests::Event::PERF_QUERY;
- if (!g_perf_query->IsFlushed())
- AsyncRequests::GetInstance()->PushEvent(e, true);
+ if (!g_perf_query->IsFlushed())
+ AsyncRequests::GetInstance()->PushEvent(e, true);
- return g_perf_query->GetQueryResult(type);
+ return g_perf_query->GetQueryResult(type);
}
u16 VideoBackendBase::Video_GetBoundingBox(int index)
{
- if (!g_ActiveConfig.backend_info.bSupportsBBox)
- return 0;
-
- if (!g_ActiveConfig.bBBoxEnable)
- {
- static bool warn_once = true;
- if (warn_once)
- ERROR_LOG(VIDEO, "BBox shall be used but it is disabled. Please use a gameini to enable it for this game.");
- warn_once = false;
- return 0;
- }
-
- Fifo::SyncGPU(Fifo::SYNC_GPU_BBOX);
-
- AsyncRequests::Event e;
- u16 result;
- e.time = 0;
- e.type = AsyncRequests::Event::BBOX_READ;
- e.bbox.index = index;
- e.bbox.data = &result;
- AsyncRequests::GetInstance()->PushEvent(e, true);
-
- return result;
+ if (!g_ActiveConfig.backend_info.bSupportsBBox)
+ return 0;
+
+ if (!g_ActiveConfig.bBBoxEnable)
+ {
+ static bool warn_once = true;
+ if (warn_once)
+ ERROR_LOG(VIDEO, "BBox shall be used but it is disabled. Please use a gameini to enable it "
+ "for this game.");
+ warn_once = false;
+ return 0;
+ }
+
+ Fifo::SyncGPU(Fifo::SYNC_GPU_BBOX);
+
+ AsyncRequests::Event e;
+ u16 result;
+ e.time = 0;
+ e.type = AsyncRequests::Event::BBOX_READ;
+ e.bbox.index = index;
+ e.bbox.data = &result;
+ AsyncRequests::GetInstance()->PushEvent(e, true);
+
+ return result;
}
void VideoBackendBase::InitializeShared()
{
- VideoCommon_Init();
+ VideoCommon_Init();
- s_FifoShuttingDown.Clear();
- memset((void*)&s_beginFieldArgs, 0, sizeof(s_beginFieldArgs));
- m_invalid = false;
+ s_FifoShuttingDown.Clear();
+ memset((void*)&s_beginFieldArgs, 0, sizeof(s_beginFieldArgs));
+ m_invalid = false;
}
// Run from the CPU thread
void VideoBackendBase::DoState(PointerWrap& p)
{
- bool software = false;
- p.Do(software);
-
- if (p.GetMode() == PointerWrap::MODE_READ && software == true)
- {
- // change mode to abort load of incompatible save state.
- p.SetMode(PointerWrap::MODE_VERIFY);
- }
-
- VideoCommon_DoState(p);
- p.DoMarker("VideoCommon");
-
- p.Do(s_beginFieldArgs);
- p.DoMarker("VideoBackendBase");
-
- // Refresh state.
- if (p.GetMode() == PointerWrap::MODE_READ)
- {
- m_invalid = true;
-
- // Clear all caches that touch RAM
- // (? these don't appear to touch any emulation state that gets saved. moved to on load only.)
- VertexLoaderManager::MarkAllDirty();
- }
+ bool software = false;
+ p.Do(software);
+
+ if (p.GetMode() == PointerWrap::MODE_READ && software == true)
+ {
+ // change mode to abort load of incompatible save state.
+ p.SetMode(PointerWrap::MODE_VERIFY);
+ }
+
+ VideoCommon_DoState(p);
+ p.DoMarker("VideoCommon");
+
+ p.Do(s_beginFieldArgs);
+ p.DoMarker("VideoBackendBase");
+
+ // Refresh state.
+ if (p.GetMode() == PointerWrap::MODE_READ)
+ {
+ m_invalid = true;
+
+ // Clear all caches that touch RAM
+ // (? these don't appear to touch any emulation state that gets saved. moved to on load only.)
+ VertexLoaderManager::MarkAllDirty();
+ }
}
void VideoBackendBase::CheckInvalidState()
{
- if (m_invalid)
- {
- m_invalid = false;
+ if (m_invalid)
+ {
+ m_invalid = false;
- BPReload();
- TextureCacheBase::Invalidate();
- }
+ BPReload();
+ TextureCacheBase::Invalidate();
+ }
}