libretro / flycast

Flycast is a multiplatform Sega Dreamcast emulator. NOTE: No longer actively developed, use upstream repo for libretro from now on - https://github.com/flyinghead/flycast
http://reicast.com
GNU General Public License v2.0
155 stars 77 forks source link

[Android 9.0] Multiple issues with Sonic Adventure 2, all potentially related #361

Closed ubergeek77 closed 5 years ago

ubergeek77 commented 5 years ago

Device Information

OS: Android 9.0 Pie Device: Google Pixel 3 XL CPU: Qualcomm SDM845 Snapdragon 845 GPU: Adreno 630 Graphics Driver: gl (OpenGL) OpenGL Info: OpenGL ES 3.2 V@313.0

Breakdown of issues

(Summary of issues at the bottom) This all started with me trying to figure out why the Reicast core wasn't rendering shadows properly in Sonic Adventure 2 (see Screenshot A). If you look closely under Omochao and Sonic, there are no shadows. This is with the default settings provided by both Retroarch and the Reicast core. A Reddit user who was helping me figure this out showed that shadows were working fine on his end (see Screenshot B, from his device, not mine).

For reference, Alpha Sorting is set to "per-triangle" by default, and I have left this setting untouched throughout all of my testing for this issue.

In addition to the lack of shadows, any time the game would load something or transition screens, a strange tiling effect would occur (see Screenshot C, which is what the emulator looks like immediately after pressing "start" to skip the intro sequence). As you can see, a portion of the screen is "tiled," and it will even do this with the on-screen controls provided by Retroarch, not just the Dreamcast video output, so it seems like something at a higher level than just the Reicast core is causing this.

The same Reddit user pointed out to me that the latest fh/mymaster build of the standalone Reicast APK does not have these issues, and he was right. According to him, since the Reicast RetroArch core and the fh/mymaster build of Reicast are nearly identical, shadows should also render properly on RetroArch. I tested that build on my phone, and it works pretty much perfectly fine, shadows included, apart from some other miscellaneous issues that RetroArch does not have, such as:

But I digress. It's possible the lack of shadows in the Reicast core has something to do with threaded rendering on my hardware. From completely default settings, if I enable "Threaded Rendering" under the Reicast core settings (which is disabled by default), the "tiling" issue I mentioned before does not happen. However, after about 10-15 seconds, the controller loses all responsiveness, and a "RetroArch isn't responding" popup appears (see Screenshot D). If I select "Wait" instead of "Close App," emulation will continue at normal speed, but I lose all controller functionality. Both external controllers and the on-screen controls stop functioning when Threaded Rendering is enabled.

Interestingly, if I play with threaded rendering disabled, save a state somewhere I can clearly see where a shadow should be, then re-load the state with threaded rendering enabled, the shadows will actually render correctly on the Reicast core. But I will still lose controller input just like before.

Summary:

I wanted to compare these findings with the Windows version of RetroArch and Reicast, but unfortunately, I can't seem to get RetroArch to load any cores at the moment, and I'm not sure how to fix it.

If there is any additional information I can gather to solve this issue, please let me know. I would be happy to assist.

Screenshots

Screenshot A: https://i.imgur.com/ZBl2ZAj.jpg Screenshot B: https://i.imgur.com/QTwZnB2.png Screenshot C: https://i.imgur.com/K08zR3j.png Screenshot D: https://i.imgur.com/KZXBhEK.png

flyinghead commented 5 years ago

Thank you for this very detailed report. Regarding the lost of input responsiveness in threaded rendering mode, setting the input poll type to Early seems to fix the problem (Settings -> Input -> Poll Type Behavior = Early). This is a known issue but the underlying cause is still unknown. Other than that, I did a test on a Snapdragon 845 device and I confirm that shadows do not appear in non-threaded rendering mode. I still have no idea why this happens.

ubergeek77 commented 5 years ago

Thanks! I can confirm changing the poll type to Early fixed the crashing, games run like a dream now and everything is rendered correctly. I never would have thought to change something input related to fix a graphics issue. Very strange, but I'm glad it worked!