diff options
author | bunnei <bunneidev@gmail.com> | 2019-01-24 03:20:08 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-01-24 03:20:08 +0100 |
commit | f574d324e7f8692ebff0aaa17c416f4840feda5c (patch) | |
tree | afd89a9ec560c65070c37bbd0151c5327cc71e8a /src/core | |
parent | Merge pull request #2049 from FearlessTobi/port-3928 (diff) | |
parent | frontend: Refactor ScopeAcquireWindowContext out of renderer_opengl. (diff) | |
download | yuzu-f574d324e7f8692ebff0aaa17c416f4840feda5c.tar yuzu-f574d324e7f8692ebff0aaa17c416f4840feda5c.tar.gz yuzu-f574d324e7f8692ebff0aaa17c416f4840feda5c.tar.bz2 yuzu-f574d324e7f8692ebff0aaa17c416f4840feda5c.tar.lz yuzu-f574d324e7f8692ebff0aaa17c416f4840feda5c.tar.xz yuzu-f574d324e7f8692ebff0aaa17c416f4840feda5c.tar.zst yuzu-f574d324e7f8692ebff0aaa17c416f4840feda5c.zip |
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/CMakeLists.txt | 2 | ||||
-rw-r--r-- | src/core/frontend/scope_acquire_window_context.cpp | 18 | ||||
-rw-r--r-- | src/core/frontend/scope_acquire_window_context.h | 23 |
3 files changed, 43 insertions, 0 deletions
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index aa9e05089..965c28787 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -95,6 +95,8 @@ add_library(core STATIC frontend/framebuffer_layout.cpp frontend/framebuffer_layout.h frontend/input.h + frontend/scope_acquire_window_context.cpp + frontend/scope_acquire_window_context.h gdbstub/gdbstub.cpp gdbstub/gdbstub.h hle/ipc.h diff --git a/src/core/frontend/scope_acquire_window_context.cpp b/src/core/frontend/scope_acquire_window_context.cpp new file mode 100644 index 000000000..3663dad17 --- /dev/null +++ b/src/core/frontend/scope_acquire_window_context.cpp @@ -0,0 +1,18 @@ +// Copyright 2019 yuzu Emulator Project +// Licensed under GPLv2 or any later version +// Refer to the license.txt file included. + +#include "core/frontend/emu_window.h" +#include "core/frontend/scope_acquire_window_context.h" + +namespace Core::Frontend { + +ScopeAcquireWindowContext::ScopeAcquireWindowContext(Core::Frontend::EmuWindow& emu_window_) + : emu_window{emu_window_} { + emu_window.MakeCurrent(); +} +ScopeAcquireWindowContext::~ScopeAcquireWindowContext() { + emu_window.DoneCurrent(); +} + +} // namespace Core::Frontend diff --git a/src/core/frontend/scope_acquire_window_context.h b/src/core/frontend/scope_acquire_window_context.h new file mode 100644 index 000000000..2d9f6e825 --- /dev/null +++ b/src/core/frontend/scope_acquire_window_context.h @@ -0,0 +1,23 @@ +// Copyright 2019 yuzu Emulator Project +// Licensed under GPLv2 or any later version +// Refer to the license.txt file included. + +#pragma once + +#include "common/common_types.h" + +namespace Core::Frontend { + +class EmuWindow; + +/// Helper class to acquire/release window context within a given scope +class ScopeAcquireWindowContext : NonCopyable { +public: + explicit ScopeAcquireWindowContext(Core::Frontend::EmuWindow& window); + ~ScopeAcquireWindowContext(); + +private: + Core::Frontend::EmuWindow& emu_window; +}; + +} // namespace Core::Frontend |