diff options
| author | 2019-01-23 21:20:08 -0500 | |
|---|---|---|
| committer | 2019-01-23 21:20:08 -0500 | |
| commit | f574d324e7f8692ebff0aaa17c416f4840feda5c (patch) | |
| tree | afd89a9ec560c65070c37bbd0151c5327cc71e8a /src/video_core | |
| parent | Merge pull request #2049 from FearlessTobi/port-3928 (diff) | |
| parent | frontend: Refactor ScopeAcquireWindowContext out of renderer_opengl. (diff) | |
| download | yuzu-f574d324e7f8692ebff0aaa17c416f4840feda5c.tar.gz yuzu-f574d324e7f8692ebff0aaa17c416f4840feda5c.tar.xz yuzu-f574d324e7f8692ebff0aaa17c416f4840feda5c.zip | |
Merge pull request #2054 from bunnei/scope-context-refactor
frontend: Refactor ScopeAcquireWindowContext out of renderer_opengl.
Diffstat (limited to 'src/video_core')
| -rw-r--r-- | src/video_core/renderer_opengl/gl_rasterizer.cpp | 4 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/renderer_opengl.cpp | 16 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/renderer_opengl.h | 10 |
3 files changed, 2 insertions, 28 deletions
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp index d8e9df5db..6600ad528 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp | |||
| @@ -643,8 +643,6 @@ void RasterizerOpenGL::Clear() { | |||
| 643 | return; | 643 | return; |
| 644 | } | 644 | } |
| 645 | 645 | ||
| 646 | ScopeAcquireGLContext acquire_context{emu_window}; | ||
| 647 | |||
| 648 | ConfigureFramebuffers(clear_state, use_color, use_depth || use_stencil, false, | 646 | ConfigureFramebuffers(clear_state, use_color, use_depth || use_stencil, false, |
| 649 | regs.clear_buffers.RT.Value()); | 647 | regs.clear_buffers.RT.Value()); |
| 650 | if (regs.clear_flags.scissor) { | 648 | if (regs.clear_flags.scissor) { |
| @@ -678,8 +676,6 @@ void RasterizerOpenGL::DrawArrays() { | |||
| 678 | auto& gpu = Core::System::GetInstance().GPU().Maxwell3D(); | 676 | auto& gpu = Core::System::GetInstance().GPU().Maxwell3D(); |
| 679 | const auto& regs = gpu.regs; | 677 | const auto& regs = gpu.regs; |
| 680 | 678 | ||
| 681 | ScopeAcquireGLContext acquire_context{emu_window}; | ||
| 682 | |||
| 683 | ConfigureFramebuffers(state); | 679 | ConfigureFramebuffers(state); |
| 684 | SyncColorMask(); | 680 | SyncColorMask(); |
| 685 | SyncFragmentColorClampState(); | 681 | SyncFragmentColorClampState(); |
diff --git a/src/video_core/renderer_opengl/renderer_opengl.cpp b/src/video_core/renderer_opengl/renderer_opengl.cpp index c268c9686..e37b65b38 100644 --- a/src/video_core/renderer_opengl/renderer_opengl.cpp +++ b/src/video_core/renderer_opengl/renderer_opengl.cpp | |||
| @@ -14,6 +14,7 @@ | |||
| 14 | #include "core/core.h" | 14 | #include "core/core.h" |
| 15 | #include "core/core_timing.h" | 15 | #include "core/core_timing.h" |
| 16 | #include "core/frontend/emu_window.h" | 16 | #include "core/frontend/emu_window.h" |
| 17 | #include "core/frontend/scope_acquire_window_context.h" | ||
| 17 | #include "core/memory.h" | 18 | #include "core/memory.h" |
| 18 | #include "core/perf_stats.h" | 19 | #include "core/perf_stats.h" |
| 19 | #include "core/settings.h" | 20 | #include "core/settings.h" |
| @@ -97,18 +98,6 @@ static std::array<GLfloat, 3 * 2> MakeOrthographicMatrix(const float width, cons | |||
| 97 | return matrix; | 98 | return matrix; |
| 98 | } | 99 | } |
| 99 | 100 | ||
| 100 | ScopeAcquireGLContext::ScopeAcquireGLContext(Core::Frontend::EmuWindow& emu_window_) | ||
| 101 | : emu_window{emu_window_} { | ||
| 102 | if (Settings::values.use_multi_core) { | ||
| 103 | emu_window.MakeCurrent(); | ||
| 104 | } | ||
| 105 | } | ||
| 106 | ScopeAcquireGLContext::~ScopeAcquireGLContext() { | ||
| 107 | if (Settings::values.use_multi_core) { | ||
| 108 | emu_window.DoneCurrent(); | ||
| 109 | } | ||
| 110 | } | ||
| 111 | |||
| 112 | RendererOpenGL::RendererOpenGL(Core::Frontend::EmuWindow& window) | 101 | RendererOpenGL::RendererOpenGL(Core::Frontend::EmuWindow& window) |
| 113 | : VideoCore::RendererBase{window} {} | 102 | : VideoCore::RendererBase{window} {} |
| 114 | 103 | ||
| @@ -117,7 +106,6 @@ RendererOpenGL::~RendererOpenGL() = default; | |||
| 117 | /// Swap buffers (render frame) | 106 | /// Swap buffers (render frame) |
| 118 | void RendererOpenGL::SwapBuffers( | 107 | void RendererOpenGL::SwapBuffers( |
| 119 | std::optional<std::reference_wrapper<const Tegra::FramebufferConfig>> framebuffer) { | 108 | std::optional<std::reference_wrapper<const Tegra::FramebufferConfig>> framebuffer) { |
| 120 | ScopeAcquireGLContext acquire_context{render_window}; | ||
| 121 | 109 | ||
| 122 | Core::System::GetInstance().GetPerfStats().EndSystemFrame(); | 110 | Core::System::GetInstance().GetPerfStats().EndSystemFrame(); |
| 123 | 111 | ||
| @@ -506,7 +494,7 @@ static void APIENTRY DebugHandler(GLenum source, GLenum type, GLuint id, GLenum | |||
| 506 | 494 | ||
| 507 | /// Initialize the renderer | 495 | /// Initialize the renderer |
| 508 | bool RendererOpenGL::Init() { | 496 | bool RendererOpenGL::Init() { |
| 509 | ScopeAcquireGLContext acquire_context{render_window}; | 497 | Core::Frontend::ScopeAcquireWindowContext acquire_context{render_window}; |
| 510 | 498 | ||
| 511 | if (GLAD_GL_KHR_debug) { | 499 | if (GLAD_GL_KHR_debug) { |
| 512 | glEnable(GL_DEBUG_OUTPUT); | 500 | glEnable(GL_DEBUG_OUTPUT); |
diff --git a/src/video_core/renderer_opengl/renderer_opengl.h b/src/video_core/renderer_opengl/renderer_opengl.h index b85cc262f..1665018db 100644 --- a/src/video_core/renderer_opengl/renderer_opengl.h +++ b/src/video_core/renderer_opengl/renderer_opengl.h | |||
| @@ -39,16 +39,6 @@ struct ScreenInfo { | |||
| 39 | TextureInfo texture; | 39 | TextureInfo texture; |
| 40 | }; | 40 | }; |
| 41 | 41 | ||
| 42 | /// Helper class to acquire/release OpenGL context within a given scope | ||
| 43 | class ScopeAcquireGLContext : NonCopyable { | ||
| 44 | public: | ||
| 45 | explicit ScopeAcquireGLContext(Core::Frontend::EmuWindow& window); | ||
| 46 | ~ScopeAcquireGLContext(); | ||
| 47 | |||
| 48 | private: | ||
| 49 | Core::Frontend::EmuWindow& emu_window; | ||
| 50 | }; | ||
| 51 | |||
| 52 | class RendererOpenGL : public VideoCore::RendererBase { | 42 | class RendererOpenGL : public VideoCore::RendererBase { |
| 53 | public: | 43 | public: |
| 54 | explicit RendererOpenGL(Core::Frontend::EmuWindow& window); | 44 | explicit RendererOpenGL(Core::Frontend::EmuWindow& window); |