libretro / RetroArch

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

Video Backend Switching on Core Load #3297

Closed tony971 closed 7 years ago

tony971 commented 8 years ago

The per-core option "video_driver" already exists and RetroArch restarts when loading a core. This will allow setting different drivers for different cores

i.e. setting paraLLEl to vulkan, while keeping everything else set to gl

rz5 commented 7 years ago

Putting this here for future reference: @Alcaro has mentioned that cores can request or at least signal that they want the 'gl' or 'vulkan' video drivers.

This feature request is important because some cores freeze or crash if their requirements aren't met.

andres-asm commented 7 years ago

I have found the following:

GL->Vulkan with soft rendered core: Works, crashes when toggling the menu.

#0  gl_raster_font_render_line (font=0xeb5a1f0, msg=<optimized out>,
    msg_len=<optimized out>, scale=1, color=0x45cebc0, pos_x=inf,
    pos_y=-nan(0x400000), text_align=0)
    at gfx/drivers_font/gl_raster_font.c:339
#1  0x0000000000000000 in ?? ()
Backtrace stopped: previous frame inner to this frame (corrupt stack?)

GL->Vulkan with HW mednafen psx: Appears to work, loads correctly, the core loads and game loads too but I think it's just falling back to GL. Slang shaders don't work but CG shaders do

GL->Vulkan with HW parallel: Crashes

[Switching to thread 1 (Thread 5280.0xf4c)]
#0  RDP::begin_frame () at mupen64plus-video-paraLLEl/rdp.cpp:131
131     in mupen64plus-video-paraLLEl/rdp.cpp

Vulkan->GL anything Crashes right away

Thread 1 received signal SIGSEGV, Segmentation fault.
[Switching to Thread 7256.0x32e8]
vulkan_create_texture (vk=0x6c1d020, old=old@entry=0x0, width=544,
    height=544, format=format@entry=VK_FORMAT_R8_UNORM, initial=0x1346baa0,
    swizzle=swizzle@entry=0x0, type=type@entry=VULKAN_TEXTURE_STATIC)
    at gfx/common/vulkan_common.c:293
293        VkDevice device                      = vk->context->device;
(gdb) bt
#0  vulkan_create_texture (vk=0x6c1d020, old=old@entry=0x0, width=544,
    height=544, format=format@entry=VK_FORMAT_R8_UNORM, initial=0x1346baa0,
    swizzle=swizzle@entry=0x0, type=type@entry=VULKAN_TEXTURE_STATIC)
    at gfx/common/vulkan_common.c:293
#1  0x000000000050534d in vulkan_raster_font_init_font (data=0x6c1d020,
    font_path=0x45c8740 "userdata\\fonts\\font.ttf", font_size=32)
    at gfx/drivers_font/vulkan_raster_font.c:69
#2  0x000000000044e002 in gl_font_init_first (font_size=<optimized out>,
    font_path=<optimized out>, video_data=<optimized out>,
    font_handle=<optimized out>, font_driver=<optimized out>)
    at gfx/font_driver.c:137
#3  font_init_first (api=FONT_DRIVER_RENDER_VULKAN_API, font_size=32,
    font_path=0x45c8740 "userdata\\fonts\\font.ttf", video_data=0x6c1d020,
    font_handle=0x45c8688, font_driver=0x45c8680) at gfx/font_driver.c:282
#4  font_driver_init_first (video_data=0x6c1d020,
    font_path=font_path@entry=0x45c8740 "userdata\\fonts\\font.ttf",
    font_size=font_size@entry=32, threading_hint=threading_hint@entry=true,
    api=api@entry=FONT_DRIVER_RENDER_VULKAN_API) at gfx/font_driver.c:381
#5  0x000000000061edf4 in menu_display_vk_font_init_first (
    font_handle=font_handle@entry=0x45c8738, video_data=<optimized out>,
    font_path=font_path@entry=0x45c8740 "userdata\\fonts\\font.ttf",
    font_size=font_size@entry=32)
    at menu/drivers_display/menu_display_vulkan.c:258
#6  0x00000000004bb904 in menu_display_font_main_init (
    font=<synthetic pointer>) at menu/menu_display.c:225
#7  menu_display_font (
    type=type@entry=APPLICATION_SPECIAL_DIRECTORY_ASSETS_XMB_FONT,
    font_size=32) at menu/menu_display.c:215
#8  0x0000000000487c19 in xmb_context_reset (data=0x12c005a0)
    at menu/drivers/xmb.c:3308
#9  0x000000000048d09b in menu_driver_ctl (
    state=state@entry=RARCH_MENU_CTL_CONTEXT_RESET, data=data@entry=0x0)
    at menu/menu_driver.c:981
#10 0x000000000042d4c8 in init_drivers (flags=<optimized out>) at driver.c:351
#11 driver_ctl (state=<optimized out>, data=<optimized out>) at driver.c:466
#12 0x000000000042d3f7 in driver_ctl (
    state=state@entry=RARCH_DRIVER_CTL_INIT_ALL, data=data@entry=0x0)
    at driver.c:472
#13 0x0000000000405105 in retroarch_main_init (argc=0, argv=0x0,
    argv@entry=0x45cc280) at retroarch.c:1083
#14 0x00000000004152f2 in content_load (info=0x45cd370)
    at tasks/task_content.c:280
#15 task_load_content (content_info=content_info@entry=0x45cd3f0,
    launched_from_menu=launched_from_menu@entry=false,
    mode=CONTENT_MODE_LOAD_CONTENT_FROM_PLAYLIST_FROM_MENU)
    at tasks/task_content.c:902
#16 0x00000000004161b9 in command_event_cmd_exec (
    mode=CONTENT_MODE_LOAD_CONTENT_FROM_PLAYLIST_FROM_MENU,
    data=0x12e8dad0 "D:\\PortableData\\GameData\\EmulatorData\\Games\\Console\\Super Nintendo Entertainment System\\Virtual Bart (USA).zip")
    at tasks/task_content.c:1016
#17 task_push_content_load_default (
    core_path=core_path@entry=0x45cd500 "D:\\PortableData\\GameData\\Emulators\\RetroArch\\libretro\\bsnes_balanced_libretro.dll",
    fullpath=0x12e8dad0 "D:\\PortableData\\GameData\\EmulatorData\\Games\\Console\\Super Nintendo Entertainment System\\Virtual Bart (USA).zip",
    content_info=content_info@entry=0x45ce500,
    type=type@entry=CORE_TYPE_PLAIN,
    mode=mode@entry=CONTENT_MODE_LOAD_CONTENT_FROM_PLAYLIST_FROM_MENU,
    cb=cb@entry=0x0, user_data=user_data@entry=0x0)
    at tasks/task_content.c:1154
#18 0x00000000004a67b8 in generic_action_ok_file_load (
    content_enum_idx=CONTENT_MODE_LOAD_CONTENT_FROM_PLAYLIST_FROM_MENU,
    action_type=CORE_TYPE_PLAIN, fullpath=<optimized out>,
    corepath=0x45cd500 "D:\\PortableData\\GameData\\Emulators\\RetroArch\\libretro\\bsnes_balanced_libretro.dll") at menu/cbs/menu_cbs_ok.c:867
#19 action_ok_playlist_entry_collection (path=<optimized out>,
    label=<optimized out>, type=<optimized out>, idx=<optimized out>,
    entry_idx=0) at menu/cbs/menu_cbs_ok.c:1095
#20 0x00000000004a072a in menu_entry_action (entry=entry@entry=0x45cf620,
    i=<optimized out>, action=action@entry=MENU_ACTION_OK)
    at menu/widgets/menu_entry.c:523
#21 0x00000000004c7d4b in generic_menu_iterate (data=0x12bfc190,
    userdata=<optimized out>, action=MENU_ACTION_OK)
    at menu/drivers/menu_generic.c:233
#22 0x000000000048de39 in menu_driver_ctl (
    state=state@entry=RARCH_MENU_CTL_ITERATE, data=data@entry=0x45cfc60)
    at menu/menu_driver.c:888
#23 0x0000000000412779 in runloop_check_state (
    settings=settings@entry=0x71fb040, current_input=current_input@entry=1,
    old_input=old_input@entry=0, sleep_ms=0x45cfde0) at runloop.c:888
#24 0x0000000000412fa9 in runloop_iterate (sleep_ms=sleep_ms@entry=0x45cfde0)
    at runloop.c:1203
#25 0x00000000004016c0 in rarch_main (argc=<optimized out>,
    argv=<optimized out>, data=0x0) at frontend/frontend.c:130
#26 0x00000000006691f8 in main_getcmdline ()
#27 0x00000000004013f8 in __tmainCRTStartup ()
    at C:/repo/mingw-w64-crt-git/src/mingw-w64/mingw-w64-crt/crt/crtexe.c:334
#28 0x00000000004014eb in WinMainCRTStartup ()
    at C:/repo/mingw-w64-crt-git/src/mingw-w64/mingw-w64-crt/crt/crtexe.c:184
hizzlekizzle commented 7 years ago

closing this as dupe of #4804