summaryrefslogtreecommitdiffstats
path: root/src/core/frontend
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2019-04-14 04:08:40 +0200
committerGitHub <noreply@github.com>2019-04-14 04:08:40 +0200
commit065f83c6c321c9672cda9b89c09bef6c7f3c5472 (patch)
tree3efd50ea836f1ab052581108f1fa218a22e73b62 /src/core/frontend
parentMerge pull request #2389 from FreddyFunk/rename-gamedir (diff)
parentbootmanager: Bypass input focus issues (diff)
downloadyuzu-065f83c6c321c9672cda9b89c09bef6c7f3c5472.tar
yuzu-065f83c6c321c9672cda9b89c09bef6c7f3c5472.tar.gz
yuzu-065f83c6c321c9672cda9b89c09bef6c7f3c5472.tar.bz2
yuzu-065f83c6c321c9672cda9b89c09bef6c7f3c5472.tar.lz
yuzu-065f83c6c321c9672cda9b89c09bef6c7f3c5472.tar.xz
yuzu-065f83c6c321c9672cda9b89c09bef6c7f3c5472.tar.zst
yuzu-065f83c6c321c9672cda9b89c09bef6c7f3c5472.zip
Diffstat (limited to 'src/core/frontend')
-rw-r--r--src/core/frontend/emu_window.h39
1 files changed, 30 insertions, 9 deletions
diff --git a/src/core/frontend/emu_window.h b/src/core/frontend/emu_window.h
index d0bcb4660..70a522556 100644
--- a/src/core/frontend/emu_window.h
+++ b/src/core/frontend/emu_window.h
@@ -13,6 +13,23 @@
namespace Core::Frontend {
/**
+ * 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
+ * stubs
+ */
+class GraphicsContext {
+public:
+ /// Makes the graphics context current for the caller thread
+ virtual void MakeCurrent() = 0;
+
+ /// Releases (dunno if this is the "right" word) the context from the caller thread
+ virtual void DoneCurrent() = 0;
+
+ /// Swap buffers to display the next frame
+ virtual void SwapBuffers() = 0;
+};
+
+/**
* Abstraction class used to provide an interface between emulation code and the frontend
* (e.g. SDL, QGLWidget, GLFW, etc...).
*
@@ -30,7 +47,7 @@ namespace Core::Frontend {
* - DO NOT TREAT THIS CLASS AS A GUI TOOLKIT ABSTRACTION LAYER. That's not what it is. Please
* re-read the upper points again and think about it if you don't see this.
*/
-class EmuWindow {
+class EmuWindow : public GraphicsContext {
public:
/// Data structure to store emuwindow configuration
struct WindowConfig {
@@ -40,17 +57,21 @@ public:
std::pair<unsigned, unsigned> min_client_area_size;
};
- /// Swap buffers to display the next frame
- virtual void SwapBuffers() = 0;
-
/// Polls window events
virtual void PollEvents() = 0;
- /// Makes the graphics context current for the caller thread
- virtual void MakeCurrent() = 0;
-
- /// Releases (dunno if this is the "right" word) the GLFW context from the caller thread
- virtual void DoneCurrent() = 0;
+ /**
+ * Returns a GraphicsContext that the frontend provides that is shared with the emu window. This
+ * context can be used from other threads for background graphics computation. If the frontend
+ * is using a graphics backend that doesn't need anything specific to run on a different thread,
+ * then it can use a stubbed implemenation for GraphicsContext.
+ *
+ * If the return value is null, then the core should assume that the frontend cannot provide a
+ * Shared Context
+ */
+ virtual std::unique_ptr<GraphicsContext> CreateSharedContext() const {
+ return nullptr;
+ }
/**
* Signal that a touch pressed event has occurred (e.g. mouse click pressed)