[GH-ISSUE #6883] Flat draws: translucent quads from the translucent arena (a call per page, not per section) #2238

Closed
opened 2026-11-02 15:53:14 +07:00 by bsakaguchi · 1 comment
Owner

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

Originally assigned to: @ludovic111 on GitHub.

🤖 Filed by Ludovic's AI agent (Claude), not by Ludovic himself.

Problem. In frames drawn flat (gfx/flat.rs: Metal from render distance 32, Intel Gen11/Gen12's Vulkan driver), translucent sections are drawn back to front from the section arena. Consecutive sections usually sit in different arena pages, so nearly every translucent section becomes a call of its own. Each call costs a vertex-buffer bind, a bind group and a draw_indexed, and Metal encodes each one on the render thread.

Measured on a Mac mini M4 Pro (Metal), RD 32, perf_bench's four flights. Values are means per frame over windows of 500 frames, from a local count in Flat::prepare:

phase 1 solid phase 2 solid translucent
flat calls per frame 30-103 14-47 178-672
draws (sections × parts) 1,855-4,983 1,319-4,253 316-1,513

encode (CommandEncoder::finish) is the largest span of the renderer there: 0.34 ms of about 1.0 ms of render-thread CPU per frame. Translucent calls are 60-80 % of the flat calls.

Proposal. Give flat frames Translucent Batching's arena (#5984 … #6455), which today leaves out devices that draw flat (translucent_batchable). Flat draws would read translucent quads from translucent_arena, and calls are already merged per page, so the camera's translucent draws become about one call per translucent arena page: a handful instead of hundreds.

  • Same picture. The back-to-front order is kept, and only the vertex buffer the indices point into changes.
  • Pack frames unchanged. Frames whose shader pack draws terrain or a shadow keep reading the section arena, as translucent_split already decides.

Size. Flat's page tables are keyed by section-arena page, so translucent-arena pages need tables of their own (ids per vertex grain), and move_off_page and the release paths must follow them. Estimated at about 200-300 lines.

I'll claim this and re-measure in the PR (render-thread CPU per frame, A/B pairs at RD 16 and 32, shots).

Originally created by @ludovic111 on GitHub (Nov 2, 2026). Original GitHub issue: https://github.com/horizon-rust/horizon/issues/6883 Originally assigned to: @ludovic111 on GitHub. > 🤖 Filed by Ludovic's AI agent (Claude), not by Ludovic himself. **Problem.** In frames drawn flat (`gfx/flat.rs`: Metal from render distance 32, Intel Gen11/Gen12's Vulkan driver), translucent sections are drawn back to front from the section arena. Consecutive sections usually sit in different arena pages, so nearly every translucent section becomes a call of its own. Each call costs a vertex-buffer bind, a bind group and a `draw_indexed`, and Metal encodes each one on the render thread. Measured on a Mac mini M4 Pro (Metal), RD 32, perf_bench's four flights. Values are means per frame over windows of 500 frames, from a local count in `Flat::prepare`: | | phase 1 solid | phase 2 solid | translucent | |---|---|---|---| | flat calls per frame | 30-103 | 14-47 | **178-672** | | draws (sections × parts) | 1,855-4,983 | 1,319-4,253 | 316-1,513 | `encode` (`CommandEncoder::finish`) is the largest span of the renderer there: 0.34 ms of about 1.0 ms of render-thread CPU per frame. Translucent calls are 60-80 % of the flat calls. **Proposal.** Give flat frames Translucent Batching's arena (#5984 … #6455), which today leaves out devices that draw flat (`translucent_batchable`). Flat draws would read translucent quads from `translucent_arena`, and calls are already merged per page, so the camera's translucent draws become about one call per translucent arena page: a handful instead of hundreds. - **Same picture.** The back-to-front order is kept, and only the vertex buffer the indices point into changes. - **Pack frames unchanged.** Frames whose shader pack draws terrain or a shadow keep reading the section arena, as `translucent_split` already decides. **Size.** Flat's page tables are keyed by section-arena page, so translucent-arena pages need tables of their own (ids per vertex grain), and `move_off_page` and the release paths must follow them. Estimated at about 200-300 lines. I'll claim this and re-measure in the PR (render-thread CPU per frame, A/B pairs at RD 16 and 32, shots).
Author
Owner

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

🤖 Agent: /claim

<!-- gh-comment-id:6571892060 --> @ludovic111 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#2238
No description provided.