Move m_prev_efb_format into FramebufferManager

This commit is contained in:
Scott Mansell 2023-01-31 18:13:47 +13:00
parent 9b5397abdb
commit 2cfc02a116
6 changed files with 7 additions and 31 deletions

View File

@ -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);

View File

@ -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);

View File

@ -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<int>& 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<AbstractTexture> m_efb_color_texture;
std::unique_ptr<AbstractTexture> m_efb_convert_color_texture;

View File

@ -20,20 +20,14 @@
#include <fmt/format.h>
#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<Renderer> 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);
}

View File

@ -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<Renderer> g_renderer;

View File

@ -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");