Defer GX pipeline UID cache writes in libretro - #503
Conversation
Queue newly discovered GX pipeline UIDs during rendering and append them when the cache closes on reload or shutdown. Keep the existing immediate writes for standalone Dolphin.
|
Thanks for the PR! Is this something that can be upstream to dolphin-emu? |
|
I guarded the code with #ifdef LIBRETRO because of your previous recommendation of avoiding any change on non-libretro code, but definitely this is something that could be added upstream. |
|
Quite possibly this is due to me implementing VFS for everything and not specific to ISO loading 👍 Could you restore the comments? I try to keep this repo as close to upstream as possible. |
|
Using VFS is definitely the right thing to do, but the original code was already writing to disk from the draw path. Cached or not, I think deferring those writes is a much better approach. The improvement is pretty noticeable. BTW, I’ve already restored the original comments. |
Summary
Several games experience frequent brief stalls, sometimes severe enough to make them unplayable. Each newly discovered GX pipeline UID is currently written to disk from the draw path, making rendering sensitive to storage delays.
In the libretro core, this change queues new UIDs in memory and writes them together when the cache closes on reload or shutdown.
Following the PR rules, I want to disclose that this issue was identified during an AI review of the draw path that I requested. I reviewed the code myself, and other users and I tested the change.
Testing
Read 0 pipeline UIDs. After a clean unload, the next launch loggedRead 6 pipeline UIDsfromGBZP08.uidcache, confirming the entries were saved and reloaded.