From 2cfc02a1169653566e277a7e23e69fd5eb628434 Mon Sep 17 00:00:00 2001 From: Scott Mansell Date: Tue, 31 Jan 2023 18:13:47 +1300 Subject: [PATCH] Move m_prev_efb_format into FramebufferManager --- Source/Core/VideoCommon/BPFunctions.cpp | 4 ++-- Source/Core/VideoCommon/FramebufferManager.cpp | 1 + Source/Core/VideoCommon/FramebufferManager.h | 3 +++ Source/Core/VideoCommon/RenderBase.cpp | 15 --------------- Source/Core/VideoCommon/RenderBase.h | 11 +---------- Source/Core/VideoCommon/VideoState.cpp | 4 ---- 6 files changed, 7 insertions(+), 31 deletions(-) diff --git a/Source/Core/VideoCommon/BPFunctions.cpp b/Source/Core/VideoCommon/BPFunctions.cpp index ef705a50fd..5bd4ab241c 100644 --- a/Source/Core/VideoCommon/BPFunctions.cpp +++ b/Source/Core/VideoCommon/BPFunctions.cpp @@ -364,9 +364,9 @@ void OnPixelFormatChange() if (!g_ActiveConfig.bEFBEmulateFormatChanges) return; - const auto old_format = g_renderer->GetPrevPixelFormat(); + const auto old_format = g_framebuffer_manager->GetPrevPixelFormat(); const auto new_format = bpmem.zcontrol.pixel_format; - g_renderer->StorePixelFormat(new_format); + g_framebuffer_manager->StorePixelFormat(new_format); DEBUG_LOG_FMT(VIDEO, "pixelfmt: pixel={}, zc={}", new_format, bpmem.zcontrol.zformat); diff --git a/Source/Core/VideoCommon/FramebufferManager.cpp b/Source/Core/VideoCommon/FramebufferManager.cpp index a987624f1a..21871f8442 100644 --- a/Source/Core/VideoCommon/FramebufferManager.cpp +++ b/Source/Core/VideoCommon/FramebufferManager.cpp @@ -1092,6 +1092,7 @@ void FramebufferManager::DestroyPokePipelines() void FramebufferManager::DoState(PointerWrap& p) { FlushEFBPokes(); + p.Do(m_prev_efb_format); bool save_efb_state = Config::Get(Config::GFX_SAVE_TEXTURE_CACHE_TO_STATE); p.Do(save_efb_state); diff --git a/Source/Core/VideoCommon/FramebufferManager.h b/Source/Core/VideoCommon/FramebufferManager.h index cc41c0ffba..087c5023aa 100644 --- a/Source/Core/VideoCommon/FramebufferManager.h +++ b/Source/Core/VideoCommon/FramebufferManager.h @@ -105,6 +105,8 @@ public: // Assumes no render pass is currently in progress. // Swaps EFB framebuffers, so re-bind afterwards. bool ReinterpretPixelData(EFBReinterpretType convtype); + PixelFormat GetPrevPixelFormat() const { return m_prev_efb_format; } + void StorePixelFormat(PixelFormat new_format) { m_prev_efb_format = new_format; } // Clears the EFB using shaders. void ClearEFB(const MathUtil::Rectangle& rc, bool clear_color, bool clear_alpha, @@ -193,6 +195,7 @@ protected: void DoSaveState(PointerWrap& p); float m_efb_scale = 0.0f; + PixelFormat m_prev_efb_format; std::unique_ptr m_efb_color_texture; std::unique_ptr m_efb_convert_color_texture; diff --git a/Source/Core/VideoCommon/RenderBase.cpp b/Source/Core/VideoCommon/RenderBase.cpp index e597ee1e82..f09dfcc048 100644 --- a/Source/Core/VideoCommon/RenderBase.cpp +++ b/Source/Core/VideoCommon/RenderBase.cpp @@ -20,20 +20,14 @@ #include -#include "Common/Assert.h" -#include "Common/ChunkFile.h" -#include "Common/CommonTypes.h" #include "Common/Logging/Log.h" #include "Common/MsgHandler.h" #include "Core/ConfigManager.h" #include "Core/System.h" -#include "VideoCommon/BPFunctions.h" -#include "VideoCommon/BPMemory.h" #include "VideoCommon/FramebufferManager.h" #include "VideoCommon/PixelEngine.h" -#include "VideoCommon/Present.h" #include "VideoCommon/VideoBackendBase.h" #include "VideoCommon/VideoCommon.h" #include "VideoCommon/VideoConfig.h" @@ -41,10 +35,6 @@ std::unique_ptr g_renderer; -Renderer::Renderer() : m_prev_efb_format{PixelFormat::INVALID_FMT} -{ -} - Renderer::~Renderer() = default; void Renderer::ReinterpretPixelData(EFBReinterpretType convtype) @@ -170,8 +160,3 @@ bool Renderer::UseVertexDepthRange() // in the vertex shader. return fabs(xfmem.viewport.zRange) > 16777215.0f || fabs(xfmem.viewport.farZ) > 16777215.0f; } - -void Renderer::DoState(PointerWrap& p) -{ - p.Do(m_prev_efb_format); -} diff --git a/Source/Core/VideoCommon/RenderBase.h b/Source/Core/VideoCommon/RenderBase.h index e2ff0d0a06..0306a00e65 100644 --- a/Source/Core/VideoCommon/RenderBase.h +++ b/Source/Core/VideoCommon/RenderBase.h @@ -24,12 +24,10 @@ struct EfbPokeData // Renderer really isn't a very good name for this class - it's more like "Misc". // It used to be a massive mess, but almost everything has been refactored out. // -// All that's left is Widescreen tracking, pixel format and a thin abstraction layer -// for VideoSoftware to intercept EFB accesses. +// All that's left is a thin abstraction layer for VideoSoftware to intercept EFB accesses. class Renderer { public: - Renderer(); virtual ~Renderer(); virtual void ReinterpretPixelData(EFBReinterpretType convtype); @@ -37,14 +35,7 @@ public: virtual u32 AccessEFB(EFBAccessType type, u32 x, u32 y, u32 poke_data); virtual void PokeEFB(EFBAccessType type, const EfbPokeData* points, size_t num_points); - PixelFormat GetPrevPixelFormat() const { return m_prev_efb_format; } - void StorePixelFormat(PixelFormat new_format) { m_prev_efb_format = new_format; } - static bool UseVertexDepthRange(); - void DoState(PointerWrap& p); - -private: - PixelFormat m_prev_efb_format; }; extern std::unique_ptr g_renderer; diff --git a/Source/Core/VideoCommon/VideoState.cpp b/Source/Core/VideoCommon/VideoState.cpp index 45b06e4973..7f005e1474 100644 --- a/Source/Core/VideoCommon/VideoState.cpp +++ b/Source/Core/VideoCommon/VideoState.cpp @@ -19,7 +19,6 @@ #include "VideoCommon/PixelEngine.h" #include "VideoCommon/PixelShaderManager.h" #include "VideoCommon/Present.h" -#include "VideoCommon/RenderBase.h" #include "VideoCommon/TMEM.h" #include "VideoCommon/TextureCacheBase.h" #include "VideoCommon/TextureDecoder.h" @@ -96,9 +95,6 @@ void VideoCommon_DoState(PointerWrap& p) g_texture_cache->DoState(p); p.DoMarker("TextureCache"); - g_renderer->DoState(p); - p.DoMarker("Renderer"); - g_presenter->DoState(p); g_frame_dumper->DoState(p); p.DoMarker("Presenter");