SFTtech / openage

Free (as in freedom) open source clone of the Age of Empires II engine 🚀
http://openage.dev
Other
12.51k stars 1.11k forks source link

OpenGL error when launching on Wayland #1596

Closed zoli111 closed 8 months ago

zoli111 commented 8 months ago

I get this error when I try to launch the demo on Wayland session. OS: Arch Compositor: Mutter (I can test with others too)

./run game --modpacks hd_base

WARN [T2] QEGLPlatformContext: Failed to create context: 3009

FATAL: terminate has been called

uncaught exception

Traceback (most recent call last):
  File ?, in ? [0x7facb48aa9eb]
  File ?, in ? [0x7facb4ae1943]
  File ?, in ? [0x7facb52ea683]
  File ?, in ? [0x7facb52ea65e]
  File ?, in openage::presenter::Presenter::run(bool)+0x6e [0x7facb54060d6]
  File ?, in openage::presenter::Presenter::init_graphics(bool)+0xd8 [0x7facb5404c72]
  File ?, in openage::renderer::Window::create(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned long, unsigned long, bool)+0x4b [0x7facb5430429]
  File ?, in std::shared_ptr<openage::renderer::opengl::GlWindow>::shared_ptr<std::allocator<void>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned long&, unsigned long&, bool&>(std::_Sp_alloc_shared_tag<std::allocator<void> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned long&, unsigned long&, bool&)+0x28 [0x7facb5430f4c]
  File ?, in std::__shared_count<(__gnu_cxx::_Lock_policy)2>::__shared_count<openage::renderer::opengl::GlWindow, std::allocator<void>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned long&, unsigned long&, bool&>(openage::renderer::opengl::GlWindow*&, std::_Sp_alloc_shared_tag<std::allocator<void> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned long&, unsigned long&, bool&)+0x61 [0x7facb5430eb7]
  File ?, in std::_Sp_counted_ptr_inplace<openage::renderer::opengl::GlWindow, std::allocator<void>, (__gnu_cxx::_Lock_policy)2>::_Sp_counted_ptr_inplace<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned long&, unsigned long&, bool&>(std::allocator<void>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned long&, unsigned long&, bool&)+0x41 [0x7facb5430b3b]
  File ?, in openage::renderer::opengl::GlWindow::GlWindow(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned long, unsigned long, bool)+0x265 [0x7facb54986f3]
  File ?, in std::shared_ptr<openage::renderer::opengl::GlContext>::shared_ptr<std::allocator<void>, std::shared_ptr<QWindow>&, bool&>(std::_Sp_alloc_shared_tag<std::allocator<void> >, std::shared_ptr<QWindow>&, bool&)+0x23 [0x7facb549924b]
  File ?, in std::__shared_count<(__gnu_cxx::_Lock_policy)2>::__shared_count<openage::renderer::opengl::GlContext, std::allocator<void>, std::shared_ptr<QWindow>&, bool&>(openage::renderer::opengl::GlContext*&, std::_Sp_alloc_shared_tag<std::allocator<void> >, std::shared_ptr<QWindow>&, bool&)+0x4a [0x7facb54991bc]
  File ?, in std::_Sp_counted_ptr_inplace<openage::renderer::opengl::GlContext, std::allocator<void>, (__gnu_cxx::_Lock_policy)2>::_Sp_counted_ptr_inplace<std::shared_ptr<QWindow>&, bool&>(std::allocator<void>, std::shared_ptr<QWindow>&, bool&)+0x3a [0x7facb5498e10]
  File ?, in openage::renderer::opengl::GlContext::GlContext(std::shared_ptr<QWindow> const&, bool)+0x215 [0x7facb5484cb7]
  File ?, in openage::error::Error::Error(openage::log::message const&, bool, bool)+0xba [0x7facb52ecbe4]
  File "libopenage/renderer/opengl/context.cpp", line 102, in openage::renderer::opengl::GlContext::GlContext(const std::shared_ptr<QWindow>&, bool)
openage::error::Error: OpenGL context creation failed.

current stack:

Traceback (most recent call last):
  File ?, in ? [0x7facb48aa9eb]
  File ?, in ? [0x7facb4ae1943]
  File ?, in ? [0x7facb52ea683]
  File ?, in ? [0x7facb52ea65e]
INFO Loading .nyan file: hd_base/data/tech/generic/berserkergang/berserkergang.nyan
  File ?, in openage::presenter::Presenter::run(bool)+0x6e [0x7facb54060d6]
INFO Loading .nyan file: hd_base/data/game_entity/generic/longboat/elite_longboat.nyan
  File ?, in openage::presenter::Presenter::init_graphics(bool)+0xd8 [0x7facb5404c72]
INFO Loading .nyan file: hd_base/data/game_entity/generic/berserk/elite_berserk.nyan
  File ?, in openage::renderer::Window::create(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned long, unsigned long, bool)+0x4b [0x7facb5430429]
  File ?, in std::shared_ptr<openage::renderer::opengl::GlWindow>::shared_ptr<std::allocator<void>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned long&, unsigned long&, bool&>(std::_Sp_alloc_shared_tag<std::allocator<void> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned long&, unsigned long&, bool&)+0x28 [0x7facb5430f4c]
INFO Loading .nyan file: hd_base/data/civ/koreans/koreans.nyan
  File ?, in std::__shared_count<(__gnu_cxx::_Lock_policy)2>::__shared_count<openage::renderer::opengl::GlWindow, std::allocator<void>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned long&, unsigned long&, bool&>(openage::renderer::opengl::GlWindow*&, std::_Sp_alloc_shared_tag<std::allocator<void> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned long&, unsigned long&, bool&)+0x61 [0x7facb5430eb7]
  File ?, in std::_Sp_counted_ptr_inplace<openage::renderer::opengl::GlWindow, std::allocator<void>, (__gnu_cxx::_Lock_policy)2>::_Sp_counted_ptr_inplace<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned long&, unsigned long&, bool&>(std::allocator<void>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned long&, unsigned long&, bool&)+0x41 [0x7facb5430b3b]
  File ?, in openage::renderer::opengl::GlWindow::GlWindow(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned long, unsigned long, bool)+0x265 [0x7facb54986f3]
  File ?, in std::shared_ptr<openage::renderer::opengl::GlContext>::shared_ptr<std::allocator<void>, std::shared_ptr<QWindow>&, bool&>(std::_Sp_alloc_shared_tag<std::allocator<void> >, std::shared_ptr<QWindow>&, bool&)+0x23 [0x7facb549924b]
  File ?, in std::__shared_count<(__gnu_cxx::_Lock_policy)2>::__shared_count<openage::renderer::opengl::GlContext, std::allocator<void>, std::shared_ptr<QWindow>&, bool&>(openage::renderer::opengl::GlContext*&, std::_Sp_alloc_shared_tag<std::allocator<void> >, std::shared_ptr<QWindow>&, bool&)+0x4a [0x7facb54991bc]
  File ?, in std::_Sp_counted_ptr_inplace<openage::renderer::opengl::GlContext, std::allocator<void>, (__gnu_cxx::_Lock_policy)2>::_Sp_counted_ptr_inplace<std::shared_ptr<QWindow>&, bool&>(std::allocator<void>, std::shared_ptr<QWindow>&, bool&)+0x3a [0x7facb5498e10]
  File ?, in openage::renderer::opengl::GlContext::GlContext(std::shared_ptr<QWindow> const&, bool)+0x24d [0x7facb5484cef]
  File ?, in ? [0x7facb4ab03ed]
  File ?, in ? [0x7facb4ab0189]
  File ?, in ? [0x7facb4ab011c]
  File ?, in openage::error::terminate_handler()+0x1da [0x7facb52ed825]

handing over to the system...

terminate called after throwing an instance of 'openage::error::Error'
  what():  OpenGL context creation failed.
Aborted (core dumped)
heinezen commented 8 months ago

Anything before that error message in the console output related to Wayland?

zoli111 commented 8 months ago

No, only nyan info.

zoli111 commented 8 months ago

I can get it to run on Xwayland by setting QT_QPA_PLATFORM=xcb, but I think it would be better to have native support.

heinezen commented 8 months ago

https://github.com/SFTtech/openage/pull/1597 should provide a fix

zoli111 commented 8 months ago

Received this error now:

WARN [T2] QEGLPlatformContext: Failed to create context: 3009
INFO Loading .nyan file: hd_base/data/game_entity/generic/boar/boar.nyan
INFO Loading .nyan file: hd_base/data/game_entity/generic/mangudai/mangudai.nyan

FATAL: terminate has been called

uncaught exception

Traceback (most recent call last):
  File ?, in ? [0x7effc3eaa9eb]
  File ?, in ? [0x7effc40e1943]
  File ?, in ? [0x7effc48ea633]
  File ?, in ? [0x7effc48ea60e]
INFO Loading .nyan file: hd_base/data/terrain/farm_construction3/farm_construction3.nyan
INFO Loading .nyan file: hd_base/data/tech/generic/keep/keep.nyan
INFO Loading .nyan file: hd_base/data/game_entity/generic/tower/keep_upgrade.nyan
  File ?, in openage::presenter::Presenter::run(bool)+0x6e [0x7effc4a06086]
INFO Loading .nyan file: hd_base/data/civ/vikings/vikings.nyan
  File ?, in openage::presenter::Presenter::init_graphics(bool)+0xd8 [0x7effc4a04c22]
  File ?, in openage::renderer::Window::create(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned long, unsigned long, bool)+0x4b [0x7effc4a303d9]
  File ?, in std::shared_ptr<openage::renderer::opengl::GlWindow>::shared_ptr<std::allocator<void>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned long&, unsigned long&, bool&>(std::_Sp_alloc_shared_tag<std::allocator<void> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned long&, unsigned long&, bool&)+0x28 [0x7effc4a30efc]
  File ?, in std::__shared_count<(__gnu_cxx::_Lock_policy)2>::__shared_count<openage::renderer::opengl::GlWindow, std::allocator<void>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned long&, unsigned long&, bool&>(openage::renderer::opengl::GlWindow*&, std::_Sp_alloc_shared_tag<std::allocator<void> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned long&, unsigned long&, bool&)+0x61 [0x7effc4a30e67]
  File ?, in std::_Sp_counted_ptr_inplace<openage::renderer::opengl::GlWindow, std::allocator<void>, (__gnu_cxx::_Lock_policy)2>::_Sp_counted_ptr_inplace<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned long&, unsigned long&, bool&>(std::allocator<void>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned long&, unsigned long&, bool&)+0x41 [0x7effc4a30aeb]
  File ?, in openage::renderer::opengl::GlWindow::GlWindow(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned long, unsigned long, bool)+0x1a1 [0x7effc4a985d5]
  File ?, in openage::renderer::opengl::GlContext::find_spec()+0x16c [0x7effc4a84788]
  File ?, in openage::error::Error::Error(openage::log::message const&, bool, bool)+0xba [0x7effc48ecb94]
  File "libopenage/renderer/opengl/context.cpp", line 41, in static openage::renderer::opengl::gl_context_spec openage::renderer::opengl::GlContext::find_spec()
openage::error::Error: OpenGL version 3.3 is not available. It is the minimal required version.

current stack:

Traceback (most recent call last):
  File ?, in ? [0x7effc3eaa9eb]
  File ?, in ? [0x7effc40e1943]
  File ?, in ? [0x7effc48ea633]
  File ?, in ? [0x7effc48ea60e]
  File ?, in openage::presenter::Presenter::run(bool)+0x6e [0x7effc4a06086]
  File ?, in openage::presenter::Presenter::init_graphics(bool)+0xd8 [0x7effc4a04c22]
  File ?, in openage::renderer::Window::create(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned long, unsigned long, bool)+0x4b [0x7effc4a303d9]
  File ?, in std::shared_ptr<openage::renderer::opengl::GlWindow>::shared_ptr<std::allocator<void>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned long&, unsigned long&, bool&>(std::_Sp_alloc_shared_tag<std::allocator<void> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned long&, unsigned long&, bool&)+0x28 [0x7effc4a30efc]
INFO Loading .nyan file: hd_base/data/tech/generic/berserkergang/berserkergang.nyan
  File ?, in std::__shared_count<(__gnu_cxx::_Lock_policy)2>::__shared_count<openage::renderer::opengl::GlWindow, std::allocator<void>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned long&, unsigned long&, bool&>(openage::renderer::opengl::GlWindow*&, std::_Sp_alloc_shared_tag<std::allocator<void> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned long&, unsigned long&, bool&)+0x61 [0x7effc4a30e67]
INFO Loading .nyan file: hd_base/data/game_entity/generic/longboat/elite_longboat.nyan
INFO Loading .nyan file: hd_base/data/game_entity/generic/berserk/elite_berserk.nyan
  File ?, in std::_Sp_counted_ptr_inplace<openage::renderer::opengl::GlWindow, std::allocator<void>, (__gnu_cxx::_Lock_policy)2>::_Sp_counted_ptr_inplace<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned long&, unsigned long&, bool&>(std::allocator<void>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned long&, unsigned long&, bool&)+0x41 [0x7effc4a30aeb]
INFO Loading .nyan file: hd_base/data/civ/koreans/koreans.nyan
  File ?, in openage::renderer::opengl::GlWindow::GlWindow(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned long, unsigned long, bool)+0x1a1 [0x7effc4a985d5]
  File ?, in openage::renderer::opengl::GlContext::find_spec()+0x1a4 [0x7effc4a847c0]
  File ?, in ? [0x7effc40b03ed]
  File ?, in ? [0x7effc40b0189]
  File ?, in ? [0x7effc40b011c]
  File ?, in openage::error::terminate_handler()+0x1da [0x7effc48ed7d5]

handing over to the system...

terminate called after throwing an instance of 'openage::error::Error'
  what():  OpenGL version 3.3 is not available. It is the minimal required version.
Aborted (core dumped)
heinezen commented 8 months ago

Damn, I thought it would work.

zoli111 commented 8 months ago

I forgot to add that my desktop computer has an Nvidia card with their proprietary driver, for which Wayland support is not the best.

Then I tried it with my Intel graphics laptop and the demo started without errors, but looked like this: Video

heinezen commented 8 months ago

I'v now tested on Intel Graphics and got the same result as you. The window is just blank. Could be an issue with the OpenGL context not being properly working again...

The resizing reveals that something is drawn without OpenGL errors in the background but it doesn't display correctly. So the framebuffer is not correctly swapped or it cannot be accessed?

I got other Qt examples to work in QtCreator, so this is orobably an openage issue not a driver issue.

heinezen commented 8 months ago

I found the issue for the blank window!

Turns out the default framebuffer ID on QtWayland is not 0 but our default render target assumes that it is. The problem now is that there are some segfaults that I have to get rid of.

heinezen commented 8 months ago

I got it to run with https://github.com/SFTtech/openage/pull/1598/

image

zoli111 commented 8 months ago

I got it to run with #1598

I can confirm that it works right with Intel. And with Nvidia too if using the open source driver.