Fix OpenGL behavior under wayland-egl

This commit is contained in:
kd-11 2024-08-12 04:03:34 +03:00 committed by kd-11
parent b0d07a75e5
commit c7b2a21fcb
3 changed files with 15 additions and 0 deletions

View File

@ -30,6 +30,7 @@ if(UNIX AND NOT APPLE)
find_package(Wayland) find_package(Wayland)
if(WAYLAND_FOUND) if(WAYLAND_FOUND)
add_definitions(-DHAVE_WAYLAND) add_definitions(-DHAVE_WAYLAND)
set(ADDITIONAL_LIBS ${ADDITIONAL_LIBS} "EGL")
endif() endif()
endif() endif()

View File

@ -1,6 +1,10 @@
#include "stdafx.h" #include "stdafx.h"
#include "OpenGL.h" #include "OpenGL.h"
#if defined(HAVE_WAYLAND)
#include <EGL/egl.h>
#endif
#ifdef _WIN32 #ifdef _WIN32
extern "C" extern "C"
@ -54,6 +58,14 @@ void gl::set_swapinterval(int interval)
} }
} }
#ifdef HAVE_WAYLAND
if (auto egl_display = eglGetCurrentDisplay(); egl_display != EGL_NO_DISPLAY)
{
eglSwapInterval(egl_display, interval);
return;
}
#endif
//No existing drawable or missing swap extension, EGL? //No existing drawable or missing swap extension, EGL?
rsx_log.error("Failed to set swap interval"); rsx_log.error("Failed to set swap interval");
#else #else

View File

@ -18,12 +18,14 @@ gl_gs_frame::gl_gs_frame(QScreen* screen, const QRect& geometry, const QIcon& ap
m_format.setAlphaBufferSize(0); m_format.setAlphaBufferSize(0);
m_format.setDepthBufferSize(0); m_format.setDepthBufferSize(0);
m_format.setSwapBehavior(QSurfaceFormat::SwapBehavior::DoubleBuffer); m_format.setSwapBehavior(QSurfaceFormat::SwapBehavior::DoubleBuffer);
m_format.setSwapInterval(0);
if (g_cfg.video.debug_output) if (g_cfg.video.debug_output)
{ {
m_format.setOption(QSurfaceFormat::FormatOption::DebugContext); m_format.setOption(QSurfaceFormat::FormatOption::DebugContext);
} }
setFormat(m_format); setFormat(m_format);
create(); create();
show();
} }
draw_context_t gl_gs_frame::make_context() draw_context_t gl_gs_frame::make_context()