Lime3DS / Lime3DS

A 3DS emulator based on Citra
https://lime3ds.github.io/
GNU General Public License v2.0
2.22k stars 125 forks source link

Vulkan renderer refuses to work on Android 9 #142

Open Raypuia opened 6 months ago

Raypuia commented 6 months ago

Is there an existing issue for this?

Affected Build(s)

2110

Description of Issue

Just before launching any game the app suddenly crashes. I don't understand why this happens. I have both Dolphin and Vita3K on the same device, and the Vulkan renderer worked just fine on those.

Expected Behavior

Vulkan rendering working for Adreno GPUs without adrenotools support.

Reproduction Steps

  1. Go to settings
  2. Go to Graphics
  3. Change OpenGLES to Vulkan
  4. Return to main menu
  5. Select any game
  6. crashes

Log File

citra_log.txt Screenshot_2024-04-22-13-41-53-633_com miui bugreport

System Configuration

CPU: Qualcomm Snapdragon 665 (Redmi Note 8) GPU/Driver: Adreno 610 / Default System Driver RAM: 4GB OS: Android 9 Vulkan: 1.1.87

rtiangha commented 6 months ago

Did it ever work under older Lime3DS releases? How about the last Citra nightly? Or even PabloMK7's fork?

Raypuia commented 6 months ago

Did it ever work under older Lime3DS releases? How about the last Citra nightly? Or even PabloMK7's fork?

None of them. Is there some requirement on the Vulkan renderer i ain't aware off?

rtiangha commented 6 months ago

If it doesn't work with the last Citra Nightly, then I'm not sure what more can easily be done.

The only thing I can suggest is to see if maybe an older version works. See if you can download something newer than Nightly-1995 from the Wayback Machine; Vulkan support was officially introduced after September 15, 2023 and they originally claimed that it supported Vulkan 1.1. Because if it doesn't work with one of the first builds to support Vulkan, then you'll probably need to stick with OpenGL. If it does work, then keep trying newer versions until it stops working and report back and maybe we can figure out what changed.

https://web.archive.org/web/20231002001630/github.com/citra-emu/citra-nightly/releases

rtiangha commented 6 months ago

Also, someone suggested trying this driver for adreno, assuming you can install it: https://github.com/K11MCH1/AdrenoToolsDrivers/releases/tag/A7xx_R4

As anything newer didn't work. So maybe try that too if you can (I don't know much about this hardware).

Raypuia commented 6 months ago

Also, someone suggested trying this driver for adreno, assuming you can install it: https://github.com/K11MCH1/AdrenoToolsDrivers/releases/tag/A7xx_R4

As anything newer didn't work. So maybe try that too if you can (I don't know much about this hardware).

Adrenotools doesn't work on Android 9 and below

rtiangha commented 6 months ago

Ah. Well, try an older version of Citra; if it doesn't work there, then not much more can probably be done (other than use OpenGL).

Raypuia commented 6 months ago

If it doesn't work with the last Citra Nightly, then I'm not sure what more can easily be done.

The only thing I can suggest is to see if maybe an older version works. See if you can download something newer than Nightly-1995 from the Wayback Machine; Vulkan support was officially introduced after September 15, 2023 and they originally claimed that it supported Vulkan 1.1. Because if it doesn't work with one of the first builds to support Vulkan, then you'll probably need to stick with OpenGL. If it does work, then keep trying newer versions until it stops working and report back and maybe we can figure out what changed.

https://web.archive.org/web/20231002001630/github.com/citra-emu/citra-nightly/releases

Vulkan on nightly-2000 works. Later builds seems weren't archived...

rtiangha commented 6 months ago

Hit the forward arrow on the top right to see a later snapshot and keep going.

Example: https://web.archive.org/web/20231006075554/https://github.com/citra-emu/citra-nightly/releases

Edit: Or use the calendar: https://web.archive.org/web/20240000000000*/https://github.com/citra-emu/citra-nightly/releases

Raypuia commented 6 months ago

Already did, nightly-2000 was the last archived build of 2023. The rest are just gone. IMG_20240424_170639

rtiangha commented 6 months ago

Try this one, although they're not in numerical order:

https://web.archive.org/web//https://github.com/citra-emu/citra-nightly/releases/download

Raypuia commented 6 months ago

Done, same thing. nightly-2098 doesn't even download (possibly an expired amazonaws link) And nightly-2104 was the build before Citra was axed IMG_20240424_175404

rtiangha commented 6 months ago

Well, that sucks. That's a pretty big range to try and figure out what changed such that it made it not work anymore on your hardware. It's probably a safe bet though that if it didn't work on the final Nightly, then it'll be tough for someone to figure out how to make it work on current Lime3DS since it forked the Nightly branch. Certainly outside of my skill set. I don't suppose OpenGL works on your device? If not, you might be stuck with build 2000 for the foreseeable future.

Raypuia commented 6 months ago

Well, that sucks. That's a pretty big range to try and figure out what changed such that it made it not work anymore on your hardware. It's probably a safe bet though that if it didn't work on the final Nightly, then it'll be tough for someone to figure out how to make it work on current Lime3DS since it forked the Nightly branch. Certainly outside of my skill set. I don't suppose OpenGL works on your device? If not, you might be stuck with build 2000 for the foreseeable future.

GLES does work, but it's painfully slow because of the shader compilation. (Only Citra MMJ solves this problem)

rtiangha commented 6 months ago

Hmm, looks like slim pickings for Android, but here's the list of Canaries, for completeness sake (filter by apk; should return about 5 hits, no idea how many links are actually working): https://web.archive.org/web//https://github.com/citra-emu/citra-canary/releases/download

Raypuia commented 6 months ago

Hmm, looks like slim pickings for Android, but here's the list of Canaries, for completeness sake (filter by apk; should return about 5 hits, no idea how many links are actually working): https://web.archive.org/web//https://github.com/citra-emu/citra-canary/releases/download

Vulkan still works on canary-2618, but the others weren't archived (except for some Win and Linux x86_64 builds)

Raypuia commented 6 months ago

I think I've found a page with some builds. https://citra-emulator-3ds-emulator.uptodown.com/android/versions

rtiangha commented 6 months ago

Nice! If you can find the latest build that still works with your device, that'll at least give a date to work with to start looking at the code. Hopefully whatever changed will be obvious (and reversible; would suck if the requirements changed to Vulkan 1.3 somewhere along the line).

Raypuia commented 6 months ago

Nice! If you can find the latest build that still works with your device, that'll at least give a date to work with to start looking at the code. Hopefully whatever changed will be obvious (and reversible; would suck if the requirements changed to Vulkan 1.3 somewhere along the line).

I've found it! nightly-2030 is the last build were Vulkan worked on my device. Anything onwards just crashes right when preloading the game having Vulkan enabled

rtiangha commented 6 months ago

Good News: I found it. It was commit fa08df21a50f7de06f39333bd441d2f44c9f7ed8 Bad News: Looks like it was intentional. 🙁

* vk_platform: Hardcode apiVersion to VK_API_VERSION_1_3

So there you go. Minimal requirement as of Nov 10, 2023 is Vulkan 1.3. Up until then, it was Vulkan 1.1.

I would suggest the documentation be updated and an FAQ be made for the Lime3DS project, if only to reduce the support burden. Heck, add it in big bold letters to the Issues template if someone is filing a Vulkan issue (i.e. Note: Vulkan support requires Vulkan 1.3 or newer) CC: @OpenSauce04

OpenSauce04 commented 6 months ago

I will update the minimum specs on the website accordingly

Despite the fact that this was kind of our bad due to incorrect documentation, I am going to close this under user error as there is technically nothing wrong here on the emulator's end

rtiangha commented 6 months ago

Edit: Maybe I spoke too soon? Two months ago, aa6809e2a8f8264f6c5ed359a0fc458c66368856 reset things back to 1.1 (I think; if I'm understanding the code correctly) and that was the last change to the api requirements. So I don't know anymore. My guess is 1.3 will definitely work; anything older is a crap shoot, probably because they tested on 1.3 for months but didn't really test on older after Feb.

OpenSauce04 commented 6 months ago

I'll hold off then until we find out what's really going on

rtiangha commented 6 months ago

I'll go ask over at PabloMK7's fork about some api clarification. Hopefully GPUCode/raphaelthegreat chimes in since he made the changes, but I don't know what the status is of his involvement in the project these days due to all the scene drama recently.

rtiangha commented 6 months ago

In the meantime, maybe changing the Issue template to explicitly ask what Vulkan version their video card driver supports would be helpful in trying to find patterns. If they really intended to bring back support to Vulkan 1.0 or 1.1 back in mid-Feb after having it at 1.3 for 3-4 months, perhaps they just didn't have enough time to iron out the regression bugs with older cards through user testing before the project shutdown just a few weeks later.

Raypuia commented 6 months ago

Edit: Maybe I spoke too soon? Two months ago, aa6809e reset things back to 1.1 (I think; if I'm understanding the code correctly) and that was the last change to the api requirements. So I don't know anymore. My guess is 1.3 will definitely work; anything older is a crap shoot, probably because they tested on 1.3 for months but didn't really test on older after Feb.

Probably, Vita3K allows the renderer to work on Vulkan 1.1 despite recommending 1.2 for optimal usage.

Enforcing Vulkan 1.3 on mobile is pretty exaggerated, knowing most phones only have either 1.1 or 1.2

EDIT: I added the Vulkan version of my device to the OP to clarify

rtiangha commented 5 months ago

@Raypuia Hey, this might be a long shot, but can you try this custom version of PabloMK7's Citra fork that I made and see if it solves your issue? I was looking around for something unrelated and stumbled upon some Android shader options that were never set in the past. I wonder if that'll fix things.

https://github.com/rtiangha/bravely-offline-citra/actions/runs/9046314371/artifacts/1493978721

Edit: Or maybe it won't if the issue really is adrenotools. Still though, it should work on Android 9. The documentation says Android 9+ so I assume it's Android 9 inclusive. Have you tried that driver update above? Maybe it'll work.

Raypuia commented 5 months ago

@Raypuia Hey, this might be a long shot, but can you try this custom version of PabloMK7's Citra fork that I made and see if it solves your issue? I was looking around for something unrelated and stumbled upon some Android shader options that were never set in the past. I wonder if that'll fix things.

https://github.com/rtiangha/bravely-offline-citra/actions/runs/9046314371/artifacts/1493978721

Edit: Or maybe it won't if the issue really is adrenotools. Still though, it should work on Android 9. The documentation says Android 9+ so I assume it's Android 9 inclusive. Have you tried that driver update above? Maybe it'll work.

I've tried the build and the issue still persists. And about Adrenotools, it actually requires Android +10. Because that version implemented custom drivers through APKs, which Skyline took advantage from to get extra Vulkan extensions on mobile

github-actions[bot] commented 2 months ago

This issue has been marked as stale. If there is no activity within the next 10 days, this issue will be closed.

Raypuia commented 2 months ago

Just bumping this in case there's a solution for the Vulkan renderer. GLES shader compilation is annoyingly slow.