core: frontend: Refactor scope_acquire_window_context to scope_acquire_context.
This commit is contained in:
parent
2e16c23784
commit
667f026c95
|
@ -131,8 +131,8 @@ add_library(core STATIC
|
||||||
frontend/framebuffer_layout.cpp
|
frontend/framebuffer_layout.cpp
|
||||||
frontend/framebuffer_layout.h
|
frontend/framebuffer_layout.h
|
||||||
frontend/input.h
|
frontend/input.h
|
||||||
frontend/scope_acquire_window_context.cpp
|
frontend/scope_acquire_context.cpp
|
||||||
frontend/scope_acquire_window_context.h
|
frontend/scope_acquire_context.h
|
||||||
gdbstub/gdbstub.cpp
|
gdbstub/gdbstub.cpp
|
||||||
gdbstub/gdbstub.h
|
gdbstub/gdbstub.h
|
||||||
hardware_interrupt_manager.cpp
|
hardware_interrupt_manager.cpp
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
#include "core/file_sys/sdmc_factory.h"
|
#include "core/file_sys/sdmc_factory.h"
|
||||||
#include "core/file_sys/vfs_concat.h"
|
#include "core/file_sys/vfs_concat.h"
|
||||||
#include "core/file_sys/vfs_real.h"
|
#include "core/file_sys/vfs_real.h"
|
||||||
|
#include "core/frontend/scope_acquire_context.h"
|
||||||
#include "core/gdbstub/gdbstub.h"
|
#include "core/gdbstub/gdbstub.h"
|
||||||
#include "core/hardware_interrupt_manager.h"
|
#include "core/hardware_interrupt_manager.h"
|
||||||
#include "core/hle/kernel/client_port.h"
|
#include "core/hle/kernel/client_port.h"
|
||||||
|
@ -184,6 +185,8 @@ struct System::Impl {
|
||||||
|
|
||||||
ResultStatus Load(System& system, Frontend::EmuWindow& emu_window,
|
ResultStatus Load(System& system, Frontend::EmuWindow& emu_window,
|
||||||
const std::string& filepath) {
|
const std::string& filepath) {
|
||||||
|
Core::Frontend::ScopeAcquireContext acquire_context{emu_window};
|
||||||
|
|
||||||
app_loader = Loader::GetLoader(GetGameFileFromPath(virtual_filesystem, filepath));
|
app_loader = Loader::GetLoader(GetGameFileFromPath(virtual_filesystem, filepath));
|
||||||
if (!app_loader) {
|
if (!app_loader) {
|
||||||
LOG_CRITICAL(Core, "Failed to obtain loader for {}!", filepath);
|
LOG_CRITICAL(Core, "Failed to obtain loader for {}!", filepath);
|
||||||
|
|
|
@ -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_context.h"
|
||||||
|
|
||||||
|
namespace Core::Frontend {
|
||||||
|
|
||||||
|
ScopeAcquireContext::ScopeAcquireContext(Core::Frontend::GraphicsContext& context)
|
||||||
|
: context{context} {
|
||||||
|
context.MakeCurrent();
|
||||||
|
}
|
||||||
|
ScopeAcquireContext::~ScopeAcquireContext() {
|
||||||
|
context.DoneCurrent();
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace Core::Frontend
|
|
@ -8,16 +8,16 @@
|
||||||
|
|
||||||
namespace Core::Frontend {
|
namespace Core::Frontend {
|
||||||
|
|
||||||
class EmuWindow;
|
class GraphicsContext;
|
||||||
|
|
||||||
/// Helper class to acquire/release window context within a given scope
|
/// Helper class to acquire/release window context within a given scope
|
||||||
class ScopeAcquireWindowContext : NonCopyable {
|
class ScopeAcquireContext : NonCopyable {
|
||||||
public:
|
public:
|
||||||
explicit ScopeAcquireWindowContext(Core::Frontend::EmuWindow& window);
|
explicit ScopeAcquireContext(Core::Frontend::GraphicsContext& context);
|
||||||
~ScopeAcquireWindowContext();
|
~ScopeAcquireContext();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Core::Frontend::EmuWindow& emu_window;
|
Core::Frontend::GraphicsContext& context;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Core::Frontend
|
} // namespace Core::Frontend
|
|
@ -1,18 +0,0 @@
|
||||||
// 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
|
|
|
@ -5,7 +5,7 @@
|
||||||
#include "common/assert.h"
|
#include "common/assert.h"
|
||||||
#include "common/microprofile.h"
|
#include "common/microprofile.h"
|
||||||
#include "core/core.h"
|
#include "core/core.h"
|
||||||
#include "core/frontend/scope_acquire_window_context.h"
|
#include "core/frontend/scope_acquire_context.h"
|
||||||
#include "video_core/dma_pusher.h"
|
#include "video_core/dma_pusher.h"
|
||||||
#include "video_core/gpu.h"
|
#include "video_core/gpu.h"
|
||||||
#include "video_core/gpu_thread.h"
|
#include "video_core/gpu_thread.h"
|
||||||
|
@ -27,7 +27,7 @@ static void RunThread(VideoCore::RendererBase& renderer, Tegra::DmaPusher& dma_p
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Core::Frontend::ScopeAcquireWindowContext acquire_context{renderer.GetRenderWindow()};
|
Core::Frontend::ScopeAcquireContext acquire_context{renderer.GetRenderWindow()};
|
||||||
|
|
||||||
CommandDataContainer next;
|
CommandDataContainer next;
|
||||||
while (state.is_running) {
|
while (state.is_running) {
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
#include "common/scm_rev.h"
|
#include "common/scm_rev.h"
|
||||||
#include "core/core.h"
|
#include "core/core.h"
|
||||||
#include "core/frontend/framebuffer_layout.h"
|
#include "core/frontend/framebuffer_layout.h"
|
||||||
#include "core/frontend/scope_acquire_window_context.h"
|
#include "core/frontend/scope_acquire_context.h"
|
||||||
#include "core/settings.h"
|
#include "core/settings.h"
|
||||||
#include "input_common/keyboard.h"
|
#include "input_common/keyboard.h"
|
||||||
#include "input_common/main.h"
|
#include "input_common/main.h"
|
||||||
|
@ -569,7 +569,7 @@ bool GRenderWindow::InitializeVulkan() {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GRenderWindow::LoadOpenGL() {
|
bool GRenderWindow::LoadOpenGL() {
|
||||||
Core::Frontend::ScopeAcquireWindowContext acquire_context{*this};
|
Core::Frontend::ScopeAcquireContext acquire_context{*this};
|
||||||
if (!gladLoadGL()) {
|
if (!gladLoadGL()) {
|
||||||
QMessageBox::critical(this, tr("Error while initializing OpenGL 4.3!"),
|
QMessageBox::critical(this, tr("Error while initializing OpenGL 4.3!"),
|
||||||
tr("Your GPU may not support OpenGL 4.3, or you do not have the "
|
tr("Your GPU may not support OpenGL 4.3, or you do not have the "
|
||||||
|
|
Loading…
Reference in New Issue