summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar bunnei2020-02-13 22:10:20 -0500
committerGravatar bunnei2020-02-25 21:22:57 -0500
commit0c82b00dfde1071b3619e288b223f771953775eb (patch)
treed8cb9f373d92b7e05a067cf11abe0bf87f8c271d /src
parentcore: settings: Add setting to enable vsync, which is on by default. (diff)
downloadyuzu-0c82b00dfde1071b3619e288b223f771953775eb.tar.gz
yuzu-0c82b00dfde1071b3619e288b223f771953775eb.tar.xz
yuzu-0c82b00dfde1071b3619e288b223f771953775eb.zip
core: frontend: emu_window: Add TextureMailbox class.
Diffstat (limited to 'src')
-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 @@
12 12
13namespace Core::Frontend { 13namespace Core::Frontend {
14 14
15struct Frame;
16/**
17 * For smooth Vsync rendering, we want to always present the latest frame that the core generates,
18 * but also make sure that rendering happens at the pace that the frontend dictates. This is a
19 * helper class that the renderer can define to sync frames between the render thread and the
20 * presentation thread
21 */
22class TextureMailbox {
23public:
24 virtual ~TextureMailbox() = default;
25
26 /**
27 * Recreate the render objects attached to this frame with the new specified width/height
28 */
29 virtual void ReloadRenderFrame(Frontend::Frame* frame, u32 width, u32 height) = 0;
30
31 /**
32 * Recreate the presentation objects attached to this frame with the new specified width/height
33 */
34 virtual void ReloadPresentFrame(Frontend::Frame* frame, u32 width, u32 height) = 0;
35
36 /**
37 * Render thread calls this to get an available frame to present
38 */
39 virtual Frontend::Frame* GetRenderFrame() = 0;
40
41 /**
42 * Render thread calls this after draw commands are done to add to the presentation mailbox
43 */
44 virtual void ReleaseRenderFrame(Frame* frame) = 0;
45
46 /**
47 * Presentation thread calls this to get the latest frame available to present. If there is no
48 * frame available after timeout, returns the previous frame. If there is no previous frame it
49 * returns nullptr
50 */
51 virtual Frontend::Frame* TryGetPresentFrame(int timeout_ms) = 0;
52};
53
15/** 54/**
16 * Represents a graphics context that can be used for background computation or drawing. If the 55 * Represents a graphics context that can be used for background computation or drawing. If the
17 * graphics backend doesn't require the context, then the implementation of these methods can be 56 * graphics backend doesn't require the context, then the implementation of these methods can be
@@ -132,6 +171,8 @@ public:
132 */ 171 */
133 void UpdateCurrentFramebufferLayout(unsigned width, unsigned height); 172 void UpdateCurrentFramebufferLayout(unsigned width, unsigned height);
134 173
174 std::unique_ptr<TextureMailbox> mailbox;
175
135protected: 176protected:
136 EmuWindow(); 177 EmuWindow();
137 virtual ~EmuWindow(); 178 virtual ~EmuWindow();