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

Intern mesh vertex buffer layouts so that we don't have to compare them over and over. #12216

Merged

Commits on Feb 29, 2024

  1. Intern mesh vertex buffer layouts so that we don't have to compare them

    over and over.
    
    Although we cached hashes of `MeshVertexBufferLayout`, we were paying
    the cost of `PartialEq` on `InnerMeshVertexBufferLayout` for every
    entity, every frame. This patch changes that logic to place
    `MeshVertexBufferLayout`s in `Arc`s so that they can be compared and
    hashed by pointer. This results in a 28% speedup in the
    `queue_material_meshes` phase of `many_cubes`, with frustum culling
    disabled.
    
    Additionally, this patch contains two minor changes:
    
    1. This commit flattens the specialized mesh pipeline cache to one level
       of hash tables instead of two. This saves a hash lookup.
    
    2. The example `many_cubes` has been given a `--no-frustum-culling`
       flag, to aid in benchmarking.
    pcwalton committed Feb 29, 2024
    Configuration menu
    Copy the full SHA
    796d9e0 View commit details
    Browse the repository at this point in the history

Commits on Mar 1, 2024

  1. Address review comments

    pcwalton committed Mar 1, 2024
    Configuration menu
    Copy the full SHA
    7973535 View commit details
    Browse the repository at this point in the history
  2. Fix broken doc links

    pcwalton committed Mar 1, 2024
    Configuration menu
    Copy the full SHA
    9a240ae View commit details
    Browse the repository at this point in the history
  3. Warning police

    pcwalton committed Mar 1, 2024
    Configuration menu
    Copy the full SHA
    8a3c3de View commit details
    Browse the repository at this point in the history
  4. Address review comment

    pcwalton committed Mar 1, 2024
    Configuration menu
    Copy the full SHA
    1cb7abf View commit details
    Browse the repository at this point in the history
  5. Clippy police

    pcwalton committed Mar 1, 2024
    Configuration menu
    Copy the full SHA
    cae189c View commit details
    Browse the repository at this point in the history
  6. Don't hash the pointer when inserting into the MeshVertexBufferLayouts

    table.
    
    The trick with `Borrow` was too clever and ended up actually hashing the
    pointer, causing lookups to sometimes spuriously fail. This manifested
    itself as a crash in `alien_cake_addict`. Removing the
    `MeshVertexBufferLayoutRef` wrapper from the entries in the store
    prevents its implementation of `Hash` from being called, solving the
    problem.
    pcwalton committed Mar 1, 2024
    Configuration menu
    Copy the full SHA
    fa07eee View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    73d99ec View commit details
    Browse the repository at this point in the history