summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon/FramebufferManager.h
diff options
context:
space:
mode:
authorScott Mansell <phiren@gmail.com>2023-02-09 19:59:16 +1300
committerGitHub <noreply@github.com>2023-02-09 19:59:16 +1300
commitccf92a3e56764d6378c436a8040519a5bffc3372 (patch)
treee2b330b225044e1901e77a6ed147cf21b9d7ac0e /Source/Core/VideoCommon/FramebufferManager.h
parent72b22ef0a54f841b1c52d49cf0e00d3b12c29ac7 (diff)
parent5c1b3ac61d7e660a9d1c206dbd0e615d637d3272 (diff)
Merge pull request #11522 from phire/KillRendererWithFire
Kill Renderer (with phire)
Diffstat (limited to 'Source/Core/VideoCommon/FramebufferManager.h')
-rw-r--r--Source/Core/VideoCommon/FramebufferManager.h34
1 files changed, 30 insertions, 4 deletions
diff --git a/Source/Core/VideoCommon/FramebufferManager.h b/Source/Core/VideoCommon/FramebufferManager.h
index dd073dda12..7921a70d41 100644
--- a/Source/Core/VideoCommon/FramebufferManager.h
+++ b/Source/Core/VideoCommon/FramebufferManager.h
@@ -6,6 +6,7 @@
#include <array>
#include <memory>
#include <optional>
+#include <tuple>
#include "Common/CommonTypes.h"
#include "Common/EnumFormatter.h"
@@ -16,6 +17,7 @@
#include "VideoCommon/AbstractTexture.h"
#include "VideoCommon/RenderState.h"
#include "VideoCommon/TextureConfig.h"
+#include "VideoCommon/VideoEvents.h"
class NativeVertexFormat;
class PointerWrap;
@@ -53,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(); }
@@ -68,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<int> ConvertEFBRectangle(const MathUtil::Rectangle<int>& 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();
@@ -89,11 +105,15 @@ 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,
bool clear_z, u32 color, u32 z);
+ AbstractPipeline* GetClearPipeline(bool clear_color, bool clear_alpha, bool clear_z) const;
+
// Reads a framebuffer value back from the GPU. This may block if the cache is not current.
u32 PeekEFBColor(u32 x, u32 y);
float PeekEFBDepth(u32 x, u32 y);
@@ -169,9 +189,14 @@ protected:
void DrawPokeVertices(const EFBPokeVertex* vertices, u32 vertex_count,
const AbstractPipeline* pipeline);
+ std::tuple<u32, u32> CalculateTargetSize();
+
void DoLoadState(PointerWrap& p);
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;
std::unique_ptr<AbstractTexture> m_efb_depth_texture;
@@ -204,8 +229,7 @@ protected:
// EFB clear pipelines
// Indexed by [color_write_enabled][alpha_write_enabled][depth_write_enabled]
- std::array<std::array<std::array<std::unique_ptr<AbstractPipeline>, 2>, 2>, 2>
- m_efb_clear_pipelines;
+ std::array<std::array<std::array<std::unique_ptr<AbstractPipeline>, 2>, 2>, 2> m_clear_pipelines;
// EFB poke drawing setup
std::unique_ptr<NativeVertexFormat> m_poke_vertex_format;
@@ -213,6 +237,8 @@ protected:
std::unique_ptr<AbstractPipeline> m_depth_poke_pipeline;
std::vector<EFBPokeVertex> m_color_poke_vertices;
std::vector<EFBPokeVertex> m_depth_poke_vertices;
+
+ Common::EventHook m_end_of_frame_event;
};
extern std::unique_ptr<FramebufferManager> g_framebuffer_manager;