Skip to content

Performence improvements in renderer and mesher - #382

Draft
urisinger wants to merge 29 commits into
PommeMC:masterfrom
urisinger:master
Draft

Performence improvements in renderer and mesher#382
urisinger wants to merge 29 commits into
PommeMC:masterfrom
urisinger:master

Conversation

@urisinger

Copy link
Copy Markdown

Overview

Refactoring the renderer to improve throughput and modernize our data handling. A lot of the core architecture is shifting toward being lock-free and multi-threaded.

What’s changed

  • Per-section meshing: Switched to per-section meshing.
  • ChunkStore: Data shared with the mesher made atomic, chunk data now uses clone-on-write to avoid locking bottlenecks.
  • Code Cleanup: Split meshing.rs into dispatcher.rs (thread pool) and mesher.rs (logic) to make it easier to navigate.
  • Lock-free dispatcher: Replaced the old locking logic for the mesh dispatcher with an improved lock-free dispatcher.
  • ChunkRing: Swapped out HashMap for ChunkRing in several spots to cut down on overhead.
  • GPU Culling: Added a visibility bitset that uses Hi-Z and frustum data.
  • Batching: All chunk mesh uploads to the GPU are now batched.

Current Status (Work in progress)

  • LOD: Not currently triggering remeshes for sections.
  • Hi-Z Culling: Not working right (likely a gpu sync issue).
  • Documentation: Document how and why all these changes work more clearly, to prevent future mistakes when making changes.
  • Cleanup: Still need to scrub the old culling shader and clear out dead code/warnings.
  • Mesh uploads: Make section staging transfers use the frame command buffer to avoid stalling on a single queue.
  • Next steps/Ideas

  • Split into fixed-size meshlets to stop the allocator from fragmenting.
  • Pack vertex data tighter.
  • Look into implementing Mesh Shaders.

Merging & Contribution

This PR contains significant changes that conflict with master. I will be away for the next two weeks and will be unable to maintain this branch or resolve these conflicts.
If anyone is interested in picking this up, I would appreciate help with:

  • Conflict Resolution: Bringing this up to date with the latest master.
  • Issue Tracking: Investigating the sync issues currently affecting Hi-Z culling and LOD updates.

I am happy to provide context or answer questions regarding the new architecture whenever i can, but please feel free to push fixes or refactors to this branch in the meantime.

urisinger and others added 29 commits July 3, 2026 12:34
…2. refactor visibility and add gpu side visibility checks, will soon replace the old culling too. 3. add gpu timings.
- fail open on unwritten visibility masks instead of culling everything
- pass section count, not block height, to the visibility shader
- cover odd mip dimensions in the Hi-Z reduction
- replace mem::zeroed per-frame arrays (UB) with array::from_fn
- retire replaced MeshQueue states instead of leaking them each frame
- derive section layout from min_y instead of hardcoding the overworld
- dedup same-section uploads within one batch
- clone chunks once per multi-block update run, not per block
- fix neighbor check in enqueue_with_neighbors using the wrong variable
- fix biome border sampling with div_euclid
- clamp the ring radius to MAX_RD and derive range checks from it
- restore the release launch-token gate and winit defaults
- drop the azalea fork patch, keep the ffedf17 pin and own the deltas
- serde default for frustum_padding so existing settings load
- remove dead code, unused deps, and clippy/fmt failures
# Conflicts:
#	pomme-client/src/app/core.rs
#	pomme-client/src/app/mod.rs
#	pomme-client/src/app/phases/connecting.rs
#	pomme-client/src/app/phases/in_game.rs
#	pomme-client/src/benchmark.rs
#	pomme-client/src/physics/block_shape.rs
#	pomme-client/src/physics/collision.rs
#	pomme-client/src/physics/movement.rs
#	pomme-client/src/player/interaction.rs
#	pomme-client/src/player/mod.rs
#	pomme-client/src/renderer/chunk/buffer.rs
#	pomme-client/src/renderer/chunk/mesher.rs
#	pomme-client/src/renderer/mod.rs
#	pomme-client/src/ui/hud.rs
#	pomme-client/src/world/block/mod.rs
#	pomme-client/src/world/block/registry.rs
#	pomme-client/src/world/block/sound.rs
#	pomme-client/src/world/chunk.rs
…vent drain without dropping, add render cpu timers, fix bench hang on unreachable targets
# Conflicts:
#	pomme-client/src/app/core.rs
#	pomme-client/src/app/phases/in_game.rs
#	pomme-client/src/renderer/chunk/mesher.rs
#	pomme-client/src/renderer/mod.rs
#	pomme-client/src/ui/menu/mod.rs
#	pomme-client/src/world/chunk.rs
…s, epoch floors, hiz occluder split, single visibility mask, arc per section cow, chunk detail auto
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants