mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-11-22 09:23:46 +00:00
VideoCommon: pass the EFB buffer scale into the FramebufferManager instead of pulling it from config, in the future this will allow us to have multiple framebuffers
This commit is contained in:
parent
2170080f53
commit
2f20c12d82
@ -45,9 +45,9 @@ FramebufferManager::~FramebufferManager()
|
||||
DestroyEFBFramebuffer();
|
||||
}
|
||||
|
||||
bool FramebufferManager::Initialize()
|
||||
bool FramebufferManager::Initialize(int efb_scale)
|
||||
{
|
||||
if (!CreateEFBFramebuffer())
|
||||
if (!CreateEFBFramebuffer(efb_scale))
|
||||
{
|
||||
PanicAlertFmt("Failed to create EFB framebuffer");
|
||||
return false;
|
||||
@ -90,14 +90,14 @@ bool FramebufferManager::Initialize()
|
||||
return true;
|
||||
}
|
||||
|
||||
void FramebufferManager::RecreateEFBFramebuffer()
|
||||
void FramebufferManager::RecreateEFBFramebuffer(int efb_scale)
|
||||
{
|
||||
FlushEFBPokes();
|
||||
InvalidatePeekCache(true);
|
||||
|
||||
DestroyReadbackFramebuffer();
|
||||
DestroyEFBFramebuffer();
|
||||
if (!CreateEFBFramebuffer() || !CreateReadbackFramebuffer())
|
||||
if (!CreateEFBFramebuffer(efb_scale) || !CreateReadbackFramebuffer())
|
||||
PanicAlertFmt("Failed to recreate EFB framebuffer");
|
||||
}
|
||||
|
||||
@ -210,12 +210,12 @@ float FramebufferManager::EFBToScaledYf(float y) const
|
||||
return y * ((float)GetEFBHeight() / (float)EFB_HEIGHT);
|
||||
}
|
||||
|
||||
std::tuple<u32, u32> FramebufferManager::CalculateTargetSize()
|
||||
std::tuple<u32, u32> FramebufferManager::CalculateTargetSize(int efb_scale)
|
||||
{
|
||||
if (g_ActiveConfig.iEFBScale == EFB_SCALE_AUTO_INTEGRAL)
|
||||
if (efb_scale == EFB_SCALE_AUTO_INTEGRAL)
|
||||
m_efb_scale = g_presenter->AutoIntegralScale();
|
||||
else
|
||||
m_efb_scale = g_ActiveConfig.iEFBScale;
|
||||
m_efb_scale = efb_scale;
|
||||
|
||||
const u32 max_size = g_backend_info.MaxTextureSize;
|
||||
if (max_size < EFB_WIDTH * m_efb_scale)
|
||||
@ -227,9 +227,9 @@ std::tuple<u32, u32> FramebufferManager::CalculateTargetSize()
|
||||
return std::make_tuple(new_efb_width, new_efb_height);
|
||||
}
|
||||
|
||||
bool FramebufferManager::CreateEFBFramebuffer()
|
||||
bool FramebufferManager::CreateEFBFramebuffer(int efb_scale)
|
||||
{
|
||||
auto [width, height] = CalculateTargetSize();
|
||||
auto [width, height] = CalculateTargetSize(efb_scale);
|
||||
|
||||
const TextureConfig efb_color_texture_config = GetEFBColorTextureConfig(width, height);
|
||||
const TextureConfig efb_depth_texture_config = GetEFBDepthTextureConfig(width, height);
|
||||
|
||||
@ -85,10 +85,10 @@ public:
|
||||
float EFBToScaledYf(float y) const;
|
||||
|
||||
// First-time setup.
|
||||
bool Initialize();
|
||||
bool Initialize(int efb_scale);
|
||||
|
||||
// Recreate EFB framebuffers, call when the EFB size (IR) changes.
|
||||
void RecreateEFBFramebuffer();
|
||||
void RecreateEFBFramebuffer(int efb_scale);
|
||||
|
||||
// Recompile shaders, use when MSAA mode changes.
|
||||
void RecompileShaders();
|
||||
@ -160,7 +160,7 @@ protected:
|
||||
bool needs_flush;
|
||||
};
|
||||
|
||||
bool CreateEFBFramebuffer();
|
||||
bool CreateEFBFramebuffer(int efb_scale);
|
||||
void DestroyEFBFramebuffer();
|
||||
|
||||
bool CompileConversionPipelines();
|
||||
@ -189,7 +189,7 @@ protected:
|
||||
void DrawPokeVertices(const EFBPokeVertex* vertices, u32 vertex_count,
|
||||
const AbstractPipeline* pipeline);
|
||||
|
||||
std::tuple<u32, u32> CalculateTargetSize();
|
||||
std::tuple<u32, u32> CalculateTargetSize(int efb_scale);
|
||||
|
||||
void DoLoadState(PointerWrap& p);
|
||||
void DoSaveState(PointerWrap& p);
|
||||
|
||||
@ -329,7 +329,7 @@ void Presenter::OnBackbufferSet(bool size_changed, bool is_first_set)
|
||||
if (size_changed && !is_first_set && g_ActiveConfig.iEFBScale == EFB_SCALE_AUTO_INTEGRAL &&
|
||||
m_auto_resolution_scale != AutoIntegralScale())
|
||||
{
|
||||
g_framebuffer_manager->RecreateEFBFramebuffer();
|
||||
g_framebuffer_manager->RecreateEFBFramebuffer(g_ActiveConfig.iEFBScale);
|
||||
}
|
||||
if (size_changed || is_first_set)
|
||||
{
|
||||
|
||||
@ -310,7 +310,8 @@ bool VideoBackendBase::InitializeShared(std::unique_ptr<AbstractGfx> gfx,
|
||||
|
||||
if (!g_vertex_manager->Initialize() || !g_shader_cache->Initialize() ||
|
||||
!g_perf_query->Initialize() || !g_presenter->Initialize() ||
|
||||
!g_framebuffer_manager->Initialize() || !g_texture_cache->Initialize() ||
|
||||
!g_framebuffer_manager->Initialize(g_ActiveConfig.iEFBScale) ||
|
||||
!g_texture_cache->Initialize() ||
|
||||
(g_backend_info.bSupportsBBox && !g_bounding_box->Initialize()) ||
|
||||
!g_graphics_mod_manager->Initialize())
|
||||
{
|
||||
|
||||
@ -369,7 +369,7 @@ void CheckForConfigChanges()
|
||||
if (changed_bits & (CONFIG_CHANGE_BIT_MULTISAMPLES | CONFIG_CHANGE_BIT_STEREO_MODE |
|
||||
CONFIG_CHANGE_BIT_TARGET_SIZE | CONFIG_CHANGE_BIT_HDR))
|
||||
{
|
||||
g_framebuffer_manager->RecreateEFBFramebuffer();
|
||||
g_framebuffer_manager->RecreateEFBFramebuffer(g_ActiveConfig.iEFBScale);
|
||||
}
|
||||
|
||||
if (old_scale != g_framebuffer_manager->GetEFBScale())
|
||||
|
||||
Loading…
Reference in New Issue
Block a user