mirror of
https://github.com/citra-emu/citra.git
synced 2024-11-22 21:40:06 +00:00
android: Move PollEvents to OpenGL window
* Vulkan does not need this and it causes problems
This commit is contained in:
parent
dd71859818
commit
faf6b36f3b
@ -82,20 +82,6 @@ EmuWindow_Android::~EmuWindow_Android() {
|
|||||||
DestroyContext();
|
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() {
|
void EmuWindow_Android::MakeCurrent() {
|
||||||
core_context->MakeCurrent();
|
core_context->MakeCurrent();
|
||||||
}
|
}
|
||||||
|
@ -21,15 +21,13 @@ public:
|
|||||||
/// Handles movement of touch pointer
|
/// Handles movement of touch pointer
|
||||||
void OnTouchMoved(int x, int y);
|
void OnTouchMoved(int x, int y);
|
||||||
|
|
||||||
void PollEvents() override;
|
|
||||||
|
|
||||||
void MakeCurrent() override;
|
void MakeCurrent() override;
|
||||||
|
|
||||||
void DoneCurrent() override;
|
void DoneCurrent() override;
|
||||||
|
|
||||||
virtual void TryPresenting() = 0;
|
virtual void TryPresenting() {}
|
||||||
|
|
||||||
virtual void StopPresenting() = 0;
|
virtual void StopPresenting() {}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void OnFramebufferSizeChanged();
|
void OnFramebufferSizeChanged();
|
||||||
@ -53,11 +51,4 @@ protected:
|
|||||||
int window_height{};
|
int window_height{};
|
||||||
|
|
||||||
std::unique_ptr<Frontend::GraphicsContext> core_context;
|
std::unique_ptr<Frontend::GraphicsContext> core_context;
|
||||||
|
|
||||||
enum class PresentingState {
|
|
||||||
Initial,
|
|
||||||
Running,
|
|
||||||
Stopped,
|
|
||||||
};
|
|
||||||
PresentingState presenting_state{};
|
|
||||||
};
|
};
|
||||||
|
@ -177,6 +177,20 @@ std::unique_ptr<Frontend::GraphicsContext> EmuWindow_Android_OpenGL::CreateShare
|
|||||||
return std::make_unique<SharedContext_Android>(egl_display, egl_config, egl_context);
|
return std::make_unique<SharedContext_Android>(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() {
|
void EmuWindow_Android_OpenGL::StopPresenting() {
|
||||||
if (presenting_state == PresentingState::Running) {
|
if (presenting_state == PresentingState::Running) {
|
||||||
eglMakeCurrent(egl_display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
|
eglMakeCurrent(egl_display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
|
||||||
|
@ -20,6 +20,7 @@ public:
|
|||||||
|
|
||||||
void TryPresenting() override;
|
void TryPresenting() override;
|
||||||
void StopPresenting() override;
|
void StopPresenting() override;
|
||||||
|
void PollEvents() override;
|
||||||
|
|
||||||
std::unique_ptr<GraphicsContext> CreateSharedContext() const override;
|
std::unique_ptr<GraphicsContext> CreateSharedContext() const override;
|
||||||
|
|
||||||
@ -33,4 +34,11 @@ private:
|
|||||||
EGLSurface egl_surface{};
|
EGLSurface egl_surface{};
|
||||||
EGLContext egl_context{};
|
EGLContext egl_context{};
|
||||||
EGLDisplay egl_display{};
|
EGLDisplay egl_display{};
|
||||||
|
|
||||||
|
enum class PresentingState {
|
||||||
|
Initial,
|
||||||
|
Running,
|
||||||
|
Stopped,
|
||||||
|
};
|
||||||
|
PresentingState presenting_state{};
|
||||||
};
|
};
|
||||||
|
@ -51,13 +51,3 @@ bool EmuWindow_Android_Vulkan::CreateWindowSurface() {
|
|||||||
std::unique_ptr<Frontend::GraphicsContext> EmuWindow_Android_Vulkan::CreateSharedContext() const {
|
std::unique_ptr<Frontend::GraphicsContext> EmuWindow_Android_Vulkan::CreateSharedContext() const {
|
||||||
return std::make_unique<GraphicsContext_Android>(driver_library);
|
return std::make_unique<GraphicsContext_Android>(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;
|
|
||||||
}
|
|
||||||
}
|
|
@ -14,8 +14,7 @@ public:
|
|||||||
std::shared_ptr<Common::DynamicLibrary> driver_library);
|
std::shared_ptr<Common::DynamicLibrary> driver_library);
|
||||||
~EmuWindow_Android_Vulkan() override = default;
|
~EmuWindow_Android_Vulkan() override = default;
|
||||||
|
|
||||||
void TryPresenting() override;
|
void PollEvents() override {}
|
||||||
void StopPresenting() override;
|
|
||||||
|
|
||||||
std::unique_ptr<GraphicsContext> CreateSharedContext() const override;
|
std::unique_ptr<GraphicsContext> CreateSharedContext() const override;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user