bevyengine / bevyengine/bevy

bevy_pbr: indexed/non_indexed occlusion-culling bind-group fns differ only by buffer

Open
#24,679 0 comments 0 reactions 0 assignees View on GitHub
A-Rendering C-Code-Quality S-Needs-Investigation
Dominant language
Rust
Stars
48.2k
Forks
4.8k
Avg merge
3d 16h
Merged PRs (30d)
171

Description

While reading `crates/bevy_pbr/src/render/gpu_preprocess.rs` I noticed the occlusion-culling bind-group constructors pair up almost exactly along the indexed/non_indexed axis:

- `create_indirect_occlusion_culling_early_indexed_bind_group` (line 2090) and `create_indirect_occlusion_culling_early_non_indexed_bind_group` (line 2192) differ only in the `indexed` vs `non_indexed` buffer and field names; the bodies are otherwise identical (~91 lines each).
- The same holds for the `late_indexed` (line 2294) and `late_non_indexed` (line 2385) pair.

The early/late axis is genuinely different (early binds an extra work-item buffer that late does not), so that part is not duplication. But the indexed/non_indexed split looks like it could collapse into two functions parameterized over the buffer set, removing roughly half of the ~250 near-duplicate lines.

Is the explicit form deliberate (readability of the GPU bind-group setup), or would a PR parameterizing the indexed/non_indexed pairs be welcome? Happy to send one if so.

Contributor guide

Open the contributing guide

Research direction

Read crates/bevy_pbr/src/render/gpu_preprocess.rs and compare the four named occlusion-culling bind-group constructors, starting with the indexed/non_indexed pairs. Confirm which buffer and field differences can be parameterized while preserving the early/late distinction. Done means the duplicated indexed/non-indexed setup is reduced without changing bind-group behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
computer-graphics
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.