afwbkbc / glsmac

Unofficial open-source OpenGL/SDL2 reimplementation of Sid Meier's Alpha Centauri ( + Alien Crossfire )
GNU Affero General Public License v3.0
425 stars 12 forks source link

Crash when trying to start the game with Huge Random map #21

Open tsunamistate opened 1 year ago

tsunamistate commented 1 year ago

Environment:

Steps to reproduce:

  1. Start a GLSMAC game with proper path to SMAC resources
  2. In main menu, click "Start Game"
  3. Click "Make Random Map" ⇒ "Huge Planet"
  4. Choose any difficulty
  5. Click "Start with standard rules"
  6. Wait until map generation completes

Actual result: The game crashes to desktop on both Windows and Linux.

https://github.com/afwbkbc/glsmac/assets/4958520/3231c9d7-a5ba-45a1-8854-f0e1c7e366fc

Linux release build shows the following logs:

terminate called after throwing an instance of 'std::runtime_error'
  what():  OpenGL error occured in render loop, aborting
Aborted

Debug build shows A breakpoint instruction (__debugbreak() statement or a similar call) was executed in GLSMAC.exe. with call stack pointing to https://github.com/afwbkbc/glsmac/blob/3d6a9fba39c11a55c3e5c8327a48f26d5fdb32c3/src/graphics/opengl/OpenGL.cpp#L469 Debug logs have the following error:

Exception thrown at 0x00007FFE91E84FFC in GLSMAC.exe: Microsoft C++ exception: std::runtime_error at memory location 0x00000069065FEC58.

Expected result: Game successfully starts with newly generated map

Note: Game only crashes after generating "Huge Planet" map, "Large Planet" and lower don't crash

afwbkbc commented 1 year ago

Our of curiosity - which GPU was that or was it two different GPUs? In particular, how much video memory is there?

tsunamistate commented 1 year ago

Radeon RX 590 8Gb Also happens on my laptop, Ryzen 5300U with 2Gb VRAM set in BIOS

hartmark commented 1 year ago

I get the same behaviour on arch linux

Console log:

<Scheduler::Simple::#30> Stopping task [Task::MainMenu::#185]
<Audio::SDL2::#21> Removing sound actor Entity::Actor::Sound::(UI::SoundEffect)#253
<Graphics::OpenGL::#13> FATAL: Error loading texture
terminate called after throwing an instance of 'std::runtime_error'
  what():  Error loading texture
[1]    17416 IOT instruction (core dumped)  ./build/bin/GLSMAC --gdb --smacpath 
./build/bin/GLSMAC --gdb --smacpath   20.40s user 2.02s system 39% cpu 56.620 total

tmp.tar.gz

% lspci | grep -i vga 0a:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Vega 10 XL/XT [Radeon RX Vega 56/64] (rev c1)

Running the program with --gdb flag didn't work. Doing manual way with gdp worked and yielded the following bt:

...
<Graphics::OpenGL::#13> FATAL: Error loading texture
terminate called after throwing an instance of 'std::runtime_error'
  what():  Error loading texture

Thread 2 "GLSMAC" received signal SIGABRT, Aborted.
[Switching to Thread 0x7ffff677f6c0 (LWP 18322)]
__pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0) at pthread_kill.c:44
Downloading source file /usr/src/debug/glibc/glibc/nptl/pthread_kill.c
44            return INTERNAL_SYSCALL_ERROR_P (ret) ? INTERNAL_SYSCALL_ERRNO (ret) : 0;                                                                                                                                                                                     
(gdb) bt
#0  __pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0) at pthread_kill.c:44
#1  0x00007ffff74ac8a3 in __pthread_kill_internal (signo=6, threadid=<optimized out>) at pthread_kill.c:78
#2  0x00007ffff745c668 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
#3  0x00007ffff74444b8 in __GI_abort () at abort.c:79
#4  0x00007ffff769ca6f in __gnu_cxx::__verbose_terminate_handler () at /usr/src/debug/gcc/gcc/libstdc++-v3/libsupc++/vterminate.cc:95
#5  0x00007ffff76b011c in __cxxabiv1::__terminate (handler=<optimized out>) at /usr/src/debug/gcc/gcc/libstdc++-v3/libsupc++/eh_terminate.cc:48
#6  0x00007ffff76b0189 in std::terminate () at /usr/src/debug/gcc/gcc/libstdc++-v3/libsupc++/eh_terminate.cc:58
#7  0x00007ffff76b03ed in __cxxabiv1::__cxa_throw (obj=<optimized out>, tinfo=0x55555598bf80 <typeinfo for std::runtime_error@GLIBCXX_3.4>, dest=0x7ffff76c8320 <std::runtime_error::~runtime_error()>) at /usr/src/debug/gcc/gcc/libstdc++-v3/libsupc++/eh_throw.cc:98
#8  0x00005555556ae8f1 in graphics::opengl::OpenGL::LoadTexture (this=0x7fffffffcb30, texture=0x7fffeca04ee0) at /home/markus/code/glsmac/src/graphics/opengl/OpenGL.cpp:467
#9  0x0000555555696298 in graphics::opengl::Mesh::LoadTexture (this=0x7ffff1c5a3b0) at /home/markus/code/glsmac/src/graphics/opengl/actor/Mesh.cpp:123
#10 0x00005555556a1ab1 in graphics::opengl::Scene::Update (this=0x7ffff25f9500) at /home/markus/code/glsmac/src/graphics/opengl/Scene.cpp:139
#11 0x000055555568bb87 in graphics::opengl::routine::World::Iterate (this=0x5555559b5000) at /home/markus/code/glsmac/src/graphics/opengl/routine/World.cpp:31
#12 0x00005555556aca85 in graphics::opengl::OpenGL::Iterate (this=0x7fffffffcb30) at /home/markus/code/glsmac/src/graphics/opengl/OpenGL.cpp:207
#13 0x00005555555840a3 in base::Thread::Run (this=0x555555a43ee0) at /home/markus/code/glsmac/src/base/Thread.cpp:84
#14 0x0000555555586452 in std::__invoke_impl<void, void (base::Thread::*)(), base::Thread*> (__f=@0x5555559b4ea0: (void (base::Thread::*)(base::Thread * const)) 0x555555583d28 <base::Thread::Run()>, __t=@0x5555559b4e98: 0x555555a43ee0)
    at /usr/include/c++/13.2.1/bits/invoke.h:74
#15 0x00005555555863b1 in std::__invoke<void (base::Thread::*)(), base::Thread*> (__fn=@0x5555559b4ea0: (void (base::Thread::*)(base::Thread * const)) 0x555555583d28 <base::Thread::Run()>) at /usr/include/c++/13.2.1/bits/invoke.h:96
#16 0x0000555555586321 in std::thread::_Invoker<std::tuple<void (base::Thread::*)(), base::Thread*> >::_M_invoke<0ul, 1ul> (this=0x5555559b4e98) at /usr/include/c++/13.2.1/bits/std_thread.h:292
#17 0x00005555555862da in std::thread::_Invoker<std::tuple<void (base::Thread::*)(), base::Thread*> >::operator() (this=0x5555559b4e98) at /usr/include/c++/13.2.1/bits/std_thread.h:299
#18 0x00005555555862be in std::thread::_State_impl<std::thread::_Invoker<std::tuple<void (base::Thread::*)(), base::Thread*> > >::_M_run (this=0x5555559b4e90) at /usr/include/c++/13.2.1/bits/std_thread.h:244
#19 0x00007ffff76e1943 in std::execute_native_thread_routine (__p=0x5555559b4e90) at /usr/src/debug/gcc/gcc/libstdc++-v3/src/c++11/thread.cc:104
#20 0x00007ffff74aa9eb in start_thread (arg=<optimized out>) at pthread_create.c:444
#21 0x00007ffff752e7cc in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
(gdb)