From 11de923dcb7e6a7e1b29e5b15cb2bf71ede22b97 Mon Sep 17 00:00:00 2001 From: Scott Mansell Date: Tue, 31 Jan 2023 17:26:46 +1300 Subject: Move xfb tracking and IR scaling out of RenderBase --- Source/Core/VideoCommon/FramebufferManager.h | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) (limited to 'Source/Core/VideoCommon/FramebufferManager.h') diff --git a/Source/Core/VideoCommon/FramebufferManager.h b/Source/Core/VideoCommon/FramebufferManager.h index c3871c8e15..0eb5d4aa93 100644 --- a/Source/Core/VideoCommon/FramebufferManager.h +++ b/Source/Core/VideoCommon/FramebufferManager.h @@ -6,6 +6,7 @@ #include #include #include +#include #include "Common/CommonTypes.h" #include "Common/EnumFormatter.h" @@ -54,8 +55,8 @@ public: static AbstractTextureFormat GetEFBColorFormat(); static AbstractTextureFormat GetEFBDepthFormat(); static AbstractTextureFormat GetEFBDepthCopyFormat(); - static TextureConfig GetEFBColorTextureConfig(); - static TextureConfig GetEFBDepthTextureConfig(); + static TextureConfig GetEFBColorTextureConfig(u32 width, u32 height); + static TextureConfig GetEFBDepthTextureConfig(u32 width, u32 height); // Accessors. AbstractTexture* GetEFBColorTexture() const { return m_efb_color_texture.get(); } @@ -69,6 +70,20 @@ public: bool IsEFBStereo() const { return m_efb_color_texture->GetLayers() > 1; } FramebufferState GetEFBFramebufferState() const; + // EFB coordinate conversion functions + // Use this to convert a whole native EFB rect to backbuffer coordinates + MathUtil::Rectangle ConvertEFBRectangle(const MathUtil::Rectangle& rc) const; + + unsigned int GetEFBScale() const; + + // Use this to upscale native EFB coordinates to IDEAL internal resolution + int EFBToScaledX(int x) const; + int EFBToScaledY(int y) const; + + // Floating point versions of the above - only use them if really necessary + float EFBToScaledXf(float x) const; + float EFBToScaledYf(float y) const; + // First-time setup. bool Initialize(); @@ -172,9 +187,13 @@ protected: void DrawPokeVertices(const EFBPokeVertex* vertices, u32 vertex_count, const AbstractPipeline* pipeline); + std::tuple CalculateTargetSize(); + void DoLoadState(PointerWrap& p); void DoSaveState(PointerWrap& p); + float m_efb_scale = 0.0f; + std::unique_ptr m_efb_color_texture; std::unique_ptr m_efb_convert_color_texture; std::unique_ptr m_efb_depth_texture; -- cgit v1.2.3