Search Unity

Question Metal Meshes Duplicated in Memory?

Discussion in 'iOS and tvOS' started by chrismarch, Oct 14, 2020.

  1. chrismarch

    chrismarch

    Joined:
    Jul 24, 2013
    Posts:
    472
    Help me understand Metal GPU Captures, where I am looking at the memory used per character. Our game has a skinned mesh that is instantiated around 60 times in this capture, and there seems to be a Buffer that only matches the size of the skinned mesh for this asset, for every single instantiate. The FBX importer for this mesh has Read/Write disabled. The selected Mesh asset has around 12k verts, 16k tris, uv,colors, skin (displayed in the Inspector preview). Yes it is pretty heavy, but should I expect this much memory usage per instantiation? We are not manipulating the sharedMesh, or doing anything weird there. There also seems to be a Compute0_0 buffer per character, 128KB, NonVolatile, ReadWrite, mostly not bound. We are not using GPU instancing, as my understanding is that would require converting the animations to textures, and other non standard setups. (URP 7.5.1, Unity 2019.4.10f1, Compute Skinning off, Graphics Jobs on, Multithreaded Rendering on)

    upload_2020-10-13_18-12-2.png
     
  2. joshuacwilde

    joshuacwilde

    Joined:
    Feb 4, 2018
    Posts:
    731
    Following as I have experienced similar things.
     
  3. chrismarch

    chrismarch

    Joined:
    Jul 24, 2013
    Posts:
    472
    https://support.unity3d.com/hc/en-u...21.1898592515.1603126774-731577765.1544037663

    I'm not sure if the additional copy for a skinned mesh being in system memory would show up in a gpu capture for an iOS device (with unified memory), but maybe every skinned mesh is going to need a copy of the per vertex info for ... reasons? I would have thought the transform hierarchy of each instance could be applied without making another copy of all the thousands of vertices, but I'm guessing that is what GPU instancing would get me, I just don't see doing the animation to texture workflow for most games, and giving up skinning (to allow for GPU instancing)
     
    Last edited: Oct 19, 2020
  4. joshuacwilde

    joshuacwilde

    Joined:
    Feb 4, 2018
    Posts:
    731
    The thing is, I have seen duplicated meshes in GPU Frame Capture where they were just regular meshes, not skinned.