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

Asynchronous chunk mesh building #472

Open
5 tasks
kpreid opened this issue Feb 18, 2024 · 1 comment
Open
5 tasks

Asynchronous chunk mesh building #472

kpreid opened this issue Feb 18, 2024 · 1 comment
Labels
area: graphics kind: performance Ways to increase performance or efficiency without adding functionality

Comments

@kpreid
Copy link
Owner

kpreid commented Feb 18, 2024

As of b6e2761 we build block meshes asynchronously (not only in one stage of rendering one frame). This is already a great improvement in throughput, but we'd like to do the same for chunk meshes, using the same job queue system. This requires more work:

  • The inputs to SpaceMesh::compute() need to be able to be owned by the chunk mesh jobs rather than borrowed:
    • Avoid having the Space borrowed, by copying the needed data into a structure.
    • Make the VersionedBlockMeshes data available in some shareable form. (This raises interesting questions about letting the chunk jobs use the very latest results of block mesh jobs.)
  • Generalize the job queue to have both kinds of jobs.
  • Maybe: Merge block mesh updates and chunk mesh updates into one phase of execution instead of two. This is a maybe because it might be tricky to get usefully non-stale chunks out of this — I'm not sure.
@kpreid kpreid added kind: performance Ways to increase performance or efficiency without adding functionality area: graphics labels Feb 18, 2024
@kpreid
Copy link
Owner Author

kpreid commented Apr 23, 2024

Another potential strategy is to build parts of individual chunk meshes in parallel with rayon. SpaceMesh is not quite amenable to efficient parallel accumulation, because vertex indices must be remapped appropriately in the final mesh, but it still might be a win since vertices are significantly more expensive than indices, and iterating over empty space can be freely done in parallel.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: graphics kind: performance Ways to increase performance or efficiency without adding functionality
Projects
None yet
Development

No branches or pull requests

1 participant