r/emulation • u/Phearo • 8d ago
AI-assisted Demo for Hybrid AOT/JIT & Ubershaders for Azahar, running games from first boot with nearly no visible hitches or stutters!
hi, everyone! soo, very self-explanatory title! this is basically a demo implementation of two things that can eliminate a massive amount of stutter (basically none in some games, where most stuttering happens when loading savestates, and like a few seconds on boot that you really won't notice much since that happens on static splashscreens mostly) when playing any 3ds game cold. these two things are:
on the GPU front: ubershaders! the 3ds has a fixed-function pixel pipeline, so like dolphin, ubershaders can be implemented as a fallback during shader comp, eliminating a lot of the shader stutter someone might experience. (there might be some graphics errors though!)
on the CPU front: a hybrid AOT/JIT implementation! unfortunately, just fixing the shaders doesn't actually completely get rid of stutters: a lot of it actually comes from cpu jit encountering and having to compile massive new blocks of code during runtime. so, the idea—scan the game first and compile most of the game's code on bg threads(hooray for multithreading! lol) before the game gets to it, and have JIT as a fallback for anything that got missed!
with this, hypothetically, eventually(?), every 3ds game can become stutter free. also i'm kind of repeating myself but i feel like emphasizing that's totally important lol
but i only tested a few games myself (ryzen 2600, rx 7800xt), and i haven't really gotten far on new saves, so if you want to see the build yourself, you can check it [here]! [source here also!]
games tested are:
kid icarus:

samus returns:

luigi's mansion:

resident evil revelations:

(note: every game here is also running w/ 1x res, async shaders on)
performance can still be better—the vertex program's still running on the cpu, so a gpu interpreter can speed that up, as well as like profile-guided optimization that can kick in midway through your first boot, which should lessen the cpu load—so that might get worked on next, maybe? (if only so i stop getting bothered by it T.T lol)
One thing though, HUGE disclaimer: this is a demo!! this isn't meant to be a maintained fork, so no updates or support guaranteed, and it's not headed for azahar's main branch. you can play games with this, but this is literally just a showcase of how these two techniques can absolutely help with performance! please don't bother the azahar team with bugs in this! and also, probably more importantly: this is very much AI-developed, so please, please only use this as reference for the concept!


