[GH-ISSUE #7411] Avoid redundant framebuffer target changes during repeated draws #3228

Open
opened 2026-11-03 04:06:51 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @elythepreciouscat on GitHub (Nov 2, 2026).
Original GitHub issue: https://github.com/horizon-rust/horizon/issues/7411

Originally assigned to: @elythepreciouscat on GitHub.

🤖 Filed by elythepreciouscat's AI agent (OpenAI Codex, GPT-6), not by elythepreciouscat personally.

Problem

High-volume immediate rendering can repeatedly select or bind the same framebuffer/render target while drawing entities, block entities, particles, or HUD elements. Avoid redundant same-target state changes in these hot paths.

Horizon uses wgpu, where targets are expressed through render-pass attachments rather than an explicit OpenGL framebuffer bind. Trace where repeated target requests become backend state changes or repeated pass setup, then optimize at the layer that owns that state. Keep distinct passes when attachment, ordering, depth, blending, or load/store requirements differ.

Work

  • Identify repeated same-target binds or activations in entity, block-entity, particle, and HUD rendering paths.
  • Avoid reapplying unchanged target state when the renderer can safely reuse it; where pass boundaries are required, batch compatible submissions without combining passes with different attachment or ordering requirements.
  • Add counters for target changes and redundant same-target requests in the relevant benchmark output.
  • Measure CPU submission time in entity/block-entity/particle-heavy and HUD-heavy scenes before and after the change.
  • Verify visual output, render ordering, depth and blending behavior, and shader-pack paths remain correct.

Acceptance criteria

  • The identified hot path no longer performs redundant same-target state changes.
  • Before/after measurements report target-change counts and CPU submission time on the same scenes.
  • Visual output and required pass boundaries remain intact.
Originally created by @elythepreciouscat on GitHub (Nov 2, 2026). Original GitHub issue: https://github.com/horizon-rust/horizon/issues/7411 Originally assigned to: @elythepreciouscat on GitHub. > 🤖 Filed by elythepreciouscat's AI agent (OpenAI Codex, GPT-6), not by elythepreciouscat personally. ## Problem High-volume immediate rendering can repeatedly select or bind the same framebuffer/render target while drawing entities, block entities, particles, or HUD elements. Avoid redundant same-target state changes in these hot paths. Horizon uses `wgpu`, where targets are expressed through render-pass attachments rather than an explicit OpenGL framebuffer bind. Trace where repeated target requests become backend state changes or repeated pass setup, then optimize at the layer that owns that state. Keep distinct passes when attachment, ordering, depth, blending, or load/store requirements differ. ## Work - Identify repeated same-target binds or activations in entity, block-entity, particle, and HUD rendering paths. - Avoid reapplying unchanged target state when the renderer can safely reuse it; where pass boundaries are required, batch compatible submissions without combining passes with different attachment or ordering requirements. - Add counters for target changes and redundant same-target requests in the relevant benchmark output. - Measure CPU submission time in entity/block-entity/particle-heavy and HUD-heavy scenes before and after the change. - Verify visual output, render ordering, depth and blending behavior, and shader-pack paths remain correct. ## Acceptance criteria - The identified hot path no longer performs redundant same-target state changes. - Before/after measurements report target-change counts and CPU submission time on the same scenes. - Visual output and required pass boundaries remain intact.
Author
Owner

@elythepreciouscat commented on GitHub (Nov 2, 2026):

🤖 Agent: /claim

<!-- gh-comment-id:6581204198 --> @elythepreciouscat commented on GitHub (Nov 2, 2026): 🤖 Agent: /claim
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
horizon-rust/horizon#3228
No description provided.