Enable GL on Wayland for wx 3.2+, no vsync.
wxWidgets 3.2+ has experimental `wxGLCanvas` support for Wayland EGL, enable it for those versions. The `glXQueryExtensionsString()` method for enabling or disabling vsync does not work on Wayland currently, so it's disabled. TODO: Enable/disable vsync on Wayland EGL. Fix #1028. Signed-off-by: Rafael Kitover <rkitover@gmail.com>
This commit is contained in:
parent
75e46b7117
commit
c27d384a53
|
@ -3707,8 +3707,8 @@ bool MainFrame::BindControls()
|
|||
#ifdef NO_OGL
|
||||
rb->Hide();
|
||||
#endif
|
||||
#ifdef __WXGTK__
|
||||
// wxGLCanvas segfaults on Wayland
|
||||
#if defined(__WXGTK__) && !wxCHECK_VERSION(3, 2, 0)
|
||||
// wxGLCanvas segfaults on Wayland before wx 3.2
|
||||
if (wxGetApp().UsingWayland()) {
|
||||
rb->Hide();
|
||||
}
|
||||
|
|
|
@ -2176,13 +2176,17 @@ void GLDrawingPanel::DrawingPanelInit()
|
|||
glClearColor(0.0, 0.0, 0.0, 1.0);
|
||||
// non-portable vsync code
|
||||
#if defined(__WXGTK__)
|
||||
// TODO: Use Wayland EGL equivalent to enable/disable vsync.
|
||||
if (!IsItWayland()) {
|
||||
static PFNGLXSWAPINTERVALEXTPROC glXSwapIntervalEXT = NULL;
|
||||
static PFNGLXSWAPINTERVALSGIPROC glXSwapIntervalSGI = NULL;
|
||||
static PFNGLXSWAPINTERVALMESAPROC glXSwapIntervalMESA = NULL;
|
||||
|
||||
auto display = GetX11Display();
|
||||
// These wayland checks don't work.
|
||||
auto display = IsItWayland() ? 0 : GetX11Display();
|
||||
auto default_screen = IsItWayland() ? 0 : DefaultScreen(display);
|
||||
|
||||
char* glxQuery = (char*)glXQueryExtensionsString(display, DefaultScreen(display));
|
||||
char* glxQuery = (char*)glXQueryExtensionsString(display, default_screen);
|
||||
|
||||
if (strstr(glxQuery, "GLX_EXT_swap_control") != NULL)
|
||||
{
|
||||
|
@ -2210,6 +2214,7 @@ void GLDrawingPanel::DrawingPanelInit()
|
|||
else
|
||||
systemScreenMessage(_("Failed to set glXSwapIntervalMESA"));
|
||||
}
|
||||
}
|
||||
#elif defined(__WXMSW__)
|
||||
typedef const char* (*wglext)();
|
||||
wglext wglGetExtensionsStringEXT = (wglext)wglGetProcAddress("wglGetExtensionsStringEXT");
|
||||
|
|
|
@ -358,10 +358,12 @@ bool wxvbamApp::OnInit() {
|
|||
|
||||
load_opts();
|
||||
|
||||
// wxGLCanvas segfaults under wayland
|
||||
// wxGLCanvas segfaults under wayland before wx 3.2
|
||||
#if defined(__WXGTK__) && !wxCHECK_VERSION(3, 2, 0)
|
||||
if (UsingWayland() && gopts.render_method == RND_OPENGL) {
|
||||
gopts.render_method = RND_SIMPLE;
|
||||
}
|
||||
#endif
|
||||
|
||||
// process command-line options
|
||||
for (size_t i = 0; i < pending_optset.size(); i++) {
|
||||
|
|
Loading…
Reference in New Issue