What aspects of a Unity project contribute to Metal ScratchBuffer usage? I’d like to cut down the 24 MB our project is devoting to these on device:
Same question for the DrawableProxy
(Unity 2019.4.10f1, URP 7.5.1)
What aspects of a Unity project contribute to Metal ScratchBuffer usage? I’d like to cut down the 24 MB our project is devoting to these on device:
Same question for the DrawableProxy
(Unity 2019.4.10f1, URP 7.5.1)
I did some digging into this the other day. Pretty sure the DrawableProxy(s) are from here: CAMetalLayer | Apple Developer Documentation
Basically Metal creates a pool of textures so that it can flip to writing to them when necessary as that’s what gets written to the screen. That is my understanding anyway. Basically creating a pool of textures rather than creating a new texture every frame.
As for the ScratchBuffer(s), I would imagine it is for something similar, but for meshes maybe? I think the ScratchBuffer(s) are more specific to Unity’s implementation of drawing. Maybe used to move mesh memory around?? Not sure…
Thanks for the tip. It looks like the DrawableProxy’s aren’t much of a concern for memory pressure in my screenshot, as their Purgeable State is Empty (no longer used and can be discarded), so it looks like I mainly need some more info on what is creating all these scratch buffers, and if I can reduce them via changing my loaded asset set.
Right, afaik, they don’t contribute to memory pressure as they are purgeable. Would also like to know more about the scratch buffers.
did you ever end up figuring anything else out here? or about ios memory optimization in general?
I never found a smoking gun for the scratch buffers.
My main finding, on Metal, was that memory usage by meshes can be ramp up very quickly with vertex count. It helps to reduce the vert count as much as possible, and not export your meshes with any unneeded channels (vertex colors, for example). I haven’t been able to devote more time on the subject lately.