libretro / RetroArch

Cross-platform, sophisticated frontend for the libretro API. Licensed GPLv3.
http://www.libretro.com
GNU General Public License v3.0
10.33k stars 1.84k forks source link

Crash when closing running content with slang shaders #4664

Closed pepedopolous closed 4 years ago

pepedopolous commented 7 years ago

First and foremost consider this:

Description

When I play a game and then decide to close it using the Quick Menu, RetroArch crashes and I have to start the whole program again if I want to load a different game.

Expected behavior

Return to the menu to continue using RetroArch

Actual behavior

RetroArch crashes.

Output from retroarch -v

retroarch: deps/glslang/glslang/OGLCompilersDLL/InitializeDll.cpp:105: bool glslang::InitThread(): Assertion `0 && "InitThread(): Unable to set init flag."' failed. Aborted (core dumped)

Version/Commit

You can find this information under Information/System Information

Environment information

--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/42188102-crash-when-closing-running-content-xmb-linux-vulkan?utm_campaign=plugin&utm_content=tracker%2F296058&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F296058&utm_medium=issues&utm_source=github).
orbea commented 7 years ago
  1. Does it happen with the git master?
  2. Can you get a backtrace with gdb?
  3. Can you git bisect it and find the first bad commit?
RobLoach commented 7 years ago

What core? Which game?

pepedopolous commented 7 years ago

This problem happens with git master (I update retroarch almost every day).

It happens with all the cores I've tried (bsnes-mercury performance, beetle PSX HW, Gambette, parallel, FBA). I downloaded the cores again before trying them.

I tried both an X11 session and a Wayland session (KDE Plasma 5) but the crash happens every time I close a game.

AaronBPaden commented 6 years ago

Are you using Vulkan or OpenGL? I get the same symptoms. Backtrace:

retroarch: deps/glslang/glslang/OGLCompilersDLL/InitializeDll.cpp:105: bool glslang::InitThread(): Assertion `0 && "InitThread(): Unable to set init flag."' failed.

Thread 1 "retroarch" received signal SIGABRT, Aborted.
0x00007fffef63886b in raise () from /usr/lib/libc.so.6
(gdb) bt
#0  0x00007fffef63886b in raise () from /usr/lib/libc.so.6
#1  0x00007fffef62340e in abort () from /usr/lib/libc.so.6
#2  0x00007fffef6232e0 in __assert_fail_base.cold.0 () from /usr/lib/libc.so.6
#3  0x00007fffef631112 in __assert_fail () from /usr/lib/libc.so.6
#4  0x00005555557dc680 in glslang::InitThread () at deps/glslang/glslang/OGLCompilersDLL/InitializeDll.cpp:105
#5  0x0000555555859c95 in glslang::TShader::preprocess(TBuiltInResource const*, int, EProfile, bool, bool, EShMessages, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*, glslang::TShader::Includer&) () at deps/glslang/glslang/glslang/MachineIndependent/ShaderLang.cpp:1577
#6  0x000055555578f9d7 in glslang::compile_spirv(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, glslang::Stage, std::vector<unsigned int, std::allocator<unsigned int> >*) () at deps/glslang/glslang.cpp:362
#7  0x00005555557891ab in glslang_compile_shader(char const*, glslang_output*) () at gfx/drivers_shader/glslang_util.cpp:385
#8  0x0000555555777b0c in vulkan_filter_chain_create_from_preset () at gfx/drivers_shader/shader_vulkan.cpp:2846
#9  0x0000555555765c4b in vulkan_init_filter_chain_preset (vk=vk@entry=0x555556cfda60, 
    shader_path=shader_path@entry=0x555555e50220 <runtime_shader_preset> "/home/aaron/.config/retroarch/shaders/presets/Gambatte/gbc.slangp") at gfx/drivers/vulkan.c:795
#10 0x0000555555768673 in vulkan_init_filter_chain (vk=0x555556cfda60) at gfx/drivers/vulkan.c:828
#11 vulkan_init (video=video@entry=0x7fffffffbd70, input=0x555555e8c328 <current_input>, input_data=input_data@entry=0x555555e8c320 <current_input_data>)
    at gfx/drivers/vulkan.c:1197
#12 0x0000555555618c1d in video_driver_init_internal (video_is_threaded=0x7fffffffbd97) at gfx/video_driver.c:1060
#13 video_driver_init (video_is_threaded=video_is_threaded@entry=0x7fffffffbde7) at gfx/video_driver.c:1782
#14 0x000055555561d572 in drivers_init (flags=flags@entry=511) at driver.c:354
#15 0x00005555555c9f5a in retroarch_main_init (argc=7, argv=argv@entry=0x7fffffffc430) at retroarch.c:1359
#16 0x00005555555dbe28 in content_load (info=<optimized out>) at tasks/task_content.c:279
#17 0x00005555555dc229 in task_load_content (content_info=<optimized out>, content_ctx=0x7fffffffc710, launched_from_menu=<optimized out>, launched_from_cli=<optimized out>, 
    error_string=0x7fffffffc6e8) at tasks/task_content.c:874
#18 0x00005555555dd45b in command_event_cmd_exec (launched_from_cli=false, error_string=0x7fffffffc6e8, content_ctx=0x7fffffffc710, data=<optimized out>)
    at tasks/task_content.c:997
#19 task_push_load_content_from_playlist_from_menu (core_path=core_path@entry=0x7fffffffc820 "/home/aaron/.config/retroarch/cores/gambatte_libretro.so", 
    fullpath=0x555556a94450 "/data/roms/gbc/Legend of Zelda, The - Link's Awakening DX (USA, Europe) (Rev B) (SGB Enhanced).gbc.7z#Legend of Zelda, The - Link's Awakening DX (USA, Europe) (Rev B) (SGB Enhanced).gbc", label=0x555556add8e0 "Legend of Zelda, The - Link's Awakening DX (USA, Europe) (Rev B) (SGB Enhanced) (GB Compatible)", 
    content_info=content_info@entry=0x7fffffffc800, cb=cb@entry=0x0, user_data=user_data@entry=0x0) at tasks/task_content.c:1217
#20 0x00005555556fa9b9 in default_action_ok_load_content_from_playlist_from_menu (entry_label=<optimized out>, path=<optimized out>, 
    _path=0x7fffffffc820 "/home/aaron/.config/retroarch/cores/gambatte_libretro.so") at menu/cbs/menu_cbs_ok.c:1408
#21 action_ok_playlist_entry_collection (path=<optimized out>, label=<optimized out>, type=<optimized out>, idx=<optimized out>, entry_idx=1) at menu/cbs/menu_cbs_ok.c:1619
#22 0x00005555556f36fe in menu_entry_action (entry=entry@entry=0x7fffffffd8c0, i=i@entry=0, action=action@entry=MENU_ACTION_OK) at menu/widgets/menu_entry.c:452
#23 0x000055555572c1fd in generic_menu_iterate (data=0x555556e81e60, userdata=<optimized out>, action=MENU_ACTION_OK) at menu/drivers/menu_generic.c:232
#24 0x00005555556df8cf in menu_driver_iterate (iterate=iterate@entry=0x7fffffffd970) at menu/menu_driver.c:1860
#25 0x00005555555c6cd0 in runloop_check_state (settings=settings@entry=0x7ffff7fc7010, input_nonblock_state=input_nonblock_state@entry=false, sleep_ms=0x7fffffffdb4c)
    at retroarch.c:2645
#26 0x00005555555ca53c in runloop_iterate (sleep_ms=0x7fffffffdb4c) at retroarch.c:3249
#27 0x000055555569c115 in ui_application_qt_run (args=0x0) at ui/drivers/qt/ui_qt_application.cpp:177
#28 0x00005555555c44c2 in rarch_main (argc=<optimized out>, argv=<optimized out>, data=0x0) at frontend/frontend.c:157
#29 0x00007fffef62506b in __libc_start_main () from /usr/lib/libc.so.6
#30 0x00005555555c0f3a in _start () at tasks/task_content.c:1774
pepedopolous commented 6 years ago

I get this crash when running on Vulkan.

retroarch: deps/glslang/glslang/OGLCompilersDLL/InitializeDll.cpp:105: bool glslang::InitThread(): Assertion 0 && "InitThread(): Unable to set init flag."' failed. Aborted (core dumped)

AaronBPaden commented 6 years ago

Yeah, that's the same error.

Weirdly, I don't get this with 1.4.1 or 7a5ed7cc6563df1643a6895af693c6e6f15779ce but I am getting this with the current git master, though the symptoms seem to be the same.

AaronBPaden commented 6 years ago

Hmm...

There are only 'skip'ped commits left to test.
The first bad commit could be any of:
37454f79a8ba0de1d923fe28cc010add044790ec
bc9006236631f0f9bfc488a32dfecfc8176738ab
e9b7c7267e24c20f3c63c4c8856b25d7cf57b1c4
30353792a532d471eef46fc5c36784866986987f
c64d5556c127a9d193cc47dea41950c23ed2d036
3b3bcd8697725128fa347b2d8bab065d19f2b27e
d5dbfe78d5fd3b8c0551617c30f7b21bc89506f8
6900045b35886c285fccee4336bfacc849786c77
940efa8d73a55a7817dfc333cdc34c807519432c
26b2ff7c3f7348c743bc3fdf7acb41e4bd05494b
We cannot bisect more!

There were several commits that I couldn't test because the compilation failed in configuration.c. I did notice that for the commits where switching games were working, shaders were not working.

AaronBPaden commented 6 years ago

I do not get this crash with video_shader_enable = "false"

AaronBPaden commented 5 years ago

It looks like this issue also happens with glcore and slang shaders, so the issue isn't with vulkan per se, but with spirv.

orbea commented 5 years ago

@BPaden Do you have some exact steps to reproduce this? I'll try again.

ghost commented 5 years ago

What GPU is this?

AaronBPaden commented 5 years ago

@orbea Launch a game (in any core AFAIK, but mesen and gambatte for sure), go into the quick menu and load an slang shader (for example, the mame ntsc shader or the dmg console border shader). The shader loads fine. Now go back into the quick menu and select "close content".

@bparker06 This is with radv. I recently upgraded from an r7 240 to an rx 580, so it doesn't appear to be card specific.

orbea commented 5 years ago

@BPaden Thanks for the instructions, I have radv too so I'll try to reproduce this tomorrow.

orbea commented 5 years ago

I can reproduce it with the glcore or vulkan video drivers with both gambatte and mgba using the mame ntsc slang shader. I'll try to see if I can make progress debugging this.

Edit: Also I was using rgui so its not specific to xmb.

orbea commented 5 years ago

@fr500 You might want to look at this also, all of the possible bad commits are yours...

37454f79a8ba0de1d923fe28cc010add044790ec bc9006236631f0f9bfc488a32dfecfc8176738ab e9b7c7267e24c20f3c63c4c8856b25d7cf57b1c4 30353792a532d471eef46fc5c36784866986987f c64d5556c127a9d193cc47dea41950c23ed2d036 3b3bcd8697725128fa347b2d8bab065d19f2b27e d5dbfe78d5fd3b8c0551617c30f7b21bc89506f8 6900045b35886c285fccee4336bfacc849786c77 940efa8d73a55a7817dfc333cdc34c807519432c 26b2ff7c3f7348c743bc3fdf7acb41e4bd05494b

AaronBPaden commented 5 years ago

Sorry, I think that may have been a mistake on my part. Just reading that old comment, I'm not sure I was marking commits with broken shaders as bad. Hey, it didn't crash! I'm not sure what I was thinking at the time, please just ignore me when I do something blatantly stupid. đŸ˜…

andres-asm commented 5 years ago

It's crashing on libc though I don't see how it's something I can fix. Does it happen only with some shaders? or all of them?

andres-asm commented 5 years ago

So the bisect is incorrect?

AaronBPaden commented 5 years ago

Yes ignore that please, I'm not sure if it ever worked correctly (when slang shaders actually work).

If I'm reading the stack trace correctly, it's only crashing in libc because of a failed assert. I doubt this is a bug in libc.

AaronBPaden commented 5 years ago

Oh yeah, this happens with every shader AFAIK.

andres-asm commented 5 years ago

Does it happen with all shaders? Or just a few?

orbea commented 5 years ago

This crashes in v1.4.1, in v1.3.6 applying the shader seems silently fail.

I am getting this error in all the versions I can reproduce this which seems relevant.

retroarch: deps/glslang/glslang/OGLCompilersDLL/InitializeDll.cpp:109: bool glslang::InitThread(): Assertion `0 && "InitThread(): Unable to set init flag."' failed.
Aborted
orbea commented 5 years ago

Here is an updated backtrace.

Thread 1 "retroarch" received signal SIGABRT, Aborted.
0x00007ffff63eb20b in raise () from /lib64/libc.so.6
(gdb) bt
#0  0x00007ffff63eb20b in raise () from /lib64/libc.so.6
#1  0x00007ffff63cd524 in abort () from /lib64/libc.so.6
#2  0x00007ffff63cd40f in __assert_fail_base.cold.0 () from /lib64/libc.so.6
#3  0x00007ffff63dc4d2 in __assert_fail () from /lib64/libc.so.6
#4  0x0000000000781f18 in glslang::InitThread ()
    at deps/glslang/glslang/OGLCompilersDLL/InitializeDll.cpp:109
#5  0x00000000007c92b1 in glslang::TShader::preprocess (this=0x7fffffffcdf0, 
    builtInResources=0xf78740 <glslang::compile_spirv(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, glslang::Stage, std::vector<unsigned int, std::allocator<unsigned int> >*)::process>, 
    defaultVersion=100, defaultProfile=ENoProfile, 
    forceDefaultVersionAndProfile=false, forwardCompatible=false, 
    message=(EShMsgSpvRules | EShMsgVulkanRules), output_string=0x7fffffffcdc0, 
    includer=...)
    at deps/glslang/glslang/glslang/MachineIndependent/ShaderLang.cpp:1736
#6  0x0000000000709f6d in glslang::compile_spirv (
    source="#version 450\n#extension GL_GOOGLE_cpp_style_line_directive : require\n#line 2 \"mame-ntsc.slang\"\n\n// This is a port of the NTSC encode/decode shader pair in MAME and MESS, modified to use only\n// one pa"..., 
    stage=glslang::StageVertex, spirv=0x7fffffffd090)
    at deps/glslang/glslang.cpp:362
#7  0x0000000000702574 in glslang_compile_shader (
    shader_path=0x2d58a10 "/home/orbea/.config/retroarch/shaders/shaders_slang/ntsc/shaders/mame-ntsc/mame-ntsc.slang", output=0x7fffffffd090)
    at gfx/drivers_shader/glslang_util.cpp:395
#8  0x00000000006c35a3 in vulkan_filter_chain_create_from_preset (
    info=0x7fffffffd230, 
    path=0x7ffff5230074 "/home/orbea/.config/retroarch/shaders/shaders_slang/ntsc/mame-ntsc.slangp", filter=VULKAN_FILTER_CHAIN_LINEAR)
    at gfx/drivers_shader/shader_vulkan.cpp:2865
#9  0x00000000006aa4fa in vulkan_init_filter_chain_preset (vk=0x21dccd0, 
    shader_path=0x7ffff5230074 "/home/orbea/.config/retroarch/shaders/shaders_slang/ntsc/mame-ntsc.slangp") at gfx/drivers/vulkan.c:815
#10 0x00000000006aa5c5 in vulkan_init_filter_chain (vk=0x21dccd0)
    at gfx/drivers/vulkan.c:847
#11 0x00000000006ab4cb in vulkan_init (video=0x7fffffffd380, 
    input=0xf09430 <current_input>, input_data=0xf09438 <current_input_data>)
    at gfx/drivers/vulkan.c:1241
#12 0x00000000004801ac in video_driver_init_internal (
    video_is_threaded=0x7fffffffd447) at gfx/video_driver.c:1063
#13 0x0000000000481511 in video_driver_init (video_is_threaded=0x7fffffffd447)
    at gfx/video_driver.c:1758
#14 0x0000000000418072 in drivers_init (flags=1023) at retroarch.c:599
#15 0x000000000041a7b2 in retroarch_main_init (argc=8, argv=0x7fffffffd630)
    at retroarch.c:2052
#16 0x000000000043780d in content_load (info=0x7fffffffd8e0)
    at tasks/task_content.c:291
#17 0x0000000000438ab9 in task_load_content (content_info=0x7fffffffd8e0, 
    content_ctx=0x7fffffffd840, launched_from_menu=false, 
    launched_from_cli=false, error_string=0x7fffffffd838)
    at tasks/task_content.c:982
#18 0x0000000000439282 in task_push_start_dummy_core (
    content_info=0x7fffffffd8e0) at tasks/task_content.c:1260
#19 0x0000000000425ea5 in command_event (cmd=CMD_EVENT_UNLOAD_CORE, data=0x0)
    at command.c:1949
#20 0x0000000000619047 in generic_action_ok_command (cmd=CMD_EVENT_UNLOAD_CORE)
    at menu/cbs/menu_cbs_ok.c:1274
#21 0x000000000061edcc in action_ok_close_content (
    path=0x7fffe4000d20 "Close Content", label=0x7fffe4000c30 "unload_core", 
    type=128, idx=2, entry_idx=0) at menu/cbs/menu_cbs_ok.c:3776
#22 0x0000000000615fbb in menu_entry_action (entry=0x7fffffffdcc0, i=2, 
    action=MENU_ACTION_OK) at menu/widgets/menu_entry.c:471
#23 0x000000000066469d in generic_menu_iterate (menu=0x1f40bc0, 
    userdata=0x1eb47d0, action=MENU_ACTION_OK) at menu/drivers/menu_generic.c:233
#24 0x00000000005f165d in menu_driver_iterate (iterate=0x7fffffffde80)
    at menu/menu_driver.c:2049
#25 0x000000000041cf57 in runloop_check_state (settings=0x7ffff5210010, 
    input_nonblock_state=false, runloop_is_paused=false, fastforward_ratio=5, 
    sleep_ms=0x7fffffffe0f0) at retroarch.c:3634
#26 0x000000000041e550 in runloop_iterate (sleep_ms=0x7fffffffe0f0)
    at retroarch.c:4412
#27 0x0000000000415e33 in rarch_main (argc=1, argv=0x7fffffffe208, data=0x0)
    at frontend/frontend.c:156
#28 0x0000000000415e90 in main (argc=1, argv=0x7fffffffe208)
    at frontend/frontend.c:184

Full GDB log - https://paste.ee/p/jbiG7

orbea commented 5 years ago

It seems to work with this hack...

diff --git a/deps/glslang/glslang/OGLCompilersDLL/InitializeDll.cpp b/deps/glslang/glslang/OGLCompilersDLL/InitializeDll.cpp
index abea9108b1..29dcdf058f 100644
--- a/deps/glslang/glslang/OGLCompilersDLL/InitializeDll.cpp
+++ b/deps/glslang/glslang/OGLCompilersDLL/InitializeDll.cpp
@@ -105,10 +105,12 @@ bool InitThread()
     if (OS_GetTLSValue(ThreadInitializeIndex) != 0)
         return true;

+#if 0
     if (! OS_SetTLSValue(ThreadInitializeIndex, (void *)1)) {
         assert(0 && "InitThread(): Unable to set init flag.");
         return false;
     }
+#endif

     glslang::SetThreadPoolAllocator(nullptr);

Obviously not a solution.

AaronBPaden commented 5 years ago

@bparker06 Any clue why this would fail here?

orbea commented 5 years ago

The assert was added to glslang in this commit https://github.com/KhronosGroup/glslang/commit/a0af473a8bedbff4df6152bc6732ed6548a96150.

andres-asm commented 5 years ago

Can't seem to repro on windows

andres-asm commented 5 years ago

Try this diff with vulkan

diff --git a/gfx/drivers/vulkan.c b/gfx/drivers/vulkan.c
index 297170de5e..c66c55f316 100644
--- a/gfx/drivers/vulkan.c
+++ b/gfx/drivers/vulkan.c
@@ -830,7 +830,10 @@ static bool vulkan_init_filter_chain(vk_t *vk)
 {
    const char     *shader_path = retroarch_get_shader_preset();

-   enum rarch_shader_type type = video_shader_parse_type(shader_path, RARCH_SHADER_NONE);
+   if (!string_is_empty(shader_path))
+      enum rarch_shader_type type = video_shader_parse_type(shader_path, RARCH_SHADER_NONE);
+   else
+      enum rarch_shader_type type = RARCH_SHADER_NONE;

    if (type == RARCH_SHADER_NONE)
    {
andres-asm commented 5 years ago

On other drivers we have guards too:

   if (settings->bools.video_shader_enable)
   {
      const char* ext = path_get_extension(retroarch_get_shader_preset());

      if (ext && !strncmp(ext, "slang", 5))
         d3d11_gfx_set_shader(d3d11, RARCH_SHADER_SLANG, retroarch_get_shader_preset());
   }
ghost commented 5 years ago

I'm unable to reproduce the issue on Linux or Windows, using a gtx1050.

orbea commented 5 years ago

@fr500 That doesn't build, but I tried this which didn't work unfortunately.

diff --git a/gfx/drivers/vulkan.c b/gfx/drivers/vulkan.c
index 297170de5e..987e5f3bf1 100644
--- a/gfx/drivers/vulkan.c
+++ b/gfx/drivers/vulkan.c
@@ -829,8 +829,12 @@ static bool vulkan_init_filter_chain_preset(vk_t *vk, const char *shader_path)
 static bool vulkan_init_filter_chain(vk_t *vk)
 {
    const char     *shader_path = retroarch_get_shader_preset();
+   enum rarch_shader_type type;

-   enum rarch_shader_type type = video_shader_parse_type(shader_path, RARCH_SHADER_NONE);
+   if (!string_is_empty(shader_path))
+      type = video_shader_parse_type(shader_path, RARCH_SHADER_NONE);
+   else
+      type = RARCH_SHADER_NONE;

    if (type == RARCH_SHADER_NONE)
    {

I'm unable to reproduce the issue on Linux or Windows, using a gtx1050.

Can you or anyone else test with intel? Its possible that this is specific to mesa, radv or nvidia is doing something to avoid it.

ghost commented 5 years ago

That's why I asked what kind of GPU was being used :)

orbea commented 5 years ago

Maybe you missed it?

@bparker06 This is with radv. I recently upgraded from an r7 240 to an rx 580, so it doesn't appear to be card specific.

https://github.com/libretro/RetroArch/issues/4664#issuecomment-473141385

Now that I think about it, it should also be possible to test this with nouveau and the glcore video driver, but I don't have a nvidia card pugged in anymore and just a AMD RX Vega 56.

orbea commented 5 years ago

@Themaister iirc you have radv too? By any chance can you reproduce this or know what's wrong?

Edit: My reproduction steps are.

  1. Load any content without any shaders using glcore or vulkan.
  2. Load any slang shader preset while content is running.
  3. Proceed to close content.

It doesn't seem to abort if shaders are already enabled when loading content.

andres-asm commented 5 years ago

Did you test this code that's defined on other SLANG drivers? https://github.com/libretro/RetroArch/issues/4664#issuecomment-473606905

orbea commented 5 years ago

So that is wiiu, metal, d3d10, d3d11, d3d12, vulkan and glcore? I looked at all the drivers that use video_shader_parse_type and didn't see anything that helped.

orbea commented 5 years ago

I guess the problem is that its trying to compile the shader with the dummy core when content is closed.

[INFO] No content, starting dummy core.
[INFO] arg #0: retroarch
[INFO] arg #1: --menu
[INFO] arg #2: -s
[INFO] arg #3: /media/data/home/games/roms/.saves/retroarch
[INFO] arg #4: -S
[INFO] arg #5: /media/data/home/games/roms/.saves/retroarch/.sstates
[INFO] arg #6: -c
[INFO] arg #7: /home/orbea/.config/retroarch/retroarch.cfg
[INFO] arg #8: -v
[INFO] Saving RAM type #0 to "/media/data/home/games/roms/.saves/retroarch/mGBA/Pokemon - Red Version (USA, Europe).srm".
[INFO] Saved successfully to "/media/data/home/games/roms/.saves/retroarch/mGBA/Pokemon - Red Version (USA, Europe).srm".
[INFO] Content ran for a total of: 00 hours, 00 minutes, 00 seconds.
[INFO] Unloading game..
[INFO] Unloading core..
[INFO] Unloading core symbols..
[INFO] Saved core options file to "/home/orbea/.config/retroarch/retroarch-core-options.cfg"
[INFO] [XINERAMA]: Xinerama version: 1.1.
[INFO] [XINERAMA]: Xinerama screens: 1.
[INFO] [XINERAMA]: Saved monitor #0.
[INFO] [Video]: Does not have enough samples for monitor refresh rate estimation. Requires to run for at least 4096 frames.
[INFO] Set config file to : /home/orbea/.config/retroarch/retroarch.cfg
[INFO] RetroArch 1.7.6 (Git 5661c29)
[INFO] === Build =======================================
[INFO] CPU Model Name: AMD FX(tm)-6350 Six-Core Processor             
Capabilities: MMX MMXEXT SSE1 SSE2 SSE3 SSSE3 SSE4 SSE4.2 AVX AES 
Built: Mar 15 2019
[INFO] Version: 1.7.6
[INFO] Git: 5661c29
[INFO] =================================================
[INFO] Environ SET_PIXEL_FORMAT: RGB565.
[INFO] Redirecting save file to "/media/data/home/games/roms/.saves/retroarch/Pokemon - Red Version (USA, Europe).srm".
[INFO] Redirecting savestate to "/media/data/home/games/roms/.saves/retroarch/.sstates/Pokemon - Red Version (USA, Europe).state".
[INFO] Version of libretro API: 1
[INFO] Compiled against API: 1
[INFO] [Audio]: Set audio input rate to: 30000.00 Hz.
[INFO] [Video]: Video @ 1152x720
[INFO] [GLX]: GLX_OML_sync_control and GLX_MESA_swap_control supported, using better swap control method...
[INFO] [GLCore]: Found GL context: x
[INFO] [GLCore]: Detecting screen resolution 1680x1050.
[INFO] [GLX]: Window manager is spectrwm.
[INFO] [GLX]: X = 0, Y = 0, W = 1152, H = 720.
[INFO] [GLX]: Found swap function: glXSwapIntervalMESA.
[INFO] [GLX]: glXSwapInterval(0)
[INFO] [GLCore]: Vendor: X.Org, Renderer: Radeon RX Vega (VEGA10, DRM 3.27.0, 4.20.12, LLVM 7.0.1).
[INFO] [GLCore]: Version: 4.5 (Core Profile) Mesa 19.1.0-devel (git-0010d0348a).
[INFO] [GLCore]: Using resolution 748x349
[INFO] [udev]: Keyboard #0 (/dev/input/event21).
[INFO] [udev]: Keyboard #1 (/dev/input/event22).
[INFO] [udev]: Keyboard #2 (/dev/input/event1).
[INFO] [udev]: Mouse #0 (/dev/input/event0).
[INFO] [udev]: Mouse #1 (/dev/input/mouse0).
[INFO] [udev]: Plugged pad: Sony PLAYSTATION(R)3 Controller (1356:616) on port #0.
[INFO] [udev]: Pad #0 (/dev/input/event20) supports force feedback.
[INFO] [udev]: Pad #0 (/dev/input/event20) supports 16 force feedback effects.
[INFO] [Autoconf]: 338 profiles found.
[INFO] [Joypad]: Found joypad driver: "udev".
[INFO] [slang]: Compiling shader "/home/orbea/.config/retroarch/shaders/shaders_slang/3dfx/shaders/3dfx_pass_0.slang".
retroarch: deps/glslang/glslang/OGLCompilersDLL/InitializeDll.cpp:109: bool glslang::InitThread(): Assertion `0 && "InitThread(): Unable to set init flag."' failed.
Aborted

This doesn't happen with the gl2 driver and glsl.

LazyBumHorse commented 5 years ago

Does this still happen after 579ff877e4a44be31b71a313b55dadeb0e7dd001?

Themaister commented 5 years ago

FWIW, I cannot reproduce any of this.

LazyBumHorse commented 5 years ago

I never had that problem (on Windows) and I'm curious what this is/was all about.

realnc commented 5 years ago

I'm getting this crash on Linux with glcore. It doesn't look like this has anything to do with Vulkan.

NVidia 980 Ti (with nvidia binary driver.)

[INFO] [slang]: Compiling shader "/app/share/libretro/shaders/shaders_slang/presets/../reshade/shaders/LUT/LUT.slang".
retroarch: deps/glslang/glslang/OGLCompilersDLL/InitializeDll.cpp:109: bool glslang::InitThread(): Assertion `0 && "InitThread(): Unable to set init flag."' failed.

Latest RetroArch installed with flatpak.

Themaister commented 5 years ago

This just looks like another instance of the weird glslang InitThreads bug.

realnc commented 5 years ago

OK, this seems to be specific to whatever libraries are bundled with the flatpak package. I just ran the flatpak retroarch binary outside of flatpak and it solves every single problem I had: no more slang shader crash on exit, Vulkan works, udev input driver works, Dolphin core works... everything works.

I'm on Gentoo Linux and after installing RetroArch through flatpak, you launch it with:

/var/lib/flatpak/app/org.libretro.RetroArch/current/active/files/bin/retroarch

You can just symlink that to your desktop:

ln -s /var/lib/flatpak/app/org.libretro.RetroArch/current/active/files/bin/retroarch ~/Desktop/RetroArch

When running it, you might get missing libraries errors. If you get an error that libudev.0 was not found, install the libudev-compat package in portage. If it says that libCg was not found, install nvidia-cg-toolkit package.

When you start RA for the first time, it will complain that the assets weren't found and the UI is ugly. Simply go the online updater and install the assets, update core information files, etc, etc. Everything works perfectly after that, no more flatpak nonsense.

tjanas commented 5 years ago

I am experiencing this issue with RetroArch 1.7.7 on PlayStation Classic (BleemSync) with glcore and slang shaders.

PitiBatou commented 5 years ago

Hello all,

I am experiencing the same message in v1.7.8 upon loading a second game (and closing content from Quick Menu). Happens with all shaders, (vulkan & glcore driver)

Steps:

My setup: Ubuntu 18.04 LTS/ AMDGPU - Radeon RX550 (open source driver, not PRO driver)

After forking the repo and some trials and error, I could pin point that:

Cloning the repo and doing a simple git revert of 00299cf283d7d6f935d48e2623e0fd88d3c727d3 gets rid of the issue. (with HEAD at 2179c16f60550d646f4de85e8bfc2f5736e49252)

ohnozen commented 5 years ago

I'm getting the same error on 1.7.8.3 with a AMD 2400G (Arch + Mesa 19.1.6-2) on both Vulkan and GLCore. I was able to stop the crashing by disabling shaders, but that's not an ideal solution. Have not tested CPU shaders yet.

upwhatever commented 4 years ago

Same Issue on Ubuntu 18.04.3 LTS with Radeon RX570 using Mesa 19.2.1 from ubuntu-x-swat. Retroarch 1.8.1 from ppa as well as self-compiled (tags/v1.8.1) with Vulkan. As soon as I try to launch a game with shaders enabled the second time retroarch exits. It's as easy as start game -> quick menu -> close -> start same game again -> retroarch: deps/glslang/glslang/OGLCompilersDLL/InitializeDll.cpp:109: bool glslang::InitThread(): Assertion `0 && "InitThread(): Unable to set init flag."' failed.

Reverting 00299cf283d7d6f935d48e2623e0fd88d3c727d3 does not fix this, neither does compiling the latest code from master branch (79c336b6fd6d1579df867ce3b82f3bae7bcb80ad).

I "fixed" it for me by commenting out the corresponding assert and return line: https://github.com/libretro/RetroArch/blob/79c336b6fd6d1579df867ce3b82f3bae7bcb80ad/deps/glslang/glslang/OGLCompilersDLL/InitializeDll.cpp#L109-L110 This probably causes some very ugly issues, but at least it allows me to launch multiple games with shaders enabled without getting kicked out of retroarch.

Hari-82 commented 4 years ago

Hi, just updated retroarch to 1.8.2, in the changelog i read:

"BUG/CRASH/GLSLANG: Fix glslang crashing error – managed to reproduce an issue which has been plaguing users for a while, where glslang throws an assert after closing a game (and starting a new one). This would affect all video drivers that use Slang for shaders, such as D3D10/11/12/Vulkan/Metal"

but i still have the issue, did i miss something?

upwhatever commented 4 years ago

I just tested latest master (88c331ea995c8fb4d3c6e9bfb744f0fb24fba8a4) and this issue appears to be fixed for me.

Hari-82 commented 4 years ago

solved by replacing retroarch.cfg with a fresh one..