gpu(native): honor rectangular render-target color clears #206
No reviewers
Labels
No labels
accessibility
bug
claimed
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
tester report
urgent
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/LakshanSivakumar--Native-Victory-macOS!206
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-206"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@evan-kolberg on GitHub · 2026-11-27 00:31 UTC · original
evan-kolberg:codex/native-rectangular-color-clear→main· +244 −22 · 7 files · 4 commits · merged 2026-11-27 00:58 UTCChange
Carry the rectangles supplied to
ClearRenderTargetViewinto the Native command list, clip them to the selected color view, and clear each surviving region. The command list owns the rectangle values from recording time. Empty or out-of-view rectangles leave the view alone. A zero rectangle count uses the existing whole-view clear.The partial path clears a private Metal scratch attachment in the view's pixel format and copies the clipped regions via the ordered texture blit. This keeps Metal's sRGB and integer clear conversion and preserves the mip and slice selected by #171. The partial path covers single-sampled 2D and 2D array color views.
Verification
The checks used Native main
f4030084.victory-gpuWindows cross-compile passed with--target x86_64-pc-windows-msvc --features blake3/pure.Scratch cost
A separate generated fixture measured eight paired batches of 16 clears on the same 128×96 RGBA8 target, with a 32×24 partial rectangle. Median partial versus whole-view times were 359 vs 119 µs for CPU encoding, 224 vs 120 µs for GPU execution, and 380 vs 289 µs from commit to completion. Upload and readback were outside the timers, Metal API Validation was off for timing, and each sample checked every target pixel.
The partial path allocates one scratch texture per nonempty clear. Metal reported 4,224 allocated bytes for a matching 32×24 scratch, or 16 resources and 67,584 matching bytes per partial batch. Scratch dimensions use the maximum clipped width and height across the rectangles, so small crossed regions can require a larger allocation. Gameplay behavior and peak memory under queue backlog remain unmeasured.
Thanks to Sheffy007 for the ordered GPU texture copy in #183, merged at
ae11992b9c25944940ce0b2987dfb7330839226d. This builds on #171's RTV mip and slice selection.Prepared and tested with Codex.
@LakshanSivakumar on GitHub · 2026-11-27 00:58 UTC · original · approved these changes
Reviewed and tested together with the other open PRs on main (macOS x86_64 workspace tests, the setup shell tests, and Windows clippy). I merged main into this branch (the texture_tests.rs conflict kept both sides) and pushed one small fix: since #198,
encode_rendertakes the command buffer's attached-heaps list, soencode_color_clear_rectsnow takes it too and passes it on. Thanks!