Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Divide the single VisibleEntities list into separate lists for 2D meshes, 3D meshes, lights, and UI elements, for performance. #12582

Merged
merged 16 commits into from
Apr 11, 2024

Commits on Mar 19, 2024

  1. Divide the single VisibleEntities list into separate lists for 2D

    meshes, 3D meshes, and lights, for performance.
    
    This commit splits `VisibleEntities::entities` into three separate
    lists: one for lights, one for 2D meshes, and one for 3D meshes. This
    allows `queue_material_meshes` and similar methods to avoid examining
    entities that are obviously irrelevant. In particular, this separation
    helps scenes with many skinned meshes, as the individual bones are
    considered visible entities but have no rendered appearance.
    
    Internally, `VisibleEntities::entities` is a `HashMap` from the `TypeId`
    representing a `QueryFilter` to the appropriate `Entity` list. I had to
    do this because `VisibleEntities` is located within an upstream crate
    from the crates that provide lights (`bevy_pbr`) and 2D meshes
    (`bevy_sprite`). As an added benefit, this setup allows apps to provide
    their own types of renderable components, by simply adding a specialized
    `check_visibility` to the schedule.
    
    Currently, this provides minimal performance benefit in `many_foxes`,
    but on top of binning (bevyengine#12453) it provides a 20% end-to-end speedup on
    that benchmark.
    
    * `check_visibility` and `VisibleEntities` now store the three types of
      renderable entities--2D meshes, 3D meshes, and lights--separately. If
      your custom rendering code examines `VisibleEntities`, it will now
      need to specify which type of entity it's interested in using the
      `WithMesh2d`, `WithMesh`, and `WithLight` types respectively. If your
      app introduces a new type of renderable entity, you'll need to add an
      explicit call to `check_visibility` to the schedule to accommodate
      your new component or components.
    pcwalton committed Mar 19, 2024
    Configuration menu
    Copy the full SHA
    b225d52 View commit details
    Browse the repository at this point in the history

Commits on Mar 20, 2024

  1. Rustfmt police

    pcwalton committed Mar 20, 2024
    Configuration menu
    Copy the full SHA
    a6ffc08 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    958de2b View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    3cbb44a View commit details
    Browse the repository at this point in the history
  4. Doc check police

    pcwalton committed Mar 20, 2024
    Configuration menu
    Copy the full SHA
    aeee618 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    4866699 View commit details
    Browse the repository at this point in the history

Commits on Mar 26, 2024

  1. Configuration menu
    Copy the full SHA
    0212fcf View commit details
    Browse the repository at this point in the history

Commits on Mar 31, 2024

  1. Configuration menu
    Copy the full SHA
    8daaafd View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    253cb25 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    2f2fbc7 View commit details
    Browse the repository at this point in the history
  4. Doc check police

    pcwalton committed Mar 31, 2024
    Configuration menu
    Copy the full SHA
    2e40d1e View commit details
    Browse the repository at this point in the history

Commits on Apr 1, 2024

  1. Use TypeIdMap

    pcwalton committed Apr 1, 2024
    Configuration menu
    Copy the full SHA
    1a60ba8 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    046d6b5 View commit details
    Browse the repository at this point in the history

Commits on Apr 11, 2024

  1. Configuration menu
    Copy the full SHA
    fb57cef View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    deb3de4 View commit details
    Browse the repository at this point in the history
  3. Doc check police

    pcwalton committed Apr 11, 2024
    Configuration menu
    Copy the full SHA
    626fba3 View commit details
    Browse the repository at this point in the history