diff --git a/src/android/app/src/main/jni/emu_window/emu_window.cpp b/src/android/app/src/main/jni/emu_window/emu_window.cpp index 1ce0429f3..5a9e7ba53 100644 --- a/src/android/app/src/main/jni/emu_window/emu_window.cpp +++ b/src/android/app/src/main/jni/emu_window/emu_window.cpp @@ -82,20 +82,6 @@ EmuWindow_Android::~EmuWindow_Android() { DestroyContext(); } -void EmuWindow_Android::PollEvents() { - if (!render_window) { - return; - } - - host_window = render_window; - render_window = nullptr; - - DestroyWindowSurface(); - CreateWindowSurface(); - OnFramebufferSizeChanged(); - presenting_state = PresentingState::Initial; -} - void EmuWindow_Android::MakeCurrent() { core_context->MakeCurrent(); } diff --git a/src/android/app/src/main/jni/emu_window/emu_window.h b/src/android/app/src/main/jni/emu_window/emu_window.h index dd43fa16f..3dd9f30df 100644 --- a/src/android/app/src/main/jni/emu_window/emu_window.h +++ b/src/android/app/src/main/jni/emu_window/emu_window.h @@ -21,15 +21,13 @@ public: /// Handles movement of touch pointer void OnTouchMoved(int x, int y); - void PollEvents() override; - void MakeCurrent() override; void DoneCurrent() override; - virtual void TryPresenting() = 0; + virtual void TryPresenting() {} - virtual void StopPresenting() = 0; + virtual void StopPresenting() {} protected: void OnFramebufferSizeChanged(); @@ -53,11 +51,4 @@ protected: int window_height{}; std::unique_ptr core_context; - - enum class PresentingState { - Initial, - Running, - Stopped, - }; - PresentingState presenting_state{}; }; diff --git a/src/android/app/src/main/jni/emu_window/emu_window_gl.cpp b/src/android/app/src/main/jni/emu_window/emu_window_gl.cpp index f0de55483..b910c3184 100644 --- a/src/android/app/src/main/jni/emu_window/emu_window_gl.cpp +++ b/src/android/app/src/main/jni/emu_window/emu_window_gl.cpp @@ -177,6 +177,20 @@ std::unique_ptr EmuWindow_Android_OpenGL::CreateShare return std::make_unique(egl_display, egl_config, egl_context); } +void EmuWindow_Android_OpenGL::PollEvents() { + if (!render_window) { + return; + } + + host_window = render_window; + render_window = nullptr; + + DestroyWindowSurface(); + CreateWindowSurface(); + OnFramebufferSizeChanged(); + presenting_state = PresentingState::Initial; +} + void EmuWindow_Android_OpenGL::StopPresenting() { if (presenting_state == PresentingState::Running) { eglMakeCurrent(egl_display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); diff --git a/src/android/app/src/main/jni/emu_window/emu_window_gl.h b/src/android/app/src/main/jni/emu_window/emu_window_gl.h index b1a22b31d..f92950b94 100644 --- a/src/android/app/src/main/jni/emu_window/emu_window_gl.h +++ b/src/android/app/src/main/jni/emu_window/emu_window_gl.h @@ -20,6 +20,7 @@ public: void TryPresenting() override; void StopPresenting() override; + void PollEvents() override; std::unique_ptr CreateSharedContext() const override; @@ -33,4 +34,11 @@ private: EGLSurface egl_surface{}; EGLContext egl_context{}; EGLDisplay egl_display{}; + + enum class PresentingState { + Initial, + Running, + Stopped, + }; + PresentingState presenting_state{}; }; diff --git a/src/android/app/src/main/jni/emu_window/emu_window_vk.cpp b/src/android/app/src/main/jni/emu_window/emu_window_vk.cpp index c8dadd8ec..81dc69c4a 100644 --- a/src/android/app/src/main/jni/emu_window/emu_window_vk.cpp +++ b/src/android/app/src/main/jni/emu_window/emu_window_vk.cpp @@ -51,13 +51,3 @@ bool EmuWindow_Android_Vulkan::CreateWindowSurface() { std::unique_ptr EmuWindow_Android_Vulkan::CreateSharedContext() const { return std::make_unique(driver_library); } - -void EmuWindow_Android_Vulkan::StopPresenting() { - presenting_state = PresentingState::Stopped; -} - -void EmuWindow_Android_Vulkan::TryPresenting() { - if (presenting_state == PresentingState::Initial) { - presenting_state = PresentingState::Running; - } -} \ No newline at end of file diff --git a/src/android/app/src/main/jni/emu_window/emu_window_vk.h b/src/android/app/src/main/jni/emu_window/emu_window_vk.h index 9459a735a..58bbd3092 100644 --- a/src/android/app/src/main/jni/emu_window/emu_window_vk.h +++ b/src/android/app/src/main/jni/emu_window/emu_window_vk.h @@ -14,8 +14,7 @@ public: std::shared_ptr driver_library); ~EmuWindow_Android_Vulkan() override = default; - void TryPresenting() override; - void StopPresenting() override; + void PollEvents() override {} std::unique_ptr CreateSharedContext() const override;