Search Unity

Dynamic toggle of entity rendering to increase fps blocked by gpu - avoiding syncpoint

Discussion in 'Graphics for ECS' started by mailfromthewilds, May 15, 2021.

  1. mailfromthewilds

    mailfromthewilds

    Joined:
    Jan 31, 2020
    Posts:
    217
    i think entities are not optimized for deactivation/deinstantiation, as doing that will trigger structural change/syncpoint

    deactivation is a matter of adding/removing Disabled component = that changes archetype = moves entities to different chunks = syncpoint

    according to this logic whether i deactivate or deinstantiate i will have syncpoints in every second, if i want to have some dynamic mechanism for eg stopping not-currently-seen entities from rendering


    when I was using GOs, i was enabling/disabling them depending whether theyre currently visible by camera (and basing on distance as well)

    I wanted to do the same with Entities but i am not sure how, as it will trigger syncpoints, as i said, every second


    Here are my three questions:
    1. How to avoid these syncpoints in said scenario?
    2. How to toggle entity rendering without creating syncpoint?
    3. Are syncpoints every second really that bad? maybe i worry needlessly

    (PS, unity's Camera component doesnt do this sort of thing automatically for runtime spawned models, in case you wanted to mention it)
     
  2. DreamingImLatios

    DreamingImLatios

    Joined:
    Jun 3, 2017
    Posts:
    4,264
    1) You usually have at least one sync point every frame. Your goal is to keep the number of sync points per frame as low as possible by having systems that introduce sync points run adjacent to each other. When you do that, your normal jobs can schedule more efficiently, and then you have one longer sync-point stretch which you can more easily fill with some special jobs that don't depend on sync points.
    2) Modify the RenderBounds. You can create a backup of them, then modify them to be ridiculously out-of-range, and then restore them later.
    3) Again, having as few sync points per frame and having them be short are your main goals. Different projects will have different frame-budgets for sync points.
     
    mailfromthewilds likes this.