Repository navigation
Eager write-back of linear color targets costs ~3.7 ms per frame in PPSA02070 #9754
krishalivaibhav
started this conversation in
Architecture changes
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
What we measured
Don't Starve Together (PPSA02070) on macOS, Apple M2 (MoltenVK 1.4.2), on the macOS series at 42c3fd0 with local changes. The same code is on
mainatGraphics/src/Draw.cpp:1700.Since 88ee391 ("linear color targets over imported memory get a resident image"),
keepRecordedDrawstores every linear resident target back to guest memory right after each draw. WithAPS5_TRACE_FLUSH=1, the title's menu loop shows about 5 stores per frame, all with reasonlinear target. They come from five linear targets: two 3840x2160 RGBA8, two 960x544 and one 1024x32. Only the GPU reads these targets afterwards, as textures in later passes.APS5_PROFILE_GPU, two watched 60 s runs on the main menu:The user saw no visual difference between the two runs. Later in the runs, the game issued different amounts of draw work, so we only compare the write-back class and the first 20 s.
Why we are not proposing to just remove it
As far as we can tell, nothing traps a CPU read of guest memory. Pending results are stored only through explicit hooks:
GuestArenaPrepareHostRead(file, stdio, aio, socket)A guest that reads a linear target through a pointer after a label or EOP would see stale bytes if the eager store were removed. Tiled resident targets already have this exposure, but linear targets are the kind titles read on the CPU (readbacks, screenshots), which we assume is why the store was kept.
Deferring the store to the label or EOP that retires the draw keeps the current behaviour. It saves nothing for this title, though: it draws each target once per frame and waits on a label every frame.
Options
ProbeImportWriteProtectionshows for writes.We'd like to know which of these, if either, you would accept, or whether there is a mechanism we missed.
Tested only on macOS (Apple M2) with PPSA02070. Not tested on Linux or Windows.
AI-assisted: yes.
All reactions