Move m_prev_efb_format into FramebufferManager
This commit is contained in:
parent
9b5397abdb
commit
2cfc02a116
|
@ -364,9 +364,9 @@ void OnPixelFormatChange()
|
||||||
if (!g_ActiveConfig.bEFBEmulateFormatChanges)
|
if (!g_ActiveConfig.bEFBEmulateFormatChanges)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const auto old_format = g_renderer->GetPrevPixelFormat();
|
const auto old_format = g_framebuffer_manager->GetPrevPixelFormat();
|
||||||
const auto new_format = bpmem.zcontrol.pixel_format;
|
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);
|
DEBUG_LOG_FMT(VIDEO, "pixelfmt: pixel={}, zc={}", new_format, bpmem.zcontrol.zformat);
|
||||||
|
|
||||||
|
|
|
@ -1092,6 +1092,7 @@ void FramebufferManager::DestroyPokePipelines()
|
||||||
void FramebufferManager::DoState(PointerWrap& p)
|
void FramebufferManager::DoState(PointerWrap& p)
|
||||||
{
|
{
|
||||||
FlushEFBPokes();
|
FlushEFBPokes();
|
||||||
|
p.Do(m_prev_efb_format);
|
||||||
|
|
||||||
bool save_efb_state = Config::Get(Config::GFX_SAVE_TEXTURE_CACHE_TO_STATE);
|
bool save_efb_state = Config::Get(Config::GFX_SAVE_TEXTURE_CACHE_TO_STATE);
|
||||||
p.Do(save_efb_state);
|
p.Do(save_efb_state);
|
||||||
|
|
|
@ -105,6 +105,8 @@ public:
|
||||||
// Assumes no render pass is currently in progress.
|
// Assumes no render pass is currently in progress.
|
||||||
// Swaps EFB framebuffers, so re-bind afterwards.
|
// Swaps EFB framebuffers, so re-bind afterwards.
|
||||||
bool ReinterpretPixelData(EFBReinterpretType convtype);
|
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.
|
// Clears the EFB using shaders.
|
||||||
void ClearEFB(const MathUtil::Rectangle<int>& rc, bool clear_color, bool clear_alpha,
|
void ClearEFB(const MathUtil::Rectangle<int>& rc, bool clear_color, bool clear_alpha,
|
||||||
|
@ -193,6 +195,7 @@ protected:
|
||||||
void DoSaveState(PointerWrap& p);
|
void DoSaveState(PointerWrap& p);
|
||||||
|
|
||||||
float m_efb_scale = 0.0f;
|
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_color_texture;
|
||||||
std::unique_ptr<AbstractTexture> m_efb_convert_color_texture;
|
std::unique_ptr<AbstractTexture> m_efb_convert_color_texture;
|
||||||
|
|
|
@ -20,20 +20,14 @@
|
||||||
|
|
||||||
#include <fmt/format.h>
|
#include <fmt/format.h>
|
||||||
|
|
||||||
#include "Common/Assert.h"
|
|
||||||
#include "Common/ChunkFile.h"
|
|
||||||
#include "Common/CommonTypes.h"
|
|
||||||
#include "Common/Logging/Log.h"
|
#include "Common/Logging/Log.h"
|
||||||
#include "Common/MsgHandler.h"
|
#include "Common/MsgHandler.h"
|
||||||
|
|
||||||
#include "Core/ConfigManager.h"
|
#include "Core/ConfigManager.h"
|
||||||
#include "Core/System.h"
|
#include "Core/System.h"
|
||||||
|
|
||||||
#include "VideoCommon/BPFunctions.h"
|
|
||||||
#include "VideoCommon/BPMemory.h"
|
|
||||||
#include "VideoCommon/FramebufferManager.h"
|
#include "VideoCommon/FramebufferManager.h"
|
||||||
#include "VideoCommon/PixelEngine.h"
|
#include "VideoCommon/PixelEngine.h"
|
||||||
#include "VideoCommon/Present.h"
|
|
||||||
#include "VideoCommon/VideoBackendBase.h"
|
#include "VideoCommon/VideoBackendBase.h"
|
||||||
#include "VideoCommon/VideoCommon.h"
|
#include "VideoCommon/VideoCommon.h"
|
||||||
#include "VideoCommon/VideoConfig.h"
|
#include "VideoCommon/VideoConfig.h"
|
||||||
|
@ -41,10 +35,6 @@
|
||||||
|
|
||||||
std::unique_ptr<Renderer> g_renderer;
|
std::unique_ptr<Renderer> g_renderer;
|
||||||
|
|
||||||
Renderer::Renderer() : m_prev_efb_format{PixelFormat::INVALID_FMT}
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
Renderer::~Renderer() = default;
|
Renderer::~Renderer() = default;
|
||||||
|
|
||||||
void Renderer::ReinterpretPixelData(EFBReinterpretType convtype)
|
void Renderer::ReinterpretPixelData(EFBReinterpretType convtype)
|
||||||
|
@ -170,8 +160,3 @@ bool Renderer::UseVertexDepthRange()
|
||||||
// in the vertex shader.
|
// in the vertex shader.
|
||||||
return fabs(xfmem.viewport.zRange) > 16777215.0f || fabs(xfmem.viewport.farZ) > 16777215.0f;
|
return fabs(xfmem.viewport.zRange) > 16777215.0f || fabs(xfmem.viewport.farZ) > 16777215.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Renderer::DoState(PointerWrap& p)
|
|
||||||
{
|
|
||||||
p.Do(m_prev_efb_format);
|
|
||||||
}
|
|
||||||
|
|
|
@ -24,12 +24,10 @@ struct EfbPokeData
|
||||||
// Renderer really isn't a very good name for this class - it's more like "Misc".
|
// 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.
|
// 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
|
// All that's left is a thin abstraction layer for VideoSoftware to intercept EFB accesses.
|
||||||
// for VideoSoftware to intercept EFB accesses.
|
|
||||||
class Renderer
|
class Renderer
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Renderer();
|
|
||||||
virtual ~Renderer();
|
virtual ~Renderer();
|
||||||
|
|
||||||
virtual void ReinterpretPixelData(EFBReinterpretType convtype);
|
virtual void ReinterpretPixelData(EFBReinterpretType convtype);
|
||||||
|
@ -37,14 +35,7 @@ public:
|
||||||
virtual u32 AccessEFB(EFBAccessType type, u32 x, u32 y, u32 poke_data);
|
virtual u32 AccessEFB(EFBAccessType type, u32 x, u32 y, u32 poke_data);
|
||||||
virtual void PokeEFB(EFBAccessType type, const EfbPokeData* points, size_t num_points);
|
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();
|
static bool UseVertexDepthRange();
|
||||||
void DoState(PointerWrap& p);
|
|
||||||
|
|
||||||
private:
|
|
||||||
PixelFormat m_prev_efb_format;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
extern std::unique_ptr<Renderer> g_renderer;
|
extern std::unique_ptr<Renderer> g_renderer;
|
||||||
|
|
|
@ -19,7 +19,6 @@
|
||||||
#include "VideoCommon/PixelEngine.h"
|
#include "VideoCommon/PixelEngine.h"
|
||||||
#include "VideoCommon/PixelShaderManager.h"
|
#include "VideoCommon/PixelShaderManager.h"
|
||||||
#include "VideoCommon/Present.h"
|
#include "VideoCommon/Present.h"
|
||||||
#include "VideoCommon/RenderBase.h"
|
|
||||||
#include "VideoCommon/TMEM.h"
|
#include "VideoCommon/TMEM.h"
|
||||||
#include "VideoCommon/TextureCacheBase.h"
|
#include "VideoCommon/TextureCacheBase.h"
|
||||||
#include "VideoCommon/TextureDecoder.h"
|
#include "VideoCommon/TextureDecoder.h"
|
||||||
|
@ -96,9 +95,6 @@ void VideoCommon_DoState(PointerWrap& p)
|
||||||
g_texture_cache->DoState(p);
|
g_texture_cache->DoState(p);
|
||||||
p.DoMarker("TextureCache");
|
p.DoMarker("TextureCache");
|
||||||
|
|
||||||
g_renderer->DoState(p);
|
|
||||||
p.DoMarker("Renderer");
|
|
||||||
|
|
||||||
g_presenter->DoState(p);
|
g_presenter->DoState(p);
|
||||||
g_frame_dumper->DoState(p);
|
g_frame_dumper->DoState(p);
|
||||||
p.DoMarker("Presenter");
|
p.DoMarker("Presenter");
|
||||||
|
|
Loading…
Reference in New Issue