libretro / RetroArch

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

Vulkan backend segfaults on loading certain thumbnails. [$25] #3141

Closed torisuke closed 7 years ago

torisuke commented 8 years ago

Okay, I'm not sure whether this a bug within Retroarch or a driver bug, but thus far I've only been able to reproduce it in RA, so I'll post this here.

I'm using the b434f08 build on Win 8.1 x64, with a GTX 750ti (driver version 368.39), and when I switch to the Vulkan backend, Retroarch will indubitably segfault on attempting to load certain images in the thumbnails packages.

I have been unable to track down what is actually causing this, as the log doesn't give any useful details, and attaching Visual Studio's debugger only records an access violation in nvoglv64.dll.

I've done some cursory looks at the problematic inputs, and the only commonality I've found is that they are all pngs with indexed palettes of 8 bit or less of color depth, and I can avoid the segfaults by converting the problematic images nonindexed RGB pngs.

Anyways, here's the relevant log files, and at the end is the list of problem images I've confirmed as problematic so far.

Exception thrown at 0x0000000075CC16F0 (nvoglv64.dll) in retroarch_debug.exe: 0xC0000005: Access violation reading location 0x0000000000000064.
RetroArch [INFO] :: === Build =======================================                                                                                                  
Capabilities: MMX MMXEXT SSE1 SSE2 SSE3 SSSE3 SSE4 SSE4.2 AVX AES                                                                                                      
Built: Jun 23 2016                                                                                                                                                     
RetroArch [INFO] :: Version: 1.3.4                                                                                                                                     
RetroArch [INFO] :: Git: b434f08                                                                                                                                       
RetroArch [INFO] :: =================================================                                                                                                  
RetroArch [INFO] :: Config: loading config from: D:\emu\RetroArch\retroarch.cfg.                                                                                       
RetroArch [INFO] :: Resetting undo buffers.                                                                                                                            
RetroArch [INFO] :: Environ SET_PIXEL_FORMAT: RGB565.                                                                                                                  
RetroArch [INFO] :: Version of libretro API: 1                                                                                                                         
RetroArch [INFO] :: Compiled against API: 1                                                                                                                            
RetroArch [INFO] :: Set audio input rate to: 30000.00 Hz.                                                                                                              
RetroArch [INFO] :: Timings deviate too much. Will not adjust. (Display = 119.94 Hz, Game = 60.00 Hz)                                                                  
RetroArch [INFO] :: Video @ fullscreen                                                                                                                                 
RetroArch [INFO] :: Vulkan dynamic library loaded.                                                                                                                     
RetroArch [INFO] :: [Vulkan]: Device supports 16 sub-queues.                                                                                                           
RetroArch [INFO] :: Detecting screen resolution 1920x1080.                                                                                                             
RetroArch [INFO] :: [WGL]: Setting fullscreen to 1920x1080 @ 240Hz on device \\.\DISPLAY1.                                                                             
RetroArch [INFO] :: [Vulkan]: Swapchain supports present mode: 2.                                                                                                      
RetroArch [INFO] :: [Vulkan]: Swapchain supports present mode: 3.                                                                                                      
RetroArch [INFO] :: [Vulkan]: Swapchain supports present mode: 1.                                                                                                      
RetroArch [INFO] :: [Vulkan]: Creating swapchain with present mode: 1                                                                                                  
RetroArch [INFO] :: [Vulkan]: Using swapchain size 1920 x 1080.                                                                                                        
RetroArch [INFO] :: [Vulkan]: Got 3 swapchain images.                                                                                                                  
RetroArch [INFO] :: Vulkan: Using resolution 1920x1080                                                                                                                 
RetroArch [INFO] :: [Vulkan]: Using RGB565 format.                                                                                                                     
RetroArch [INFO] :: [Vulkan]: GPU supports linear images as textures, but not DEVICE_LOCAL. Falling back to copy path.                                                 
RetroArch [INFO] :: [Vulkan]: GPU supports linear images as textures, but not DEVICE_LOCAL. Falling back to copy path.                                                 
RetroArch [INFO] :: [Vulkan]: GPU supports linear images as textures, but not DEVICE_LOCAL. Falling back to copy path.                                                 
RetroArch [INFO] :: [Vulkan]: Only SLANG shaders are supported, falling back to stock.                                                                                 
RetroArch [INFO] :: [slang]: Building pass #0 (N/A)                                                                                                                    
RetroArch [INFO] :: [slang]: Reflection                                                                                                                                
RetroArch [INFO] :: [slang]:   Textures:                                                                                                                               
RetroArch [INFO] :: [slang]:      Source (#0)                                                                                                                          
RetroArch [INFO] :: [slang]:                                                                                                                                           
RetroArch [INFO] :: [slang]:   Uniforms (Vertex: yes, Fragment: no):                                                                                                   
RetroArch [INFO] :: [slang]:      MVP (Offset: 0)                                                                                                                      
RetroArch [INFO] :: [Vulkan filter chain]: Not using frame history.                                                                                                    
RetroArch [INFO] :: [Vulkan filter chain]: Not using framebuffer feedback.                                                                                             
RetroArch [INFO] :: Found XInput v1.4.                                                                                                                                 
RetroArch [INFO] :: Found XInput v1.4.                                                                                                                                 
RetroArch [INFO] :: Enumerating DInput joypads ...                                                                                                                     
RetroArch [INFO] :: Device #0 PID: {2060} VID:{0583}                                                                                                                   
RetroArch [INFO] :: Autodetect: 42 profiles found                                                                                                                      
RetroArch [INFO] :: Autodetect: selected configuration: D:\emu\RetroArch\autoconfig\xinput\USB,2-axis 8-button gamepad  .cfg                                           
RetroArch [INFO] :: Done enumerating DInput joypads ...                                                                                                                
RetroArch [INFO] :: Found joypad driver: "dinput".                                                                                                                     
RetroArch [INFO] :: Using font rendering backend: freetype.                                                                                                            
RetroArch [INFO] :: XAudio2: Requesting 96 ms latency, using 96 ms latency.                                                                                            
RetroArch [INFO] :: Found menu display driver: "menu_display_vulkan".                                                                                                  
RetroArch [INFO] :: Using font rendering backend: freetype.                                                                                                            
RetroArch [INFO] :: Using font rendering backend: freetype.                                                                                                            
RetroArch [INFO] :: SRAM will not be saved.                                                                                                                            
RetroArch [INFO] :: null: [D:\emu\RetroArch\content_history.lpl].                                                                                                      
RetroArch [INFO] :: [Vulkan]: VSync => off                                                                                                                             
RetroArch [INFO] :: [Vulkan]: VSync => on                                                                                                                              
RetroArch [INFO] :: [Vulkan]: Swapchain supports present mode: 2.                                                                                                      
RetroArch [INFO] :: [Vulkan]: Swapchain supports present mode: 3.                                                                                                      
RetroArch [INFO] :: [Vulkan]: Swapchain supports present mode: 1.                                                                                                      
RetroArch [INFO] :: [Vulkan]: Creating swapchain with present mode: 2                                                                                                  
RetroArch [INFO] :: [Vulkan]: Using swapchain size 1920 x 1080.                                                                                                        
RetroArch [INFO] :: [Vulkan]: Recycled old swapchain.                                                                                                                  
RetroArch [INFO] :: [Vulkan]: Got 3 swapchain images.                                                                                                                  
RetroArch [INFO] :: [Vulkan]: GPU supports linear images as textures, but not DEVICE_LOCAL. Falling back to copy path.                                                 
RetroArch [INFO] :: [Vulkan]: GPU supports linear images as textures, but not DEVICE_LOCAL. Falling back to copy path.                                                 
RetroArch [INFO] :: [Vulkan]: GPU supports linear images as textures, but not DEVICE_LOCAL. Falling back to copy path.                                                 
RetroArch [INFO] :: [slang]: Building pass #0 (N/A)                                                                                                                    
RetroArch [INFO] :: [slang]: Reflection                                                                                                                                
RetroArch [INFO] :: [slang]:   Textures:                                                                                                                               
RetroArch [INFO] :: [slang]:      Source (#0)                                                                                                                          
RetroArch [INFO] :: [slang]:                                                                                                                                           
RetroArch [INFO] :: [slang]:   Uniforms (Vertex: yes, Fragment: no):                                                                                                   
RetroArch [INFO] :: [slang]:      MVP (Offset: 0)                                                                                                                      
RetroArch [INFO] :: [Vulkan filter chain]: Not using frame history.                                                                                                    
RetroArch [INFO] :: [Vulkan filter chain]: Not using framebuffer feedback.                                                                                             
Segmentation fault                                                                                                                                                     

Problematic Images:

thumbnails\NEC - PC Engine - TurboGrafx 16\Named_Snaps\Artist Tool (Japan).png
thumbnails\NEC - PC Engine - TurboGrafx 16\Named_Snaps\Space Invaders - Fukkatsu no Hi (Japan).png
thumbnails\NEC - PC Engine - TurboGrafx 16\Named_Titles\City Hunter (Japan).png
--- Did you help close this issue? Go claim the **[$25 bounty](https://www.bountysource.com/issues/35435129-vulkan-backend-segfaults-on-loading-certain-thumbnails?utm_campaign=plugin&utm_content=tracker%2F296058&utm_medium=issues&utm_source=github)** on [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F296058&utm_medium=issues&utm_source=github).
inactive123 commented 8 years ago

Can you retest this again against the latest commit?

torisuke commented 8 years ago

Still occuring with 251f902 nightly build.

Logs are pretty much the same.

markwkidd commented 8 years ago

I notice that those are very tiny thumbnail files.

There is a recent Lakka bug involving tiny PNG files apparently disappearing. Is there some chance these issues are related? https://github.com/libretro/Lakka/issues/422

bjorhn commented 7 years ago

I've reported a similar issue on the forums. The difference is that my crash appears to happen when unloading the thumbnail file. To test, I have set up a single playlist with a single game (Super Mario Bros. (World)). Starting the game through the playlist causes a crash in the thumbnail unloading code. There's some additional information in the thread (http://libretro.com/forums/showthread.php?t=6773), and I have also uploaded my gdb log: http://pastebin.com/MaQNi3T1. I'm running a GTX 970 on 372.54 and Windows 10 with the Anniversary update, RetroArch nightly build 9629bd1.

The Super Mario Bros. (World) thumbnail is a 24-bit image file, so that's another difference as well. I think the issue creator only had issues with 8-bit (or less) images.

daninthemix commented 7 years ago

This issue is a major barrier to Vulkan adoption for me, as with the Vulkan driver, clicking on any game in a collection that has a boxart thumbnail causes a crash (loading the image doesn't cause the crash, but trying to launch the game does).

kivutar commented 7 years ago

Could be related to https://github.com/libretro/Lakka/issues/262

inactive123 commented 7 years ago

@daninthemix Aliaspider pushed a PR, you will have to determine now if the issue is fixed so that the bounty can be claimed.

daninthemix commented 7 years ago

This fix should appear in tonight's nightly, right?

aliaspider commented 7 years ago

it should already be up in the buildbot nightly folder.

daninthemix commented 7 years ago

k, will test tonight. Cheers

daninthemix commented 7 years ago

This is fixed - nice job.

daninthemix commented 7 years ago

@twinaphex will this fix make it into the 1.5.1 release mentioned on the news page?

inactive123 commented 7 years ago

I will mention it yeah.

bjorhn commented 7 years ago

So glad this is fixed. Thanks!