From 826c11ba3b92add21d6f9a0513cc861826d419fb Mon Sep 17 00:00:00 2001 From: Lioncash Date: Sat, 17 Mar 2018 17:53:34 -0400 Subject: [PATCH 1/2] MainBase: Remove unused s_beginFieldArgs struct This is only ever memset to zero and never used again. This also gets rid of an instance of undefined behavior considering the draft standard for C++17 (N4659) states at [dcl.type.cv] paragraph 5: " The semantics of an access through a volatile glvalue are implementation-defined. If an attempt is made to access an object defined with a volatile-qualified type through the use of a non-volatile glvalue, the behavior is undefined. " --- Source/Core/Core/State.cpp | 2 +- Source/Core/VideoCommon/MainBase.cpp | 12 ------------ 2 files changed, 1 insertion(+), 13 deletions(-) diff --git a/Source/Core/Core/State.cpp b/Source/Core/Core/State.cpp index 3ec1eac913..9ad992e0d0 100644 --- a/Source/Core/Core/State.cpp +++ b/Source/Core/Core/State.cpp @@ -74,7 +74,7 @@ static Common::Event g_compressAndDumpStateSyncEvent; static std::thread g_save_thread; // Don't forget to increase this after doing changes on the savestate system -static const u32 STATE_VERSION = 93; // Last changed in PR 6389 +static const u32 STATE_VERSION = 94; // Last changed in PR 6456 // Maps savestate versions to Dolphin versions. // Versions after 42 don't need to be added to this list, diff --git a/Source/Core/VideoCommon/MainBase.cpp b/Source/Core/VideoCommon/MainBase.cpp index fcad23ccbf..02eef33e08 100644 --- a/Source/Core/VideoCommon/MainBase.cpp +++ b/Source/Core/VideoCommon/MainBase.cpp @@ -31,14 +31,6 @@ static Common::Flag s_FifoShuttingDown; -static volatile struct -{ - u32 xfbAddr; - u32 fbWidth; - u32 fbStride; - u32 fbHeight; -} s_beginFieldArgs; - void VideoBackendBase::Video_ExitLoop() { Fifo::ExitGpuLoop(); @@ -175,7 +167,6 @@ void VideoBackendBase::InitializeShared() m_initialized = true; s_FifoShuttingDown.Clear(); - memset((void*)&s_beginFieldArgs, 0, sizeof(s_beginFieldArgs)); m_invalid = false; frameCount = 0; @@ -221,9 +212,6 @@ void VideoBackendBase::DoState(PointerWrap& p) VideoCommon_DoState(p); p.DoMarker("VideoCommon"); - p.Do(s_beginFieldArgs); - p.DoMarker("VideoBackendBase"); - // Refresh state. if (p.GetMode() == PointerWrap::MODE_READ) { From 13ed71641993a3eb0ecb48127247c8c90ce1bf31 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Sat, 17 Mar 2018 18:08:49 -0400 Subject: [PATCH 2/2] MainBase: Remove effectively unused s_FifoShuttingDown variable This is only ever set and cleared, which is fine, however nothing else ever actually reads its state to perform differing behavior. --- Source/Core/VideoCommon/MainBase.cpp | 5 ----- 1 file changed, 5 deletions(-) diff --git a/Source/Core/VideoCommon/MainBase.cpp b/Source/Core/VideoCommon/MainBase.cpp index 02eef33e08..3a579991a0 100644 --- a/Source/Core/VideoCommon/MainBase.cpp +++ b/Source/Core/VideoCommon/MainBase.cpp @@ -7,7 +7,6 @@ #include "Common/ChunkFile.h" #include "Common/CommonTypes.h" #include "Common/Event.h" -#include "Common/Flag.h" #include "Common/Logging/Log.h" #include "Core/Host.h" #include "VideoCommon/AsyncRequests.h" @@ -29,12 +28,9 @@ #include "VideoCommon/VideoConfig.h" #include "VideoCommon/VideoState.h" -static Common::Flag s_FifoShuttingDown; - void VideoBackendBase::Video_ExitLoop() { Fifo::ExitGpuLoop(); - s_FifoShuttingDown.Set(); } // Run from the CPU thread (from VideoInterface.cpp) @@ -166,7 +162,6 @@ void VideoBackendBase::InitializeShared() // do not initialize again for the config window m_initialized = true; - s_FifoShuttingDown.Clear(); m_invalid = false; frameCount = 0;