summaryrefslogtreecommitdiffstats
path: root/src/core/frontend/emu_window.h
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2020-02-14 04:10:20 +0100
committerbunnei <bunneidev@gmail.com>2020-02-26 03:22:57 +0100
commit0c82b00dfde1071b3619e288b223f771953775eb (patch)
treed8cb9f373d92b7e05a067cf11abe0bf87f8c271d /src/core/frontend/emu_window.h
parentcore: settings: Add setting to enable vsync, which is on by default. (diff)
downloadyuzu-0c82b00dfde1071b3619e288b223f771953775eb.tar
yuzu-0c82b00dfde1071b3619e288b223f771953775eb.tar.gz
yuzu-0c82b00dfde1071b3619e288b223f771953775eb.tar.bz2
yuzu-0c82b00dfde1071b3619e288b223f771953775eb.tar.lz
yuzu-0c82b00dfde1071b3619e288b223f771953775eb.tar.xz
yuzu-0c82b00dfde1071b3619e288b223f771953775eb.tar.zst
yuzu-0c82b00dfde1071b3619e288b223f771953775eb.zip
Diffstat (limited to '')
-rw-r--r--src/core/frontend/emu_window.h41
1 files changed, 41 insertions, 0 deletions
diff --git a/src/core/frontend/emu_window.h b/src/core/frontend/emu_window.h
index 3376eedc5..5dde199d4 100644
--- a/src/core/frontend/emu_window.h
+++ b/src/core/frontend/emu_window.h
@@ -12,6 +12,45 @@
namespace Core::Frontend {
+struct Frame;
+/**
+ * For smooth Vsync rendering, we want to always present the latest frame that the core generates,
+ * but also make sure that rendering happens at the pace that the frontend dictates. This is a
+ * helper class that the renderer can define to sync frames between the render thread and the
+ * presentation thread
+ */
+class TextureMailbox {
+public:
+ virtual ~TextureMailbox() = default;
+
+ /**
+ * Recreate the render objects attached to this frame with the new specified width/height
+ */
+ virtual void ReloadRenderFrame(Frontend::Frame* frame, u32 width, u32 height) = 0;
+
+ /**
+ * Recreate the presentation objects attached to this frame with the new specified width/height
+ */
+ virtual void ReloadPresentFrame(Frontend::Frame* frame, u32 width, u32 height) = 0;
+
+ /**
+ * Render thread calls this to get an available frame to present
+ */
+ virtual Frontend::Frame* GetRenderFrame() = 0;
+
+ /**
+ * Render thread calls this after draw commands are done to add to the presentation mailbox
+ */
+ virtual void ReleaseRenderFrame(Frame* frame) = 0;
+
+ /**
+ * Presentation thread calls this to get the latest frame available to present. If there is no
+ * frame available after timeout, returns the previous frame. If there is no previous frame it
+ * returns nullptr
+ */
+ virtual Frontend::Frame* TryGetPresentFrame(int timeout_ms) = 0;
+};
+
/**
* Represents a graphics context that can be used for background computation or drawing. If the
* graphics backend doesn't require the context, then the implementation of these methods can be
@@ -132,6 +171,8 @@ public:
*/
void UpdateCurrentFramebufferLayout(unsigned width, unsigned height);
+ std::unique_ptr<TextureMailbox> mailbox;
+
protected:
EmuWindow();
virtual ~EmuWindow();